diff --git a/build/build.js b/build/build.js index 7921af1..180625b 100644 --- a/build/build.js +++ b/build/build.js @@ -14,36 +14,39 @@ rollup.rollup({ entry: 'src/index.js', plugins: [buble()] }) -.then(function (bundle) { - return write('dist/vue-event-manager.js', bundle.generate({ +.then(bundle => + bundle.generate({ format: 'umd', banner: banner, moduleName: 'VueEventManager' - }).code, bundle); -}) -.then(function (bundle) { - var code = fs.readFileSync('dist/vue-event-manager.js', 'utf8'); - return write('dist/vue-event-manager.min.js', - banner + '\n' + uglify.minify(code).code, - bundle); -}) -.then(function (bundle) { - return write('dist/vue-event-manager.es2015.js', bundle.generate({ + }).then(({code}) => write('dist/vue-event-manager.js', code, bundle)) +) +.then(bundle => + write('dist/vue-event-manager.min.js', banner + '\n' + + uglify.minify(read('dist/vue-event-manager.js')).code, + bundle) +) +.then(bundle => + bundle.generate({ format: 'es', banner: banner - }).code, bundle); -}) -.then(function (bundle) { - return write('dist/vue-event-manager.common.js', bundle.generate({ + }).then(({code}) => write('dist/vue-event-manager.es2015.js', code, bundle)) +) +.then(bundle => + bundle.generate({ format: 'cjs', banner: banner - }).code, bundle); -}) + }).then(({code}) => write('dist/vue-event-manager.common.js', code, bundle)) +) .catch(logError); +function read(path) { + return fs.readFileSync(path, 'utf8') +} + function write(dest, code, bundle) { - return new Promise(function (resolve, reject) { - fs.writeFile(dest, code, function (err) { + return new Promise((resolve, reject) => { + fs.writeFile(dest, code, err => { if (err) return reject(err); console.log(blue(dest) + ' ' + getSize(code)); resolve(bundle); diff --git a/package.json b/package.json index eab6ad8..6aefc33 100644 --- a/package.json +++ b/package.json @@ -28,10 +28,10 @@ "buble": "^0.15.2", "buble-loader": "^0.4.1", "jest": "^20.0.4", - "replace-in-file": "^2.5.2", - "rollup": "^0.43.0", + "replace-in-file": "^2.5.3", + "rollup": "^0.45.1", "rollup-plugin-buble": "^0.15.0", - "uglify-js": "^3.0.23", + "uglify-js": "^3.0.24", "vue": "^2.3.4" } } diff --git a/yarn.lock b/yarn.lock index b954f89..0ab748c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -91,6 +91,12 @@ ansi-styles@^3.0.0: dependencies: color-convert "^1.0.0" +ansi-styles@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.1.0.tgz#09c202d5c917ec23188caa5c9cb9179cd9547750" + dependencies: + color-convert "^1.0.0" + anymatch@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507" @@ -542,6 +548,14 @@ chalk@^1.1.0, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.0.1.tgz#dbec49436d2ae15f536114e76d14656cdbc0f44d" + dependencies: + ansi-styles "^3.1.0" + escape-string-regexp "^1.0.5" + supports-color "^4.0.0" + chokidar@^1.4.3: version "1.6.1" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2" @@ -822,7 +836,7 @@ error-ex@^1.2.0: dependencies: is-arrayish "^0.2.1" -escape-string-regexp@^1.0.2: +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -1123,6 +1137,10 @@ has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" +has-flag@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" @@ -2349,11 +2367,11 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" -replace-in-file@^2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/replace-in-file/-/replace-in-file-2.5.2.tgz#0f0f7c128b2a62d84327b3211986efdfbbf4e680" +replace-in-file@^2.5.3: + version "2.5.3" + resolved "https://registry.yarnpkg.com/replace-in-file/-/replace-in-file-2.5.3.tgz#82ad441ee9e8cdf32751fc45b10b8314a9ba3630" dependencies: - chalk "^1.1.3" + chalk "^2.0.1" glob "^7.1.2" yargs "^8.0.2" @@ -2432,9 +2450,9 @@ rollup-pluginutils@^1.5.0: estree-walker "^0.2.1" minimatch "^3.0.2" -rollup@^0.43.0: - version "0.43.0" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.43.0.tgz#b36bdb75fa5e0823b6de8aee18ff7b5655520543" +rollup@^0.45.1: + version "0.45.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.45.1.tgz#af67ded79974079095b5fede8817b4ec26d610e1" dependencies: source-map-support "^0.4.0" @@ -2649,6 +2667,12 @@ supports-color@^3.1.0, supports-color@^3.1.2: dependencies: has-flag "^1.0.0" +supports-color@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.0.tgz#ad986dc7eb2315d009b4d77c8169c2231a684037" + dependencies: + has-flag "^2.0.0" + symbol-tree@^3.2.1: version "3.2.2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" @@ -2753,9 +2777,9 @@ uglify-js@^2.6, uglify-js@^2.8.5: optionalDependencies: uglify-to-browserify "~1.0.0" -uglify-js@^3.0.23: - version "3.0.23" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.0.23.tgz#a58c6b97e6d6763d94dbc265fe8e8c1725e64666" +uglify-js@^3.0.24: + version "3.0.24" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.0.24.tgz#ee93400ad9857fb7a1671778db83f6a23f033121" dependencies: commander "~2.9.0" source-map "~0.5.1"