Skip to content

feat(ui-scripts): add publish-private command for private-registry releases#2555

Merged
balzss merged 1 commit into
masterfrom
publish-to-custom-registry
May 15, 2026
Merged

feat(ui-scripts): add publish-private command for private-registry releases#2555
balzss merged 1 commit into
masterfrom
publish-to-custom-registry

Conversation

@balzss
Copy link
Copy Markdown
Contributor

@balzss balzss commented May 12, 2026

Summary

Adds pnpm run publish-private for publishing all non-private packages to an npm-compatible private registry. Used to ship pre-release builds of security fixes to selected consumers ahead of the public release.

Reads INSTUI_PRIVATE_REGISTRY and INSTUI_PRIVATE_REGISTRY_TOKEN from the environment. The existing public release path (pnpm run release, OIDC, GitHub workflows) is untouched.

Why a separate command

pnpm run release is invoked on master push and OIDC-publishes to npmjs. Overloading it would mean a mis-set env var could leak embargoed code to the public registry. A distinct command isolates the private path and its guard rails.

Safety

  • Refuses any host matching *.npmjs.org.
  • Exits 1 if either env var is missing.
  • Operator must type the registry hostname to confirm (skippable with --yes).
  • Writes a temp .npmrc for the publish subprocesses only — user/project .npmrc untouched, cleaned up in finally.
  • Publishes under dist-tag security so pnpm install won't resolve a private build by accident.
  • Skips packages whose version already exists on the target registry.
  • 500ms delay between publishes to stay under registry rate limits.

Usage

export INSTUI_PRIVATE_REGISTRY=https://<host>/<path>/
export INSTUI_PRIVATE_REGISTRY_TOKEN=<token>
pnpm run publish-private

What this PR does NOT do

  • No version bumping — handled separately.
  • No changes to the public release flow, OIDC auth, GitHub workflows, or publish.js.
  • No documentation update yet — coming once the surrounding bump-script work lands and the end-to-end flow is settled.

Test Plan

  • Smoke-tested against a real private registry — auth, tag, and versions all land correctly.
  • pnpm run publish-private --help shows the --yes flag.
  • Missing env vars and npmjs hostname both exit 1.

Draft until the version-bump PR lands and the end-to-end flow can be walked through.

@balzss balzss self-assigned this May 12, 2026
@balzss balzss requested review from joyenjoyer and matyasf May 12, 2026 12:38
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-05-15 09:50 UTC

@balzss balzss requested review from HerrTopi and removed request for joyenjoyer May 12, 2026 12:39
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

Visual regression report

No changes.

Status Count
Unchanged 32
Changed 0
New 0
Removed 0

📊 View full report

Baselines come from the visual-baselines branch. They refresh on every merge to master.

github-actions Bot pushed a commit that referenced this pull request May 12, 2026
@matyasf matyasf marked this pull request as ready for review May 14, 2026 08:47
// No --provenance: only npmjs supports it.
// No --registry flag: the temp .npmrc handles registry + auth.
],
childEnv
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would include a small delay between calling this. We ran into very inconvenient errors when calling this 80+ times without delay, the command started failing after a while (npmjs's DDOS protection?).

I suggest to add a small delay here too (we were using 500ms)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good call, adding it

PRIVATE_TAG,
'--no-git-checks'
// No --provenance: only npmjs supports it.
// No --registry flag: the temp .npmrc handles registry + auth.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I dont see this flag in the docs https://pnpm.io/cli/publish

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it's there
image

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm talking about --registry

@balzss balzss force-pushed the publish-to-custom-registry branch 2 times, most recently from 7369857 to 95c499c Compare May 15, 2026 08:29
@balzss balzss requested a review from matyasf May 15, 2026 08:29
@balzss balzss force-pushed the publish-to-custom-registry branch from 95c499c to 43aa634 Compare May 15, 2026 08:54
…leases

Adds a new `ui-scripts publish-private` command that publishes all
non-private packages to a private npm-compatible registry. Intended for
distributing fixes to a small set of consumers before a public release.

The command reads INSTUI_PRIVATE_REGISTRY and INSTUI_PRIVATE_REGISTRY_TOKEN
from the environment, refuses any npmjs.org host as a hard guard, prompts
the operator to confirm the registry hostname (skippable with --yes), and
writes an isolated .npmrc to a temp dir via NPM_CONFIG_USERCONFIG so the
user's global config is left untouched. Each package is published under the
`security` dist-tag with `--no-git-checks` and no `--provenance`.

The existing `publish` command, npm.js helpers, and release workflows are
unchanged.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@balzss balzss force-pushed the publish-to-custom-registry branch from 43aa634 to eabb624 Compare May 15, 2026 09:33
Copy link
Copy Markdown
Contributor

@HerrTopi HerrTopi left a comment

Choose a reason for hiding this comment

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

Seems good to me, giving thumbs up with cautious optimism, hope everything will work properly

@balzss balzss merged commit eefa5bd into master May 15, 2026
8 checks passed
@balzss balzss deleted the publish-to-custom-registry branch May 15, 2026 09:50
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.

3 participants