diff --git a/cli-cache.json b/cli-cache.json index f21757e7268..7935d409c51 100644 --- a/cli-cache.json +++ b/cli-cache.json @@ -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" } \ No newline at end of file diff --git a/cli/lib/build.js b/cli/lib/build.js index ae3fae9b77f..5351f78a359 100644 --- a/cli/lib/build.js +++ b/cli/lib/build.js @@ -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' @@ -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() diff --git a/cli/lib/extract.js b/cli/lib/extract.js index 4773d8d0243..260b69323ab 100644 --- a/cli/lib/extract.js +++ b/cli/lib/extract.js @@ -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) { @@ -231,4 +231,6 @@ const unpackRelease = async (release, {cache, contentPath, baseNav, prerelease = } } -module.exports = unpackRelease +module.exports = { + unpackRelease, +} diff --git a/cli/lib/gh.js b/cli/lib/gh.js index 79cd162fae1..8deb6562347 100644 --- a/cli/lib/gh.js +++ b/cli/lib/gh.js @@ -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') @@ -69,6 +57,5 @@ const pathExists = async (ref, path) => { module.exports = { getFile, pathExists, - getCurrentSha, nwo: `${owner}/${repo}`, } diff --git a/cli/test/index.js b/cli/test/index.js index 99a62ca2b13..e34a0e64a6a 100644 --- a/cli/test/index.js +++ b/cli/test/index.js @@ -84,10 +84,6 @@ const mockBuild = async (t, {releases = getReleases(), packument = {}, testdir: }, '@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')) { diff --git a/content/cli/v8/using-npm/registry.mdx b/content/cli/v8/using-npm/registry.mdx index a70c843b63a..1bd092a7bbf 100644 --- a/content/cli/v8/using-npm/registry.mdx +++ b/content/cli/v8/using-npm/registry.mdx @@ -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. diff --git a/content/cli/v9/using-npm/registry.mdx b/content/cli/v9/using-npm/registry.mdx index 63630363c26..852b240efb5 100644 --- a/content/cli/v9/using-npm/registry.mdx +++ b/content/cli/v9/using-npm/registry.mdx @@ -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.