Browse Source

build: tweak build script

dev
Evan You 7 years ago
parent
commit
ef358fef94
  1. 2
      build/build.js
  2. 14
      build/config.js
  3. 6
      package.json

2
build/build.js

@ -14,7 +14,7 @@ let builds = require('./config').getAllBuilds()
if (process.argv[2]) {
const filters = process.argv[2].split(',')
builds = builds.filter(b => {
return filters.some(f => b.output.file.indexOf(f) > -1)
return filters.some(f => b.output.file.indexOf(f) > -1 || b._name.indexOf(f) > -1)
})
} else {
// filter out weex builds by default

14
build/config.js

@ -168,7 +168,8 @@ const builds = {
}
}
function genConfig (opts) {
function genConfig (name) {
const opts = builds[name]
const config = {
input: opts.entry,
external: opts.external,
@ -196,12 +197,17 @@ function genConfig (opts) {
}))
}
Object.defineProperty(config, '_name', {
enumerable: false,
value: name
})
return config
}
if (process.env.TARGET) {
module.exports = genConfig(builds[process.env.TARGET])
module.exports = genConfig(process.env.TARGET)
} else {
exports.getBuild = name => genConfig(builds[name])
exports.getAllBuilds = () => Object.keys(builds).map(name => genConfig(builds[name]))
exports.getBuild = genConfig
exports.getAllBuilds = () => Object.keys(builds).map(genConfig)
}

6
package.json

@ -22,12 +22,12 @@
"dev:weex": "rollup -w -c build/config.js --environment TARGET:weex-framework ",
"dev:weex:compiler": "rollup -w -c build/config.js --environment TARGET:weex-compiler ",
"build": "node build/build.js",
"build:ssr": "npm run build -- vue.runtime.common.js,vue-server-renderer",
"build:weex": "npm run build -- weex-vue-framework,weex-template-compiler",
"build:ssr": "npm run build -- web-runtime-cjs,web-server-renderer",
"build:weex": "npm run build -- weex-framework,weex-compiler",
"test": "npm run lint && flow check && npm run test:types && npm run test:cover && npm run test:e2e -- --env phantomjs && npm run test:ssr && npm run test:weex",
"test:unit": "karma start test/unit/karma.unit.config.js",
"test:cover": "karma start test/unit/karma.cover.config.js",
"test:e2e": "npm run build -- vue.min.js && node test/e2e/runner.js",
"test:e2e": "npm run build -- web-full-prod,web-server-basic-renderer && node test/e2e/runner.js",
"test:weex": "npm run build:weex && jasmine JASMINE_CONFIG_PATH=test/weex/jasmine.json",
"test:ssr": "npm run build:ssr && jasmine JASMINE_CONFIG_PATH=test/ssr/jasmine.json",
"test:sauce": "npm run sauce -- 0 && npm run sauce -- 1 && npm run sauce -- 2",

Loading…
Cancel
Save