Skip to content

Build your personal knowledge base with Trilium Notes

chore(flatpak): stop gating the vendored manifest's pnpm pin

Elian Doran214de070f43e
diff --git a/.claude/skills/packaging-for-flathub/SKILL.md b/.claude/skills/packaging-for-flathub/SKILL.md
index c4f080f6af..115471b972 100644
--- a/.claude/skills/packaging-for-flathub/SKILL.md
+++ b/.claude/skills/packaging-for-flathub/SKILL.md
@@ -110,13 +110,14 @@ that SHA.
`chmod`/symlink step. Refs older than pnpm 12 are rejected by `checkPnpmSupported` —
pnpm 11 had a single wrapper tarball and the per-arch URL would 404.
- A release run re-pins pnpm from the **packaged ref's** `packageManager`, so the
- published manifest is never stale no matter what the vendored copy says. Between
- releases Renovate moves `packageManager` and knows nothing about the manifest, so a
- spec in `update-repo.spec.ts` fails once the two diverge and
- `pnpm chore:sync-flatpak-pnpm` rewrites both URLs and both `sha256`s from the working
- tree. Renovate cannot own this itself: a regex manager moves a version but computes no
- hash, which would trade a stale pin for a mismatch inside Flathub's builder.
+ **The vendored pins are allowed to trail the repository** — the git ref and the pnpm
+ version both. `update-repo.mts` re-pins pnpm from the **packaged ref's**
+ `packageManager` and fetches the two `sha256`s while it writes the packaging repo, so
+ the published manifest is right whatever the vendored copy says. Renovate moves
+ `packageManager` without touching the manifest; do not add a check that fails on the
+ gap. One was tried and reverted: on a `pull_request` run the comparison sees main's
+ `package.json` against the branch's manifest, so a bump on main reddens every open
+ pull request, none of which can fix it.
- **`flathub.json`** carries `disable-external-data-checker: true` (the checker probes
broken URLs *without* `x-checker-data`, so it would poll ~2400 generated npm sources)
and `automerge-flathubbot-prs: false` — the linter errors on `true`
diff --git a/package.json b/package.json
index 566f7c1a32..5df7878eae 100644
--- a/package.json
+++ b/package.json
@@ -33,7 +33,6 @@
"electron:start-prod": "pnpm desktop:start-prod",
"chore:ci-update-nightly-version": "tsx ./scripts/update-nightly-version.ts",
"chore:release-notes-body": "node --experimental-strip-types ./scripts/release-notes-body.mts",
- "chore:sync-flatpak-pnpm": "node --experimental-strip-types ./scripts/flatpak/update-repo.mts --sync-pnpm",
"chore:update-build-info": "tsx ./scripts/update-build-info.mts",
"chore:update-flake-electron": "tsx ./scripts/update-flake-electron.ts",
"chore:update-version": "tsx ./scripts/update-version.ts",
diff --git a/scripts/flatpak/update-repo.mts b/scripts/flatpak/update-repo.mts
index 270aa4c18a..0290083629 100644
--- a/scripts/flatpak/update-repo.mts
+++ b/scripts/flatpak/update-repo.mts
@@ -9,12 +9,10 @@
* Usage:
*
* pnpm exec tsx ./scripts/flatpak/update-repo.mts <packaging-repo-dir> [ref]
- * pnpm exec tsx ./scripts/flatpak/update-repo.mts --sync-pnpm
*
* `ref` defaults to HEAD; a tag pins `tag:` and `commit:`, anything else pins
- * the bare commit (the beta case). `--sync-pnpm` rewrites the vendored
- * manifest's own pnpm sources from the working tree's package.json instead,
- * which is what `pnpm chore:sync-flatpak-pnpm` runs.
+ * the bare commit (the beta case). The vendored manifest's own pins are a
+ * starting point this rewrites, so they can trail the repository.
*/
import { execFileSync } from "node:child_process";
@@ -61,28 +59,6 @@ export async function main(argv: string[]) {
console.log(`Updated ${repoDir}: ${tag ?? "beta"} @ ${commit}, pnpm ${pnpmVersion}.`);
}
-/**
- * Moves the vendored manifest's pnpm sources onto the version the working tree
- * pins. A release run derives them from the packaged ref instead, so between
- * releases this is what keeps the manifest in step with `packageManager`.
- */
-export async function syncPnpmPins() {
- const manifestPath = join(FLATPAK_DIR, MANIFEST_NAME);
- const manifest = readFileSync(manifestPath, "utf-8");
- const pnpmVersion = parsePnpmVersion(readFileSync(join(REPO_ROOT, "package.json"), "utf-8"));
- if (getPnpmVersion(manifest) === pnpmVersion) {
- console.log(`${manifestPath} already pins pnpm ${pnpmVersion}.`);
- return;
- }
-
- checkPnpmSupported(pnpmVersion);
- writeFileSync(manifestPath, updatePnpmPins(manifest, pnpmVersion, {
- x64: await sha256OfUrl(pnpmExeUrl("x64", pnpmVersion)),
- arm64: await sha256OfUrl(pnpmExeUrl("arm64", pnpmVersion))
- }));
- console.log(`Pinned pnpm ${pnpmVersion} in ${manifestPath}.`);
-}
-
/** Step outputs for the workflow that opens the pull request; the tag is empty for a beta. */
export function formatOutputs(commit: string, tag: string | undefined, pnpmVersion: string): string {
return `commit=${commit}\nshort=${commit.slice(0, 8)}\ntag=${tag ?? ""}\npnpm=${pnpmVersion}\n`;
@@ -172,9 +148,7 @@ function isTag(ref: string): boolean {
// Only when run as a script — the pure helpers above are imported by the spec.
if (process.argv[1] === import.meta.filename) {
- const argv = process.argv.slice(2);
- const run = argv[0] === "--sync-pnpm" ? syncPnpmPins() : main(argv);
- run.catch((err) => {
+ main(process.argv.slice(2)).catch((err) => {
console.error(err instanceof Error ? err.message : err);
process.exit(1);
});
diff --git a/scripts/flatpak/update-repo.spec.ts b/scripts/flatpak/update-repo.spec.ts
index a08e73effe..caeac83173 100644
--- a/scripts/flatpak/update-repo.spec.ts
+++ b/scripts/flatpak/update-repo.spec.ts
@@ -1,5 +1,3 @@
-import { readFileSync } from "node:fs";
-
import { describe, expect, it } from "vitest";
import { checkPnpmSupported, formatOutputs, getPnpmVersion, parsePnpmVersion, updateGitSource, updatePnpmPins } from "./update-repo.mjs";
@@ -94,12 +92,4 @@ describe("pnpm pins", () => {
expect(() => updatePnpmPins(withoutArm, "12.5.0", { x64: "a".repeat(64), arm64: "b".repeat(64) }))
.toThrow(/arm64/);
});
-
- // Renovate moves `packageManager` and knows nothing about the manifest, which no
- // release run reads back; `pnpm chore:sync-flatpak-pnpm` is what fixes this red.
- it("keeps the vendored manifest on the pnpm the repository pins", () => {
- const read = (path: string) => readFileSync(new URL(path, import.meta.url), "utf-8");
- expect(getPnpmVersion(read("../../apps/desktop/flatpak/org.triliumnotes.Trilium.yml")))
- .toBe(parsePnpmVersion(read("../../package.json")));
- });
});