Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Rollup #24

Merged
merged 9 commits into from
Jun 9, 2017
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"presets": [ "es3", ["es2015"] ],
"presets": [ "es3", ["es2015", {"loose": true}] ],
"plugins": ["transform-object-assign"]
}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ node_modules/
# Build-related directories
dist/
docs/api/
es5/
test/dist/
test/test-expected.js
test/test-manifests.js
17 changes: 12 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
sudo: false
dist: trusty
language: node_js
node_js:
- 'node'
- '4.2'

- '8'
- '6'
- '4'
before_script:

# Set up a virtual screen for Firefox.
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
addons:
firefox: latest
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Make sure you have NodeJS 0.10 or higher and npm installed.

### Making Changes

Refer to the [video.js plugin standards][standards] for more detail on best practices and tooling for video.js plugin authorship.
Refer to the [video.js plugin conventions][conventions] for more detail on best practices and tooling for video.js plugin authorship.

When you've made your changes, push your commit(s) to your fork and issue a pull request against the original repository.

Expand All @@ -27,4 +27,4 @@ Testing is a crucial part of any software project. For all but the most trivial

[karma]: http://karma-runner.github.io/
[local]: http://localhost:9999/test/
[standards]: https://github.com/videojs/generator-videojs-plugin/docs/standards.md
[conventions]: https://github.com/videojs/generator-videojs-plugin/blob/master/docs/conventions.md
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2016 brandonocasey <[email protected]>
Copyright Brightcove, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
10 changes: 0 additions & 10 deletions bower.json

This file was deleted.

7 changes: 4 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
<title>m3u8-parser Demo</title>
</head>
<body>
<p>Open dev tools to try it out</p>
<ul>
<li><a href="/test/">Run unit tests in browser.</a></li>
<li><a href="/docs/api/">Read generated docs.</a></li>
<li><a href="test/">Run unit tests in browser.</a></li>
<li><a href="docs/api/">Read generated docs.</a></li>
</ul>
<script src="/dist/m3u8-parser.js"></script>
<script src="dist/m3u8-parser.js"></script>
</body>
</html>
80 changes: 50 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "m3u8-parser",
"version": "2.1.0",
"description": "m3u8 parser",
"jsnext:main": "src/index.js",
"main": "es5/index.js",
"main": "dist/m3u8-parser.cjs.js",
"module": "dist/m3u8-parser.es.js",
"repository": {
"type": "git",
"url": "[email protected]:videojs/m3u8-parser.git"
Expand All @@ -25,34 +25,43 @@
"scripts": {
"prebuild": "npm run clean",
"build": "npm-run-all -p build:*",
"build:js": "npm-run-all build:js:babel build:js:browserify build:js:bannerize build:js:uglify",
"build:js": "npm-run-all build:js:rollup-modules build:js:rollup-umd build:js:bannerize build:js:uglify",
"build:js:babel": "babel src -d es5",
"build:js:bannerize": "bannerize dist/m3u8-parser.js --banner=scripts/banner.ejs",
"build:js:browserify": "browserify . -s m3u8-parser -o dist/m3u8-parser.js",
"build:js:uglify": "uglifyjs dist/m3u8-parser.js --comments --mangle --compress -o dist/m3u8-parser.min.js",
"build:test": "babel-node scripts/build-test.js",
"build:js:rollup-modules": "rollup -c scripts/modules.rollup.config.js",
"build:js:rollup-umd": "rollup -c scripts/umd.rollup.config.js",
"build:js:uglify": "uglifyjs dist/m3u8-parser.js --comments --mangle --compress -o dist/m3u8-parser.min.js",
"prebuild:test": "node scripts/m3u8.js",
"build:test": "rollup -c scripts/test.rollup.config.js",
"change": "chg add",
"clean": "rimraf dist test/dist es5 && mkdirp dist test/dist es5",
"clean": "rimraf dist test/dist",
"postclean": "mkdirp dist test/dist",
"docs": "npm-run-all docs:*",
"docs:api": "jsdoc src -r -d docs/api",
"docs:toc": "doctoc README.md",
"lint": "vjsstandard",
"start": "npm-run-all -p watch start:*",
"prestart": "npm run build",
"start": "npm-run-all -p start:server watch",
"start:serve": "babel-node scripts/server.js",
"start:server": "static -a 0.0.0.0 -p 9999 -H '{\"Cache-Control\": \"no-cache, must-revalidate\"}' .",
"pretest": "npm-run-all lint build",
"test": "karma start test/karma.conf.js",
"test:chrome": "npm run pretest && karma start test/karma.conf.js --browsers Chrome",
"test:firefox": "npm run pretest && karma start test/karma.conf.js --browsers Firefox",
"test:ie": "npm run pretest && karma start test/karma.conf.js --browsers IE",
"test:safari": "npm run pretest && karma start test/karma.conf.js --browsers Safari",
"preversion": "npm test",
"version": "babel-node scripts/version.js",
"version": "node scripts/version.js",
"postversion": "babel-node scripts/postversion.js",
"prepublish": "npm run build",
"watch": "npm-run-all -p watch:*",
"watch:js": "npm-run-all -p watch:js:babel watch:js:browserify",
"watch:js-modules": "rollup -c scripts/modules.rollup.config.js -w",
"watch:js-umd": "rollup -c scripts/umd.rollup.config.js -w",
"watch:js:babel": "npm run build:js:babel -- --watch",
"watch:js:browserify": "watchify . -v -g browserify-shim -o dist/m3u8-parser.js"
"watch:js:browserify": "watchify . -v -g browserify-shim -o dist/m3u8-parser.js",
"watch:test": "rollup -c scripts/test.rollup.config.js -w",
"prepublish": "npm run build"
},
"keywords": [],
"author": "Brightcove, Inc",
Expand All @@ -65,32 +74,28 @@
"ignore": [
"dist",
"docs",
"es5",
"test/dist",
"test/karma.conf.js",
"test/test-expected.js",
"test/test-manifests.js",
"test/manifests.js",
"test/fixtures/m3u8/**/*.js"
]
},
"files": [
"CONTRIBUTING.md",
"bower.json",
"dist/",
"docs/",
"es5/",
"index.html",
"scripts/",
"src/",
"test/"
],
"dependencies": {},
"devDependencies": {
"babel": "^6.5.2",
"babel-cli": "^6.11.4",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-object-assign": "^6.8.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-es2015-loose": "^7.0.0",
"babel-preset-es2015": "^6.14.0",
"babel-preset-es3": "^1.0.1",
"babelify": "^7.3.0",
"bannerize": "^1.0.2",
Expand All @@ -99,24 +104,39 @@
"browserify-shim": "^3.8.12",
"budo": "^8.0.4",
"chg": "^0.3.2",
"conventional-changelog-cli": "^1.3.1",
"conventional-changelog-videojs": "^3.0.0",
"doctoc": "^0.15.0",
"glob": "^6.0.3",
"global": "^4.3.0",
"jsdoc": "^3.4.0",
"karma": "^0.13.19",
"karma-chrome-launcher": "^0.2.2",
"karma-detect-browsers": "^2.0.2",
"karma-firefox-launcher": "^0.1.7",
"karma-ie-launcher": "^0.2.0",
"karma-qunit": "^0.1.9",
"karma-safari-launcher": "^0.1.1",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.1.1",
"karma-detect-browsers": "^2.2.5",
"karma-firefox-launcher": "^1.0.1",
"karma-ie-launcher": "^1.0.0",
"karma-qunit": "^1.2.1",
"karma-safari-launcher": "^1.0.0",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"npm-run-all": "^1.5.1",
"qunitjs": "^1.21.0",
"rimraf": "^2.5.1",
"sinon": "~1.14.0",
"uglify-js": "^2.6.1",
"videojs-standard": "5.2.0",
"node-static": "^0.7.9",
"npm-run-all": "^4.0.2",
"qunitjs": "^2.3.2",
"rimraf": "^2.6.1",
"rollup": "^0.41.6",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-json": "^2.1.1",
"rollup-plugin-multi-entry": "^2.0.1",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-watch": "^3.2.2",
"semver": "^5.3.0",
"sinon": "^2.2.0",
"uglify-js": "^3.0.7",
"videojs-standard": "^6.0.0",
"watchify": "^3.7.0"
},
"generator-videojs-plugin": {
"version": "5.0.0"
}
}
1 change: 1 addition & 0 deletions scripts/export-m3u8s.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
/* eslint no-console: 0 */

