Skip to content

feat: auto-configure .npmrc for private beta packages#19

Merged
ABujalance merged 3 commits into
mainfrom
feat/npm-credentials
Jun 16, 2026
Merged

feat: auto-configure .npmrc for private beta packages#19
ABujalance merged 3 commits into
mainfrom
feat/npm-credentials

Conversation

@ABujalance

Copy link
Copy Markdown
Contributor

Makes thatopen create --beta set up authenticated access to the private @thatopen-platform/*-beta packages automatically, instead of telling users to configure an npm token by hand.

Changes

  • EngineServicesClient.getNpmCredentials() — fetches the read-only Founders token from GET /api/npm-registry/credentials (gated to FOUNDING members; non-Founding accounts get a 403).
  • setupNpmrc() helper writes the returned .npmrc. create --beta runs it before npm install; login refreshes it inside a beta project so a rotated token propagates.
  • .npmrc added to the scaffold .gitignore (it carries a credential).
  • Exports the NpmCredentials type; adds a changeset.

Non-Founding members get a clear message and the scaffold still completes.

Backend counterpart: platform_backend-api#202 (the gated endpoint).

The thatopen CLI now sets up authenticated access to the private
@thatopen-platform/*-beta packages instead of asking users to configure an
npm token by hand:

- EngineServicesClient.getNpmCredentials() fetches the read-only Founders
  token from GET /api/npm-registry/credentials (gated to FOUNDING members).
- setupNpmrc() writes the returned .npmrc; create --beta runs it before
  npm install, and login refreshes it inside a beta project (token rotation).
- .npmrc added to the scaffold .gitignore (it carries a credential).

Non-Founding accounts get a clear message and the scaffold still completes.
- swap --beta now writes an authenticated .npmrc before install (was only
  printing a manual-token hint), matching create --beta.
- Extract the shared resolve-config + write-.npmrc glue into
  configureBetaNpmrc(); create and swap both use it.
- Document beta libraries in the README.
Comment thread src/cli/lib/npmrc.ts
): Promise<NpmrcResult> {
try {
const creds = await client.getNpmCredentials();
writeFileSync(join(dir, '.npmrc'), creds.npmrc, { mode: 0o600 });

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.

Should we make sure that .npmrc is included in .gitignore before entering the token here? In swap/login for existing projects, it might not be included (only the create command covers it by default), and we could end up pushing the credentials to the repo.

Addresses Sergio's review on #19: create covers .npmrc via the scaffold
template, but swap/login write into existing projects whose .gitignore we
don't own — risking a committed credential. ensureNpmrcIgnored() now adds
.npmrc to the project .gitignore (creating it if absent) at the single
write chokepoint, so all three flows are covered.
@ABujalance ABujalance merged commit 30a9034 into main Jun 16, 2026
1 check passed
@ABujalance ABujalance deleted the feat/npm-credentials branch June 16, 2026 13:52
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.

2 participants