补齐移动壳生成目录追踪门禁
检查 Expo 本机生成目录未被 Git 追踪 检查 Expo export smoke 临时目录未被 Git 追踪 对齐移动壳与桌面壳生成物边界
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import fs from 'node:fs';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
|
||||
import { PNG } from 'pngjs';
|
||||
|
||||
@@ -405,6 +406,10 @@ const blockedAndroidPermissions = [
|
||||
'android.permission.USE_EXACT_ALARM',
|
||||
'android.permission.WRITE_EXTERNAL_STORAGE',
|
||||
];
|
||||
const generatedMobilePaths = [
|
||||
'apps/mobile-shell/.expo',
|
||||
'apps/mobile-shell/.expo-export-smoke',
|
||||
];
|
||||
|
||||
function extractStringArrayExport(source, exportName, seen = new Set()) {
|
||||
if (seen.has(exportName)) {
|
||||
@@ -686,6 +691,34 @@ function assertNoDevScaffoldTerms(files) {
|
||||
}
|
||||
}
|
||||
|
||||
function assertNoTrackedMobileGeneratedFiles() {
|
||||
const result = spawnSync('git', ['ls-files', ...generatedMobilePaths], {
|
||||
cwd: new URL('../../..', import.meta.url),
|
||||
encoding: 'utf8',
|
||||
});
|
||||
|
||||
if (result.error) {
|
||||
throw new Error(
|
||||
`unable to check mobile generated files: ${result.error.message}`,
|
||||
);
|
||||
}
|
||||
if ((result.status ?? 0) !== 0) {
|
||||
throw new Error(
|
||||
`unable to check mobile generated files: ${result.stderr.trim()}`,
|
||||
);
|
||||
}
|
||||
|
||||
const trackedGeneratedFiles = result.stdout
|
||||
.split('\n')
|
||||
.map((entry) => entry.trim())
|
||||
.filter(Boolean);
|
||||
if (trackedGeneratedFiles.length > 0) {
|
||||
throw new Error(
|
||||
`mobile generated files must stay untracked: ${trackedGeneratedFiles.join(', ')}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function countAlphaPixels(png) {
|
||||
let transparent = 0;
|
||||
let translucent = 0;
|
||||
@@ -776,6 +809,7 @@ for (const snippet of [
|
||||
assertNoDevScaffoldTerms(
|
||||
productionSourceRoots.flatMap((root) => collectProductionSourceFiles(root)),
|
||||
);
|
||||
assertNoTrackedMobileGeneratedFiles();
|
||||
assertNoBlockedMobileChannelDependencies(packageConfig, 'mobile shell package');
|
||||
assertNoBlockedMobileChannelDependencies(rootPackageConfig, 'root H5 package');
|
||||
assertNoBlockedMobileChannelLockPackages();
|
||||
|
||||
Reference in New Issue
Block a user