import type { Logger } from "webappwiz/log"; import { type Ps } from "webappwiz/system"; import { Duration } from "webappwiz/time"; import type { CheckReport } from "../step.js"; import type { GithubActions } from "./github-actions.js"; import type { Publication, Registry } from "./registry.js"; /** Pass `ps` to run `NpmRegistry`'s npm commands through a fake in tests; the real processes by default. */ export interface NpmRegistryOptions { ps?: Ps; /** * Publish as npm's trusted publishing wants it, from a CI job that npm * trusts: a plain `npm publish` that npm authorizes from the job's OIDC * identity, with no token, no login and no stage. `trusted()` makes one. */ trusted?: boolean; /** * Publish by running the generated workflow on GitHub Actions, where npm * trusts the job, instead of staging from this machine: no token, no * login and no approval. `githubActions()` makes one. */ via?: GithubActions; } /** * Use it to stage packages on npm and read back what npm holds. A stage-only * token will do, and a person approves each version on npmjs.com; npm then * scans it, typically for about five minutes, before anyone can install it. */ export declare class NpmRegistry implements Registry { readonly staged: boolean; readonly scans = true; readonly publishDeadline?: Duration; /** Set only for a `via` publish, whose run it follows. */ readonly watch?: (name: string, version: string) => Promise; /** Set only for a `via` publish, whose workflow npm has to trust. */ readonly trust?: (name: string, log: Logger) => Promise; private readonly ps; private readonly isTrusted; private readonly via?; private authed?; private saidSkip; constructor(opts?: NpmRegistryOptions); /** * `npm trust github`, run where the person can see it: npm asks them to * authenticate in a browser, even to list what a package trusts. */ private trustWorkflow; trusted(): Registry; published(name: string, version: string): Promise; deployed(name: string): Promise; publish(dir: string): Promise; /** * `npm publish` from a job npm trusts. Verbose, because a package with no * matching trusted publisher entry fails with the same 404 as a logged-out * publish, and only the verbose log says the OIDC exchange is what refused. */ private publishTrusted; page(name: string, version: string): string; /** `npm stage` arrived in npm 11.15; older CLIs die with a bare "Unknown command". */ private checkVersion; /** Runs `npm login` unless somebody is already logged in. NPM_TOKEN counts. */ private login; }