From 4ffd20112f18c2c7b3c25e39c283f8cfe9be88fc Mon Sep 17 00:00:00 2001 From: Pete Cook Date: Thu, 18 Jan 2018 07:39:38 +0000 Subject: [PATCH] Add standalone player --- .travis.yml | 1 + package.json | 3 ++- src/standalone.js | 7 +++++++ webpack.standalone.babel.js | 24 ++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/standalone.js create mode 100644 webpack.standalone.babel.js diff --git a/.travis.yml b/.travis.yml index 72f7102a..cea82498 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/package.json b/package.json index 6938316d..87f68b7e 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/src/standalone.js b/src/standalone.js new file mode 100644 index 00000000..052c9f72 --- /dev/null +++ b/src/standalone.js @@ -0,0 +1,7 @@ +import React from 'react' +import { render } from 'react-dom' +import ReactPlayer from './ReactPlayer' + +export default function renderReactPlayer (container, props) { + render(, container) +} diff --git a/webpack.standalone.babel.js b/webpack.standalone.babel.js new file mode 100644 index 00000000..54cb936d --- /dev/null +++ b/webpack.standalone.babel.js @@ -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 +}