A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
chore(scripts): verify:cooked and verify:hotupdate run on Windows too
esengined66c3e543ac1
diff --git a/package.json b/package.jsonindex 8fc9f6c59..50c653189 100644--- a/package.json+++ b/package.json@@ -37,9 +37,9 @@"verify:render": "node tools/verify-render.mjs","test": "vitest run --config vitest.engine.config.ts","verify:aot": "rm -rf .aot-verify && node pipeline/bin/estella.mjs export examples/ecs-basics --out .aot-verify && node tools/run-electron.mjs tools/launchers/headless-aot-verify.mjs .aot-verify",- "verify:cooked": "ESTELLA_COOK_FIXTURE=1 pnpm --filter @estella/pipeline exec vitest run tests/cooked-verify-fixture.test.ts && node tools/run-electron.mjs tools/launchers/headless-cooked-verify.mjs",+ "verify:cooked": "node tools/with-env.mjs ESTELLA_COOK_FIXTURE=1 -- pnpm --filter @estella/pipeline exec vitest run tests/cooked-verify-fixture.test.ts && node tools/run-electron.mjs tools/launchers/headless-cooked-verify.mjs","verify:remote-capture": "node tools/verify-remote-capture.mjs --platform web && node tools/verify-remote-capture.mjs --platform wechat",- "verify:hotupdate": "ESTELLA_HOTUPDATE_FIXTURE=1 pnpm --filter @estella/pipeline exec vitest run tests/hotupdate-verify-fixture.test.ts && node tools/run-electron.mjs tools/launchers/headless-hotupdate-verify.mjs"+ "verify:hotupdate": "node tools/with-env.mjs ESTELLA_HOTUPDATE_FIXTURE=1 -- pnpm --filter @estella/pipeline exec vitest run tests/hotupdate-verify-fixture.test.ts && node tools/run-electron.mjs tools/launchers/headless-hotupdate-verify.mjs"},"dependencies": {"chalk": "^5.3.0",diff --git a/tools/with-env.mjs b/tools/with-env.mjsnew file mode 100644index 000000000..77e656081--- /dev/null+++ b/tools/with-env.mjs@@ -0,0 +1,29 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file with-env.mjs — run a command with some environment variables set, the+ * same way on every shell. `VAR=1 cmd` in a package script is POSIX: cmd+ * on Windows reads VAR=1 as the command and runs nothing.+ *+ * node tools/with-env.mjs ESTELLA_HOTUPDATE_FIXTURE=1 -- pnpm --filter @estella/pipeline exec vitest run …+ */+import { spawnSync } from 'node:child_process';++const args = process.argv.slice(2);+const split = args.indexOf('--');+if (split < 1 || split === args.length - 1) {+ console.error('usage: node tools/with-env.mjs NAME=value [NAME=value …] -- command [args…]');+ process.exit(2);+}+const env = { ...process.env };+for (const pair of args.slice(0, split)) {+ const eq = pair.indexOf('=');+ if (eq < 1) {+ console.error(`with-env: "${pair}" is not NAME=value`);+ process.exit(2);+ }+ env[pair.slice(0, eq)] = pair.slice(eq + 1);+}+const [command, ...rest] = args.slice(split + 1);+const run = spawnSync(command, rest, { env, stdio: 'inherit', shell: process.platform === 'win32' });+process.exit(run.status ?? 1);