Refactor mobile remote search and review state

- Move composer path search and source-control discovery into shared managed state
- Persist review async/loading state in atoms and add coverage
- Update mobile/web composers and review highlighter initialization
This commit is contained in:
Julius Marminge committed 2026-05-20 11:03:29 +02:00
1 parent ab95f11360
commit e793c07a21
37 files changed
+1366 -545

No files matched your search

+3 -13
View File
@@ -40,8 +40,10 @@ const sourceExtensions = new Set([".swift", ".kt", ".kts"]);
const excludedDirectories = new Set([
".expo",
".git",
"android",
"build",
"DerivedData",
"ios",
"node_modules",
"Pods",
"Vendor",
@@ -188,19 +190,7 @@ const runNativeStaticChecks = Effect.fn("runNativeStaticChecks")(function* () {
}
}
const androidProject = path.join(root, "android");
const gradlew = path.join(
androidProject,
process.platform === "win32" ? "gradlew.bat" : "gradlew",
);
const fs = yield* FileSystem.FileSystem;
if (yield* fs.exists(gradlew)) {
const stat = yield* fs.stat(gradlew);
if (stat.type === "File") {
yield* runCommand(gradlew, ["lint"], androidProject);
}
}
yield* Console.log("Skipping generated native project folders: android/, ios/.");
});
export const mobileNativeStaticCheckCommand = Command.make("mobile-native-static-check", {}, () =>
-63
View File
@@ -1,63 +0,0 @@
import { existsSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
const root = process.cwd();
const candidates = [join(root, "node_modules/expo-dev-launcher/ios/EXDevLauncherController.m")];
const bunStorePath = join(root, "node_modules/.bun");
if (existsSync(bunStorePath)) {
for (const entry of readdirSync(bunStorePath)) {
if (!entry.startsWith("expo-dev-launcher@")) {
continue;
}
candidates.push(
join(bunStorePath, entry, "node_modules/expo-dev-launcher/ios/EXDevLauncherController.m"),
);
}
}
const targetLine = "[manager updateCurrentBridge:self.appBridge];";
const replacement = [
" // Expo SDK 55's dev launcher still references `self.appBridge`,",
" // but React Native 0.83 removed that property from the delegate base class.",
" // Newer Expo builds stop updating the dev menu bridge here.",
].join("\n");
let patchedCount = 0;
let locatedCount = 0;
for (const filePath of candidates) {
if (!existsSync(filePath)) {
continue;
}
locatedCount += 1;
const source = readFileSync(filePath, "utf8");
if (source.includes(replacement)) {
continue;
}
if (!source.includes(targetLine)) {
throw new Error(
`Found expo-dev-launcher source at ${filePath}, but the expected bridge line was missing.`,
);
}
const nextSource = source.replace(` ${targetLine}`, replacement);
writeFileSync(filePath, nextSource);
patchedCount += 1;
}
if (patchedCount > 0) {
console.log(
`[patch-expo-dev-launcher] patched ${patchedCount} expo-dev-launcher installation(s).`,
);
} else if (locatedCount > 0) {
console.log("[patch-expo-dev-launcher] expo-dev-launcher already patched.");
} else {
console.log("[patch-expo-dev-launcher] expo-dev-launcher not installed; skipping.");
}
-105
View File
@@ -1,105 +0,0 @@
import { existsSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
const root = process.cwd();
const bunStorePath = join(root, "node_modules/.bun");
const packageDirs = [];
if (existsSync(join(root, "node_modules/@pierre/diffs"))) {
packageDirs.push(join(root, "node_modules/@pierre/diffs"));
}
if (existsSync(bunStorePath)) {
for (const entry of readdirSync(bunStorePath)) {
if (!entry.startsWith("@pierre+diffs@")) {
continue;
}
packageDirs.push(join(bunStorePath, entry, "node_modules/@pierre/diffs"));
}
}
const utilsIndexJs = [
'export { parsePatchFiles, processFile, processPatch } from "./parsePatchFiles.js";',
"export {",
" EXTENSION_TO_FILE_FORMAT,",
" getCustomExtensionsMap,",
" getCustomExtensionsVersion,",
" getFiletypeFromFileName,",
" replaceCustomExtensions,",
" setCustomExtension,",
'} from "./getFiletypeFromFileName.js";',
"",
].join("\n");
const utilsIndexDts = [
'export { parsePatchFiles, processFile, processPatch } from "./parsePatchFiles.js";',
"export {",
" EXTENSION_TO_FILE_FORMAT,",
" getCustomExtensionsMap,",
" getCustomExtensionsVersion,",
" getFiletypeFromFileName,",
" replaceCustomExtensions,",
" setCustomExtension,",
'} from "./getFiletypeFromFileName.js";',
'export type { ChangeTypes, FileDiffMetadata, ParsedPatch, SupportedLanguages } from "../types.js";',
"",
].join("\n");
let patchedCount = 0;
let locatedCount = 0;
for (const packageDir of packageDirs) {
if (!existsSync(packageDir)) {
continue;
}
locatedCount += 1;
const packageJsonPath = join(packageDir, "package.json");
const utilsIndexJsPath = join(packageDir, "dist/utils/index.js");
const utilsIndexDtsPath = join(packageDir, "dist/utils/index.d.ts");
const pkg = JSON.parse(readFileSync(packageJsonPath, "utf8"));
const currentUtilsExport = pkg.exports?.["./utils"];
const expectedUtilsExport = {
types: "./dist/utils/index.d.ts",
import: "./dist/utils/index.js",
};
const needsExportPatch =
currentUtilsExport?.types !== expectedUtilsExport.types ||
currentUtilsExport?.import !== expectedUtilsExport.import;
if (needsExportPatch) {
pkg.exports = {
...pkg.exports,
"./utils": expectedUtilsExport,
};
writeFileSync(packageJsonPath, `${JSON.stringify(pkg, null, 2)}\n`);
}
const currentJs = existsSync(utilsIndexJsPath) ? readFileSync(utilsIndexJsPath, "utf8") : null;
if (currentJs !== utilsIndexJs) {
writeFileSync(utilsIndexJsPath, utilsIndexJs);
}
const currentDts = existsSync(utilsIndexDtsPath) ? readFileSync(utilsIndexDtsPath, "utf8") : null;
if (currentDts !== utilsIndexDts) {
writeFileSync(utilsIndexDtsPath, utilsIndexDts);
}
if (needsExportPatch || currentJs !== utilsIndexJs || currentDts !== utilsIndexDts) {
patchedCount += 1;
}
}
if (patchedCount > 0) {
console.log(`[patch-pierre-diffs-utils] patched ${patchedCount} @pierre/diffs installation(s).`);
} else if (locatedCount > 0) {
console.log("[patch-pierre-diffs-utils] @pierre/diffs already patched.");
} else {
console.log("[patch-pierre-diffs-utils] @pierre/diffs not installed; skipping.");
}
@@ -1,73 +0,0 @@
import { existsSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
const root = process.cwd();
const candidates = [join(root, "node_modules/react-native-nitro-modules/package.json")];
const bunStorePath = join(root, "node_modules/.bun");
if (existsSync(bunStorePath)) {
for (const entry of readdirSync(bunStorePath)) {
if (!entry.startsWith("react-native-nitro-modules@")) {
continue;
}
candidates.push(
join(bunStorePath, entry, "node_modules/react-native-nitro-modules/package.json"),
);
}
}
let patchedCount = 0;
let locatedCount = 0;
for (const filePath of candidates) {
if (!existsSync(filePath)) {
continue;
}
locatedCount += 1;
const source = readFileSync(filePath, "utf8");
const pkg = JSON.parse(source);
if (pkg.codegenConfig == null || typeof pkg.codegenConfig !== "object") {
throw new Error(
`Found react-native-nitro-modules package at ${filePath}, but codegenConfig was missing.`,
);
}
const iosConfig =
pkg.codegenConfig.ios != null && typeof pkg.codegenConfig.ios === "object"
? pkg.codegenConfig.ios
: {};
const modulesProvider =
iosConfig.modulesProvider != null && typeof iosConfig.modulesProvider === "object"
? iosConfig.modulesProvider
: {};
if (modulesProvider.NitroModules === "NativeNitroModules") {
continue;
}
modulesProvider.NitroModules = "NativeNitroModules";
iosConfig.modulesProvider = modulesProvider;
pkg.codegenConfig.ios = iosConfig;
writeFileSync(filePath, `${JSON.stringify(pkg, null, 2)}\n`);
patchedCount += 1;
}
if (patchedCount > 0) {
console.log(
`[patch-react-native-nitro-modules] patched ${patchedCount} react-native-nitro-modules installation(s).`,
);
} else if (locatedCount > 0) {
console.log("[patch-react-native-nitro-modules] react-native-nitro-modules already patched.");
} else {
console.log(
"[patch-react-native-nitro-modules] react-native-nitro-modules not installed; skipping.",
);
}