From 11bf0635572bcda687a9d7937b20deb48cc856ee Mon Sep 17 00:00:00 2001 From: kdletters Date: Sun, 23 Aug 2026 14:51:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8E=9F=E7=94=9F=E5=A3=B3?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E9=97=A8=E7=A6=81=E6=A0=BC=E5=BC=8F=E6=BC=82?= =?UTF-8?q?=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 归一化移动端和桌面端配置源码空白 恢复 rootPackageLockPath guardrail 校验 --- scripts/check-native-shells.mjs | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/scripts/check-native-shells.mjs b/scripts/check-native-shells.mjs index 4e40a4f20..3830782d4 100644 --- a/scripts/check-native-shells.mjs +++ b/scripts/check-native-shells.mjs @@ -14,13 +14,11 @@ const developmentWorkflowDocPath = 'docs/project-memory/shared-memory/development-workflow.md'; const decisionLogDocPath = 'docs/project-memory/shared-memory/decision-log.md'; const rootPackageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')); -const mobileShellConfigCheckSource = fs.readFileSync( - 'apps/mobile-shell/scripts/check-config.mjs', - 'utf8', +const mobileShellConfigCheckSource = normalizeSourceForGuardrail( + fs.readFileSync('apps/mobile-shell/scripts/check-config.mjs', 'utf8'), ); -const desktopShellConfigCheckSource = fs.readFileSync( - 'apps/desktop-shell/scripts/check-config.mjs', - 'utf8', +const desktopShellConfigCheckSource = normalizeSourceForGuardrail( + fs.readFileSync('apps/desktop-shell/scripts/check-config.mjs', 'utf8'), ); const aiGameCreatorShellAppSource = fs.readFileSync( 'apps/ai-game-creator-shell/src/App.tsx', @@ -152,6 +150,14 @@ function readSourceTree(entryPath, extension) { return fs.readFileSync(entryPath, 'utf8'); } +function normalizeSourceForGuardrail(source) { + return source + .replace(/\s+/g, ' ') + .replace(/\s*([(),])\s*/g, '$1') + .replace(/,\s*\)/g, ')') + .trim(); +} + function assertRootNativeShellCheckScripts() { if ( rootPackageJson.scripts?.['check:native-shells'] !== @@ -187,7 +193,11 @@ function assertNativeShellDependencyVersionGuardrails() { "'eas-cli': '^20.3.0'", "assertPackageLockVersion('apps/mobile-shell', 'eas-cli', '20.3.0')", ]) { - if (!mobileShellConfigCheckSource.includes(snippet)) { + if ( + !mobileShellConfigCheckSource.includes( + normalizeSourceForGuardrail(snippet), + ) + ) { throw new Error( `mobile shell dependency guardrail drifted: missing ${snippet}`, ); @@ -211,7 +221,11 @@ function assertNativeShellDependencyVersionGuardrails() { "['tauri', '2.11.2']", 'tauri-plugin-single-instance = { version = "2.4.2", features = ["deep-link"] }', ]) { - if (!desktopShellConfigCheckSource.includes(snippet)) { + if ( + !desktopShellConfigCheckSource.includes( + normalizeSourceForGuardrail(snippet), + ) + ) { throw new Error( `desktop shell dependency guardrail drifted: missing ${snippet}`, );