Skip to content

Commit

Permalink
Add standalone player
Browse files Browse the repository at this point in the history
  • Loading branch information
cookpete committed Jan 18, 2018
1 parent 0194b43 commit 4ffd201
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ script:
- npm run build:lib
- npm run build:demo
- npm run build:dist
- npm run build:standalone
after_success:
- npm run coverage
- test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && sshpass -e scp -r -o stricthostkeychecking=no demo/* $DEPLOY_DEST
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"build:lib": "cross-env NODE_ENV=production babel src -d lib --ignore src/demo",
"build:demo": "cross-env NODE_ENV=production webpack --config webpack.demo.babel.js",
"build:dist": "cross-env NODE_ENV=production webpack --config webpack.dist.babel.js",
"build:standalone": "cross-env NODE_ENV=production webpack --config webpack.standalone.babel.js",
"preversion": "npm run lint",
"version": "auto-changelog -p && npm run build:dist && git add CHANGELOG.md dist",
"version": "auto-changelog -p && npm run build:dist && npm run build:standalone && git add CHANGELOG.md dist",
"prepublishOnly": "npm run build:lib && npm run build:dist",
"postpublish": "npm run clean"
},
Expand Down
7 changes: 7 additions & 0 deletions src/standalone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react'
import { render } from 'react-dom'
import ReactPlayer from './ReactPlayer'

export default function renderReactPlayer (container, props) {
render(<ReactPlayer {...props} />, container)
}
24 changes: 24 additions & 0 deletions webpack.standalone.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import path from 'path'
import config, { minifyPlugins } from './webpack.demo.babel'

export default {
...config,
entry: './src/standalone.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'ReactPlayer.standalone.js',
library: 'renderReactPlayer'
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
options: {
plugins: ['add-module-exports']
}
}
]
},
plugins: minifyPlugins
}

0 comments on commit 4ffd201

Please sign in to comment.