Skip to content

Commit cfd1133

Browse files
committed
fix(market-making): build playground with vite
1 parent 69100ff commit cfd1133

3 files changed

Lines changed: 15 additions & 18 deletions

File tree

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
export const productionPlaygroundBuildArguments = outdir => [
22
'build',
3-
'playground/index.html',
4-
'--outdir',
3+
'playground',
4+
'--outDir',
55
outdir,
66
'--target',
7-
'browser',
8-
'--production',
9-
'--entry-naming',
10-
'[name].[ext]',
11-
'--asset-naming',
12-
'[name].[ext]',
13-
'--define',
14-
'process.env.NODE_ENV="production"',
15-
'--sourcemap=none',
16-
'--env=disable'
7+
'es2022',
8+
'--minify',
9+
'esbuild',
10+
'--assetsDir',
11+
'.',
12+
'--sourcemap',
13+
'false'
1714
]

bots/market-making/scripts/playground-build.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ const buildIdentity = { dev: Number(created.dev), ino: Number(created.ino) }
103103
let keepTemporary = false
104104

105105
try {
106-
const bun = process.env.BUN_EXE || 'bun'
107-
const child = spawn(bun, productionPlaygroundBuildArguments(buildOutdir), {
106+
const vite = process.env.BUN_EXE || 'vite'
107+
const child = spawn(vite, productionPlaygroundBuildArguments(buildOutdir), {
108108
cwd: packageRoot,
109109
env: { ...process.env, NODE_ENV: 'production' },
110110
shell: false,

bots/market-making/scripts/playground-build.test.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ test('--temporary creates a private owned OS-temp directory, reports its exact p
107107
const { writeFileSync } = require('node:fs')
108108
const { tmpdir } = require('node:os')
109109
const { basename, dirname } = require('node:path')
110-
const outdir = process.argv[process.argv.indexOf('--outdir') + 1]
110+
const outdir = process.argv[process.argv.indexOf('--outDir') + 1]
111111
if (dirname(outdir) !== tmpdir()) throw new Error('not under OS temp')
112112
if (!basename(outdir).startsWith('market-making-playground-dist-')) throw new Error('wrong prefix')
113113
writeFileSync(outdir + '/index.html', '<script src="./index.js"></script>')
@@ -133,7 +133,7 @@ test('failed temporary build removes its internally-created partial output', asy
133133
)
134134
const fakeBun = await makeFakeBun(`
135135
const { writeFileSync } = require('node:fs')
136-
const outdir = process.argv[process.argv.indexOf('--outdir') + 1]
136+
const outdir = process.argv[process.argv.indexOf('--outDir') + 1]
137137
writeFileSync(outdir + '/partial.bin', 'partial')
138138
process.exit(23)
139139
`)
@@ -153,7 +153,7 @@ test('canonical build stages in owned OS temp, publishes finalized files, and re
153153
const { writeFileSync } = require('node:fs')
154154
const { tmpdir } = require('node:os')
155155
const { basename, dirname } = require('node:path')
156-
const outdir = process.argv[process.argv.indexOf('--outdir') + 1]
156+
const outdir = process.argv[process.argv.indexOf('--outDir') + 1]
157157
if (dirname(outdir) !== tmpdir()) throw new Error('canonical staging not in OS temp')
158158
if (!basename(outdir).startsWith('market-making-playground-staging-')) throw new Error('wrong staging prefix')
159159
writeFileSync(outdir + '/index.html', '<link rel="stylesheet" href="./index.css"><script src="./index.js"></script>')
@@ -182,7 +182,7 @@ test('failed canonical build preserves the prior index and removes OS-temp stagi
182182
)
183183
const fakeBun = await makeFakeBun(`
184184
const { writeFileSync } = require('node:fs')
185-
const outdir = process.argv[process.argv.indexOf('--outdir') + 1]
185+
const outdir = process.argv[process.argv.indexOf('--outDir') + 1]
186186
writeFileSync(outdir + '/partial', 'never publish me')
187187
process.exit(29)
188188
`)

0 commit comments

Comments
 (0)