Repository navigation
Description
Forge serves npm hosted repositories (#41), but an import copies only NuGet and Docker. This builds on #642, which makes the import read its source through the format's own protocol, and adds an npm source. The format crate's upstream client already reads packuments for proxy repositories.
Source: an npm registry
The source is a registry URL, for Nexus <nexus>/repository/<name>/.
- Names: npm's protocol has no listing, so the import tries these in turn:
GET /-/v1/search, paged withfrom/size(at most 250 a page). Nexus serves it on hosted repositories since 3.7. Whether it lists every package with an emptytext, or needs one search per scope, has to be tried; Nexus 3.88 moved its search to SQL.GET /-/all, the legacy listing. Nexus still answers it for hosted repositories.- The package names or scopes the import names itself.
- Versions: from the packument (
GET /<name>, or@scope%2fnamefor a scoped package). It lists every version withdist.tarball,dist.integrity(SHA-512) anddist.shasum, each version's publish time intime, anddeprecated. - Copy:
- The tarball is downloaded and verified against
dist.integrity, then written through the hosted write path. - A version Forge already holds with the same integrity is skipped without a download.
- Tarball URLs are built from the import's URL, not taken from
dist.tarball. Like Nexus'downloadUrltoday,dist.tarballcarries the source's configured base URL, which may name a host Forge does not reach the source on.
- The tarball is downloaded and verified against
- dist-tags and deprecations:
latest,nextand the rest are set once their versions are in Forge, anddeprecatedmessages come along. A dist-tag that Forge already points at another version followson_conflict.
Acceptance criteria
- e2e against a real Nexus 3 npm hosted repository: scoped and unscoped packages, prereleases, dist-tags and a deprecated version arrive, and
npm installfrom Forge works afterwards. - e2e against a second registry: Verdaccio (
mirror.gcr.io/verdaccio/verdaccio) or another Forge. - Publish times come from
time, and a re-run copies only what is new. - The web UI offers the import on npm hosted repositories, and the docs describe the npm source. Changelog fragment:
feature.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity