diff --git a/.eslintrc.json b/.eslintrc.json index fba3d471..63fefe4d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -8,6 +8,7 @@ "globals": { "Plyr": false, "jQuery": false }, "rules": { "no-const-assign": 1, + "no-shadow": 0, "no-this-before-super": 1, "no-undef": 1, "no-unreachable": 1, diff --git a/gulpfile.js b/gulpfile.js index 8f9b1836..eb3076db 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -9,6 +9,7 @@ const path = require('path'); const gulp = require('gulp'); const gutil = require('gulp-util'); const concat = require('gulp-concat'); +const filter = require('gulp-filter'); const sass = require('gulp-sass'); const cleancss = require('gulp-clean-css'); const run = require('run-sequence'); @@ -24,8 +25,7 @@ const size = require('gulp-size'); const rollup = require('gulp-better-rollup'); const babel = require('rollup-plugin-babel'); const sourcemaps = require('gulp-sourcemaps'); -const uglify = require('rollup-plugin-uglify'); -const { minify } = require('uglify-es'); +const uglify = require('gulp-uglify'); const commonjs = require('rollup-plugin-commonjs'); const resolve = require('rollup-plugin-node-resolve'); @@ -122,6 +122,7 @@ const build = { Object.keys(files).forEach(key => { const name = `js:${key}`; tasks.js.push(name); + const {output} = paths[bundle]; gulp.task(name, () => gulp @@ -135,15 +136,20 @@ const build = { resolve(), commonjs(), babel(babelrc), - uglify({}, minify), ], }, options, ), ) - .pipe(size(sizeOptions)) .pipe(sourcemaps.write('')) - .pipe(gulp.dest(paths[bundle].output)), + .pipe(gulp.dest(output)) + .pipe(filter('**/*.js')) + .pipe(uglify()) + .pipe(size(sizeOptions)) + .pipe(rename({suffix:'.min'})) + .pipe(sourcemaps.write('')) + .pipe(gulp.dest(output)), + ); }); }, diff --git a/package.json b/package.json index 0b0b7db1..4f5ad9b6 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "gulp-better-rollup": "^3.0.0", "gulp-clean-css": "^3.9.2", "gulp-concat": "^2.6.1", + "gulp-filter": "^5.1.0", "gulp-open": "^2.1.0", "gulp-rename": "^1.2.2", "gulp-replace": "^0.6.1", @@ -31,11 +32,11 @@ "gulp-sourcemaps": "^2.6.4", "gulp-svgmin": "^1.2.4", "gulp-svgstore": "^6.1.1", + "gulp-uglify": "^3.0.0", "gulp-util": "^3.0.8", "rollup-plugin-babel": "^3.0.3", "rollup-plugin-commonjs": "^8.3.0", "rollup-plugin-node-resolve": "^3.0.2", - "rollup-plugin-uglify": "^3.0.0", "run-sequence": "^2.2.1", "stylelint": "^8.4.0", "stylelint-config-prettier": "^2.0.0", @@ -46,7 +47,15 @@ "stylelint-selector-bem-pattern": "^2.0.0", "uglify-es": "^3.3.10" }, - "keywords": ["HTML5 Video", "HTML5 Audio", "Media Player", "DASH", "Shaka", "WordPress", "HLS"], + "keywords": [ + "HTML5 Video", + "HTML5 Audio", + "Media Player", + "DASH", + "Shaka", + "WordPress", + "HLS" + ], "repository": { "type": "git", "url": "git://github.com/sampotts/plyr.git" diff --git a/yarn.lock b/yarn.lock index ae5d5ce2..eff2f87f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1614,9 +1614,9 @@ eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" -eslint@^4.16.0: - version "4.16.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.16.0.tgz#934ada9e98715e1d7bbfd6f6f0519ed2fab35cc1" +eslint@^4.17.0: + version "4.17.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.17.0.tgz#dc24bb51ede48df629be7031c71d9dc0ee4f3ddf" dependencies: ajv "^5.3.0" babel-code-frame "^6.22.0" @@ -2269,6 +2269,14 @@ gulp-concat@^2.6.1: through2 "^2.0.0" vinyl "^2.0.0" +gulp-filter@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/gulp-filter/-/gulp-filter-5.1.0.tgz#a05e11affb07cf7dcf41a7de1cb7b63ac3783e73" + dependencies: + multimatch "^2.0.0" + plugin-error "^0.1.2" + streamfilter "^1.0.5" + gulp-open@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/gulp-open/-/gulp-open-2.1.0.tgz#ac01eee898d77a7ac0812fad4f3d53d08687d41c" @@ -2354,6 +2362,18 @@ gulp-svgstore@^6.1.1: plugin-error "^0.1.2" vinyl "^2.1.0" +gulp-uglify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-3.0.0.tgz#0df0331d72a0d302e3e37e109485dddf33c6d1ca" + dependencies: + gulplog "^1.0.0" + has-gulplog "^0.1.0" + lodash "^4.13.1" + make-error-cause "^1.1.1" + through2 "^2.0.0" + uglify-js "^3.0.5" + vinyl-sourcemaps-apply "^0.2.0" + gulp-util@^3.0, gulp-util@^3.0.0, gulp-util@^3.0.4, gulp-util@^3.0.8: version "3.0.8" resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f" @@ -3370,6 +3390,10 @@ lodash@>=3.10.0, lodash@^4.0.0, lodash@^4.14.0, lodash@^4.17.4, lodash@^4.2.0, l version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +lodash@^4.13.1: + version "4.17.5" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" + lodash@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/lodash/-/lodash-1.0.2.tgz#8f57560c83b59fc270bd3d561b690043430e2551" @@ -3420,6 +3444,16 @@ magic-string@^0.22.4: dependencies: vlq "^0.2.1" +make-error-cause@^1.1.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/make-error-cause/-/make-error-cause-1.2.2.tgz#df0388fcd0b37816dff0a5fb8108939777dcbc9d" + dependencies: + make-error "^1.2.0" + +make-error@^1.2.0: + version "1.3.3" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.3.tgz#a97ae14ffd98b05f543e83ddc395e1b2b6e4cc6a" + make-iterator@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.0.tgz#57bef5dc85d23923ba23767324d8e8f8f3d9694b" @@ -3567,7 +3601,7 @@ mimic-fn@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" -"minimatch@2 || 3", minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4, minimatch@~3.0.2: +"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4, minimatch@~3.0.2: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: @@ -3626,6 +3660,15 @@ ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" +multimatch@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-2.1.0.tgz#9c7906a22fb4c02919e2f5f75161b4cdbd4b2a2b" + dependencies: + array-differ "^1.0.0" + array-union "^1.0.1" + arrify "^1.0.0" + minimatch "^3.0.0" + multipipe@^0.1.0, multipipe@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/multipipe/-/multipipe-0.1.2.tgz#2a8f2ddf70eed564dff2d57f1e1a137d9f05078b" @@ -4571,12 +4614,6 @@ rollup-plugin-node-resolve@^3.0.2: is-module "^1.0.0" resolve "^1.1.6" -rollup-plugin-uglify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-3.0.0.tgz#a34eca24617709c6bf1778e9653baafa06099b86" - dependencies: - uglify-es "^3.3.7" - rollup-pluginutils@^1.5.0: version "1.5.2" resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408" @@ -4890,6 +4927,12 @@ stream-counter@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/stream-counter/-/stream-counter-1.0.0.tgz#91cf2569ce4dc5061febcd7acb26394a5a114751" +streamfilter@^1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/streamfilter/-/streamfilter-1.0.7.tgz#ae3e64522aa5a35c061fd17f67620c7653c643c9" + dependencies: + readable-stream "^2.0.2" + string-width@^1.0.1, string-width@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" @@ -5011,9 +5054,9 @@ stylelint-order@^0.8.0: postcss "^6.0.14" postcss-sorting "^3.1.0" -stylelint-scss@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/stylelint-scss/-/stylelint-scss-2.2.0.tgz#3e324bf13346db7af21cd24ad57fe3202f7c3823" +stylelint-scss@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/stylelint-scss/-/stylelint-scss-2.3.0.tgz#95089fa0c1cc5690be19ca80f901a4905c95dedc" dependencies: lodash "^4.17.4" postcss-media-query-parser "^0.2.3" @@ -5280,16 +5323,9 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -uglify-es@^3.3.7: - version "3.3.7" - resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.7.tgz#d1249af668666aba7cb1163e277455be9eb393cf" - dependencies: - commander "~2.13.0" - source-map "~0.6.1" - -uglify-es@^3.3.9: +uglify-js@^3.0.5: version "3.3.9" - resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.3.9.tgz#33869666c8ab7f7658ce3d22f0f1ced40097d33a" dependencies: commander "~2.13.0" source-map "~0.6.1"