Skip to content

Commit bfeff8c

Browse files
authored
refactor: Update to use generator v5 tooling. (#51)
1 parent e8bbe75 commit bfeff8c

18 files changed

+272
-410
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@ node_modules/
3131
# Build-related directories
3232
dist/
3333
docs/api/
34-
es5/
3534
test/dist/

.travis.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ node_js:
55
- 'node'
66
- 'lts/argon'
77
before_script:
8-
# check if the current version is equal to the version for the env
8+
9+
# Check if the current version is equal to the major version for the env.
910
- 'export IS_INSTALLED="$(npm list video.js | grep "video.js@$VJS")"'
10-
# we have to add semi colons to the end of each line in the if
11-
# as travis runs this all on one line
11+
12+
# We have to add semicolons to the end of each line in the if as Travis runs
13+
# this all on one line.
1214
- 'if [ -z "$IS_INSTALLED" ]; then
1315
echo "INSTALLING video.js@>=$VJS.0.0-RC.0 <$(($VJS+1)).0.0";
1416
npm i "video.js@>=$VJS.0.0-RC.0 <\$(($VJS+1)).0.0";

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Make sure you have NodeJS 0.10 or higher and npm installed.
1212

1313
### Making Changes
1414

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

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

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

2828
[karma]: http://karma-runner.github.io/
2929
[local]: http://localhost:9999/test/
30-
[standards]: https://github.com/videojs/generator-videojs-plugin/docs/standards.md
30+
[conventions]: https://github.com/videojs/generator-videojs-plugin/blob/master/docs/conventions.md

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ _Note_: This meaning of an "overlay" is distinct from that of a modal dialog, wh
1111
Once you've added the plugin script to your page, you can use it with any video:
1212

1313
```html
14-
<script src="videojs-overlay"></script>
14+
<script src="path/to/videojs-overlay.js"></script>
1515
<script>
1616
videojs(document.querySelector('video')).overlay();
1717
</script>

bower.json

-14
This file was deleted.

index.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
<head>
44
<meta charset="utf-8">
55
<title>videojs-overlay Demo</title>
6-
<link href="/node_modules/video.js/dist/video-js.css" rel="stylesheet">
7-
<link href="/dist/videojs-overlay.css" rel="stylesheet">
6+
<link href="node_modules/video.js/dist/video-js.css" rel="stylesheet">
7+
<link href="dist/videojs-overlay.css" rel="stylesheet">
88
</head>
99
<body>
1010
<video id="videojs-overlay-player" class="video-js vjs-default-skin" controls>
1111
<source src="//vjs.zencdn.net/v/oceans.mp4" type='video/mp4'>
1212
<source src="//vjs.zencdn.net/v/oceans.webm" type='video/webm'>
1313
</video>
1414
<ul>
15-
<li><a href="/test/">Run unit tests in browser.</a></li>
15+
<li><a href="test/">Run unit tests in browser.</a></li>
1616
</ul>
17-
<script src="/node_modules/video.js/dist/video.js"></script>
18-
<script src="/dist/videojs-overlay.js"></script>
17+
<script src="node_modules/video.js/dist/video.js"></script>
18+
<script src="dist/videojs-overlay.js"></script>
1919
<script>
2020
(function(window, videojs) {
2121
var player = window.player = videojs('videojs-overlay-player');

package.json

+55-52
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"author": "Brightcove, Inc.",
55
"license": "Apache-2.0",
66
"version": "1.1.4",
7-
"main": "es5/plugin.js",
7+
"main": "dist/videojs-overlay.cjs.js",
8+
"module": "dist/videojs-overlay.es.js",
89
"keywords": [
910
"videojs",
1011
"videojs-plugin"
@@ -13,16 +14,10 @@
1314
"type": "git",
1415
"url": "https://github.com/brightcove/videojs-overlay.git"
1516
},
16-
"browserify-shim": {
17-
"qunit": "global:QUnit",
18-
"sinon": "global:sinon",
19-
"video.js": "global:videojs"
20-
},
2117
"vjsstandard": {
2218
"ignore": [
2319
"dist",
2420
"docs",
25-
"es5",
2621
"test/dist",
2722
"test/karma.conf.js"
2823
]
@@ -33,59 +28,66 @@
3328
"build:css": "npm-run-all build:css:sass build:css:bannerize",
3429
"build:css:bannerize": "bannerize dist/videojs-overlay.css --banner=scripts/banner.ejs",
3530
"build:css:sass": "node-sass src/plugin.scss dist/videojs-overlay.css --output-style=compressed --linefeed=lf",
36-
"build:js": "npm-run-all build:js:babel build:js:browserify build:js:bannerize build:js:uglify",
37-
"build:js:babel": "babel src -d es5",
31+
"build:js": "npm-run-all build:js:rollup-modules build:js:rollup-umd build:js:bannerize build:js:uglify",
3832
"build:js:bannerize": "bannerize dist/videojs-overlay.js --banner=scripts/banner.ejs",
39-
"build:js:browserify": "browserify . -s videojs-overlay -g browserify-shim -t browserify-versionify -o dist/videojs-overlay.js",
40-
"build:js:uglify": "uglifyjs dist/videojs-overlay.js --comments --mangle --compress -o dist/videojs-overlay.min.js",
41-
"build:test": "babel-node scripts/build-test.js",
42-
"build:test:browserify": "browserify `find test -name '*.test.js'` -t babelify -o dist-test/videojs-overlay.js",
43-
"change": "chg add",
44-
"clean": "rimraf dist test/dist es5 && mkdirp dist test/dist es5",
33+
"build:js:rollup-modules": "rollup -c scripts/modules.rollup.config.js",
34+
"build:js:rollup-umd": "rollup -c scripts/umd.rollup.config.js",
35+
"build:js:uglify": "uglifyjs dist/videojs-overlay.js --comments --mangle --compress -o dist/videojs-overlay.min.js",
36+
"build:test": "rollup -c scripts/test.rollup.config.js",
37+
"clean": "rimraf dist test/dist",
38+
"postclean": "mkdirp dist test/dist",
4539
"lint": "vjsstandard",
46-
"start": "babel-node scripts/server.js",
40+
"start": "npm-run-all -p start:server watch",
41+
"start:server": "static -a 0.0.0.0 -p 9999 -H '{\"Cache-Control\": \"no-cache, must-revalidate\"}' .",
4742
"pretest": "npm-run-all lint build",
4843
"test": "karma start test/karma.conf.js",
49-
"test:chrome": "npm run pretest && karma start test/karma.conf.js --browsers Chrome",
50-
"test:firefox": "npm run pretest && karma start test/karma.conf.js --browsers Firefox",
51-
"test:ie": "npm run pretest && karma start test/karma.conf.js --browsers IE",
52-
"test:safari": "npm run pretest && karma start test/karma.conf.js --browsers Safari",
5344
"preversion": "npm test",
54-
"version": "babel-node scripts/version.js",
55-
"postversion": "babel-node scripts/postversion.js",
56-
"prepublish": "npm run build"
45+
"version": "node scripts/version.js",
46+
"watch": "npm-run-all -p watch:*",
47+
"watch:css": "npm-run-all build:css:sass watch:css:sass",
48+
"watch:css:sass": "node-sass src/plugin.scss dist/videojs-overlay.css --output-style=compressed --linefeed=lf --watch src/**/*.scss",
49+
"watch:js-modules": "rollup -c scripts/modules.rollup.config.js -w",
50+
"watch:js-umd": "rollup -c scripts/umd.rollup.config.js -w",
51+
"watch:test": "rollup -c scripts/test.rollup.config.js -w",
52+
"prepublish": "npm run build",
53+
"prepush": "npm run lint"
5754
},
5855
"dependencies": {
59-
"tsmlj": "^1.0.0",
60-
"video.js": "^5.6.0",
61-
"global": "^4.3.0"
56+
"global": "^4.3.2",
57+
"video.js": "^5.19.2"
6258
},
6359
"devDependencies": {
64-
"babel": "^5.8.35",
65-
"babelify": "^6.4.0",
60+
"babel-plugin-external-helpers": "^6.22.0",
61+
"babel-plugin-transform-object-assign": "^6.8.0",
62+
"babel-preset-es2015": "^6.14.0",
6663
"bannerize": "^1.0.2",
67-
"bluebird": "^3.2.2",
68-
"browserify": "^12.0.2",
69-
"browserify-shim": "^3.8.12",
70-
"browserify-versionify": "^1.0.6",
71-
"budo": "^8.0.4",
72-
"chg": "^0.3.2",
73-
"glob": "^6.0.3",
74-
"karma": "^0.13.19",
75-
"karma-chrome-launcher": "^0.2.2",
76-
"karma-detect-browsers": "^2.0.2",
77-
"karma-firefox-launcher": "^0.1.7",
78-
"karma-ie-launcher": "^0.2.0",
79-
"karma-qunit": "^0.1.9",
80-
"karma-safari-launcher": "^0.1.1",
64+
"conventional-changelog-cli": "^1.3.1",
65+
"conventional-changelog-videojs": "^3.0.0",
66+
"husky": "^0.13.3",
67+
"karma": "^1.7.0",
68+
"karma-chrome-launcher": "^2.1.1",
69+
"karma-detect-browsers": "^2.2.5",
70+
"karma-firefox-launcher": "^1.0.1",
71+
"karma-ie-launcher": "^1.0.0",
72+
"karma-qunit": "^1.2.1",
73+
"karma-safari-launcher": "^1.0.0",
8174
"mkdirp": "^0.5.1",
82-
"node-sass": "^3.4.2",
83-
"npm-run-all": "^1.5.1",
84-
"qunitjs": "^1.21.0",
85-
"rimraf": "^2.5.1",
86-
"sinon": "~1.14.0",
87-
"uglify-js": "^2.6.1",
88-
"videojs-standard": "^4.0.0"
75+
"node-sass": "^4.5.3",
76+
"node-static": "^0.7.9",
77+
"npm-run-all": "^4.0.2",
78+
"qunitjs": "^2.3.2",
79+
"rimraf": "^2.6.1",
80+
"rollup": "^0.41.6",
81+
"rollup-plugin-babel": "^2.7.1",
82+
"rollup-plugin-commonjs": "^8.0.2",
83+
"rollup-plugin-json": "^2.1.1",
84+
"rollup-plugin-multi-entry": "^2.0.1",
85+
"rollup-plugin-node-resolve": "^3.0.0",
86+
"rollup-watch": "^3.2.2",
87+
"semver": "^5.3.0",
88+
"sinon": "^2.2.0",
89+
"uglify-js": "^3.0.7",
90+
"videojs-standard": "^6.0.0"
8991
},
9092
"style": "dist/videojs-overlay.css",
9193
"videojs-plugin": {
@@ -94,13 +96,14 @@
9496
},
9597
"files": [
9698
"CONTRIBUTING.md",
97-
"bower.json",
9899
"dist/",
99100
"docs/",
100-
"es5/",
101101
"index.html",
102102
"scripts/",
103103
"src/",
104104
"test/"
105-
]
105+
],
106+
"generator-videojs-plugin": {
107+
"version": "5.0.1"
108+
}
106109
}

scripts/build-test.js

-17
This file was deleted.

scripts/modules.rollup.config.js

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* Rollup configuration for packaging the plugin in a module that is consumable
3+
* by either CommonJS (e.g. Node or Browserify) or ECMAScript (e.g. Rollup).
4+
*
5+
* These modules DO NOT include their dependencies as we expect those to be
6+
* handled by the module system.
7+
*/
8+
import babel from 'rollup-plugin-babel';
9+
import json from 'rollup-plugin-json';
10+
11+
export default {
12+
moduleName: 'videojsOverlay',
13+
entry: 'src/plugin.js',
14+
external: [
15+
'global',
16+
'global/document',
17+
'global/window',
18+
'video.js'
19+
],
20+
globals: {
21+
'video.js': 'videojs'
22+
},
23+
legacy: true,
24+
plugins: [
25+
json(),
26+
babel({
27+
babelrc: false,
28+
exclude: 'node_modules/**',
29+
presets: [
30+
['es2015', {
31+
loose: true,
32+
modules: false
33+
}]
34+
],
35+
plugins: [
36+
'external-helpers',
37+
'transform-object-assign'
38+
]
39+
})
40+
],
41+
targets: [
42+
{dest: 'dist/videojs-overlay.cjs.js', format: 'cjs'},
43+
{dest: 'dist/videojs-overlay.es.js', format: 'es'}
44+
]
45+
};

scripts/postversion.js

-33
This file was deleted.

0 commit comments

Comments
 (0)