Skip to content

Commit 7750c24

Browse files
build(mobile): installs fail when a fork tarball is patched
A pnpm patch on a tarball from apps/mobile/deps is a second source of truth that the next tarball drops without a trace, so .pnpmfile.cjs rejects one and points at the fork. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 1ca3d66 commit 7750c24

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

‎.pnpmfile.cjs‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,33 @@
1-
// Windows installs need Linux x64 glibc binaries because WSL shares node_modules.
2-
// Keep other platforms native; release scripts set their own architectures.
1+
const fs = require("node:fs");
2+
const path = require("node:path");
3+
4+
// Our forks ship as tarballs in apps/mobile/deps. A pnpm patch on one is a second source of
5+
// truth that the next tarball silently drops, so changes go to the fork (apps/mobile/deps/README.md).
6+
function forkTarballPatches(patchedDependencies) {
7+
const manifestPath = path.join(__dirname, "apps/mobile/package.json");
8+
// Release staging installs a partial workspace without the mobile app.
9+
if (!patchedDependencies || !fs.existsSync(manifestPath)) return [];
10+
const { dependencies = {} } = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
11+
const forks = Object.keys(dependencies).filter((name) =>
12+
String(dependencies[name]).startsWith("file:deps/"),
13+
);
14+
return Object.keys(patchedDependencies).filter((key) =>
15+
forks.some((name) => key === name || key.startsWith(`${name}@`)),
16+
);
17+
}
18+
319
module.exports = {
420
hooks: {
521
updateConfig(config) {
22+
const forkPatches = forkTarballPatches(config.patchedDependencies);
23+
if (forkPatches.length > 0) {
24+
throw new Error(
25+
`pnpm-workspace.yaml patches ${forkPatches.join(", ")}, which ships as a fork tarball in ` +
26+
"apps/mobile/deps. Change the fork and replace the tarball instead (apps/mobile/deps/README.md).",
27+
);
28+
}
29+
// Windows installs need Linux x64 glibc binaries because WSL shares node_modules.
30+
// Keep other platforms native; release scripts set their own architectures.
631
// oxlint-disable-next-line t3code/no-global-process-runtime -- pnpm loads this file before any Effect runtime exists.
732
if (process.platform !== "win32") return config;
833
return {

‎apps/mobile/deps/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
The Enriched Markdown tarball comes from Julius's [`fork/t3-mobile` branch](https://github.com/pingdotgg/enriched-markdown/tree/fork/t3-mobile). Its `t3-fork.json` records the exact source commit and upstream base. React block renderers, signed image sources, the `onLinksChange` link list (`renderers`, `resolveImageSource`, `onLinksChange`) and the iOS streaming memory bounds are upstream. The fork carries only changes with an open upstream PR: clipboard link metadata ([#962](https://github.com/software-mansion/enriched-markdown/pull/962)), development-host autolinks ([#961](https://github.com/software-mansion/enriched-markdown/pull/961)) and hash-route link fragments ([mity/md4c#454](https://github.com/mity/md4c/pull/454), arriving through [md4c#7](https://github.com/software-mansion-labs/md4c/pull/7)), `md4cFlags.preserveWindowsPaths`, which keeps backslashes in Windows drive paths in prose ([#1105](https://github.com/software-mansion/enriched-markdown/pull/1105), after [mity/md4c#477](https://github.com/mity/md4c/pull/477)), GitHub's strikethrough rules for `~` ([md4c#6](https://github.com/software-mansion-labs/md4c/pull/6)), `\(…\)` and `\[…\]` math delimiters ([#1043](https://github.com/software-mansion/enriched-markdown/pull/1043), [md4c#4](https://github.com/software-mansion-labs/md4c/pull/4)), iOS Copy as Markdown keeping bold spans whole ([#1143](https://github.com/software-mansion/enriched-markdown/pull/1143)), and line breaks in copied table cells written as `<br>` ([#1144](https://github.com/software-mansion/enriched-markdown/pull/1144)).
22

33
To replace it, commit the fork changes, run `yarn install --immutable` and `yarn workspace react-native-enriched-markdown prepare` in the fork checkout, then `node scripts/pack-t3.mjs /path/to/t3code/apps/mobile/deps`. Keep the package version aligned with Julius's `fork/t3-mobile` branch. Rename the archive to include the first eight characters of the source commit, such as `react-native-enriched-markdown-1.2.0-t3.18-4287c5d3.tgz`, so each build has a distinct dependency path without version bumps. Update the tarball path in `apps/mobile/package.json` and `pnpm-workspace.yaml`'s `allowBuilds`, and run `vp i` to update the lockfile. Native clients need rebuilding when this dependency changes.
4+
5+
Change a tarball in this directory through its fork, never with a pnpm patch: `.pnpmfile.cjs` fails the install when `patchedDependencies` names one, since the next tarball would drop the patch without a trace.

0 commit comments

Comments
 (0)