From 00c67a100b6fe339542263a8f608a218d5c7bfce Mon Sep 17 00:00:00 2001 From: Rob Bearman Date: Thu, 12 Jan 2017 21:47:21 +0000 Subject: [PATCH 1/8] Initial work on webpack build --- gulp/tasks/webpack.js | 98 ++++++++++++++ gulpfile.js | 11 +- package.json | 6 +- yarn.lock | 300 +++++++++++++++++++++++++++++++++++++----- 4 files changed, 375 insertions(+), 40 deletions(-) create mode 100644 gulp/tasks/webpack.js diff --git a/gulp/tasks/webpack.js b/gulp/tasks/webpack.js new file mode 100644 index 00000000..b421d9e2 --- /dev/null +++ b/gulp/tasks/webpack.js @@ -0,0 +1,98 @@ +/*jslint node: true */ +'use strict'; + +const gulp = require('gulp'); +const gutil = require('gulp-util'); +const webpack = require('webpack'); +const glob = require('glob'); +const babelify = require('babelify') +const buffer = require('vinyl-buffer'); +const vinylStream = require('vinyl-source-stream'); +const allPackages = require('../lib/allPackages'); + +// +// Build the global buildList object for use in browserifyTask +// +function buildBuildList() { + const buildList = { + 'build/tests.js': allPackages.map(pkg => `packages/${pkg}/test/*.js`) + }; + allPackages.forEach(pkg => { + buildList[`packages/${pkg}/dist/${pkg}.js`] = [`packages/${pkg}/globals.js`]; + }); + buildList['packages/demos/dist/demos.js'] = ['packages/demos/src/*.js']; + return buildList; +} +const buildList = buildBuildList(); + +const watchifyTask = function(done) { + webpackHelperTask(true, done); +}; + +const webpackTask = function(done) { + webpackHelperTask(false, done); +}; + +const webpackHelperTask = function(watch, done) { + let packOptionsArray = []; + let processedCount = 0; + let packOptionsCount = 0; + + function packIt(packOptions) { + webpack(packOptions, function(err, stats) { + if (err) { + throw new gutil.PluginError('webpack', err); + } + + gutil.log(`Processed ${packOptions.entries} and wrote ${packOptions.output.path}${packOptions.output.filename}`); + gutil.log('[webpack]', stats.toString({})); + processedCount++; + if (processedCount >= packOptionsCount) { + if (watch) { + // Do not call task completion callback in the watch case + gutil.log('Now watching for changes...') + } + else { + done(); + } + } + }); + } + + gutil.log('Preparing build...'); + + for (let key in buildList) { + let entries = []; + + buildList[key].forEach(globItem => { + let a = glob.sync(globItem); + Array.prototype.push.apply(entries, a); + }); + + let packOptions = { + entry: entries, + output: { + path: key.substring(0, key.lastIndexOf('/') + 1), + filename: key.split('/').pop() + }, + devtool: 'inline-source-map', + module: { + loaders: [ + { + loader: 'babel-loader' + } + ] + } + }; + + packOptionsArray.push(packOptions); + } + + packOptionsCount = packOptionsArray.length; + + packOptionsArray.forEach(packOptions => { + packIt(packOptions); + }); +}; + +module.exports = {webpackTask: webpackTask, watchifyTask: watchifyTask}; \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index ff007a33..485fe7f4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -3,6 +3,7 @@ const gulp = require('gulp'); +const webpackTask = require('./gulp/tasks/webpack').webpackTask; const browserifyTask = require('./gulp/tasks/browserify').browserifyTask; const watchifyTask = require('./gulp/tasks/browserify').watchifyTask; const docsTask = require('./gulp/tasks/docs'); @@ -21,15 +22,21 @@ const lintTask = require('./gulp/tasks/lint'); // // Private +gulp.task('webpack', [], webpackTask); gulp.task('browserify', [], browserifyTask); gulp.task('docs-browserify', ['browserify'], docsTask); +gulp.task('docs-webpack', ['webpack'], docsTask); gulp.task('help', [], helpTask); gulp.task('lint-docs-browserify', ['docs-browserify'], lintTask); +gulp.task('lint-docs-webpack', ['docs-webpack'], lintTask); gulp.task('lint-browserify', ['browserify'], lintTask); +gulp.task('lint-webpack', ['webpack'], lintTask); // Public -gulp.task('build', ['browserify', 'docs-browserify', 'lint-docs-browserify']); -gulp.task('devbuild', ['browserify', 'lint-browserify']); +//gulp.task('build', ['browserify', 'docs-browserify', 'lint-docs-browserify']); +//gulp.task('devbuild', ['browserify', 'lint-browserify']); +gulp.task('build', ['webpack', 'docs-webpack', 'lint-docs-webpack']); +gulp.task('devbuild', ['webpack', 'lint-webpack']); gulp.task('default', ['help']); gulp.task('docs', [], docsTask); gulp.task('lint', [], lintTask); diff --git a/package.json b/package.json index 8c9ff61c..52b0f8a0 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "web-animations-js": "^2.2.1" }, "devDependencies": { + "babel-loader": "^6.2.10", "babel-preset-es2015": "^6.6.0", "babelify": "^7.3.0", "browserify": "^13.1.1", @@ -35,11 +36,12 @@ "gulp-util": "^3.0.7", "vinyl-buffer": "^1.0.0", "vinyl-source-stream": "^1.1.0", - "watchify": "^3.7.0" + "watchify": "^3.7.0", + "webpack": "^1.14.0" }, "browserify": { "transform": [ "babelify" ] } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 2f3d422f..ae04931e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -25,7 +25,7 @@ acorn@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-2.7.0.tgz#ab6e7d9d886aaca8b085bc3312b79a198433f0e7" -acorn@^3.0.4, acorn@^3.1.0, acorn@^3.3.0: +acorn@^3.0.0, acorn@^3.0.4, acorn@^3.1.0, acorn@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" @@ -208,6 +208,12 @@ assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" +assert@^1.1.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/assert/-/assert-1.4.1.tgz#99912d591836b5a6f5b345c0f07eefc08fc65d91" + dependencies: + util "0.10.3" + assert@~1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/assert/-/assert-1.3.0.tgz#03939a622582a812cc202320a0b9a56c9b815849" @@ -232,6 +238,10 @@ async@^0.9.0: version "0.9.2" resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" +async@^1.3.0, async@1.5.2: + version "1.5.2" + resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + async@~0.1.22: version "0.1.22" resolved "https://registry.yarnpkg.com/async/-/async-0.1.22.tgz#0fc1aaa088a0e3ef0ebe2d8831bab0dcf8845061" @@ -240,10 +250,6 @@ async@~0.2.6, async@~0.2.9: version "0.2.10" resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" -async@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -379,6 +385,15 @@ babel-helpers@^6.16.0: babel-runtime "^6.0.0" babel-template "^6.16.0" +babel-loader: + version "6.2.10" + resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-6.2.10.tgz#adefc2b242320cd5d15e65b31cea0e8b1b02d4b0" + dependencies: + find-cache-dir "^0.1.1" + loader-utils "^0.2.11" + mkdirp "^0.5.1" + object-assign "^4.0.1" + babel-messages@^6.8.0: version "6.8.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.8.0.tgz#bf504736ca967e6d65ef0adb5a2a5f947c8e0eb9" @@ -703,6 +718,10 @@ beeper@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/beeper/-/beeper-1.1.1.tgz#e6d5ea8c5dad001304a70b22638447f69cb2f809" +big.js@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.1.3.tgz#4cada2193652eb3ca9ec8e55c9015669c9806978" + binary-extensions@^1.0.0: version "1.8.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.8.0.tgz#48ec8d16df4377eae5fa5884682480af4d95c774" @@ -788,6 +807,12 @@ browserify-aes@^1.0.0, browserify-aes@^1.0.4: evp_bytestokey "^1.0.0" inherits "^2.0.1" +browserify-aes@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-0.4.0.tgz#067149b668df31c4b58533e02d01e806d8608e2c" + dependencies: + inherits "^2.0.1" + browserify-cipher@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.0.tgz#9988244874bf5ed4e28da95666dcd66ac8fc363a" @@ -823,7 +848,7 @@ browserify-sign@^4.0.0: inherits "^2.0.1" parse-asn1 "^5.0.0" -browserify-zlib@~0.1.2: +browserify-zlib@^0.1.4, browserify-zlib@~0.1.2: version "0.1.4" resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.1.4.tgz#bb35f8a519f600e0fa6b8485241c979d0141fb2d" dependencies: @@ -951,7 +976,7 @@ buffer@^3.0.0: ieee754 "^1.1.4" isarray "^1.0.0" -buffer@^4.1.0: +buffer@^4.1.0, buffer@^4.9.0: version "4.9.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" dependencies: @@ -971,6 +996,10 @@ builtin-status-codes@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-2.0.0.tgz#6f22003baacf003ccd287afe6872151fddc58579" +builtin-status-codes@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" + builtins@~0.0.3: version "0.0.7" resolved "https://registry.yarnpkg.com/builtins/-/builtins-0.0.7.tgz#355219cd6cf18dbe7c01cc7fd2dce765cfdc549a" @@ -1259,6 +1288,10 @@ common-sequence@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/common-sequence/-/common-sequence-1.0.2.tgz#30e07f3f8f6f7f9b3dee854f20b2d39eee086de8" +commondir@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + commondir@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-0.0.1.tgz#89f00fdcd51b519c578733fec563e6a6da7f5be2" @@ -1322,14 +1355,14 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" +constants-browserify@^1.0.0, constants-browserify@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" + constants-browserify@~0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-0.0.1.tgz#92577db527ba6c4cf0a4568d84bc031f441e21f2" -constants-browserify@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" - convert-source-map@^1.1.0, convert-source-map@1.X: version "1.3.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.3.0.tgz#e9f3e9c6e2728efc2676696a70eb382f73106a67" @@ -1390,6 +1423,15 @@ crypto-browserify@^3.0.0: public-encrypt "^4.0.0" randombytes "^2.0.0" +crypto-browserify@3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.3.0.tgz#b9fc75bb4a0ed61dcf1cd5dae96eb30c9c3e506c" + dependencies: + browserify-aes "0.4.0" + pbkdf2-compat "2.0.1" + ripemd160 "0.2.0" + sha.js "2.2.6" + css@2.X: version "2.2.1" resolved "https://registry.yarnpkg.com/css/-/css-2.2.1.tgz#73a4c81de85db664d4ee674f7d47085e3b2d55dc" @@ -1599,7 +1641,7 @@ dom-serializer@0: domelementtype "~1.1.1" entities "~1.1.1" -domain-browser@~1.1.0: +domain-browser@^1.1.1, domain-browser@~1.1.0: version "1.1.7" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc" @@ -1655,6 +1697,10 @@ elliptic@^6.0.0: hash.js "^1.0.0" inherits "^2.0.1" +emojis-list@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" + encodeurl@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.1.tgz#79e3d58655346909fe6f0f45a5de68103b294d20" @@ -1665,6 +1711,14 @@ end-of-stream@~0.1.5: dependencies: once "~1.3.0" +enhanced-resolve@~0.9.0: + version "0.9.1" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz#4d6e689b3725f86090927ccc86cd9f1635b89e2e" + dependencies: + graceful-fs "^4.1.2" + memory-fs "^0.2.0" + tapable "^0.1.8" + entities@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" @@ -1673,6 +1727,12 @@ entities@1.0: version "1.0.0" resolved "https://registry.yarnpkg.com/entities/-/entities-1.0.0.tgz#b2987aa3821347fcde642b24fdfc9e4fb712bf26" +errno@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.4.tgz#b896e23a9e5e8ba33871fc996abd3635fc9a1c7d" + dependencies: + prr "~0.0.0" + error-ex@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.0.tgz#e67b43f3e82c96ea3a584ffee0b9fc3325d802d9" @@ -1718,14 +1778,14 @@ eventemitter2@^0.4.9, eventemitter2@~0.4.13: version "0.4.14" resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-0.4.14.tgz#8f61b75cde012b2e9eb284d4545583b5643b61ab" +events@^1.0.0, events@~1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" + events@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/events/-/events-1.0.2.tgz#75849dcfe93d10fb057c30055afdbd51d06a8e24" -events@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" - evp_bytestokey@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.0.tgz#497b66ad9fef65cd7c08a6180824ba1476b66e53" @@ -1851,6 +1911,14 @@ finalhandler@0.5.0: statuses "~1.3.0" unpipe "~1.0.0" +find-cache-dir@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-0.1.1.tgz#c8defae57c8a52a8a784f9e31c57c742e993a0b9" + dependencies: + commondir "^1.0.1" + mkdirp "^0.5.1" + pkg-dir "^1.0.0" + find-index@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/find-index/-/find-index-0.1.1.tgz#675d358b2ca3892d795a1ab47232f8b6e2e0dde4" @@ -2458,6 +2526,10 @@ has-ansi@^2.0.0: dependencies: ansi-regex "^2.0.0" +has-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + has-gulplog@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce" @@ -2555,7 +2627,7 @@ http-signature@~1.1.0: jsprim "^1.2.2" sshpk "^1.7.0" -https-browserify@~0.0.0: +https-browserify@~0.0.0, https-browserify@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82" @@ -2646,6 +2718,10 @@ insert-module-globals@^7.0.0: through2 "^2.0.0" xtend "^4.0.0" +interpret@^0.6.4: + version "0.6.6" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-0.6.6.tgz#fecd7a18e7ce5ca6abfb953e1f86213a49f1625b" + interpret@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c" @@ -3042,6 +3118,15 @@ load-json-file@^1.0.0: pinkie-promise "^2.0.0" strip-bom "^2.0.0" +loader-utils@^0.2.11: + version "0.2.16" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.16.tgz#f08632066ed8282835dff88dfb52704765adee6d" + dependencies: + big.js "^3.1.3" + emojis-list "^2.0.0" + json5 "^0.5.0" + object-assign "^4.0.1" + lodash._basecopy@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" @@ -3240,6 +3325,17 @@ marked@~0.3.6: version "0.3.6" resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.6.tgz#b2c6c618fccece4ef86c4fc6cb8a7cbf5aeda8d7" +memory-fs@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.2.0.tgz#f2bb25368bc121e391c2520de92969caee0a0290" + +memory-fs@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.3.0.tgz#7bcc6b629e3a43e871d7e29aca6ae8a7f15cbb20" + dependencies: + errno "^0.1.3" + readable-stream "^2.0.1" + meow@^3.3.0: version "3.7.0" resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" @@ -3336,7 +3432,7 @@ minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -mkdirp@^0.5.0, mkdirp@^0.5.1, "mkdirp@>=0.5 0", mkdirp@~0.5.1, mkdirp@0.5.1: +mkdirp@^0.5.0, mkdirp@^0.5.1, "mkdirp@>=0.5 0", mkdirp@~0.5.0, mkdirp@~0.5.1, mkdirp@0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: @@ -3442,6 +3538,34 @@ negotiator@0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" +node-libs-browser@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-0.7.0.tgz#3e272c0819e308935e26674408d7af0e1491b83b" + dependencies: + assert "^1.1.1" + browserify-zlib "^0.1.4" + buffer "^4.9.0" + console-browserify "^1.1.0" + constants-browserify "^1.0.0" + crypto-browserify "3.3.0" + domain-browser "^1.1.1" + events "^1.0.0" + https-browserify "0.0.1" + os-browserify "^0.2.0" + path-browserify "0.0.0" + process "^0.11.0" + punycode "^1.2.4" + querystring-es3 "^0.2.0" + readable-stream "^2.0.5" + stream-browserify "^2.0.1" + stream-http "^2.3.1" + string_decoder "^0.10.25" + timers-browserify "^2.0.2" + tty-browserify "0.0.0" + url "^0.11.0" + util "^0.10.3" + vm-browserify "0.0.4" + node-pre-gyp@^0.6.29: version "0.6.32" resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.32.tgz#fc452b376e7319b3d255f5f34853ef6fd8fe1fd5" @@ -3586,7 +3710,7 @@ opn@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/opn/-/opn-1.0.2.tgz#b909643346d00a1abc977a8b96f3ce3c53d5cf5f" -optimist@^0.6.1: +optimist@^0.6.1, optimist@~0.6.0: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" dependencies: @@ -3611,6 +3735,10 @@ ordered-read-streams@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/ordered-read-streams/-/ordered-read-streams-0.1.0.tgz#fd565a9af8eb4473ba69b6ed8a34352cb552f126" +os-browserify@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.2.1.tgz#63fc4ccee5d2d7763d26bbf8601078e6c2e0044f" + os-browserify@~0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.1.2.tgz#49ca0293e0b19590a5f5de10c7f265a617d8fe54" @@ -3684,7 +3812,7 @@ parseurl@~1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.1.tgz#c8ab8c9223ba34888aa64a297b28853bec18da56" -path-browserify@~0.0.0: +path-browserify@~0.0.0, path-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.0.tgz#a0b870729aae214005b7d5032ec2cbbb0fb4451a" @@ -3724,6 +3852,10 @@ path-type@^1.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" +pbkdf2-compat@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pbkdf2-compat/-/pbkdf2-compat-2.0.1.tgz#b6e0c8fa99494d94e0511575802a59a5c142f288" + pbkdf2@^3.0.3: version "3.0.9" resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.9.tgz#f2c4b25a600058b3c3773c086c37dbbee1ffe693" @@ -3762,6 +3894,12 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" +pkg-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + dependencies: + find-up "^1.0.0" + portscanner@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/portscanner/-/portscanner-1.2.0.tgz#b14bbda257d14c310fa9cc09682af02d40961802" @@ -3784,7 +3922,7 @@ process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" -process@~0.11.0: +process@^0.11.0, process@~0.11.0: version "0.11.9" resolved "https://registry.yarnpkg.com/process/-/process-0.11.9.tgz#7bd5ad21aa6253e7da8682264f1e11d11c0318c1" @@ -3802,6 +3940,10 @@ promise.prototype.finally@^1.0.1: dependencies: asap "~2.0.3" +prr@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" + public-encrypt@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.0.tgz#39f699f3a46560dd5ebacbca693caf7c65c18cc6" @@ -3812,7 +3954,7 @@ public-encrypt@^4.0.0: parse-asn1 "^5.0.0" randombytes "^2.0.1" -punycode@^1.3.2, punycode@^1.4.1: +punycode@^1.2.4, punycode@^1.3.2, punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" @@ -3832,7 +3974,7 @@ qs@~6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442" -querystring-es3@~0.2.0: +querystring-es3@^0.2.0, querystring-es3@~0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" @@ -3916,7 +4058,7 @@ readable-stream@^1.0.31, readable-stream@^1.1.13, readable-stream@^1.1.13-1, "re isarray "0.0.1" string_decoder "~0.10.x" -"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2, readable-stream@^2.1.0, readable-stream@^2.1.5: +"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.1.0, readable-stream@^2.1.5: version "2.2.2" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" dependencies: @@ -4175,6 +4317,10 @@ ripemd160@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-1.0.1.tgz#93a4bbd4942bc574b69a8fa57c71de10ecca7d6e" +ripemd160@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-0.2.0.tgz#2bf198bde167cacfa51c0a928e84b68bbe171fce" + sauce-tunnel@~2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/sauce-tunnel/-/sauce-tunnel-2.4.0.tgz#fb436f203deb7a8c53ed583c2569870de5b32b43" @@ -4252,6 +4398,10 @@ set-immediate-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" +setimmediate@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + setprototypeof@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.0.2.tgz#81a552141ec104b88e89ce383103ad5c66564d08" @@ -4262,6 +4412,10 @@ sha.js@^2.3.6, sha.js@~2.4.4: dependencies: inherits "^2.0.1" +sha.js@2.2.6: + version "2.2.6" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.2.6.tgz#17ddeddc5f722fb66501658895461977867315ba" + shasum@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/shasum/-/shasum-1.0.2.tgz#e7012310d8f417f4deb5712150e5678b87ae565f" @@ -4312,6 +4466,10 @@ sort-array@^1.0.0: object-get "^2.0.4" typical "^2.4.2" +source-list-map@~0.1.7: + version "0.1.8" + resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106" + source-map-resolve@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.3.1.tgz#610f6122a445b8dd51535a2a71b783dfc1248761" @@ -4341,7 +4499,7 @@ source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.3, source-map@~0.5.1, sour version "0.5.6" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" -source-map@~0.4.0, source-map@~0.4.2: +source-map@~0.4.0, source-map@~0.4.1, source-map@~0.4.2: version "0.4.4" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" dependencies: @@ -4390,7 +4548,7 @@ sshpk@^1.7.0: version "1.3.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e" -stream-browserify@^2.0.0: +stream-browserify@^2.0.0, stream-browserify@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db" dependencies: @@ -4449,6 +4607,16 @@ stream-http@^2.0.0: to-arraybuffer "^1.0.0" xtend "^4.0.0" +stream-http@^2.3.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.6.1.tgz#7d20fcdfebc16b16e4174e31dd94cd9c70f10e89" + dependencies: + builtin-status-codes "^3.0.0" + inherits "^2.0.1" + readable-stream "^2.1.0" + to-arraybuffer "^1.0.0" + xtend "^4.0.0" + stream-splicer@^1.1.0: version "1.3.2" resolved "https://registry.yarnpkg.com/stream-splicer/-/stream-splicer-1.3.2.tgz#3c0441be15b9bf4e226275e6dc83964745546661" @@ -4475,7 +4643,7 @@ stream-via@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/stream-via/-/stream-via-0.1.1.tgz#0cee5df9c959fb1d3f4eda4819f289d5f9205afc" -string_decoder@~0.10.0, string_decoder@~0.10.x: +string_decoder@^0.10.25, string_decoder@~0.10.0, string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" @@ -4550,6 +4718,12 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" +supports-color@^3.1.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" + dependencies: + has-flag "^1.0.0" + supports-color@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-1.2.0.tgz#ff1ed1e61169d06b3cf2d588e188b18d8847e17e" @@ -4575,6 +4749,10 @@ taffydb@2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/taffydb/-/taffydb-2.6.2.tgz#7cbcb64b5a141b6a2efc2c5d2c67b4e150b2a268" +tapable@^0.1.8, tapable@~0.1.8: + version "0.1.10" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.1.10.tgz#29c35707c2b70e50d07482b5d202e8ed446dafd4" + tar-pack@~3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.3.0.tgz#30931816418f55afc4d21775afdd6720cee45dae" @@ -4678,6 +4856,12 @@ timers-browserify@^1.0.1: dependencies: process "~0.11.0" +timers-browserify@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.2.tgz#ab4883cf597dcd50af211349a00fbca56ac86b86" + dependencies: + setimmediate "^1.0.4" + tiny-lr-fork@0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/tiny-lr-fork/-/tiny-lr-fork-0.0.5.tgz#1e99e1e2a8469b736ab97d97eefa98c71f76ed0a" @@ -4709,7 +4893,7 @@ trim-newlines@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" -tty-browserify@~0.0.0: +tty-browserify@~0.0.0, tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" @@ -4745,6 +4929,15 @@ uglify-js@~2.3: optimist "~0.3.5" source-map "~0.1.7" +uglify-js@~2.7.3: + version "2.7.5" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.5.tgz#4612c0c7baaee2ba7c487de4904ae122079f2ca8" + dependencies: + async "~0.2.6" + source-map "~0.5.1" + uglify-to-browserify "~1.0.0" + yargs "~3.10.0" + uglify-js@2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.0.tgz#f021e38ba2ca740860f5bd5c695c2a817345f0ec" @@ -4816,16 +5009,16 @@ urix@^0.1.0, urix@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" -url@~0.10.1: - version "0.10.3" - resolved "https://registry.yarnpkg.com/url/-/url-0.10.3.tgz#021e4d9c7705f21bbf37d03ceb58767402774c64" +url@^0.11.0, url@~0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" dependencies: punycode "1.3.2" querystring "0.2.0" -url@~0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" +url@~0.10.1: + version "0.10.3" + resolved "https://registry.yarnpkg.com/url/-/url-0.10.3.tgz#021e4d9c7705f21bbf37d03ceb58767402774c64" dependencies: punycode "1.3.2" querystring "0.2.0" @@ -4852,7 +5045,7 @@ util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" -util@~0.10.1, util@0.10.3: +util@^0.10.3, util@~0.10.1, util@0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" dependencies: @@ -4941,7 +5134,7 @@ vinyl@1.X: clone-stats "^0.0.1" replace-ext "0.0.1" -vm-browserify@~0.0.1: +vm-browserify@~0.0.1, vm-browserify@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73" dependencies: @@ -4963,10 +5156,45 @@ watchify@^3.3.1, watchify@^3.7.0: through2 "^2.0.0" xtend "^4.0.0" +watchpack@^0.2.1: + version "0.2.9" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-0.2.9.tgz#62eaa4ab5e5ba35fdfc018275626e3c0f5e3fb0b" + dependencies: + async "^0.9.0" + chokidar "^1.0.0" + graceful-fs "^4.1.2" + web-animations-js@^2.2.1: version "2.2.2" resolved "https://registry.yarnpkg.com/web-animations-js/-/web-animations-js-2.2.2.tgz#7c3aa5382c5eade70cd206880d56a37869630638" +webpack: + version "1.14.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-1.14.0.tgz#54f1ffb92051a328a5b2057d6ae33c289462c823" + dependencies: + acorn "^3.0.0" + async "^1.3.0" + clone "^1.0.2" + enhanced-resolve "~0.9.0" + interpret "^0.6.4" + loader-utils "^0.2.11" + memory-fs "~0.3.0" + mkdirp "~0.5.0" + node-libs-browser "^0.7.0" + optimist "~0.6.0" + supports-color "^3.1.0" + tapable "~0.1.8" + uglify-js "~2.7.3" + watchpack "^0.2.1" + webpack-core "~0.6.9" + +webpack-core@~0.6.9: + version "0.6.9" + resolved "https://registry.yarnpkg.com/webpack-core/-/webpack-core-0.6.9.tgz#fc571588c8558da77be9efb6debdc5a3b172bdc2" + dependencies: + source-list-map "~0.1.7" + source-map "~0.4.1" + when@~3.7.5: version "3.7.7" resolved "https://registry.yarnpkg.com/when/-/when-3.7.7.tgz#aba03fc3bb736d6c88b091d013d8a8e590d84718" From eadc26915affcdc7d8f98e6af771bb77f30b5d67 Mon Sep 17 00:00:00 2001 From: Rob Bearman Date: Thu, 12 Jan 2017 22:20:58 +0000 Subject: [PATCH 2/8] Get webpack build working. No minimize yet. --- gulp/tasks/webpack.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gulp/tasks/webpack.js b/gulp/tasks/webpack.js index b421d9e2..f1549269 100644 --- a/gulp/tasks/webpack.js +++ b/gulp/tasks/webpack.js @@ -15,12 +15,12 @@ const allPackages = require('../lib/allPackages'); // function buildBuildList() { const buildList = { - 'build/tests.js': allPackages.map(pkg => `packages/${pkg}/test/*.js`) + './build/tests.js': allPackages.map(pkg => `./packages/${pkg}/test/*.js`) }; allPackages.forEach(pkg => { - buildList[`packages/${pkg}/dist/${pkg}.js`] = [`packages/${pkg}/globals.js`]; + buildList[`./packages/${pkg}/dist/${pkg}.js`] = [`./packages/${pkg}/globals.js`]; }); - buildList['packages/demos/dist/demos.js'] = ['packages/demos/src/*.js']; + buildList['./packages/demos/dist/demos.js'] = ['./packages/demos/src/*.js']; return buildList; } const buildList = buildBuildList(); @@ -44,8 +44,8 @@ const webpackHelperTask = function(watch, done) { throw new gutil.PluginError('webpack', err); } - gutil.log(`Processed ${packOptions.entries} and wrote ${packOptions.output.path}${packOptions.output.filename}`); - gutil.log('[webpack]', stats.toString({})); + gutil.log(`Processed ${packOptions.entry} and wrote ${packOptions.output.path}${packOptions.output.filename}`); + //gutil.log('[webpack]', stats.toString({})); processedCount++; if (processedCount >= packOptionsCount) { if (watch) { From fa7a79cfc1e9bc00a074b8e4ca3d4e9f56658095 Mon Sep 17 00:00:00 2001 From: Rob Bearman Date: Thu, 12 Jan 2017 22:24:36 +0000 Subject: [PATCH 3/8] Remove unused packages in gulp/tasts/webpack.js --- gulp/tasks/webpack.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gulp/tasks/webpack.js b/gulp/tasks/webpack.js index f1549269..0e423afa 100644 --- a/gulp/tasks/webpack.js +++ b/gulp/tasks/webpack.js @@ -1,13 +1,9 @@ /*jslint node: true */ 'use strict'; -const gulp = require('gulp'); const gutil = require('gulp-util'); const webpack = require('webpack'); const glob = require('glob'); -const babelify = require('babelify') -const buffer = require('vinyl-buffer'); -const vinylStream = require('vinyl-source-stream'); const allPackages = require('../lib/allPackages'); // From db95bad5bcb67c4efee8bb3981258a96ba11e328 Mon Sep 17 00:00:00 2001 From: Rob Bearman Date: Thu, 12 Jan 2017 22:51:46 +0000 Subject: [PATCH 4/8] Bind the babel-loader to .js files --- gulp/tasks/webpack.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gulp/tasks/webpack.js b/gulp/tasks/webpack.js index 0e423afa..7a418ee8 100644 --- a/gulp/tasks/webpack.js +++ b/gulp/tasks/webpack.js @@ -46,7 +46,7 @@ const webpackHelperTask = function(watch, done) { if (processedCount >= packOptionsCount) { if (watch) { // Do not call task completion callback in the watch case - gutil.log('Now watching for changes...') + gutil.log('Now watching for changes...'); } else { done(); @@ -75,7 +75,11 @@ const webpackHelperTask = function(watch, done) { module: { loaders: [ { - loader: 'babel-loader' + test: /\.js$/, + loader: 'babel-loader', + query: { + presets: ['es2015'] + } } ] } From 4031b99b761ec1b2e28cbf94bd8b7b426ec1a775 Mon Sep 17 00:00:00 2001 From: Rob Bearman Date: Tue, 17 Jan 2017 19:10:24 +0000 Subject: [PATCH 5/8] Add uglify and split off sourcemaps to separate files --- gulp/tasks/webpack.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gulp/tasks/webpack.js b/gulp/tasks/webpack.js index 7a418ee8..05a8b9ad 100644 --- a/gulp/tasks/webpack.js +++ b/gulp/tasks/webpack.js @@ -65,13 +65,15 @@ const webpackHelperTask = function(watch, done) { Array.prototype.push.apply(entries, a); }); + let filename = key.split('/').pop(); let packOptions = { entry: entries, output: { path: key.substring(0, key.lastIndexOf('/') + 1), - filename: key.split('/').pop() + filename: filename, + sourceMapFilename: filename + '.map' }, - devtool: 'inline-source-map', + devtool: 'source-map', module: { loaders: [ { @@ -82,7 +84,14 @@ const webpackHelperTask = function(watch, done) { } } ] - } + }, + plugins: [ + new webpack.optimize.UglifyJsPlugin({ + compress: { + warnings: false // https://github.com/webpack/webpack/issues/1496 + } + }) + ] }; packOptionsArray.push(packOptions); From f44a3d905c91a5da1cf12320ed90b820942d554a Mon Sep 17 00:00:00 2001 From: Rob Bearman Date: Tue, 17 Jan 2017 22:35:46 +0000 Subject: [PATCH 6/8] Exclude node_modules from webpack babel-loader configuration to avoid TypeErrors in unit tests --- gulp/tasks/webpack.js | 1 + 1 file changed, 1 insertion(+) diff --git a/gulp/tasks/webpack.js b/gulp/tasks/webpack.js index 05a8b9ad..89ce964e 100644 --- a/gulp/tasks/webpack.js +++ b/gulp/tasks/webpack.js @@ -79,6 +79,7 @@ const webpackHelperTask = function(watch, done) { { test: /\.js$/, loader: 'babel-loader', + exclude: /node_modules/, query: { presets: ['es2015'] } From 628a4b041559c8f1a2896ad6f29529e48cd267b5 Mon Sep 17 00:00:00 2001 From: Rob Bearman Date: Wed, 18 Jan 2017 17:15:57 +0000 Subject: [PATCH 7/8] Enable watch task under webpack --- gulp/tasks/webpack.js | 1 + gulpfile.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gulp/tasks/webpack.js b/gulp/tasks/webpack.js index 89ce964e..40977927 100644 --- a/gulp/tasks/webpack.js +++ b/gulp/tasks/webpack.js @@ -67,6 +67,7 @@ const webpackHelperTask = function(watch, done) { let filename = key.split('/').pop(); let packOptions = { + watch: watch, entry: entries, output: { path: key.substring(0, key.lastIndexOf('/') + 1), diff --git a/gulpfile.js b/gulpfile.js index 485fe7f4..2c2ecdef 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,8 +4,9 @@ const gulp = require('gulp'); const webpackTask = require('./gulp/tasks/webpack').webpackTask; +const watchifyTask = require('./gulp/tasks/webpack').watchifyTask; const browserifyTask = require('./gulp/tasks/browserify').browserifyTask; -const watchifyTask = require('./gulp/tasks/browserify').watchifyTask; +//const watchifyTask = require('./gulp/tasks/browserify').watchifyTask; const docsTask = require('./gulp/tasks/docs'); const helpTask = require('./gulp/tasks/help'); const lintTask = require('./gulp/tasks/lint'); From 9dbbaeb421948b005e947ffd502615351156f07e Mon Sep 17 00:00:00 2001 From: Rob Bearman Date: Wed, 18 Jan 2017 20:06:24 +0000 Subject: [PATCH 8/8] New options for building minified/non-minified --- gulp/tasks/webpack.js | 30 ++++++++++++++++++++++-------- gulpfile.js | 5 ++++- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/gulp/tasks/webpack.js b/gulp/tasks/webpack.js index 40977927..a335d867 100644 --- a/gulp/tasks/webpack.js +++ b/gulp/tasks/webpack.js @@ -22,14 +22,18 @@ function buildBuildList() { const buildList = buildBuildList(); const watchifyTask = function(done) { - webpackHelperTask(true, done); + webpackHelperTask({minify: false, watch: true}, done); }; const webpackTask = function(done) { - webpackHelperTask(false, done); + webpackHelperTask({minify: true, watch: false}, done); }; -const webpackHelperTask = function(watch, done) { +const testWebpackTask = function(done) { + webpackHelperTask({minify: false, watch: false}, done); +} + +const webpackHelperTask = function(options, done) { let packOptionsArray = []; let processedCount = 0; let packOptionsCount = 0; @@ -44,7 +48,7 @@ const webpackHelperTask = function(watch, done) { //gutil.log('[webpack]', stats.toString({})); processedCount++; if (processedCount >= packOptionsCount) { - if (watch) { + if (options.watch) { // Do not call task completion callback in the watch case gutil.log('Now watching for changes...'); } @@ -66,8 +70,17 @@ const webpackHelperTask = function(watch, done) { }); let filename = key.split('/').pop(); + if (options.minify) { + let a = filename.split('.'); + let ext = a.pop(); + filename = ''; + for (let i = 0; i < a.length; i++) { + filename += a[i]; + } + filename += '.min.' + ext; + } let packOptions = { - watch: watch, + watch: options.watch, entry: entries, output: { path: key.substring(0, key.lastIndexOf('/') + 1), @@ -87,13 +100,14 @@ const webpackHelperTask = function(watch, done) { } ] }, - plugins: [ + plugins: options.minify ? [ new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false // https://github.com/webpack/webpack/issues/1496 } }) - ] + ] : + [] }; packOptionsArray.push(packOptions); @@ -106,4 +120,4 @@ const webpackHelperTask = function(watch, done) { }); }; -module.exports = {webpackTask: webpackTask, watchifyTask: watchifyTask}; \ No newline at end of file +module.exports = {webpackTask: webpackTask, testWebpackTask: testWebpackTask, watchifyTask: watchifyTask}; \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 2c2ecdef..c8be6bbc 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,6 +4,7 @@ const gulp = require('gulp'); const webpackTask = require('./gulp/tasks/webpack').webpackTask; +const testWebpackTask = require('./gulp/tasks/webpack').testWebpackTask; const watchifyTask = require('./gulp/tasks/webpack').watchifyTask; const browserifyTask = require('./gulp/tasks/browserify').browserifyTask; //const watchifyTask = require('./gulp/tasks/browserify').watchifyTask; @@ -24,6 +25,7 @@ const lintTask = require('./gulp/tasks/lint'); // Private gulp.task('webpack', [], webpackTask); +gulp.task('testWebpack', [], testWebpackTask); gulp.task('browserify', [], browserifyTask); gulp.task('docs-browserify', ['browserify'], docsTask); gulp.task('docs-webpack', ['webpack'], docsTask); @@ -32,12 +34,13 @@ gulp.task('lint-docs-browserify', ['docs-browserify'], lintTask); gulp.task('lint-docs-webpack', ['docs-webpack'], lintTask); gulp.task('lint-browserify', ['browserify'], lintTask); gulp.task('lint-webpack', ['webpack'], lintTask); +gulp.task('lint-testWebpack', ['testWebpack'], lintTask); // Public //gulp.task('build', ['browserify', 'docs-browserify', 'lint-docs-browserify']); //gulp.task('devbuild', ['browserify', 'lint-browserify']); gulp.task('build', ['webpack', 'docs-webpack', 'lint-docs-webpack']); -gulp.task('devbuild', ['webpack', 'lint-webpack']); +gulp.task('devbuild', ['testWebpack', 'lint-testWebpack']); gulp.task('default', ['help']); gulp.task('docs', [], docsTask); gulp.task('lint', [], lintTask);