mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-23 09:42:53 +00:00
* Upgrade to Expo 57 and unify Explorer across layouts * feat(app): retain Explorer across layout and appearance changes Keep one workspace Explorer host and destination-aware navigation so folding, theme updates and compact sheets preserve the current panel. Scope pull request discovery and timeline demand to active surfaces. * fix(app): keep Explorer resize handles stretched through the dock The shared frame moved the divider into an absolute column, leaving its horizontal handle without height. Restore the row so pointer drags reach it, preserving the existing resize and performance contract. * fix(app): keep Explorer drag widths out of the shared stylesheet Carry the existing inline sizing policy into the shared frame so pointer previews do not accumulate CSS rules. * fix(test): align isolated test runtimes with Expo 57 Hoisted React consumers need the matching DOM renderer at the repository root. Automated Metro processes must not install native DevTools into disposable homes, and development toast overlays must not cover compact actions. Keep Explorer journeys on the shared host and synchronize setup fixtures on daemon output rather than a one-second file-marker window. A delayed real child start reproduces the readiness failure on every platform. * fix(test): await retained shell layout after composer resize The gesture host now stays mounted across breakpoints, so its presence no longer identifies compact layout. Report the current layout on the retained host and synchronize composer journeys with that state. * fix(app): preserve browser interactions in retained workspace hosts Initially disabled gesture hosts still registered pointer and wheel listeners, while hover cards used window positions inside a workspace-local sheet portal. Respect initial gesture enablement and position cards relative to their measured floating host. Keep developer-toast dismissal independent of pointer input and replacement toast visibility so modal, hover, and focus checks retain their input state. * fix(test): share developer toast handling with Electron browser runs The standalone Electron browser runner bypassed the browser fixture, allowing developer errors to cover Settings. Use the same non-pointer dismissal in both runners while retaining their console logs.
118 lines
4.2 KiB
JavaScript
118 lines
4.2 KiB
JavaScript
import { copyFileSync, existsSync, mkdirSync, readdirSync, rmSync } from "node:fs";
|
|
import { spawnSync } from "node:child_process";
|
|
import { join, relative } from "node:path";
|
|
|
|
// In CI we often install a single workspace (e.g. server/relay/website). Only apply patches
|
|
// when the patched dependency is actually present.
|
|
// `cwd` is where patch-package must run from. Packages that npm does not hoist to the
|
|
// workspace root live in their workspace's own node_modules, and patch-package resolves
|
|
// the patch's node_modules/... paths relative to its working directory.
|
|
const patchedPackages = [
|
|
{
|
|
nodeModulesPath: "packages/app/node_modules/react-native-enriched-markdown",
|
|
patchPrefix: "react-native-enriched-markdown+",
|
|
cwd: "packages/app",
|
|
},
|
|
// Remove after react-native-unistyles ships
|
|
// https://github.com/jpudysz/react-native-unistyles/pull/1203.
|
|
{
|
|
nodeModulesPath: "node_modules/react-native-unistyles",
|
|
patchPrefix: "react-native-unistyles+",
|
|
},
|
|
{
|
|
nodeModulesPath: "node_modules/react-native-draggable-flatlist",
|
|
patchPrefix: "react-native-draggable-flatlist+",
|
|
},
|
|
{
|
|
nodeModulesPath: "node_modules/react-native-gesture-handler",
|
|
patchPrefix: "react-native-gesture-handler+",
|
|
},
|
|
// Exports BottomSheetModalInternalProvider so a subtree can host its own sheets on the shared
|
|
// modal stack (see packages/app/src/components/ui/isolated-bottom-sheet-modal/host-scope.tsx), and
|
|
// keeps a dismissing modal's status through its final onChange(-1), so a modal with
|
|
// enableDismissOnClose=false that unmounts while presented still leaves the portal.
|
|
{
|
|
nodeModulesPath: "node_modules/@gorhom/bottom-sheet",
|
|
patchPrefix: "@gorhom+bottom-sheet+",
|
|
},
|
|
{
|
|
nodeModulesPath: "packages/app/node_modules/react-native-svg",
|
|
patchPrefix: "react-native-svg+",
|
|
cwd: "packages/app",
|
|
},
|
|
{
|
|
nodeModulesPath: "node_modules/@mattermost/react-native-paste-input",
|
|
patchPrefix: "@mattermost+react-native-paste-input+",
|
|
},
|
|
{
|
|
nodeModulesPath: "packages/server/node_modules/@opencode-ai/sdk",
|
|
patchPrefix: "@opencode-ai+sdk+",
|
|
cwd: "packages/server",
|
|
},
|
|
];
|
|
|
|
const installedPackages = patchedPackages.filter(({ nodeModulesPath }) =>
|
|
existsSync(nodeModulesPath),
|
|
);
|
|
|
|
if (!existsSync("patches") || installedPackages.length === 0) {
|
|
process.exit(0);
|
|
}
|
|
|
|
const patchFiles = readdirSync("patches").filter((file) => file.endsWith(".patch"));
|
|
|
|
const isWindows = process.platform === "win32";
|
|
const cmd = isWindows ? "patch-package.cmd" : "patch-package";
|
|
|
|
let failed = false;
|
|
for (const [index, { nodeModulesPath, patchPrefix, cwd = "." }] of installedPackages.entries()) {
|
|
const files = patchFiles.filter((file) => file.startsWith(patchPrefix));
|
|
if (files.length === 0) {
|
|
continue;
|
|
}
|
|
const outcome = applyPatches(cwd, files, index);
|
|
if (outcome === "applied") {
|
|
continue;
|
|
}
|
|
failed = true;
|
|
if (outcome === "unavailable") {
|
|
continue;
|
|
}
|
|
// patch-package cannot apply a patch that changed after an earlier version of it was
|
|
// applied. Without the package, the next install fetches it clean and applies the patch.
|
|
rmSync(nodeModulesPath, { recursive: true, force: true });
|
|
console.error(
|
|
`postinstall-patches: removed ${nodeModulesPath} because its patch did not apply. ` +
|
|
"Run npm install again to reinstall it with the current patch. " +
|
|
"If it fails again on the clean package, the patch is out of date and must be regenerated.",
|
|
);
|
|
}
|
|
|
|
process.exit(failed ? 1 : 0);
|
|
|
|
function applyPatches(cwd, files, index) {
|
|
const tempPatchDir = join(".tmp", `postinstall-patches-${process.pid}-${index}`);
|
|
mkdirSync(tempPatchDir, { recursive: true });
|
|
for (const patchFile of files) {
|
|
copyFileSync(join("patches", patchFile), join(tempPatchDir, patchFile));
|
|
}
|
|
|
|
let result;
|
|
try {
|
|
result = spawnSync(cmd, ["--patch-dir", relative(cwd, tempPatchDir), "--error-on-fail"], {
|
|
cwd,
|
|
shell: isWindows,
|
|
stdio: "inherit",
|
|
windowsHide: true,
|
|
});
|
|
} finally {
|
|
rmSync(tempPatchDir, { recursive: true, force: true });
|
|
}
|
|
|
|
if (result.error) {
|
|
console.error("postinstall-patches: patch-package failed to spawn:", result.error.message);
|
|
return "unavailable";
|
|
}
|
|
return result.status === 0 ? "applied" : "rejected";
|
|
}
|