mirror of https://github.com/vuejs/core.git
workflow: add dev build mode for benchmark
This commit is contained in:
parent
abd685d7f4
commit
30583b9ee1
|
@ -21,6 +21,7 @@ const {
|
||||||
port: portStr,
|
port: portStr,
|
||||||
count: countStr,
|
count: countStr,
|
||||||
noHeadless,
|
noHeadless,
|
||||||
|
devBuild,
|
||||||
},
|
},
|
||||||
} = parseArgs({
|
} = parseArgs({
|
||||||
allowNegative: true,
|
allowNegative: true,
|
||||||
|
@ -58,6 +59,10 @@ const {
|
||||||
noHeadless: {
|
noHeadless: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
},
|
},
|
||||||
|
devBuild: {
|
||||||
|
type: 'boolean',
|
||||||
|
short: 'd',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -87,10 +92,11 @@ async function buildLib() {
|
||||||
cwd: path.resolve(import.meta.dirname, '..'),
|
cwd: path.resolve(import.meta.dirname, '..'),
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
}
|
}
|
||||||
|
const BuildOptions = devBuild ? '-df' : '-pf'
|
||||||
const [{ ok }, { ok: ok2 }, { ok: ok3 }, { ok: ok4 }] = await Promise.all([
|
const [{ ok }, { ok: ok2 }, { ok: ok3 }, { ok: ok4 }] = await Promise.all([
|
||||||
exec(
|
exec(
|
||||||
'pnpm',
|
'pnpm',
|
||||||
'run --silent build shared compiler-core compiler-dom compiler-vapor -pf cjs'.split(
|
`run --silent build shared compiler-core compiler-dom compiler-vapor ${BuildOptions} cjs`.split(
|
||||||
' ',
|
' ',
|
||||||
),
|
),
|
||||||
options,
|
options,
|
||||||
|
@ -102,12 +108,12 @@ async function buildLib() {
|
||||||
),
|
),
|
||||||
exec(
|
exec(
|
||||||
'pnpm',
|
'pnpm',
|
||||||
'run --silent build vue-vapor -pf esm-browser'.split(' '),
|
`run --silent build vue-vapor ${BuildOptions} esm-browser`.split(' '),
|
||||||
options,
|
options,
|
||||||
),
|
),
|
||||||
exec(
|
exec(
|
||||||
'pnpm',
|
'pnpm',
|
||||||
'run --silent build vue -pf esm-browser-runtime'.split(' '),
|
`run --silent build vue ${BuildOptions} esm-browser-runtime`.split(' '),
|
||||||
options,
|
options,
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
|
@ -128,17 +134,19 @@ async function buildApp(isVapor) {
|
||||||
const CompilerSFC = await import(
|
const CompilerSFC = await import(
|
||||||
'../packages/compiler-sfc/dist/compiler-sfc.cjs.js'
|
'../packages/compiler-sfc/dist/compiler-sfc.cjs.js'
|
||||||
)
|
)
|
||||||
|
const prodSuffix = devBuild ? '.js' : '.prod.js'
|
||||||
|
|
||||||
/** @type {any} */
|
/** @type {any} */
|
||||||
const TemplateCompiler = await import(
|
const TemplateCompiler = await import(
|
||||||
isVapor
|
(isVapor
|
||||||
? '../packages/compiler-vapor/dist/compiler-vapor.cjs.prod.js'
|
? '../packages/compiler-vapor/dist/compiler-vapor.cjs'
|
||||||
: '../packages/compiler-dom/dist/compiler-dom.cjs.prod.js'
|
: '../packages/compiler-dom/dist/compiler-dom.cjs') + prodSuffix
|
||||||
)
|
)
|
||||||
const runtimePath = path.resolve(
|
const runtimePath = path.resolve(
|
||||||
import.meta.dirname,
|
import.meta.dirname,
|
||||||
isVapor
|
(isVapor
|
||||||
? '../packages/vue-vapor/dist/vue-vapor.esm-browser.prod.js'
|
? '../packages/vue-vapor/dist/vue-vapor.esm-browser'
|
||||||
: '../packages/vue/dist/vue.runtime.esm-browser.prod.js',
|
: '../packages/vue/dist/vue.runtime.esm-browser') + prodSuffix,
|
||||||
)
|
)
|
||||||
|
|
||||||
const mode = isVapor ? 'vapor' : 'vdom'
|
const mode = isVapor ? 'vapor' : 'vdom'
|
||||||
|
@ -149,7 +157,7 @@ async function buildApp(isVapor) {
|
||||||
'import.meta.env.IS_VAPOR': String(isVapor),
|
'import.meta.env.IS_VAPOR': String(isVapor),
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
minify: 'terser',
|
minify: !devBuild && 'terser',
|
||||||
outDir: path.resolve('./client/dist', mode),
|
outDir: path.resolve('./client/dist', mode),
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
onwarn(log, handler) {
|
onwarn(log, handler) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "pnpm start --noHeadless --skipBench --vdom",
|
"dev": "pnpm start --devBuild --noHeadless --skipBench --vdom",
|
||||||
"start": "node index.js"
|
"start": "node index.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
Loading…
Reference in New Issue