Skip to content

Commit 30583b9

Browse files
committed
workflow: add dev build mode for benchmark
1 parent abd685d commit 30583b9

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

benchmark/index.js

+18-10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const {
2121
port: portStr,
2222
count: countStr,
2323
noHeadless,
24+
devBuild,
2425
},
2526
} = parseArgs({
2627
allowNegative: true,
@@ -58,6 +59,10 @@ const {
5859
noHeadless: {
5960
type: 'boolean',
6061
},
62+
devBuild: {
63+
type: 'boolean',
64+
short: 'd',
65+
},
6166
},
6267
})
6368

@@ -87,10 +92,11 @@ async function buildLib() {
8792
cwd: path.resolve(import.meta.dirname, '..'),
8893
stdio: 'inherit',
8994
}
95+
const BuildOptions = devBuild ? '-df' : '-pf'
9096
const [{ ok }, { ok: ok2 }, { ok: ok3 }, { ok: ok4 }] = await Promise.all([
9197
exec(
9298
'pnpm',
93-
'run --silent build shared compiler-core compiler-dom compiler-vapor -pf cjs'.split(
99+
`run --silent build shared compiler-core compiler-dom compiler-vapor ${BuildOptions} cjs`.split(
94100
' ',
95101
),
96102
options,
@@ -102,12 +108,12 @@ async function buildLib() {
102108
),
103109
exec(
104110
'pnpm',
105-
'run --silent build vue-vapor -pf esm-browser'.split(' '),
111+
`run --silent build vue-vapor ${BuildOptions} esm-browser`.split(' '),
106112
options,
107113
),
108114
exec(
109115
'pnpm',
110-
'run --silent build vue -pf esm-browser-runtime'.split(' '),
116+
`run --silent build vue ${BuildOptions} esm-browser-runtime`.split(' '),
111117
options,
112118
),
113119
])
@@ -128,17 +134,19 @@ async function buildApp(isVapor) {
128134
const CompilerSFC = await import(
129135
'../packages/compiler-sfc/dist/compiler-sfc.cjs.js'
130136
)
137+
const prodSuffix = devBuild ? '.js' : '.prod.js'
138+
131139
/** @type {any} */
132140
const TemplateCompiler = await import(
133-
isVapor
134-
? '../packages/compiler-vapor/dist/compiler-vapor.cjs.prod.js'
135-
: '../packages/compiler-dom/dist/compiler-dom.cjs.prod.js'
141+
(isVapor
142+
? '../packages/compiler-vapor/dist/compiler-vapor.cjs'
143+
: '../packages/compiler-dom/dist/compiler-dom.cjs') + prodSuffix
136144
)
137145
const runtimePath = path.resolve(
138146
import.meta.dirname,
139-
isVapor
140-
? '../packages/vue-vapor/dist/vue-vapor.esm-browser.prod.js'
141-
: '../packages/vue/dist/vue.runtime.esm-browser.prod.js',
147+
(isVapor
148+
? '../packages/vue-vapor/dist/vue-vapor.esm-browser'
149+
: '../packages/vue/dist/vue.runtime.esm-browser') + prodSuffix,
142150
)
143151

144152
const mode = isVapor ? 'vapor' : 'vdom'
@@ -149,7 +157,7 @@ async function buildApp(isVapor) {
149157
'import.meta.env.IS_VAPOR': String(isVapor),
150158
},
151159
build: {
152-
minify: 'terser',
160+
minify: !devBuild && 'terser',
153161
outDir: path.resolve('./client/dist', mode),
154162
rollupOptions: {
155163
onwarn(log, handler) {

benchmark/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "MIT",
66
"type": "module",
77
"scripts": {
8-
"dev": "pnpm start --noHeadless --skipBench --vdom",
8+
"dev": "pnpm start --devBuild --noHeadless --skipBench --vdom",
99
"start": "node index.js"
1010
},
1111
"dependencies": {

0 commit comments

Comments
 (0)