const { join } = require('path')
const { writeFile } = require('fs').promises
const { default: players } = require('../lib/players')

const generateSinglePlayers = async () => {
  for (const { key, name } of players) {
    const file = `
      const createReactPlayer = require('./lib/ReactPlayer').createReactPlayer
      const Player = require('./lib/players/${name}').default
      module.exports = createReactPlayer([Player])
    `
    await writeFile(join('.', `${key}.js`), file)
  }
}

generateSinglePlayers()

const { join } = require('path')
const { writeFile } = require('fs').promises
const { default: players } = require('../lib/players')

const generateSinglePlayers = async () => {
  for (const { key, name } of players) {
    const file = `
      const createReactPlayer = require('./lib/ReactPlayer').createReactPlayer
      const Player = require('./lib/players/${name}').default
      module.exports = createReactPlayer([{
        key: '${key}',
        canPlay: Player.canPlay,
        lazyPlayer: Player
      }])
    `
    await writeFile(join('.', `${key}.js`), file)
  }
}

generateSinglePlayers()

Fix single player import logic
Fix single player import logic

Passing through the player directly meant `key` couldn’t be used for the clever config merging
Fixes https://github.com/CookPete/react-player/issues/993
