Skip to content

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.

fix(gates): two scanners had quietly stopped seeing the editor

esengineccfb8aad74b6
diff --git a/tools/check-path-sandbox.mjs b/tools/check-path-sandbox.mjs
index 676af4914..46ce37abe 100644
--- a/tools/check-path-sandbox.mjs
+++ b/tools/check-path-sandbox.mjs
@@ -11,8 +11,8 @@
* A use that is NOT a boundary — classifying paths for a report, say — opts out
* on the line above with `path-sandbox: <why>`.
*/
-import { execFileSync } from 'node:child_process';
import { readFileSync, existsSync } from 'node:fs';
+import { listTrackedSources } from './lib/sourceRoots.mjs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -27,10 +27,16 @@ const IDIOMS = [
];
const OPT_OUT = /path-sandbox:/;
-const files = execFileSync('git', ['ls-files'], { cwd: ROOT, encoding: 'utf8' })
- .split('\n')
+const { files: tracked, missing } = listTrackedSources(['desktop/electron', 'desktop/src', 'pipeline/src']);
+// A gate that scans the editor has to read the SUBMODULE's index: this repo's
+// `git ls-files` does not list a submodule's contents, so scanning that way
+// quietly dropped 90% of the files in scope and still printed green.
+if (missing.length) {
+ console.log(`check-path-sandbox: no editor checkout — ${missing.join(', ')} not scanned.`);
+}
+const files = tracked
// `git ls-files` lists what is TRACKED, which includes a file deleted in the
- // working tree: reading one throws and takes every later gate with it.
+ // working tree; reading one throws before any verdict is reached.
.filter((f) => SCOPE.test(f) && f !== HOME && existsSync(path.join(ROOT, f)));
const findings = [];
diff --git a/tools/check-shipped-resources.mjs b/tools/check-shipped-resources.mjs
index 78db2676c..58b1292a9 100644
--- a/tools/check-shipped-resources.mjs
+++ b/tools/check-shipped-resources.mjs
@@ -12,9 +12,9 @@
* Nothing fails until someone installs a release and imports a model, which is
* the worst moment to find out. Both halves are declarations, so this pairs them.
*/
-import { readFileSync, readdirSync } from 'node:fs';
-import { execFileSync } from 'node:child_process';
+import { existsSync, readFileSync, readdirSync } from 'node:fs';
import path from 'node:path';
+import { listTrackedSources } from './lib/sourceRoots.mjs';
import { fileURLToPath } from 'node:url';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
@@ -23,6 +23,16 @@ const BUILDER = path.join('desktop', 'electron-builder.yml');
/** Trees whose code is bundled into the editor's main process. */
const SHIPPED = ['pipeline/src', 'desktop/electron', 'desktop/src'];
+// This asks what the EDITOR's package stages, so it needs the editor. run-gates
+// declares that (needs: 'editor') and skips it; run directly, say why rather
+// than throwing ENOENT on the builder manifest.
+if (!existsSync(path.join(ROOT, BUILDER))) {
+ console.error('check-shipped-resources: the editor is not checked out, and its');
+ console.error(` packaging manifest (${BUILDER}) is the subject of this check.`);
+ console.error(' git submodule update --init desktop (private; you need access)');
+ process.exit(2);
+}
+
/** `build-tools/<name>` referenced from a `from '…'` or `import('…')` specifier. */
const REFERENCE = /(?:from\s*|import\s*\(\s*)['"][^'"]*build-tools\/([\w.-]+)\//g;
@@ -36,8 +46,14 @@ function hasBinary(name) {
}
}
-const files = execFileSync('git', ['ls-files', ...SHIPPED], { cwd: ROOT, encoding: 'utf8' })
- .split('\n').filter((f) => /\.(ts|tsx|mts|mjs|js)$/.test(f));
+// Through the submodule's own index for the editor's half: this repo's
+// `git ls-files` does not list a submodule's contents, so asking it here would
+// judge the pipeline alone and still report on the package as a whole.
+const { files: tracked, missing } = listTrackedSources(SHIPPED);
+if (missing.length) {
+ console.log(`check-shipped-resources: no editor checkout — ${missing.join(', ')} not scanned.`);
+}
+const files = tracked.filter((f) => /\.(ts|tsx|mts|mjs|js)$/.test(f));
/** name → the files that reach it. */
const needed = new Map();