-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactors `src/ReactPlayer.js` to be a `createReactPlayer` factory that takes an array of players The default import then becomes `src/index.js` which just calls `createReactPlayer` with the whole players array from `src/players/index.js` A script now generates top level files before publishing, eg `youtube.js` that call `createReactPlayer` with just the `YouTube` player
- Loading branch information
Showing
14 changed files
with
220 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const { join } = require('path') | ||
const { unlink } = require('fs').promises | ||
const { default: players } = require('../lib/players') | ||
|
||
const deleteSinglePlayers = async () => { | ||
for (const { key } of players) { | ||
await unlink(join('.', `${key}.js`)) | ||
} | ||
} | ||
|
||
deleteSinglePlayers() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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') | ||
This comment has been minimized.
Sorry, something went wrong. |
||
const Player = require('./lib/players/${name}').default | ||
module.exports = createReactPlayer([Player]) | ||
` | ||
await writeFile(join('.', `${key}.js`), file) | ||
} | ||
} | ||
|
||
generateSinglePlayers() |
Oops, something went wrong.
This ends up injecting code that circumvents webpack's
target
option. Meaning, if you specify in webpacktarget = ['web', 'es5']
and are expecting an es5-compatible bundle, the bundle will be broken because of theconst
injected here;const
is not es5.