Skip to content

fix(multipublish): publish gitignored build output to jsr and fail on errors - #354

Merged
stephansama merged 2 commits into
mainfrom
fix/multipublish-jsr-publish
Nov 16, 2026
Merged

stephansama merged 2 commits into
mainfrom
fix/multipublish-jsr-publish

Conversation

@stephansama

Copy link
Copy Markdown
Owner

Problem

JSR publishing has been failing on every release, and CI has stayed green. JSR has 2 versions of multipublish, ending at 1.0.10 (npm is on 1.0.15). pnpm-hooks, auto-readme and find-floating-deps have never been published there. From the last release run (#353):

error[excluded-module]: module in package's module graph was excluded from publishing
 --> core/find-floating-deps/dist/cli.mjs
  = hint: … use 'publish.exclude' with a negative glob to unexclude from gitignore
error: Found 6 problems
…
✅ Published package @stephansama/pnpm-hooks@0.2.0   ← GitHub Packages, step exits 0

Two bugs:

  1. Gitignored build output is excluded. dist/ is gitignored, and Deno only un-ignores files through negated globs in publish.exclude. multipublish wrote defaultExclude to the top-level exclude, where negations don't apply. So the README's own defaultExclude: ["!dist"] example, and this repo's !config, never had any effect. The likely trigger for the recent failures is that pnpm dlx jsr isn't pinned and now pulls a stricter Deno (v2.6.7), but I haven't confirmed that.
  2. Failures are swallowed. utilities.chdir caught every error and only logged it, so the CLI exited 0.

Fix

JSR config (jsr.ts):

  • includeExportDirectories adds !<dir> to publish.exclude for every directory exports point into (!dist for ./dist/index.mjs). JSR says an excluded export target fails at runtime anyway, so this is always safe.
  • defaultInclude / defaultExclude now go to publish.include / publish.exclude.
  • jsrSchema keeps a user's publish block instead of stripping it.

Errors (utilities.ts, publish.ts, index.ts, cli.ts):

  • chdir rethrows, and the cleanup (jsr.json, package.json, .npmrc) runs in finally.
  • run still attempts every platform and package, so a JSR outage doesn't block GitHub Packages, then throws a PublishError listing what failed. The CLI prints it and exits 1.
  • Publish errors are jsr publish failed for <name> (exit code 1). The original execSync error repeated the whole command, --token included.
  • An unscoped package with the .npmrc strategy now throws instead of returning silently.

Verification

  • 50 tests pass (13 new). Lint, typecheck and build (attw, publint) pass, and the API snapshot is updated for the new PublishError export.
  • I dry-ran the built CLI with the JSON the release job pipes in, with GITHUB_TOKEN unset so the npm step fails on purpose:
$ echo '[{"name":"@stephansama/pnpm-hooks","version":"0.2.0"}]' | node core/multipublish/dist/cli.mjs --dry
Success Dry run complete
✖ @stephansama/pnpm-hooks (npm): no auth token provided. please use an auth token with npmrc strategy
1 publish failed: @stephansama/pnpm-hooks (npm)
exit code: 1

The same dry run for find-floating-deps also succeeds on JSR. Before the fix, both failed with excluded-module.

Heads up

  • The release job can go red after merge. Publish failures now fail the job; that's the point of this PR, but it's a change.
  • New JSR packages may need creating first. The first JSR publish of pnpm-hooks, auto-readme and find-floating-deps may require creating each package on jsr.io. I haven't confirmed this.
  • Not changed here:
    • The cleanup can't restore a tracked package.json after experimentalUpdateCatalogs rewrites it. Harmless in CI, but it leaves local runs dirty.
    • pnpm dlx jsr isn't pinned.
    • The "workflow file issue" failures on the changesets release PR are a separate problem.

Checklist

  • Latest changes from main have been merged
  • Conflicts have been resolved
  • The branch is pointing to main
  • ESLint hasn't reported any issues
  • All unit tests pass
  • README updated and a patch changeset included

🤖 Generated with Claude Code

… errors

JSR publishes have been failing on every release with `excluded-module`:
build output in `dist/` is gitignored, and deno only un-ignores files
through negated globs in `publish.exclude`. multipublish wrote
`defaultExclude` to the top-level `exclude`, where `!dist` is ignored.

- add `!<dir>` to `publish.exclude` for every directory `exports` point into
- write `defaultInclude` / `defaultExclude` to `publish.include` / `publish.exclude`
- keep a user's `publish` block instead of stripping it in jsrSchema

The failures went unnoticed because `chdir` caught and logged every
error, so the CLI exited 0. It now rethrows; cleanup runs in `finally`;
`run` attempts every platform and package, then throws a PublishError
listing what failed, and the CLI exits 1. Publish errors no longer
include the command, which contained the JSR token. An unscoped package
with the `.npmrc` strategy now throws instead of returning silently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@netlify

netlify Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for packages-node-modules ready!

Name Link
🔨 Latest commit 686b9ea
🔍 Latest deploy log https://app.netlify.com/projects/packages-node-modules/deploys/6afb33c3d11a338c3d0a68da
😎 Deploy Preview https://deploy-preview-354--packages-node-modules.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot

changeset-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 686b9ea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stephansama/multipublish Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues. One ordering issue in the auto-added !dist globs is worth a look.

Reviewed changes

I reviewed the whole PR: fixes to how the JSR config is generated, and failures that used to be swallowed now fail the CLI. I checked the negated-glob behavior against Deno's matcher source, and the 50 multipublish tests pass locally.

  • includeExportDirectories: adds !<dir> to publish.exclude for each directory an export points into. Root-level exports like ./package.json are skipped.
  • defaultInclude / defaultExclude: these now go to publish.include / publish.exclude, and jsrSchema keeps a user's publish block.
  • execPublish: publish failures now throw <platform> publish failed for <name> (exit code N). The command, and with it the --token, no longer appears in the error. Cleanup now runs in finally.
  • chdir: callback errors are rethrown after switching back to the original directory.
  • PublishError and the CLI: run still tries every platform and package, then throws PublishError with the list of failures. The CLI prints that list and sets process.exitCode = 1.
  • Unscoped .npmrc strategy: this now throws instead of returning silently.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Comment thread core/multipublish/src/jsr.ts Resolved
@pkg-pr-new

pkg-pr-new Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@stephansama/ai-commit-msg

pnpm add https://pkg.pr.new/@stephansama/ai-commit-msg@354

@stephansama/alfred-kaomoji

pnpm add https://pkg.pr.new/@stephansama/alfred-kaomoji@354

@stephansama/astro-iconify-svgmap

pnpm add https://pkg.pr.new/@stephansama/astro-iconify-svgmap@354

@stephansama/auto-readme

pnpm add https://pkg.pr.new/@stephansama/auto-readme@354

@stephansama/catppuccin-jsonresume-theme

pnpm add https://pkg.pr.new/@stephansama/catppuccin-jsonresume-theme@354

@stephansama/catppuccin-opml

pnpm add https://pkg.pr.new/@stephansama/catppuccin-opml@354

@stephansama/catppuccin-rss

pnpm add https://pkg.pr.new/@stephansama/catppuccin-rss@354

@stephansama/catppuccin-typedoc

pnpm add https://pkg.pr.new/@stephansama/catppuccin-typedoc@354

@stephansama/catppuccin-xsl

pnpm add https://pkg.pr.new/@stephansama/catppuccin-xsl@354

@stephansama/eslint-config

pnpm add https://pkg.pr.new/@stephansama/eslint-config@354

create-stephansama-example

pnpm add https://pkg.pr.new/create-stephansama-example@354

@stephansama/find-floating-deps

pnpm add https://pkg.pr.new/@stephansama/find-floating-deps@354

@stephansama/find-makefile-targets

pnpm add https://pkg.pr.new/@stephansama/find-makefile-targets@354

@stephansama/github-env

pnpm add https://pkg.pr.new/@stephansama/github-env@354

@stephansama/inline-image

pnpm add https://pkg.pr.new/@stephansama/inline-image@354

@stephansama/monorule

pnpm add https://pkg.pr.new/@stephansama/monorule@354

@stephansama/multipublish

pnpm add https://pkg.pr.new/@stephansama/multipublish@354

@stephansama/pnpm-hooks

pnpm add https://pkg.pr.new/@stephansama/pnpm-hooks@354

@stephansama/prettier-plugin-handlebars

pnpm add https://pkg.pr.new/@stephansama/prettier-plugin-handlebars@354

@stephansama/rehype-bluesky-embed

pnpm add https://pkg.pr.new/@stephansama/rehype-bluesky-embed@354

@stephansama/remark-asciinema

pnpm add https://pkg.pr.new/@stephansama/remark-asciinema@354

@stephansama/single-file

pnpm add https://pkg.pr.new/@stephansama/single-file@354

@stephansama/svelte-social-share-links

pnpm add https://pkg.pr.new/@stephansama/svelte-social-share-links@354

@stephansama/typed-env

pnpm add https://pkg.pr.new/@stephansama/typed-env@354

@stephansama/typed-events

pnpm add https://pkg.pr.new/@stephansama/typed-events@354

@stephansama/typed-nocodb-api

pnpm add https://pkg.pr.new/@stephansama/typed-nocodb-api@354

@stephansama/typed-templates

pnpm add https://pkg.pr.new/@stephansama/typed-templates@354

@stephansama/types-github-action-env

pnpm add https://pkg.pr.new/@stephansama/types-github-action-env@354

@stephansama/types-lhci

pnpm add https://pkg.pr.new/@stephansama/types-lhci@354

@stephansama/vite-devtools-tailwind-debug-screens

pnpm add https://pkg.pr.new/@stephansama/vite-devtools-tailwind-debug-screens@354

@stephansama/vite-iconify-svgmap

pnpm add https://pkg.pr.new/@stephansama/vite-iconify-svgmap@354

commit: 686b9ea

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.48485% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
core/multipublish/src/publish.ts 96.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…cludes

jsr uses the last matching glob in `publish.exclude`, so appending `!dist`
overrode narrower user excludes inside it like `dist/*.map`. Prepend the
export directory globs instead, and leave a directory the user already
listed where it is.

Also cover the CLI exit codes and a publish error without an exit code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stephansama

Copy link
Copy Markdown
Owner Author

Addressed review feedback in 686b9ea:

  • Glob order (pullfrog): Deno uses the last matching glob in publish.exclude, so the auto-added !<dir> entries now go first, and narrower user excludes like dist/*.map still apply. A directory the user already listed keeps its position. Confirmed with a JSR dry run.
  • Coverage (Codecov): added cli.test.ts (exit 0, summary plus exit 1, rethrowing other errors) and a test for a publish error with no exit code. 55 tests pass.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. The !dist ordering issue from the last review is fixed.

Reviewed changes

Since the last review, includeExportDirectories now puts its globs first, and new tests were added. All 55 multipublish tests pass locally.

  • Prepended export-directory globs: missing !<dir> entries now go before the existing publish.exclude entries. With JSR's last-match-wins rule, narrower excludes like dist/**/*.map still apply. If !<dir> is already in the list, it stays where the user put it.
  • Added cli.test.ts: covers a clean exit, the PublishError summary with process.exitCode = 1, and rethrowing errors that aren't publish failures.
  • Added a test for errors with no exit code: checks that execPublish leaves out (exit code N) when the error has no numeric status.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@stephansama
stephansama merged commit cd89a2d into main Nov 16, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant