diff --git a/apps/ai-game-creator-shell/scripts/check-macos-bundle.mjs b/apps/ai-game-creator-shell/scripts/check-macos-bundle.mjs index e23db686a..5d4fa9881 100644 --- a/apps/ai-game-creator-shell/scripts/check-macos-bundle.mjs +++ b/apps/ai-game-creator-shell/scripts/check-macos-bundle.mjs @@ -287,6 +287,13 @@ try { ]) { assert.ok(fs.existsSync(path.join(plugin, file)), file); } + // 随包 Node 的 npm 是包里唯一允许出现的 node_modules:除了 npm 目录自身与它的子项, + // 还要放行它的上级目录 `game-runtime/node/node_modules`(recursive readdir 会列出目录项, + // 少了这一条会让整个门禁对合法包失败——#439 引入后一直没被跑到,直到 2026-09-21 才暴露)。 + const allowedNodeModules = (file) => + file === 'game-runtime/node/node_modules' || + file === 'game-runtime/node/node_modules/npm' || + file.startsWith('game-runtime/node/node_modules/npm/'); const packageFiles = fs.readdirSync(resources, { recursive: true }); assert.ok( !packageFiles.some( @@ -294,8 +301,7 @@ try { /(^|\/)(\.env[^/]*|auth\.json|target|\.git)(\/|$)|\.(exe|dll)$/.test( file, ) || - (/(^|\/)node_modules(\/|$)/.test(file) && - !file.startsWith('game-runtime/node/node_modules/npm')), + (/(^|\/)node_modules(\/|$)/.test(file) && !allowedNodeModules(file)), ), ); assert.equal(run(executable, ['--version']).stdout.trim(), manifest.version);