Skip to content

Commit ef358fe

Browse files
committed
build: tweak build script
1 parent 8295f71 commit ef358fe

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

Diff for: build/build.js

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

Diff for: build/config.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ const builds = {
168168
}
169169
}
170170

171-
function genConfig (opts) {
171+
function genConfig (name) {
172+
const opts = builds[name]
172173
const config = {
173174
input: opts.entry,
174175
external: opts.external,
@@ -196,12 +197,17 @@ function genConfig (opts) {
196197
}))
197198
}
198199

200+
Object.defineProperty(config, '_name', {
201+
enumerable: false,
202+
value: name
203+
})
204+
199205
return config
200206
}
201207

202208
if (process.env.TARGET) {
203-
module.exports = genConfig(builds[process.env.TARGET])
209+
module.exports = genConfig(process.env.TARGET)
204210
} else {
205-
exports.getBuild = name => genConfig(builds[name])
206-
exports.getAllBuilds = () => Object.keys(builds).map(name => genConfig(builds[name]))
211+
exports.getBuild = genConfig
212+
exports.getAllBuilds = () => Object.keys(builds).map(genConfig)
207213
}

Diff for: package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
"dev:weex": "rollup -w -c build/config.js --environment TARGET:weex-framework ",
2323
"dev:weex:compiler": "rollup -w -c build/config.js --environment TARGET:weex-compiler ",
2424
"build": "node build/build.js",
25-
"build:ssr": "npm run build -- vue.runtime.common.js,vue-server-renderer",
26-
"build:weex": "npm run build -- weex-vue-framework,weex-template-compiler",
25+
"build:ssr": "npm run build -- web-runtime-cjs,web-server-renderer",
26+
"build:weex": "npm run build -- weex-framework,weex-compiler",
2727
"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",
2828
"test:unit": "karma start test/unit/karma.unit.config.js",
2929
"test:cover": "karma start test/unit/karma.cover.config.js",
30-
"test:e2e": "npm run build -- vue.min.js && node test/e2e/runner.js",
30+
"test:e2e": "npm run build -- web-full-prod,web-server-basic-renderer && node test/e2e/runner.js",
3131
"test:weex": "npm run build:weex && jasmine JASMINE_CONFIG_PATH=test/weex/jasmine.json",
3232
"test:ssr": "npm run build:ssr && jasmine JASMINE_CONFIG_PATH=test/ssr/jasmine.json",
3333
"test:sauce": "npm run sauce -- 0 && npm run sauce -- 1 && npm run sauce -- 2",

0 commit comments

Comments
 (0)