Repository navigation
Commit 9833c69
committed
✨ Bootstrap an npm package as a real
Closes #276, and answers the bootstrap cycle #152 recorded.
Before CI can publish a package to npm, someone has to publish it once by hand.
CI authenticates with OIDC and never holds a secret, but npm only lets you
configure a trusted publisher on a package that already exists — so the first
version cannot come from CI. It cannot be the real package either: one that
declares `workspace:*` dependencies resolves its siblings from the registry at
build time, and those siblings cannot be published until this record exists.
`scripts/bootstrap-npm-package.md` publishes an empty placeholder under the
`bootstrap` dist-tag and installs the trusted publisher. The one-time password
arrives through `<Elicit>` at the point of use, so the npm commands are
non-interactive; the target package arrives as a root prop.
The document is prose that executes. Each step explains why it is necessary,
performs it, and shows the result: `npm whoami` and `npm --version` become two
reported lines, `<File>` and `<Parse>` read the npm and JSR names and confirm
they match, `<File>` writes the placeholder into a wrapping `<TempDir>`, and
every registry answer becomes a binding that a TypeScript comparison classifies
and `<If>` acts on. Terms of art are explained where they first appear — OIDC,
one-time password, `npm trust`, dist-tag, JSR — because whoever runs this does
so once and should not have to already know them. The machinery stays out of the
report: captures, classifiers and schemas render nothing, and the two writes run
`silent` so the document says what it did rather than npm saying it.
The operational sequence is one `<Output>` region, so a failing step ends the
run and nothing after it begins, while everything already rendered still
reaches the stream.
Asking the registry first is what makes the document safe to run twice. Each
half is skipped separately when it is already done, and a package with real
versions, an unexpected `bootstrap` tag, or a different trusted publisher is a
live package — treating it as a fresh one could break it for everyone installing
it, so any of those stops the run before a code is requested. npm holds one
trusted publisher per package and refuses a second, so a foreign one is reported
with the exact `npm trust revoke --id` command rather than replaced. A code is
requested only when something will actually be written.
The spec records the procedure, the operator command, what is checked, the rerun
behaviour and the refusals. It keeps npm's documented ordering without claiming
the registry enforces it: #276 observed trust being accepted for a package the
registry still 404'd, and nothing here relies on that. It also drops two claims
that are no longer true — `packages/web` carries a public identity and publish
jobs, and effection is 4.1.0 rather than a prerelease needing
`--legacy-peer-deps`.xmd run
1 parent 7819058 commit 9833c69
3 files changed
Lines changed: 1519 additions & 23 deletions
File tree
- scripts
- tests
- specs
0 commit comments