Skip to content

Commit

Permalink
build: bump rollup version
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 authored and ztlevi committed Feb 14, 2018
1 parent 2e973f4 commit 71454c1
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 48 deletions.
16 changes: 9 additions & 7 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ let builds = require('./config').getAllBuilds()
if (process.argv[2]) {
const filters = process.argv[2].split(',')
builds = builds.filter(b => {
return filters.some(f => b.dest.indexOf(f) > -1)
return filters.some(f => b.output.file.indexOf(f) > -1)
})
} else {
// filter out weex builds by default
builds = builds.filter(b => {
return b.dest.indexOf('weex') === -1
return b.output.file.indexOf('weex') === -1
})
}

Expand All @@ -41,22 +41,24 @@ function build (builds) {
}

function buildEntry (config) {
const isProd = /min\.js$/.test(config.dest)
const output = config.output
const { file, banner } = output
const isProd = /min\.js$/.test(file)
return rollup.rollup(config)
.then(bundle => bundle.generate(config))
.then(bundle => bundle.generate(output))
.then(({ code }) => {
if (isProd) {
var minified = (config.banner ? config.banner + '\n' : '') + uglify.minify(code, {
var minified = (banner ? banner + '\n' : '') + uglify.minify(code, {
output: {
ascii_only: true
},
compress: {
pure_funcs: ['makeMap']
}
}).code
return write(config.dest, minified, true)
return write(file, minified, true)
} else {
return write(config.dest, code)
return write(file, code)
}
})
}
Expand Down
14 changes: 8 additions & 6 deletions build/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,8 @@ const builds = {

function genConfig (opts) {
const config = {
entry: opts.entry,
dest: opts.dest,
input: opts.entry,
external: opts.external,
format: opts.format,
banner: opts.banner,
moduleName: opts.moduleName || 'Vue',
plugins: [
replace({
__WEEX__: !!opts.weex,
Expand All @@ -176,7 +172,13 @@ function genConfig (opts) {
flow(),
buble(),
alias(Object.assign({}, aliases, opts.alias))
].concat(opts.plugins || [])
].concat(opts.plugins || []),
output: {
file: opts.dest,
format: opts.format,
banner: opts.banner,
name: opts.moduleName || 'Vue'
}
}

if (opts.env) {
Expand Down
111 changes: 81 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"babel-plugin-transform-vue-jsx": "^3.4.3",
"babel-preset-es2015": "^6.24.1",
"babel-preset-flow-vue": "^1.0.0",
"buble": "^0.15.2",
"buble": "^0.16.0",
"chalk": "^1.1.3",
"chromedriver": "^2.30.1",
"codecov.io": "^0.1.6",
Expand Down Expand Up @@ -107,14 +107,14 @@
"nightwatch-helpers": "^1.2.0",
"phantomjs-prebuilt": "^2.1.14",
"resolve": "^1.3.3",
"rollup": "^0.45.1",
"rollup": "^0.50.0",
"rollup-plugin-alias": "^1.3.1",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-buble": "^0.15.0",
"rollup-plugin-babel": "^3.0.2",
"rollup-plugin-buble": "^0.16.0",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-flow-no-whitespace": "^1.0.0",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-replace": "^1.1.1",
"rollup-plugin-replace": "^2.0.0",
"rollup-watch": "^4.0.0",
"selenium-server": "^2.53.1",
"serialize-javascript": "^1.3.0",
Expand Down

0 comments on commit 71454c1

Please sign in to comment.