修复原生壳依赖门禁格式漂移
归一化移动端和桌面端配置源码空白 恢复 rootPackageLockPath guardrail 校验
This commit is contained in:
@@ -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}`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user