收口原生壳命令入口

移动壳配置检查锁定壳级和根级脚本入口

桌面壳配置检查锁定壳级和根级脚本入口

桌面壳配置检查锁定Tauri dev与build前置命令

宿主壳方案文档补充命令入口门禁

共享决策日志记录原生壳命令入口边界
This commit is contained in:
2026-06-18 13:59:13 +08:00
parent e8bcd3ba88
commit c2dd4424e4
4 changed files with 72 additions and 0 deletions
@@ -193,6 +193,15 @@ function assertNoBlockedDesktopSdkSnippets() {
}
}
function assertPackageScript(packageJson, packageLabel, scriptName, expected) {
const actual = packageJson.scripts?.[scriptName];
if (actual !== expected) {
throw new Error(
`${packageLabel} script ${scriptName} drifted: expected ${expected} but got ${actual}`,
);
}
}
function collectProductionSourceFiles(entry) {
const stats = fs.statSync(entry);
if (stats.isDirectory()) {
@@ -250,6 +259,23 @@ assertNoTauriGuestNpmDependencies(rootPackageConfig, 'root H5 package');
assertNoBlockedCargoDependencies();
assertNoBlockedDesktopSdkSnippets();
for (const [scriptName, expected] of Object.entries({
dev: 'tauri dev',
build: 'tauri build',
typecheck: 'node scripts/check-config.mjs',
})) {
assertPackageScript(packageConfig, 'desktop shell package', scriptName, expected);
}
for (const [scriptName, expected] of Object.entries({
'desktop-shell:dev': 'npm --prefix apps/desktop-shell run dev',
'desktop-shell:build': 'npm --prefix apps/desktop-shell run build --',
'desktop-shell:typecheck': 'npm --prefix apps/desktop-shell run typecheck',
'desktop-shell:test': 'cargo test --manifest-path apps/desktop-shell/src-tauri/Cargo.toml',
})) {
assertPackageScript(rootPackageConfig, 'root package', scriptName, expected);
}
function readPngSize(file) {
const buffer = fs.readFileSync(file);
if (
@@ -566,6 +592,10 @@ if (config.build?.beforeBuildCommand !== 'npm --prefix ../.. run build:raw && np
throw new Error('desktop shell build command must run from apps/desktop-shell');
}
if (config.build?.beforeDevCommand !== 'npm --prefix ../.. run dev:web') {
throw new Error('desktop shell dev command must run the root H5 Vite dev server');
}
const [mainWindow] = config.app?.windows ?? [];
if (!mainWindow || mainWindow.create !== false) {
throw new Error('desktop shell must create the main window from Rust setup');