From edfabefe7cb411f78e1d39a6beae06b510eb70fc Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 6 Nov 2026 18:03:03 -0800 Subject: [PATCH 1/3] chore(quest): claim quest/m0/ci/jsr-retire.md Quest-Claim: ce7e03fadd1313be From 39e79769fbdaecb793a5d050e5b28eeae64739d7 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 6 Nov 2026 18:14:42 -0800 Subject: [PATCH 2/3] ci(js): stop publishing to JSR @moq/* packages publish only to npm. The release script no longer generates jsr.json or runs deno publish, release-js passes no JSR_TOKEN, the "jsr" opt-out field is gone from every package.json, deno leaves the dev shell, and doc links point at npm. The quest now holds only the release backport and the maintainer's archiving on jsr.io. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release-js.yml | 13 +-- .gitignore | 2 - doc/.vitepress/api/index.ts | 2 +- flake.nix | 3 - infra/README.md | 6 +- js/AGENTS.md | 2 +- js/common/package.ts | 127 +------------------------- js/common/release.test.ts | 149 +++++++------------------------ js/common/release.ts | 118 ++++-------------------- js/hang/src/container/index.ts | 2 +- js/hang/src/index.ts | 4 +- js/justfile | 2 +- js/libav/package.json | 1 - js/libav/package.nix | 2 +- js/moq-boy/package.json | 1 - js/net/src/index.ts | 2 +- js/publish/package.json | 1 - js/publish/src/index.ts | 8 +- js/room/src/index.ts | 2 +- js/ui/package.json | 1 - js/watch/package.json | 1 - js/watch/src/index.ts | 8 +- quest/m0/ci/README.md | 2 +- quest/m0/ci/jsr-retire.md | 45 +++++----- quest/m3/audit-ci.md | 2 +- 25 files changed, 95 insertions(+), 411 deletions(-) diff --git a/.github/workflows/release-js.yml b/.github/workflows/release-js.yml index a8d315dd2f5..de7615023b8 100644 --- a/.github/workflows/release-js.yml +++ b/.github/workflows/release-js.yml @@ -10,9 +10,9 @@ on: paths: - 'js/**' - '.github/workflows/release-js.yml' - # Dry-run: builds, packs, and runs `deno publish --dry-run`, which catches - # JSR-only failures before they break a release on `release`. Only a push - # publishes, so nightly.yml calls this on main in place of main PRs. + # Dry-run: builds and packs, which catches packaging failures before they + # break a release on `release`. Only a push publishes, so nightly.yml calls + # this on main in place of main PRs. workflow_call: # Only publishing runs share the serialized group. GitHub keeps a single pending @@ -28,9 +28,7 @@ jobs: runs-on: ubuntu-latest if: github.repository_owner == 'moq-dev' # npm trusted publishing can require this Environment, which only `release` - # can deploy to, so a branch's OIDC identity cannot publish. It also holds - # the JSR token, since JSR's OIDC trust cannot require an Environment. - # Dry-runs skip it. + # can deploy to, so a branch's OIDC identity cannot publish. Dry-runs skip it. environment: ${{ github.event_name == 'push' && 'npm' || '' }} steps: @@ -53,7 +51,4 @@ jobs: - name: Release packages env: DRY_RUN: ${{ github.event_name != 'push' }} - # Only the `npm` Environment holds it, so dry-runs get none. - # release.ts hands it to `deno publish` alone. - JSR_TOKEN: ${{ secrets.JSR_TOKEN }} run: nix develop --command bun --filter '*' release diff --git a/.gitignore b/.gitignore index b3ef8e75a69..37f44777ebf 100644 --- a/.gitignore +++ b/.gitignore @@ -73,8 +73,6 @@ __pycache__/ # installs of the py/moq-ffi package. /py/moq-ffi/moq_ffi/_uniffi/ -# Generated JSR manifest (derived from package.json by js/common/package.ts) -jsr.json # msys/cygwin crash dumps, from running the shell scripts on Windows. *.stackdump diff --git a/doc/.vitepress/api/index.ts b/doc/.vitepress/api/index.ts index f651c3a6fc2..a8589ee6ba2 100644 --- a/doc/.vitepress/api/index.ts +++ b/doc/.vitepress/api/index.ts @@ -168,7 +168,7 @@ function newest(dirs: string[]): number { found = Math.max(found, stat.mtimeMs); if (!stat.isDirectory()) return; for (const entry of readdirSync(path)) { - if (!["node_modules", "dist", "result", ".vite", "jsr.json"].includes(entry)) walk(join(path, entry)); + if (!["node_modules", "dist", "result", ".vite"].includes(entry)) walk(join(path, entry)); } }; for (const dir of dirs) walk(dir); diff --git a/flake.nix b/flake.nix index 21edb2d260f..79008b92247 100644 --- a/flake.nix +++ b/flake.nix @@ -223,9 +223,6 @@ bun # Only for NPM publishing nodejs_24 - # JSR publishing. We call `deno publish` directly instead of `bunx jsr` - # so the release doesn't race on a runtime binary download. - deno # One browser build for local and CI Playwright checks. playwright-driver.browsers ]; diff --git a/infra/README.md b/infra/README.md index b5c9e6ea4eb..74541e4aae3 100644 --- a/infra/README.md +++ b/infra/README.md @@ -57,7 +57,7 @@ names the Environment, and a branch that is not on the list fails to start it. | `publish` | `release`, `moq-ffi-v*`, `moq-relay-v*`, `moq-cli-v*` | Registry, signing, and deploy credentials, and the moq-bot key for jobs that also need one of those | | `alert` | `main` | `DISCORD_WEBHOOK`, for `alert.yml`'s failure posts | | `cache-write` | `main`, its merge queue, binary release tags | The mbx and Nix cache write keys ([below](#bootstrapping-the-rust-build-cache)) | -| `npm` | `release` | `JSR_TOKEN`; npm's trusted publisher names it | +| `npm` | `release` | Nothing; npm's trusted publisher names it | | `pypi` | `main`, `release`, `moq-ffi-v*` | Nothing; PyPI's trusted publisher names it | | `pub.dev` | `moq-dart-v*`, `moq-ffi-v*` | Nothing; pub.dev's automated publishing names it | | `github-pages` | `main` | Nothing | @@ -78,9 +78,7 @@ A tag policy only helps if the tag itself is protected, so the `release tags` ruleset ([below](#bootstrapping-the-nix-cache)) also covers `moq-ffi-v*` and `moq-dart-v*`. A `workflow_run` job that checks out the triggering commit first requires its `head_branch` to be such a tag at that commit, since a -branch can share a release's name. JSR's GitHub trust checks only the repository, not an -Environment, so `release-js` publishes to JSR with `JSR_TOKEN` instead and the -JSR packages do not trust the repository. +branch can share a release's name. ## Bootstrapping a new package repository diff --git a/js/AGENTS.md b/js/AGENTS.md index 24bae62af83..04250d88153 100644 --- a/js/AGENTS.md +++ b/js/AGENTS.md @@ -24,6 +24,6 @@ The `/js` Bun workspace, published as `@moq/`. Run recipes via `just js # Conventions - Only browser performance counts; accept a small regression that shows only on node or bun. -- Document every export and give each entrypoint a `@module` block (JSR builds docs from them). Hide deprecated exports with `@internal` or drop them; never annotate "use X". +- Document every export and give each entrypoint a `@module` block. Hide deprecated exports with `@internal` or drop them; never annotate "use X". - `just js check` includes the build, since declaration emit catches errors `--noEmit` misses, and rejects importing a `@moq/*` package the manifest doesn't declare. - Test UI or playback changes with `just dev` in a real browser. `` renders black in a background tab unless `visible="always"`. diff --git a/js/common/package.ts b/js/common/package.ts index 31fcd2df6c4..a19ace17e48 100644 --- a/js/common/package.ts +++ b/js/common/package.ts @@ -3,7 +3,7 @@ // Split from release.ts to allow building packages without publishing import { copyFileSync, existsSync, readFileSync, writeFileSync } from "node:fs"; -import { basename, join, resolve } from "node:path"; +import { join, resolve } from "node:path"; import { publint } from "publint"; import { formatMessage } from "publint/utils"; import { checkPackageConstructors } from "./constructors.ts"; @@ -13,19 +13,6 @@ checkPackageConstructors(process.cwd()); console.log("✍️ Rewriting package.json..."); const pkg = JSON.parse(readFileSync("package.json", "utf8")); -// Capture the source exports before the npm rewrite below mutates them, so the -// JSR config can map them to the built (.js) entrypoints. -const srcExports: Record = structuredClone(pkg.exports ?? {}); - -// A package publishes at all when it has a release script. Captured before pkg.scripts is -// cleared below. -const published = Boolean(pkg.scripts?.release); - -// Publish to JSR alongside npm for every published package, unless it opts out with -// "jsr": false. The web-component packages opt out: JSR forbids the HTMLElementTagNameMap -// global augmentation every custom element needs. -const publishJsr = published && pkg.jsr !== false; - function rewritePath(p: string, ext: string): string { return p.replace(/^\.\/src/, ".").replace(/\.ts(x)?$/, `.${ext}`); } @@ -107,7 +94,6 @@ rewriteWorkspaceDependency(pkg.peerDependencies); pkg.devDependencies = undefined; pkg.scripts = undefined; -pkg.jsr = undefined; // JSR opt-out flag, not part of the npm package // Write the rewritten package.json writeFileSync("dist/package.json", JSON.stringify(pkg, null, 2)); @@ -146,114 +132,3 @@ if (messages.length > 0) { } console.log("📦 Package built successfully in dist/"); - -// Optionally emit a jsr.json so the package can also publish to JSR (jsr.io). -// Generated from package.json so version/exports never drift. We publish the -// built dist (.js + .d.ts) rather than source: tsc emits explicit types into -// the .d.ts, which sidesteps JSR's "slow types" and ships real declarations, -// while JSR still builds the API docs from the .d.ts (JSDoc is preserved). -if (publishJsr) { - writeJsrConfig(); -} - -function writeJsrConfig() { - console.log("✍️ Generating jsr.json..."); - - const exports: Record = {}; - for (const [key, val] of Object.entries(srcExports)) { - if (typeof val !== "string") continue; - // CSS exports are dev-only and not published, same as the npm package. - if (val.endsWith(".css")) continue; - // rewritePath turns "./src/index.ts" into "./index.js". - exports[key] = `./dist/${rewritePath(val, "js").slice(2)}`; - } - - // Self-contained import map so we don't rely on JSR's package.json merge - // behavior. Deps resolve via npm, so packages can publish to JSR in any - // order. Flip @moq/* entries to "jsr:" once the whole graph is on JSR if you - // want JSR-native cross-links between the docs. - const imports: Record = {}; - const deps = { ...(pkg.dependencies ?? {}), ...(pkg.peerDependencies ?? {}) }; - for (const [name, range] of Object.entries(deps) as [string, string][]) { - if (name.startsWith("@types/")) continue; // type-only, never imported at runtime - imports[name] = `npm:${name}@${range}`; - // Trailing-slash subpath mapping (e.g. @moq/signals/dom). The leading slash - // in "npm:/" is required: jsr.json's imports is a standalone import map, so - // the value must parse as a base URL for relative resolution. The - // "npm:name@range/" form (no slash) fails to URL-parse the appended subpath. - imports[`${name}/`] = `npm:/${name}@${range}/`; - } - - injectSelfTypes(); - rewriteDtsImports(); - - // JSR validates the license field as a single recognized SPDX identifier, not - // an expression: it rejects "(MIT OR Apache-2.0)". Take the first identifier - // from a dual-license expression so the package keeps a valid license field. - const license = - typeof pkg.license === "string" - ? pkg.license - .replace(/[()]/g, "") - .split(/\s+(?:OR|AND)\s+/i)[0] - .trim() - : undefined; - - const jsr = { - name: pkg.name, - version: pkg.version, - // JSR reads this for the package description and the "has a description" - // score check; it isn't pulled from the npm package.json automatically. - ...(pkg.description ? { description: pkg.description } : {}), - ...(license ? { license } : {}), - exports, - ...(Object.keys(imports).length ? { imports } : {}), - // A sibling @moq package is published to npm minutes before its dependents - // in the same release, and Deno otherwise refuses npm versions under 24h old. - minimumDependencyAge: 0, - // dist is gitignored, so un-ignore it with a "!" negation; JSR honors - // .gitignore otherwise and would drop the whole build from the graph. - publish: { include: ["dist", "README.md", "LICENSE*"], exclude: ["!dist"] }, - }; - - writeFileSync("jsr.json", JSON.stringify(jsr, null, 2)); - console.log("📦 jsr.json written"); -} - -function rewriteDtsImports() { - // JSR's doc generator resolves the .d.ts import graph and can't handle a - // ".ts" extension (the dist ships .js/.d.ts, not .ts) or a bare "." specifier. - // Normalize those in the declarations so doc generation resolves. Only the - // .d.ts needs this; the .js keeps its own specifiers for npm consumers. - const glob = new Bun.Glob("**/*.d.ts"); - for (const rel of glob.scanSync("dist")) { - const file = join("dist", rel); - const body = readFileSync(file, "utf8"); - const next = body - .replace(/(from\s+"\.[^"]*?)\.ts"/g, '$1"') // "./x.ts" -> "./x" - .replace(/(from\s+")\.(")/g, "$1./index$2"); // "." -> "./index" - if (next !== body) writeFileSync(file, next); - } -} - -function injectSelfTypes() { - // JSR ignores a sibling .d.ts unless the .js references it explicitly; - // without this it infers types from the JS and reports "slow type" warnings. - const glob = new Bun.Glob("**/*.js"); - for (const rel of glob.scanSync("dist")) { - const js = join("dist", rel); - const dts = js.replace(/\.js$/, ".d.ts"); - if (!existsSync(dts)) continue; - const body = readFileSync(js, "utf8"); - if (body.includes("@ts-self-types")) continue; - // Sibling .d.ts (same directory), so just its basename. - const directive = `/* @ts-self-types="./${basename(dts)}" */\n`; - // A shebang (bin entrypoints) must stay on line 1, so insert after it; - // otherwise the directive goes first. - if (body.startsWith("#!")) { - const nl = body.indexOf("\n") + 1; - writeFileSync(js, body.slice(0, nl) + directive + body.slice(nl)); - } else { - writeFileSync(js, directive + body); - } - } -} diff --git a/js/common/release.test.ts b/js/common/release.test.ts index c8aba9e997d..009fbaebd5b 100644 --- a/js/common/release.test.ts +++ b/js/common/release.test.ts @@ -1,5 +1,5 @@ import { expect, test } from "bun:test"; -import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; @@ -11,18 +11,14 @@ type Manifest = { }; type Reply = { status?: number; output?: string; error?: string }; -// Run the real release entrypoint with isolated command and fetch substitutes: no registry +// Run the real release entrypoint with isolated command substitutes: no registry // credentials, builds, or publishing escape the fixture. function run(options: { manifest: Manifest; - imports?: Record; nested?: boolean; replies?: Record; dryRun?: boolean; - jsr?: boolean; published?: boolean; - jsrPublished?: boolean; - jsrToken?: string; sibling?: { name: string; version: string; private?: boolean; scripts?: { release: string } }; }) { const cwd = mkdtempSync(join(tmpdir(), "moq-release-")); @@ -41,7 +37,6 @@ function run(options: { JSON.stringify({ name: "@moq/fixture", version: "1.0.0", - jsr: options.jsr ?? false, scripts: { release: "unused" }, workspaces: options.sibling ? ["sibling"] : undefined, dependencies: { "@moq/source-only": "workspace:^" }, @@ -56,19 +51,7 @@ function run(options: { writeFileSync(join(packageDir, "package.json"), JSON.stringify(manifest)); } writeFileSync(join(cwd, "fixture.json"), JSON.stringify(options)); - const preload = join(cwd, "fetch.ts"); - writeFileSync( - preload, - `import { appendFileSync, readFileSync } from "node:fs"; -const options = JSON.parse(readFileSync("${cwd}/fixture.json", "utf8")); -globalThis.fetch = async (url) => { - appendFileSync("${cwd}/calls.jsonl", JSON.stringify(["fetch", String(url)]) + "\\n"); - if (String(url) !== "https://jsr.io/@moq/fixture/meta.json") process.exit(1); - return Response.json({ versions: options.jsrPublished ? { "1.0.0": {} } : {} }); -}; -`, - ); - for (const tool of ["bun", "npm", "deno"]) { + for (const tool of ["bun", "npm"]) { writeFileSync( join(bin, tool), `#!${process.execPath} @@ -76,12 +59,9 @@ import { appendFileSync, readFileSync, mkdirSync, writeFileSync } from "node:fs" const options = JSON.parse(readFileSync("${cwd}/fixture.json", "utf8")); const args = process.argv.slice(2); appendFileSync("${cwd}/calls.jsonl", JSON.stringify(["${tool}", ...args]) + "\\n"); -if (process.env.JSR_TOKEN) appendFileSync("${cwd}/leaks.txt", "${tool}\\n"); if ("${tool}" === "bun") { mkdirSync("dist", { recursive: true }); writeFileSync("dist/package.json", JSON.stringify(options.manifest)); - const deps = { ...options.manifest.dependencies, ...options.manifest.peerDependencies }; - writeFileSync("jsr.json", JSON.stringify({ imports: options.imports ?? Object.fromEntries(Object.entries(deps).map(([k,v]) => [k, "npm:" + k + "@" + v])) })); } else if ("${tool}" === "npm" && args[0] === "view") { if (args[1] === "@moq/fixture") { console.log(options.published ? "1.0.0" : "0.9.0"); } else { @@ -98,47 +78,36 @@ if ("${tool}" === "bun") { { mode: 0o755 }, ); } - const result = Bun.spawnSync( - [process.execPath, "--preload", preload, release, ...(options.dryRun ? ["--dry-run"] : [])], - { - cwd: packageDir, - env: { - PATH: bin, - HOME: cwd, - DRY_RUN: String(options.dryRun ?? false), - ...(options.jsrToken ? { JSR_TOKEN: options.jsrToken } : {}), - }, - stdout: "pipe", - stderr: "pipe", + const result = Bun.spawnSync([process.execPath, release, ...(options.dryRun ? ["--dry-run"] : [])], { + cwd: packageDir, + env: { + PATH: bin, + HOME: cwd, + DRY_RUN: String(options.dryRun ?? false), }, - ); + stdout: "pipe", + stderr: "pipe", + }); const calls = readFileSync(join(cwd, "calls.jsonl"), "utf8") .trim() .split("\n") .map((s) => JSON.parse(s) as string[]); - const leaks = existsSync(join(cwd, "leaks.txt")) - ? readFileSync(join(cwd, "leaks.txt"), "utf8").trim().split("\n") - : []; - return { code: result.exitCode, output: result.stdout.toString() + result.stderr.toString(), calls, leaks }; + return { code: result.exitCode, output: result.stdout.toString() + result.stderr.toString(), calls }; } finally { rmSync(cwd, { recursive: true, force: true }); } } -for (const jsr of [false, true]) { - test(`dry-run packs an unpublished workspace dependency without publishing (jsr=${jsr})`, () => { - const result = run({ - dryRun: true, - jsr, - sibling: { name: "@moq/net", version: "999.0.0" }, - manifest: { dependencies: { "@moq/net": "^999.0.0" } }, - }); - expect(result.code).toBe(0); - expect(result.calls).toContainEqual(["npm", "pack", "--dry-run"]); - expect(result.calls.some((c) => c[1] === "publish")).toBe(false); - if (jsr) expect(result.output).toContain("Skipping JSR dry-run"); +test("dry-run packs an unpublished workspace dependency without publishing", () => { + const result = run({ + dryRun: true, + sibling: { name: "@moq/net", version: "999.0.0" }, + manifest: { dependencies: { "@moq/net": "^999.0.0" } }, }); -} + expect(result.code).toBe(0); + expect(result.calls).toContainEqual(["npm", "pack", "--dry-run"]); + expect(result.calls.some((c) => c[1] === "publish")).toBe(false); +}); test("refuses all missing dependencies and peers before publishing", () => { const result = run({ @@ -202,48 +171,6 @@ test("matching dependencies publish, deduplicating identical dependency and peer expect(result.calls.at(-1)).toEqual(["npm", "publish", "--access", "public"]); }); -test("JSR dry-run checks its import map once and runs when dependencies are published", () => { - const result = run({ - dryRun: true, - jsr: true, - manifest: { dependencies: { "@moq/net": "^1" } }, - replies: { - "@moq/net@^1": { output: "1.1.0" }, - }, - }); - expect(result.code).toBe(0); - expect(result.calls.filter((c) => c[1] === "view")).toEqual([["npm", "view", "@moq/net@^1", "version", "--json"]]); - expect(result.calls.some((c) => c[0] === "deno" && c.includes("--dry-run"))).toBe(true); - expect(result.calls.some((c) => c[0] === "npm" && c[1] === "publish")).toBe(false); -}); - -test("the JSR token reaches only deno publish", () => { - const result = run({ jsr: true, jsrToken: "jsr-secret", manifest: {} }); - expect(result.code).toBe(0); - expect(result.calls).toContainEqual(["fetch", "https://jsr.io/@moq/fixture/meta.json"]); - expect(result.calls.at(-1)).toEqual([ - "deno", - "publish", - "--unstable-bare-node-builtins", - "--unstable-sloppy-imports", - "--no-check", - "--allow-dirty", - "--token", - "jsr-secret", - ]); - expect(result.calls.filter((c) => c.includes("jsr-secret"))).toHaveLength(1); - expect(result.leaks).toEqual([]); -}); - -test("an already-published version on both registries skips publishing", () => { - const result = run({ jsr: true, published: true, jsrPublished: true, manifest: {} }); - expect(result.code).toBe(0); - expect(result.calls).toEqual([ - ["npm", "view", "@moq/fixture", "version"], - ["fetch", "https://jsr.io/@moq/fixture/meta.json"], - ]); -}); - test("a local sibling cannot satisfy the registry check for a real publish", () => { const result = run({ sibling: { name: "@moq/net", version: "999.0.0" }, @@ -260,26 +187,23 @@ test("packages without internal dependencies still pack", () => { expect(result.calls.at(-1)).toEqual(["npm", "pack", "--dry-run"]); }); -test("an already-published npm-only version keeps the existing skip", () => { +test("an already-published version skips publishing", () => { const result = run({ published: true, manifest: { dependencies: { "@moq/net": "^999" } } }); expect(result.code).toBe(0); expect(result.calls).toEqual([["npm", "view", "@moq/fixture", "version"]]); }); -for (const jsr of [false, true]) { - for (const sibling of [undefined, { name: "@moq/net", version: "999.0.0" }]) { - test(`dry-run rejects an unresolved non-sibling (jsr=${jsr}, sibling=${Boolean(sibling)})`, () => { - const result = run({ - dryRun: true, - jsr, - sibling, - manifest: { dependencies: { "@moq/ghost": "^999", ...(sibling ? { "@moq/net": "^999" } : {}) } }, - }); - expect(result.code).not.toBe(0); - expect(result.output).toContain("@moq/ghost@^999"); - expect(result.calls.some((c) => c[1] === "pack" || c[1] === "publish")).toBe(false); +for (const sibling of [undefined, { name: "@moq/net", version: "999.0.0" }]) { + test(`dry-run rejects an unresolved non-sibling (sibling=${Boolean(sibling)})`, () => { + const result = run({ + dryRun: true, + sibling, + manifest: { dependencies: { "@moq/ghost": "^999", ...(sibling ? { "@moq/net": "^999" } : {}) } }, }); - } + expect(result.code).not.toBe(0); + expect(result.output).toContain("@moq/ghost@^999"); + expect(result.calls.some((c) => c[1] === "pack" || c[1] === "publish")).toBe(false); + }); } for (const sibling of [ { name: "@moq/net", version: "1.0.0" }, @@ -327,10 +251,3 @@ test("a registry version can satisfy a range even when the local sibling cannot" expect(result.code).toBe(0); expect(result.calls).toContainEqual(["npm", "pack", "--dry-run"]); }); - -test("an unresolved JSR-only non-sibling fails before packing", () => { - const result = run({ dryRun: true, jsr: true, manifest: {}, imports: { "@moq/ghost": "npm:@moq/ghost@^999" } }); - expect(result.code).not.toBe(0); - expect(result.output).toContain("@moq/ghost@^999"); - expect(result.calls.some((c) => c[1] === "pack" || c[1] === "publish")).toBe(false); -}); diff --git a/js/common/release.ts b/js/common/release.ts index 7eb17fa29c9..e761af45200 100644 --- a/js/common/release.ts +++ b/js/common/release.ts @@ -3,24 +3,9 @@ import { dirname, join } from "node:path"; const dryRun = process.argv.includes("--dry-run") || process.env.DRY_RUN === "true"; -// JSR publish token, from the `npm` Environment. Remove it from this process's -// environment so only `deno publish` receives it, not builds or npm. -const jsrToken = process.env.JSR_TOKEN; -delete process.env.JSR_TOKEN; +// Read package.json to get the name and version. +const { name, version } = JSON.parse(await Bun.file("package.json").text()); -// Read package.json to get name, version, and whether to also publish to JSR. -const pkg = JSON.parse(await Bun.file("package.json").text()); -const { name, version } = pkg; -// Publish to JSR alongside npm, unless the package opts out with "jsr": false -// (the web-component packages do, since JSR forbids the global type augmentation -// custom elements need). Same predicate as package.ts so the manifest it -// generates and the publish here stay in lockstep; the release-script clause is -// always true here (this file is the release script). -const publishJsr = Boolean(pkg.scripts?.release) && pkg.jsr !== false; - -// Whether this exact version already exists on each registry. The two are -// checked independently so a package can be onboarded onto JSR even when its -// current version is already on npm. function npmHasVersion(): boolean { try { const published = execFileSync("npm", ["view", name, "version"], { @@ -33,23 +18,9 @@ function npmHasVersion(): boolean { } } -async function jsrHasVersion(): Promise { - try { - const res = await fetch(`https://jsr.io/${name}/meta.json`); - if (!res.ok) return false; - const meta = (await res.json()) as { versions?: Record }; - return Boolean(meta.versions?.[version]); - } catch { - return false; - } -} - -// Skip the registry checks in dry-run mode so we always exercise the build + -// publish manifest, even when the version is already published. -const npmDone = !dryRun && npmHasVersion(); -const jsrDone = !dryRun && publishJsr && (await jsrHasVersion()); - -if (!dryRun && npmDone && (!publishJsr || jsrDone)) { +// Skip the registry check in dry-run mode so we always exercise the build and +// pack, even when the version is already published. +if (!dryRun && npmHasVersion()) { console.log(`⏭️ ${name}@${version} already published, skipping`); process.exit(0); } @@ -77,29 +48,15 @@ if (dryRun) { if (dirname(root) === root) break; } } -const registry = new Map(); -// A dry run never sets npmDone, so this covers every pack and publish. -if (!npmDone) { - const manifest = JSON.parse(await Bun.file("dist/package.json").text()) as { - dependencies?: Record; - peerDependencies?: Record; - }; - checkDependencies( - [...Object.entries(manifest.dependencies ?? {}), ...Object.entries(manifest.peerDependencies ?? {})] - .filter(([name]) => name.startsWith("@moq/")) - .map(([name, range]) => `${name}@${range}`), - ); -} -// Validate JSR-only imports before packing too, and reuse registry results. -let jsrMissing: string[] = []; -if (dryRun && publishJsr) { - const jsr = (await Bun.file("jsr.json").json()) as { imports?: Record }; - jsrMissing = checkDependencies( - Object.values(jsr.imports ?? {}) - .filter((spec) => spec.startsWith("npm:@moq/")) - .map((spec) => spec.slice("npm:".length)), - ); -} +const manifest = JSON.parse(await Bun.file("dist/package.json").text()) as { + dependencies?: Record; + peerDependencies?: Record; +}; +checkDependencies( + [...Object.entries(manifest.dependencies ?? {}), ...Object.entries(manifest.peerDependencies ?? {})] + .filter(([name]) => name.startsWith("@moq/")) + .map(([name, range]) => `${name}@${range}`), +); // npm if (dryRun) { @@ -109,57 +66,14 @@ if (dryRun) { // same packaging path without any registry roundtrip. console.log(`🧪 Packing ${name}@${version} (dry-run)...`); execFileSync("npm", ["pack", "--dry-run"], { stdio: "inherit", cwd: "dist" }); -} else if (npmDone) { - console.log(`⏭️ ${name}@${version} already on npm, skipping`); } else { console.log(`🚀 Publishing ${name}@${version} to npm...`); // Use npm for publishing to support OIDC trusted publishing execFileSync("npm", ["publish", "--access", "public"], { stdio: "inherit", cwd: "dist" }); } -// JSR (jsr.json is generated by the build for packages with a release script). -if (publishJsr) { - // Call `deno publish` directly (what `jsr publish` wraps) using the deno from - // the nix devshell, so parallel package releases don't race on a runtime - // jsr/deno download into a shared bunx cache. jsr.json and the generated dist - // leave the tree dirty, so allow it. Without a token, Deno tries JSR's GitHub - // OIDC trust under GitHub Actions, which the packages should not grant since - // any branch of the repository could claim it, and a browser login locally. - const args = [ - "publish", - "--unstable-bare-node-builtins", - "--unstable-sloppy-imports", - "--no-check", - "--allow-dirty", - ]; - // Ignore package.json so deps resolve through jsr.json's npm: import map, as - // a JSR consumer would. Otherwise Deno follows the workspace symlinks into a - // sibling's src/, whose Vite-only imports (`?inline`) only its npm build - // resolves. Dependencies must already be on npm; release ordering alone does - // not guarantee this when a dependency's release fails. - const env = { ...process.env, DENO_NO_PACKAGE_JSON: "1" }; - if (dryRun) { - // A sibling's new version may not be on npm until the real release, so - // Deno cannot resolve that import map during a release dry run. - if (jsrMissing.length > 0) { - console.log(`⏭️ Skipping JSR dry-run: ${jsrMissing.join(", ")} not on npm yet`); - } else { - console.log(`🧪 Publishing ${name}@${version} to JSR (dry-run)...`); - args.push("--dry-run"); - execFileSync("deno", args, { stdio: "inherit", env }); - } - } else if (jsrDone) { - console.log(`⏭️ ${name}@${version} already on JSR, skipping`); - } else { - console.log(`🚀 Publishing ${name}@${version} to JSR...`); - if (jsrToken) args.push("--token", jsrToken); - execFileSync("deno", args, { stdio: "inherit", env }); - } -} - -function checkDependencies(specs: string[]): string[] { +function checkDependencies(specs: string[]) { const missing = [...new Set(specs)].filter((spec) => { - if (registry.has(spec)) return !registry.get(spec); let found = false; try { const output = execFileSync("npm", ["view", spec, "version", "--json"], { @@ -181,7 +95,6 @@ function checkDependencies(specs: string[]): string[] { if (code !== "E404") throw new Error(`Cannot resolve ${spec}: ${command.stderr ?? error}`, { cause: error }); } - registry.set(spec, found); return !found; }); const unresolved = missing.filter((spec) => { @@ -190,5 +103,4 @@ function checkDependencies(specs: string[]): string[] { return !dryRun || !version || !Bun.semver.satisfies(version, spec.slice(split + 1)); }); if (unresolved.length) throw new Error(`Cannot publish: unresolved dependencies: ${unresolved.join(", ")}`); - return missing; } diff --git a/js/hang/src/container/index.ts b/js/hang/src/container/index.ts index a703433506f..aed42709dd3 100644 --- a/js/hang/src/container/index.ts +++ b/js/hang/src/container/index.ts @@ -5,7 +5,7 @@ * @module */ -/** Re-export of {@link https://jsr.io/@moq/loc | @moq/loc}, the LOC container. */ +/** Re-export of {@link https://www.npmjs.com/package/@moq/loc | @moq/loc}, the LOC container. */ export * as Loc from "@moq/loc"; export { Consumer, type ConsumerProps, DEFAULT_MAX_BUFFER, type Read } from "./consumer"; export type { Format } from "./format"; diff --git a/js/hang/src/index.ts b/js/hang/src/index.ts index 3c18ce80d59..8d7494eb1b9 100644 --- a/js/hang/src/index.ts +++ b/js/hang/src/index.ts @@ -5,9 +5,9 @@ * @module */ -/** Re-export of {@link https://jsr.io/@moq/net | @moq/net}, the transport this package builds on. */ +/** Re-export of {@link https://www.npmjs.com/package/@moq/net | @moq/net}, the transport this package builds on. */ export * as Net from "@moq/net"; -/** Re-export of {@link https://jsr.io/@moq/signals | @moq/signals}, the reactive primitives used throughout this package. */ +/** Re-export of {@link https://www.npmjs.com/package/@moq/signals | @moq/signals}, the reactive primitives used throughout this package. */ export * as Signals from "@moq/signals"; /** The catalog schema describing a broadcast's tracks. */ export * as Catalog from "./catalog"; diff --git a/js/justfile b/js/justfile index 78ba8fd396b..a3e0e126c17 100644 --- a/js/justfile +++ b/js/justfile @@ -13,7 +13,7 @@ default: # `build` runs here rather than as its own gate: the per-package `check` script # is `tsc --noEmit`, which never runs declaration emit, so the errors that only # surface when emitting a `.d.ts` (TS4023 and friends) pass `check` and then -# break a JSR/npm publish. It costs about 20s for every package. +# break an npm publish. It costs about 20s for every package. # # `common/deps.ts` runs first and cheaply: bundlers resolve an undeclared # workspace import through hoisting, so nothing else in `check` notices one. diff --git a/js/libav/package.json b/js/libav/package.json index 4b1f78d9565..3b10c9c0f4d 100644 --- a/js/libav/package.json +++ b/js/libav/package.json @@ -10,7 +10,6 @@ "directory": "js/libav" }, "sideEffects": false, - "jsr": false, "exports": { ".": { "types": "./index.d.ts", diff --git a/js/libav/package.nix b/js/libav/package.nix index f62af9400f7..78a943cda85 100644 --- a/js/libav/package.nix +++ b/js/libav/package.nix @@ -138,7 +138,7 @@ stdenvNoCC.mkDerivation { cp ${wasm}/* $out/ install -Dm444 ${./README.md} $out/README.md install -Dm444 ${./index.d.ts} $out/index.d.ts - jq 'del(.scripts, .devDependencies, .jsr) + jq 'del(.scripts, .devDependencies) | .exports |= walk(if type == "string" then sub("^\\./dist/"; "./") else . end)' \ ${./package.json} > $out/package.json runHook postInstall diff --git a/js/moq-boy/package.json b/js/moq-boy/package.json index 807a9fe0add..72cba959329 100644 --- a/js/moq-boy/package.json +++ b/js/moq-boy/package.json @@ -2,7 +2,6 @@ "name": "@moq/boy", "type": "module", "version": "0.4.1", - "jsr": false, "description": "MoQ Boy - Crowd-controlled Game Boy streaming via MoQ", "license": "(MIT OR Apache-2.0)", "repository": { diff --git a/js/net/src/index.ts b/js/net/src/index.ts index b87a202a8be..6023214dc27 100644 --- a/js/net/src/index.ts +++ b/js/net/src/index.ts @@ -5,7 +5,7 @@ * @module */ -/** Re-export of {@link https://jsr.io/@moq/signals | @moq/signals}, the reactive primitives used throughout this package. */ +/** Re-export of {@link https://www.npmjs.com/package/@moq/signals | @moq/signals}, the reactive primitives used throughout this package. */ export * as Signals from "@moq/signals"; /** Broadcast announcement streams. */ export * as Announce from "./announce.ts"; diff --git a/js/publish/package.json b/js/publish/package.json index 29f3e9d7ee6..84f5e5eb033 100644 --- a/js/publish/package.json +++ b/js/publish/package.json @@ -2,7 +2,6 @@ "name": "@moq/publish", "type": "module", "version": "0.5.2", - "jsr": false, "description": "Publish Media over QUIC broadcasts", "license": "(MIT OR Apache-2.0)", "repository": { diff --git a/js/publish/src/index.ts b/js/publish/src/index.ts index 3e31c8878af..0581edb03b7 100644 --- a/js/publish/src/index.ts +++ b/js/publish/src/index.ts @@ -7,13 +7,13 @@ * @module */ -/** Re-export of {@link https://jsr.io/@moq/clock | @moq/clock}, the time units this package's signatures take. */ +/** Re-export of {@link https://www.npmjs.com/package/@moq/clock | @moq/clock}, the time units this package's signatures take. */ export * as Clock from "@moq/clock"; -/** Re-export of {@link https://jsr.io/@moq/hang | @moq/hang}, the media layer. */ +/** Re-export of {@link https://www.npmjs.com/package/@moq/hang | @moq/hang}, the media layer. */ export * as Hang from "@moq/hang"; -/** Re-export of {@link https://jsr.io/@moq/net | @moq/net}, the transport. */ +/** Re-export of {@link https://www.npmjs.com/package/@moq/net | @moq/net}, the transport. */ export * as Net from "@moq/net"; -/** Re-export of {@link https://jsr.io/@moq/signals | @moq/signals}, the reactive primitives used throughout this package. */ +/** Re-export of {@link https://www.npmjs.com/package/@moq/signals | @moq/signals}, the reactive primitives used throughout this package. */ export * as Signals from "@moq/signals"; export { assets } from "./assets"; /** Audio capture and encoding. */ diff --git a/js/room/src/index.ts b/js/room/src/index.ts index 22f854fb1b9..e65cc363faf 100644 --- a/js/room/src/index.ts +++ b/js/room/src/index.ts @@ -11,7 +11,7 @@ * @module */ -/** Re-export of {@link https://jsr.io/@moq/clock | @moq/clock}, the time units this package's signatures take. */ +/** Re-export of {@link https://www.npmjs.com/package/@moq/clock | @moq/clock}, the time units this package's signatures take. */ export * as Clock from "@moq/clock"; /** Chat messages exchanged in the room. */ diff --git a/js/ui/package.json b/js/ui/package.json index d35d6aa14b2..5b9fee613f5 100644 --- a/js/ui/package.json +++ b/js/ui/package.json @@ -2,7 +2,6 @@ "name": "@moq/ui", "type": "module", "version": "0.1.0", - "jsr": false, "description": "Presentation components shared by the @moq/watch and @moq/publish overlays", "license": "(MIT OR Apache-2.0)", "repository": { diff --git a/js/watch/package.json b/js/watch/package.json index a95cd0290c2..7023f799fbc 100644 --- a/js/watch/package.json +++ b/js/watch/package.json @@ -2,7 +2,6 @@ "name": "@moq/watch", "type": "module", "version": "0.6.2", - "jsr": false, "description": "Watch Media over QUIC broadcasts", "license": "(MIT OR Apache-2.0)", "repository": { diff --git a/js/watch/src/index.ts b/js/watch/src/index.ts index 4ee7d5cc566..f76c2c6cc9e 100644 --- a/js/watch/src/index.ts +++ b/js/watch/src/index.ts @@ -6,15 +6,15 @@ * * @module */ -/** Re-export of {@link https://jsr.io/@moq/clock | @moq/clock}, the time units this package's signatures take. */ +/** Re-export of {@link https://www.npmjs.com/package/@moq/clock | @moq/clock}, the time units this package's signatures take. */ export * as Clock from "@moq/clock"; -/** Re-export of {@link https://jsr.io/@moq/hang | @moq/hang}, the media layer. */ +/** Re-export of {@link https://www.npmjs.com/package/@moq/hang | @moq/hang}, the media layer. */ export * as Hang from "@moq/hang"; // Re-exported from @moq/hang so watch consumers can name the decoders' buffered output. export type { BufferedRange, BufferedRanges } from "@moq/hang/container"; -/** Re-export of {@link https://jsr.io/@moq/net | @moq/net}, the transport. */ +/** Re-export of {@link https://www.npmjs.com/package/@moq/net | @moq/net}, the transport. */ export * as Net from "@moq/net"; -/** Re-export of {@link https://jsr.io/@moq/signals | @moq/signals}, the reactive primitives used throughout this package. */ +/** Re-export of {@link https://www.npmjs.com/package/@moq/signals | @moq/signals}, the reactive primitives used throughout this package. */ export * as Signals from "@moq/signals"; export type { Arrival, Arrivals } from "./arrivals"; export { assets } from "./assets"; diff --git a/quest/m0/ci/README.md b/quest/m0/ci/README.md index a2c82ac97e1..321c6278dcb 100644 --- a/quest/m0/ci/README.md +++ b/quest/m0/ci/README.md @@ -178,7 +178,7 @@ The historical samples locate candidates; they are not controlled benchmarks. - [Read-only pull-request CI](/quest/m0/ci/read-only-secrets.md) - write secrets and publisher identities reach only protected branches and tags, never a pushed branch - [moq-gst releases publish again](/quest/m0/ci/gst-release-macos.md) - backport main's Homebrew formula test to `release`, so the macOS tarball job stops hanging and moq-gst GitHub releases publish -- [Stop publishing to JSR](/quest/m0/ci/jsr-retire.md) - `@moq/*` publishes only to npm and the JSR packages are archived, so no JSR token or OIDC link remains +- [Archive the @moq packages on JSR](/quest/m0/ci/jsr-retire.md) - once `release` stops publishing there, the maintainer archives every JSR package, ending its OIDC link - [Verify the R2 Rust cache](/quest/m0/ci/mbx-r2-verify.md) - confirm the hosted Nightly jobs reuse the previous Nightly, then measure restore time and expiry - [Verify the Nix runtime cache](/quest/m0/ci/nix-cache-verify.md) - hosted Cache uploads `main`'s relay and CLI, and Smoke's nix channel substitutes them - [Drop main from the publish Environment](/quest/m0/ci/publish-release-only.md) - the maintainer narrows `publish` to `release` and release tags once no job naming it runs as `main` diff --git a/quest/m0/ci/jsr-retire.md b/quest/m0/ci/jsr-retire.md index 1b48915a2a6..cad8df5c85f 100644 --- a/quest/m0/ci/jsr-retire.md +++ b/quest/m0/ci/jsr-retire.md @@ -1,38 +1,35 @@ -# [S] Stop publishing to JSR +# [XS] Archive the @moq packages on JSR ## Goal -`@moq/*` packages publish only to npm. The JS release path no longer -generates `jsr.json` or runs `deno publish`, no workflow or Environment needs -a `JSR_TOKEN`, and the `@moq` packages on jsr.io are archived with a pointer -to npm, so nothing can publish to them again. Deno users import the npm -packages through `npm:` specifiers. +The `@moq` packages on jsr.io are archived with a pointer to npm, so nothing +can publish to them again. Deno users import the npm packages through `npm:` +specifiers. ## Plan Decided 2026-11-06 (maintainer, /quest-unblock): ✅ drop JSR. Over the preceding 30 days `@moq/net` had about 42 JSR downloads against about 341k -on npm, and `@moq/hang` about 38 against about 306k. `@moq/watch` and -`@moq/publish` never published there (they set `"jsr": false`), and most JSR -packages last published in June. Not chosen: keeping JSR behind a `JSR_TOKEN` -in the `npm` Environment, which was +on npm, and `@moq/hang` about 38 against about 306k. Not chosen: keeping JSR +behind a `JSR_TOKEN` in the `npm` Environment, which was [read-only pull-request CI](/quest/m0/ci/read-only-secrets.md)'s step for JSR, whose repository OIDC trust cannot require an Environment. -- Remove JSR from `js/common/release.ts`, `js/common/package.ts` (the - `jsr.json` generation and the `"jsr": false` opt-out), their tests, the - `jsr` field in each `package.json`, and the `JSR_TOKEN` plumbing in - `release-js.yml`. Packages publish from `release`, so backport the change - there in the same PR, the way other release-workflow changes land. -- Rewrite doc comments and docs that link `jsr.io` (such as the - `@moq/signals` re-export in `js/net/src/index.ts`) to npm. -- Archiving on jsr.io needs the maintainer's JSR login. Once the backport - lands, they archive each `@moq` package with a description pointing to - npm; check that `https://api.jsr.io/scopes/moq/packages` lists every - package as archived. Archiving also ends the repository's OIDC link, so no - separate unlinking is needed. - -Public API: none in code; JSR stops receiving new versions. Wire: none. +`main` no longer generates `jsr.json`, runs `deno publish`, or passes a +`JSR_TOKEN`; the same change is backported to `release`, which publishes. +Checked 2026-11-07: no `JSR_TOKEN` exists as a repository secret or in the +`npm` Environment, so no secret needs removing. + +Archiving needs the maintainer's JSR login. Archiving also ends the +repository's OIDC link, so no separate unlinking is needed. Archive only after +the backport lands, or a `release` push can still try to publish. + +Public API: none. Wire: none. + +## Waiting + +- moq-dev/moq: the `release` backport that drops JSR publishing merges; check `git grep -n deno origin/release -- js/common .github/workflows/release-js.yml` prints nothing +- Maintainer: archive each `@moq` package on jsr.io (agents have no JSR login, and JSR offers no archive API for tokenless callers). For each of `auth`, `binary`, `boy`, `flate`, `hang`, `json`, `loc`, `msf`, `net`, `pattern`, `publish`, `room`, `signals`, `token`, `watch`: open `https://jsr.io/@moq//settings`, set the description to `Moved to npm: https://www.npmjs.com/package/@moq/`, then click "Archive package". `boy`, `publish`, and `watch` never published a version, so deleting them from the same page also works (recommended: archive all 15 for one uniform state). Check with `curl -s https://api.jsr.io/scopes/moq/packages | jq '[.items[] | select(.isArchived | not) | .name]'` printing `[]` ## Related diff --git a/quest/m3/audit-ci.md b/quest/m3/audit-ci.md index 37cebdf2d75..bb90fa72aa6 100644 --- a/quest/m3/audit-ci.md +++ b/quest/m3/audit-ci.md @@ -227,7 +227,7 @@ release credentials remain under the existing publisher-environment work above. | [release-gate](/.github/workflows/release-gate.yml) | Keep: complete release PR admission, including callable platform lanes | Caller gate/alert and release artifacts | [D 2026-11-02](https://github.com/moq-dev/moq/actions/runs/41376436029) ARM 0.2, Windows 6.5, macOS 4.4 | | [release-go-ffi](/.github/workflows/release-go-ffi.yml) | Keep: Go native FFI artifacts | Caller gate/alert and release artifacts | [N](https://github.com/moq-dev/moq/actions/runs/41313466339) Linux 1.0 | | [release-go](/.github/workflows/release-go.yml) | Keep: Go wrapper publication | Caller gate/alert and release artifacts | [D 2026-10-31](https://github.com/moq-dev/moq/actions/runs/41182420464) Linux 1.4 | -| [release-js](/.github/workflows/release-js.yml) | Keep: npm/JSR packages and exports | Caller gate/alert and release artifacts | [N](https://github.com/moq-dev/moq/actions/runs/41313466339) Linux 6.0 | +| [release-js](/.github/workflows/release-js.yml) | Keep: npm packages and exports | Caller gate/alert and release artifacts | [N](https://github.com/moq-dev/moq/actions/runs/41313466339) Linux 6.0 | | [release-kt-ffi](/.github/workflows/release-kt-ffi.yml) | Keep: Kotlin native FFI artifacts | Caller gate/alert and release artifacts | [N](https://github.com/moq-dev/moq/actions/runs/41313466339) Linux 1.7 | | [release-kt-lib](/.github/workflows/release-kt-lib.yml) | Keep: Kotlin wrapper artifacts | Caller gate/alert and release artifacts | [N](https://github.com/moq-dev/moq/actions/runs/41313466339) Linux 11.1 | | [release-nix](/.github/workflows/release-nix.yml) | Keep: Nix release evaluation/publication | Caller gate/alert and release artifacts | No completed direct sample in fetched page | From 85840e8c06d2d06918486c2095d39ffbd9bbba17 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 6 Nov 2026 20:47:45 -0800 Subject: [PATCH 3/3] chore: drop the blank line left by the jsr.json ignore removal Co-Authored-By: Claude Opus 5.5 --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 37f44777ebf..40cdb83c8f7 100644 --- a/.gitignore +++ b/.gitignore @@ -73,6 +73,5 @@ __pycache__/ # installs of the py/moq-ffi package. /py/moq-ffi/moq_ffi/_uniffi/ - # msys/cygwin crash dumps, from running the shell scripts on Windows. *.stackdump