清理低风险编译警告并修复构建检查脚本

清理冗余导入、可变绑定和赋值,将 AGC 默认编译警告从 231 条降至 195 条
按测试和平台边界限定导入,保留兼容出口与待核查的业务参数
修复预览部署器嵌套 npm 警告和移动端检查脚本的 Windows 启动错误
更新警告清单、开发运维文档与共享开发流程,记录验证结果和剩余项
This commit is contained in:
2026-09-23 10:58:19 +00:00
parent 07feed7511
commit 018697203f
31 changed files with 115 additions and 60 deletions
@@ -1,5 +1,7 @@
import { spawnSync } from 'node:child_process';
import fs from 'node:fs';
import { createRequire } from 'node:module';
import { dirname, resolve } from 'node:path';
const shellRoot = new URL('../', import.meta.url);
const easConfigPath = new URL('eas.json', shellRoot);
@@ -7,7 +9,10 @@ const packagePath = new URL('package.json', shellRoot);
const easConfig = JSON.parse(fs.readFileSync(easConfigPath, 'utf8'));
const packageConfig = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
const shellRequire = createRequire(packagePath);
const easPackagePath = shellRequire.resolve('eas-cli/package.json');
const easPackage = JSON.parse(fs.readFileSync(easPackagePath, 'utf8'));
const easCliPath = resolve(dirname(easPackagePath), easPackage.bin.eas);
const androidBuildOutputPath =
'../../build/native/mobile/genarrative-mobile-android.apk';
const iosSimulatorBuildOutputPath =
@@ -43,8 +48,8 @@ if (packageConfig.devDependencies?.['eas-cli'] !== '^20.3.0') {
}
const easVersionResult = spawnSync(
npmCommand,
['exec', 'eas', '--', '--version'],
process.execPath,
[easCliPath, '--version'],
{
cwd: shellRoot,
encoding: 'utf8',
@@ -29,11 +29,13 @@ const expoPrivacyInfoPluginSource = fs.readFileSync(
'utf8',
);
const sharedContractSource = fs.readFileSync(sharedContractPath, 'utf8');
const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
const expoPackagePath = shellRequire.resolve('expo/package.json');
const expoPackage = JSON.parse(fs.readFileSync(expoPackagePath, 'utf8'));
const expoCliPath = resolve(dirname(expoPackagePath), expoPackage.bin.expo);
const result = spawnSync(
npmCommand,
['exec', 'expo', 'config', '--', '--type', 'public', '--json'],
process.execPath,
[expoCliPath, 'config', '--type', 'public', '--json'],
{
cwd: shellRoot,
encoding: 'utf8',
@@ -1,5 +1,7 @@
import { spawnSync } from 'node:child_process';
import fs from 'node:fs';
import { createRequire } from 'node:module';
import { dirname, resolve } from 'node:path';
const shellRoot = new URL('../', import.meta.url);
const outputRoot = new URL('../.expo-export-smoke/', import.meta.url);
@@ -7,7 +9,10 @@ const hostBridgeContractUrl = new URL(
'../../../packages/shared/src/contracts/hostBridge.ts',
import.meta.url,
);
const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
const shellRequire = createRequire(new URL('package.json', shellRoot));
const expoPackagePath = shellRequire.resolve('expo/package.json');
const expoPackage = JSON.parse(fs.readFileSync(expoPackagePath, 'utf8'));
const expoCliPath = resolve(dirname(expoPackagePath), expoPackage.bin.expo);
const platforms = ['android', 'ios'];
const blockedDevelopmentWebUrlPatterns = [
/http:\\?\/\\?\/localhost(?::\d+)?/u,
@@ -51,17 +56,8 @@ const requiredNativeHostContextTokens = [
function runExpoExport(platform) {
const outputDir = `.expo-export-smoke/${platform}`;
const result = spawnSync(
npmCommand,
[
'exec',
'expo',
'export',
'--',
'--platform',
platform,
'--output-dir',
outputDir,
],
process.execPath,
[expoCliPath, 'export', '--platform', platform, '--output-dir', outputDir],
{
cwd: shellRoot,
encoding: 'utf8',