Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: upgrade npm to 7.6.0 #37559

Closed
wants to merge 1 commit into from
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
1 change: 1 addition & 0 deletions deps/npm/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ node_modules/npm-registry-mock

# don't need these in the npm package.
html/*.png
docs/nav.yml

# don't ignore .npmignore files
# these are used in some tests.
Expand Down
2 changes: 2 additions & 0 deletions deps/npm/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -753,3 +753,5 @@ Alexander Riccio <[email protected]>
RA80533 <[email protected]>
Ikko Ashimine <[email protected]>
MrBrain295 <[email protected]>
kumavis <[email protected]>
Christof Lemke <[email protected]>
35 changes: 34 additions & 1 deletion deps/npm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@
## v7.5.6 (2021-02-22
## v7.6.0 (2021-02-25)

### FEATURES

* [`983d218f7`](https://github.com/npm/cli/commit/983d218f7e68e3c7866f2efa23ea2aff7ff3881e)
[#2750](https://github.com/npm/cli/issues/2750)
feat(explain): mark when dependency is bundled
([@kumavis](https://github.com/kumavis))

### DEPENDENCIES

* [`b9fa7e32a`](https://github.com/npm/cli/commit/b9fa7e32a63a3dc3a4865865c4ca737c862b9cf2)
chore(package-lock): resetdeps and `[email protected]`
([@wraithgar](https://github.com/wraithgar))
* [`28d036ae9`](https://github.com/npm/cli/commit/28d036ae9179f742bd0518e558a54f014a7a895e)
`[email protected]`
* fix: hidden lockfiles were not respected on Node v10.0-10.12

### DOCUMENTATION

* [`ba1adef42`](https://github.com/npm/cli/commit/ba1adef4292123e87e26b59e0c6fd6f5ff1fe775)
[#2760](https://github.com/npm/cli/issues/2760)
chore(docs): capitalize all Instaces of "package"
([@MrBrain295](https://github.com/MrBrain295))
* [`8bfa05fa1`](https://github.com/npm/cli/commit/8bfa05fa1dfd4a64381c7ec750df6d174724e8c1)
[#2775](https://github.com/npm/cli/issues/2775)
chore(docs): add navigation configuration
([@ethomson](https://github.com/ethomson))
* [`238e474a4`](https://github.com/npm/cli/commit/238e474a48ddecc33c76eb3d2c4d0642cfe8829a)
[#2778](https://github.com/npm/cli/issues/2778)
chore(docs):update unpublish cooldown
([@christoflemke](https://github.com/christoflemke))

## v7.5.6 (2021-02-22)

### BUG FIXES

Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/content/commands/npm-unpublish.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ versions then the registry will remove the root package entry entirely.
Even if you unpublish a package version, that specific name and version
combination can never be reused. In order to publish the package again,
you must use a new version number. If you unpublish the entire package,
you may not publish any new versions of that package until 24 hours have
you may not publish any new versions of that package until 28 days have
passed.

### See Also
Expand Down
4 changes: 2 additions & 2 deletions deps/npm/docs/content/using-npm/developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ You can use `npm init` in the root of your package in order to get you
started with a pretty basic package.json file. See [`npm
init`](/commands/npm-init) for more info.

### Keeping files *out* of your package
### Keeping files *out* of your Package

Use a `.npmignore` file to keep stuff out of your package. If there's no
`.npmignore` file, but there *is* a `.gitignore` file, then npm will ignore
Expand Down Expand Up @@ -210,7 +210,7 @@ and then follow the prompts.

This is documented better in [npm adduser](/commands/npm-adduser).

### Publish your package
### Publish your Package

This part's easy. In the root of your folder, do this:

Expand Down
97 changes: 91 additions & 6 deletions deps/npm/docs/dockhand.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ const template = fs.readFileSync('template.html').toString();

const run = async function() {
try {
await walk(inputRoot);
const navPaths = await getNavigationPaths();
const fsPaths = await renderFilesystemPaths();

if (!ensureNavigationComplete(navPaths, fsPaths)) {
process.exit(1);
}
}
catch (error) {
console.error(error);
Expand All @@ -28,7 +33,85 @@ const run = async function() {

run();

async function walk(root, dirRelative) {
function ensureNavigationComplete(navPaths, fsPaths) {
const unmatchedNav = { }, unmatchedFs = { };

for (const navPath of navPaths) {
unmatchedNav[navPath] = true;
}

for (let fsPath of fsPaths) {
fsPath = '/' + fsPath.replace(/\.md$/, "");

if (unmatchedNav[fsPath]) {
delete unmatchedNav[fsPath];
}
else {
unmatchedFs[fsPath] = true;
}
}

const missingNav = Object.keys(unmatchedNav).sort();
const missingFs = Object.keys(unmatchedFs).sort()

if (missingNav.length > 0 || missingFs.length > 0) {
let message = "Error: documentation navigation (nav.yml) does not match filesystem.\n";

if (missingNav.length > 0) {
message += "\nThe following path(s) exist on disk but are not present in nav.yml:\n\n";

for (const nav of missingNav) {
message += ` ${nav}\n`;
}
}

if (missingNav.length > 0 && missingFs.length > 0) {
message += "\nThe following path(s) exist in nav.yml but are not present on disk:\n\n";

for (const fs of missingFs) {
message += ` ${fs}\n`;
}
}

message += "\nUpdate nav.yml to ensure that all files are listed in the appropriate place.";

console.error(message);

return false;
}

return true;
}

function getNavigationPaths() {
const navFilename = path.join(docsRoot, 'nav.yml');
const nav = yaml.parse(fs.readFileSync(navFilename).toString(), 'utf8');

return walkNavigation(nav);
}

function walkNavigation(entries) {
const paths = [ ]

for (const entry of entries) {
if (entry.children) {
paths.push(... walkNavigation(entry.children));
}
else {
paths.push(entry.url);
}
}

return paths;
}

async function renderFilesystemPaths() {
return await walkFilesystem(inputRoot);
}

async function walkFilesystem(root, dirRelative) {
const paths = [ ]

const dirPath = dirRelative ? path.join(root, dirRelative) : root;
const children = fs.readdirSync(dirPath);

Expand All @@ -37,15 +120,18 @@ async function walk(root, dirRelative) {
const childPath = path.join(root, childRelative);

if (fs.lstatSync(childPath).isDirectory()) {
await walk(root, childRelative);
paths.push(... await walkFilesystem(root, childRelative));
}
else {
await translate(childRelative);
await renderFile(childRelative);
paths.push(childRelative);
}
}

return paths;
}

async function translate(childPath) {
async function renderFile(childPath) {
const inputPath = path.join(inputRoot, childPath);

if (!inputPath.match(/\.md$/)) {
Expand Down Expand Up @@ -119,7 +205,6 @@ async function translate(childPath) {
console.log(`warning: unknown token '${token}' in ${inputPath}`);
return '';
}
console.log(key);
return key;
});

Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-ls.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ <h3 id="description">Description</h3>
the results to only the paths to the packages named. Note that nested
packages will <em>also</em> show the paths to the specified packages. For
example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
<pre lang="bash"><code>npm@7.5.6 /path/to/npm
<pre lang="bash"><code>npm@7.6.0 /path/to/npm
└─┬ [email protected]
└── [email protected]
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-unpublish.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ <h3 id="description">Description</h3>
<p>Even if you unpublish a package version, that specific name and version
combination can never be reused. In order to publish the package again,
you must use a new version number. If you unpublish the entire package,
you may not publish any new versions of that package until 24 hours have
you may not publish any new versions of that package until 28 days have
passed.</p>
<h3 id="see-also">See Also</h3>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h2 id="table-of-contents">Table of contents</h2>
<pre lang="bash"><code>npm &lt;command&gt; [args]
</code></pre>
<h3 id="version">Version</h3>
<p>7.5.6</p>
<p>7.6.0</p>
<h3 id="description">Description</h3>
<p>npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency
Expand Down
6 changes: 3 additions & 3 deletions deps/npm/docs/output/using-npm/developers.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ <h1 id="developers">developers</h1>

<section id="table_of_contents">
<h2 id="table-of-contents">Table of contents</h2>
<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#about-these-documents">About These Documents</a></li><li><a href="#what-is-a-package">What is a Package</a></li><li><a href="#the-packagejson-file">The package.json File</a></li><li><a href="#keeping-files-out-of-your-package">Keeping files <em>out</em> of your package</a></li><ul><li><a href="#testing-whether-your-npmignore-or-files-config-works">Testing whether your <code>.npmignore</code> or <code>files</code> config works</a></li></ul><li><a href="#link-packages">Link Packages</a></li><li><a href="#before-publishing-make-sure-your-package-installs-and-works">Before Publishing: Make Sure Your Package Installs and Works</a></li><li><a href="#create-a-user-account">Create a User Account</a></li><li><a href="#publish-your-package">Publish your package</a></li><li><a href="#brag-about-it">Brag about it</a></li><li><a href="#see-also">See also</a></li></ul></div>
<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#about-these-documents">About These Documents</a></li><li><a href="#what-is-a-package">What is a Package</a></li><li><a href="#the-packagejson-file">The package.json File</a></li><li><a href="#keeping-files-out-of-your-package">Keeping files <em>out</em> of your Package</a></li><ul><li><a href="#testing-whether-your-npmignore-or-files-config-works">Testing whether your <code>.npmignore</code> or <code>files</code> config works</a></li></ul><li><a href="#link-packages">Link Packages</a></li><li><a href="#before-publishing-make-sure-your-package-installs-and-works">Before Publishing: Make Sure Your Package Installs and Works</a></li><li><a href="#create-a-user-account">Create a User Account</a></li><li><a href="#publish-your-package">Publish your Package</a></li><li><a href="#brag-about-it">Brag about it</a></li><li><a href="#see-also">See also</a></li></ul></div>
</section>

<div id="_content"><h3 id="description">Description</h3>
Expand Down Expand Up @@ -223,7 +223,7 @@ <h3 id="the-packagejson-file">The package.json File</h3>
</ul>
<p>You can use <code>npm init</code> in the root of your package in order to get you
started with a pretty basic package.json file. See <a href="../commands/npm-init.html"><code>npm init</code></a> for more info.</p>
<h3 id="keeping-files-out-of-your-package">Keeping files <em>out</em> of your package</h3>
<h3 id="keeping-files-out-of-your-package">Keeping files <em>out</em> of your Package</h3>
<p>Use a <code>.npmignore</code> file to keep stuff out of your package. If there’s no
<code>.npmignore</code> file, but there <em>is</em> a <code>.gitignore</code> file, then npm will ignore
the stuff matched by the <code>.gitignore</code> file. If you <em>want</em> to include
Expand Down Expand Up @@ -310,7 +310,7 @@ <h3 id="create-a-user-account">Create a User Account</h3>
</code></pre>
<p>and then follow the prompts.</p>
<p>This is documented better in <a href="../commands/npm-adduser.html">npm adduser</a>.</p>
<h3 id="publish-your-package">Publish your package</h3>
<h3 id="publish-your-package">Publish your Package</h3>
<p>This part’s easy. In the root of your folder, do this:</p>
<pre lang="bash"><code>npm publish
</code></pre>
Expand Down
14 changes: 7 additions & 7 deletions deps/npm/lib/access.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ const access = async ([cmd, ...args], cb) => {
return fn(args, { ...npm.flatOptions })
}

const completion = function (opts, cb) {
var argv = opts.conf.argv.remain
const completion = async (opts) => {
const argv = opts.conf.argv.remain
if (argv.length === 2)
return cb(null, subcommands)
return subcommands

switch (argv[2]) {
case 'grant':
if (argv.length === 3)
return cb(null, ['read-only', 'read-write'])
return ['read-only', 'read-write']
else
return cb(null, [])
return []

case 'public':
case 'restricted':
Expand All @@ -79,9 +79,9 @@ const completion = function (opts, cb) {
case '2fa-required':
case '2fa-not-required':
case 'revoke':
return cb(null, [])
return []
default:
return cb(new Error(argv[2] + ' not recognized'))
throw new Error(argv[2] + ' not recognized')
}
}

Expand Down
4 changes: 1 addition & 3 deletions deps/npm/lib/adduser.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ const usage = usageUtil(
'npm adduser [--registry=url] [--scope=@orgname] [--always-auth]'
)

const completion = require('./utils/completion/none.js')

const cmd = (args, cb) => adduser(args).then(() => cb()).catch(cb)

const getRegistry = ({ scope, registry }) => {
Expand Down Expand Up @@ -74,4 +72,4 @@ const adduser = async (args) => {
output(message)
}

module.exports = Object.assign(cmd, { completion, usage })
module.exports = Object.assign(cmd, { usage })
8 changes: 4 additions & 4 deletions deps/npm/lib/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ const usage = usageUtil(
'[--force|--package-lock-only|--dry-run|--production|--only=(dev|prod)]'
)

const completion = (opts, cb) => {
const completion = async (opts) => {
const argv = opts.conf.argv.remain

if (argv.length === 2)
return cb(null, ['fix'])
return ['fix']

switch (argv[2]) {
case 'fix':
return cb(null, [])
return []
default:
return cb(new Error(argv[2] + ' not recognized'))
throw new Error(argv[2] + ' not recognized')
}
}

Expand Down
3 changes: 1 addition & 2 deletions deps/npm/lib/bin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const npm = require('./npm.js')
const output = require('./utils/output.js')
const usageUtil = require('./utils/usage.js')
const completion = require('./utils/completion/none.js')
const PATH = require('./utils/path.js')
const cmd = (args, cb) => bin(args).then(() => cb()).catch(cb)
const usage = usageUtil('bin', 'npm bin [-g]')
Expand All @@ -11,4 +10,4 @@ const bin = async (args, cb) => {
if (npm.flatOptions.global && !PATH.includes(b))
console.error('(not in PATH env variable)')
}
module.exports = Object.assign(cmd, { usage, completion })
module.exports = Object.assign(cmd, { usage })
3 changes: 1 addition & 2 deletions deps/npm/lib/bugs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const npm = require('./npm.js')
const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js')

const usage = usageUtil('bugs', 'npm bugs [<pkgname>]')
const completion = require('./utils/completion/none.js')

const cmd = (args, cb) => bugs(args).then(() => cb()).catch(cb)

Expand Down Expand Up @@ -44,4 +43,4 @@ const getBugs = async pkg => {
await openUrl(url, `${mani.name} bug list available at the following URL`)
}

module.exports = Object.assign(cmd, { usage, completion })
module.exports = Object.assign(cmd, { usage })
6 changes: 3 additions & 3 deletions deps/npm/lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ const usage = usageUtil('cache',
'\nnpm cache verify'
)

const completion = (opts, cb) => {
const completion = async (opts) => {
const argv = opts.conf.argv.remain
if (argv.length === 2)
return cb(null, ['add', 'clean', 'verify'])
return ['add', 'clean', 'verify']

// TODO - eventually...
switch (argv[2]) {
case 'verify':
case 'clean':
case 'add':
return cb(null, [])
return []
}
}

Expand Down
3 changes: 1 addition & 2 deletions deps/npm/lib/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const npm = require('./npm.js')
const usageUtil = require('./utils/usage.js')

const usage = usageUtil('ci', 'npm ci')
const completion = require('./utils/completion/none.js')

const cmd = (args, cb) => ci().then(() => cb()).catch(cb)

Expand Down Expand Up @@ -76,4 +75,4 @@ const ci = async () => {
await reifyFinish(arb)
}

module.exports = Object.assign(cmd, { completion, usage })
module.exports = Object.assign(cmd, {usage})
Loading