Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cli-cache.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"v8": "aa8fff11cdab94fff1a2160ee5241f5f4632e96b",
"v9": "64763a341e7aa5b456e696f956759bf9b3440dc1",
"v10": "e510f14bf6a20d67e7b37c3f25ff271d9f7a0da5",
"v11": "4b08e2ed252a18f85a360b76c7273a7aa7a994ca"
"v8": "8.19.4",
"v9": "9.9.4",
"v10": "10.9.2",
"v11": "11.3.0"
}
4 changes: 2 additions & 2 deletions cli/lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const fs = require('fs').promises
const yaml = require('yaml')
const semver = require('semver')
const pacote = require('pacote')
const extractRelease = require('./extract')
const {unpackRelease} = require('./extract')
const log = require('./log')

const DOCS_PATH = 'cli'
Expand Down Expand Up @@ -120,7 +120,7 @@ const main = async ({loglevel, releases: rawReleases, useCurrent, navPath, conte
cache?.voidOnNewKey(releases.map(v => v.id))

const updates = await Promise.all(
releases.map(r => extractRelease(r, {cache, contentPath, baseNav: navData, prerelease})),
releases.map(r => unpackRelease(r, {cache, contentPath, baseNav: navData, prerelease})),
).then(r => r.filter(Boolean))

await cache?.save()
Expand Down
10 changes: 6 additions & 4 deletions cli/lib/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ const writeChangelog = async ({release, nav, cwd, srcPath, contentPath}) => {

const unpackRelease = async (release, {cache, contentPath, baseNav, prerelease = false}) => {
if (cache) {
const sha = await gh.getCurrentSha(release.branch)
if (cache.same(release.id, sha)) {
const currentVersion = await pacote.manifest(`npm@${release.version}`).then(manifest => manifest.version)
if (cache.same(release.id, currentVersion)) {
log.info(`Skipping ${release.id} due to cache`)
return
}
cache.set(release.id, sha)
cache.set(release.id, currentVersion)
}

if (release.prerelease && !prerelease) {
Expand Down Expand Up @@ -231,4 +231,6 @@ const unpackRelease = async (release, {cache, contentPath, baseNav, prerelease =
}
}

module.exports = unpackRelease
module.exports = {
unpackRelease,
}
13 changes: 0 additions & 13 deletions cli/lib/gh.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,6 @@ const owner = 'npm'
const repo = 'cli'
const opts = {owner, repo}

const getCurrentSha = async branch => {
if (!octokit) {
const {Octokit} = await import('@octokit/rest')
octokit = new Octokit({auth: process.env.GITHUB_TOKEN})
}
const {data} = await octokit.repos.getBranch({
...opts,
branch,
})
return data.commit.sha
}

const getFile = async ({sha, ref, path}) => {
if (!octokit) {
const {Octokit} = await import('@octokit/rest')
Expand Down Expand Up @@ -69,6 +57,5 @@ const pathExists = async (ref, path) => {
module.exports = {
getFile,
pathExists,
getCurrentSha,
nwo: `${owner}/${repo}`,
}
4 changes: 0 additions & 4 deletions cli/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
return yaml.stringify(children).replace(new RegExp(`/cli/${id}/`, 'g'), '/')
}

let shaCounter = 0

Check failure on line 69 in cli/test/index.js

View workflow job for this annotation

GitHub Actions / Lint

'shaCounter' is never reassigned. Use 'const' instead

Check failure on line 69 in cli/test/index.js

View workflow job for this annotation

GitHub Actions / Lint

'shaCounter' is assigned a value but never used

Check failure on line 69 in cli/test/index.js

View workflow job for this annotation

GitHub Actions / Lint

'shaCounter' is never reassigned. Use 'const' instead

Check failure on line 69 in cli/test/index.js

View workflow job for this annotation

GitHub Actions / Lint

'shaCounter' is assigned a value but never used
const build = t.mockRequire('../lib/build', {
pacote: {
...pacote,
Expand All @@ -84,10 +84,6 @@
},
'@prettier/sync': {format: s => s},
'../lib/gh.js': {
getCurrentSha: async () => {
shaCounter = shaCounter + 1
return 'abc' + shaCounter
},
getFile: async ({ref}) => navSection(ref),
pathExists: async (ref, p) => {
if (ref.includes('v6') && p.includes('docs/lib/content')) {
Expand Down
2 changes: 2 additions & 0 deletions content/cli/v8/using-npm/registry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ You can configure npm to use any compatible registry you like, and even run your

npm's package registry implementation supports several write APIs as well, to allow for publishing packages and managing user account information.

The npm public registry is powered by a CouchDB database, of which there is a public mirror at [https://skimdb.npmjs.com/registry](https://skimdb.npmjs.com/registry).

The registry URL used is determined by the scope of the package (see [`scope`](/cli/v8/using-npm/scope). If no scope is specified, the default registry is used, which is supplied by the `registry` config parameter. See [`npm config`](/cli/v8/commands/npm-config), [`npmrc`](/cli/v8/configuring-npm/npmrc), and [`config`](/cli/v8/using-npm/config) for more on managing npm's configuration.

When the default registry is used in a package-lock or shrinkwrap is has the special meaning of "the currently configured registry". If you create a lock file while using the default registry you can switch to another registry and npm will install packages from the new registry, but if you create a lock file while using a custom registry packages will be installed from that registry even after you change to another registry.
Expand Down
2 changes: 2 additions & 0 deletions content/cli/v9/using-npm/registry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ You can configure npm to use any compatible registry you like, and even run your

npm's package registry implementation supports several write APIs as well, to allow for publishing packages and managing user account information.

The npm public registry is powered by a CouchDB database, of which there is a public mirror at [https://skimdb.npmjs.com/registry](https://skimdb.npmjs.com/registry).

The registry URL used is determined by the scope of the package (see [`scope`](/cli/v9/using-npm/scope). If no scope is specified, the default registry is used, which is supplied by the [`registry` config](/cli/v9/using-npm/config#registry) parameter. See [`npm config`](/cli/v9/commands/npm-config), [`npmrc`](/cli/v9/configuring-npm/npmrc), and [`config`](/cli/v9/using-npm/config) for more on managing npm's configuration. Authentication configuration such as auth tokens and certificates are configured specifically scoped to an individual registry. See [Auth Related Configuration](/cli/v9/configuring-npm/npmrc#auth-related-configuration)

When the default registry is used in a package-lock or shrinkwrap it has the special meaning of "the currently configured registry". If you create a lock file while using the default registry you can switch to another registry and npm will install packages from the new registry, but if you create a lock file while using a custom registry packages will be installed from that registry even after you change to another registry.
Expand Down
Loading