const fs = require('fs');
Expand Down
22 changes: 22 additions & 0 deletions scripts/m3u8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';
const m3u8 = require('./export-m3u8s.js');

const args = require('minimist')(process.argv.slice(2), {
boolean: ['watch', 'clean', 'build'],
default: {
build: true
},
alias: {
b: 'build',
c: 'clean',
w: 'watch'
}
});

if (args.w) {
m3u8.watch();
} else if (args.c) {
m3u8.clean();
} else if (args.b) {
m3u8.build();
}
36 changes: 36 additions & 0 deletions scripts/modules.rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Rollup configuration for packaging the plugin in a module that is consumable
* by either CommonJS (e.g. Node or Browserify) or ECMAScript (e.g. Rollup).
*
* These modules DO NOT include their dependencies as we expect those to be
* handled by the module system.
*/
import babel from 'rollup-plugin-babel';
import json from 'rollup-plugin-json';

export default {
moduleName: 'm3u8-parser',
entry: 'src/index.js',
legacy: true,
plugins: [
json(),
babel({
babelrc: false,
exclude: 'node_modules/**',
presets: [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may need es3

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

['es2015', {
loose: true,
modules: false
}]
],
plugins: [
'external-helpers',
'transform-object-assign'
]
})
],
targets: [
{dest: 'dist/m3u8-parser.cjs.js', format: 'cjs'},
{dest: 'dist/m3u8-parser.es.js', format: 'es'}
]
};
56 changes: 56 additions & 0 deletions scripts/test.rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* Rollup configuration for packaging the plugin in a test bundle.
*
* This includes all dependencies for both the plugin and its tests.
*/
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import json from 'rollup-plugin-json';
import multiEntry from 'rollup-plugin-multi-entry';
import resolve from 'rollup-plugin-node-resolve';

export default {
moduleName: 'm3u8-parser-test',
entry: 'test/**/*.test.js',
dest: 'test/dist/bundle.js',
format: 'iife',
external: [
'qunit',
'qunitjs',
'sinon'
],
globals: {
qunit: 'QUnit',
qunitjs: 'QUnit',
sinon: 'sinon'
},
legacy: true,
plugins: [
multiEntry({
exports: false
}),
resolve({
browser: true,
main: true,
jsnext: true
}),
json(),
commonjs({
sourceMap: false
}),
babel({
babelrc: false,
exclude: 'node_modules/**',
presets: [
['es2015', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only tests, but maybe es3 for consistency

loose: true,
modules: false
}]
],
plugins: [
'external-helpers',
'transform-object-assign'
]
})
]
};
Loading