From c8fed134a03428bf52a0c430be17a3aec56869fd Mon Sep 17 00:00:00 2001 From: kdletters Date: Sun, 21 Jun 2026 20:12:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E9=BD=90=E7=A7=BB=E5=8A=A8=E5=A3=B3?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9B=AE=E5=BD=95=E8=BF=BD=E8=B8=AA=E9=97=A8?= =?UTF-8?q?=E7=A6=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 检查 Expo 本机生成目录未被 Git 追踪 检查 Expo export smoke 临时目录未被 Git 追踪 对齐移动壳与桌面壳生成物边界 --- apps/mobile-shell/scripts/check-config.mjs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/apps/mobile-shell/scripts/check-config.mjs b/apps/mobile-shell/scripts/check-config.mjs index d3cdc01a4..f3fb7368d 100644 --- a/apps/mobile-shell/scripts/check-config.mjs +++ b/apps/mobile-shell/scripts/check-config.mjs @@ -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();