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 numberDiff line numberDiff 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 numberDiff line numberDiff line change
Expand Up@@ -753,3 +753,5 @@ Alexander Riccio <test35965@gmail.com>
RA80533 <32469082+RA80533@users.noreply.github.com>
Ikko Ashimine <eltociear@gmail.com>
MrBrain295 <66077254+MrBrain295@users.noreply.github.com>
kumavis <aaron@kumavis.me>
Christof Lemke <christoflemke@github.com>
35 changes: 34 additions & 1 deletion deps/npm/CHANGELOG.md
Original file line numberDiff line numberDiff 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 `eslint@7.20.0`
([@wraithgar](https://github.com/wraithgar))
* [`28d036ae9`](https://github.com/npm/cli/commit/28d036ae9179f742bd0518e558a54f014a7a895e)
`arborist@2.2.5`
* 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-unpublish.html
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
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
1 change: 1 addition & 0 deletions deps/npm/.npmignore
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff line change
Expand Up@@ -753,3 +753,5 @@ Alexander Riccio <test35965@gmail.com>
RA80533 <32469082+RA80533@users.noreply.github.com>
Ikko Ashimine <eltociear@gmail.com>
MrBrain295 <66077254+MrBrain295@users.noreply.github.com>
kumavis <aaron@kumavis.me>
Christof Lemke <christoflemke@github.com>
35 changes: 34 additions & 1 deletion deps/npm/CHANGELOG.md
Original file line numberDiff line numberDiff 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 `eslint@7.20.0`
([@wraithgar](https://github.com/wraithgar))
* [`28d036ae9`](https://github.com/npm/cli/commit/28d036ae9179f742bd0518e558a54f014a7a895e)
`arborist@2.2.5`
* 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-unpublish.html
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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
1 change: 1 addition & 0 deletions deps/npm/.npmignore
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff line change
Expand Up@@ -753,3 +753,5 @@ Alexander Riccio <test35965@gmail.com>
RA80533 <32469082+RA80533@users.noreply.github.com>
Ikko Ashimine <eltociear@gmail.com>
MrBrain295 <66077254+MrBrain295@users.noreply.github.com>
kumavis <aaron@kumavis.me>
Christof Lemke <christoflemke@github.com>
35 changes: 34 additions & 1 deletion deps/npm/CHANGELOG.md
Original file line numberDiff line numberDiff 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 `eslint@7.20.0`
([@wraithgar](https://github.com/wraithgar))
* [`28d036ae9`](https://github.com/npm/cli/commit/28d036ae9179f742bd0518e558a54f014a7a895e)
`arborist@2.2.5`
* 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-unpublish.html
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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
1 change: 1 addition & 0 deletions deps/npm/.npmignore
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff line change
Expand Up@@ -753,3 +753,5 @@ Alexander Riccio <test35965@gmail.com>
RA80533 <32469082+RA80533@users.noreply.github.com>
Ikko Ashimine <eltociear@gmail.com>
MrBrain295 <66077254+MrBrain295@users.noreply.github.com>
kumavis <aaron@kumavis.me>
Christof Lemke <christoflemke@github.com>
35 changes: 34 additions & 1 deletion deps/npm/CHANGELOG.md
Original file line numberDiff line numberDiff 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 `eslint@7.20.0`
([@wraithgar](https://github.com/wraithgar))
* [`28d036ae9`](https://github.com/npm/cli/commit/28d036ae9179f742bd0518e558a54f014a7a895e)
`arborist@2.2.5`
* 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-unpublish.html
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
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
1 change: 1 addition & 0 deletions deps/npm/.npmignore
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff line change
Expand Up@@ -753,3 +753,5 @@ Alexander Riccio <test35965@gmail.com>
RA80533 <32469082+RA80533@users.noreply.github.com>
Ikko Ashimine <eltociear@gmail.com>
MrBrain295 <66077254+MrBrain295@users.noreply.github.com>
kumavis <aaron@kumavis.me>
Christof Lemke <christoflemke@github.com>
35 changes: 34 additions & 1 deletion deps/npm/CHANGELOG.md
Original file line numberDiff line numberDiff 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 `eslint@7.20.0`
([@wraithgar](https://github.com/wraithgar))
* [`28d036ae9`](https://github.com/npm/cli/commit/28d036ae9179f742bd0518e558a54f014a7a895e)
`arborist@2.2.5`
* 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-unpublish.html
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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
1 change: 1 addition & 0 deletions deps/npm/.npmignore
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff line change
Expand Up@@ -753,3 +753,5 @@ Alexander Riccio <test35965@gmail.com>
RA80533 <32469082+RA80533@users.noreply.github.com>
Ikko Ashimine <eltociear@gmail.com>
MrBrain295 <66077254+MrBrain295@users.noreply.github.com>
kumavis <aaron@kumavis.me>
Christof Lemke <christoflemke@github.com>
35 changes: 34 additions & 1 deletion deps/npm/CHANGELOG.md
Original file line numberDiff line numberDiff 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 `eslint@7.20.0`
([@wraithgar](https://github.com/wraithgar))
* [`28d036ae9`](https://github.com/npm/cli/commit/28d036ae9179f742bd0518e558a54f014a7a895e)
`arborist@2.2.5`
* 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-unpublish.html
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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
1 change: 1 addition & 0 deletions deps/npm/.npmignore
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff line change
Expand Up@@ -753,3 +753,5 @@ Alexander Riccio <test35965@gmail.com>
RA80533 <32469082+RA80533@users.noreply.github.com>
Ikko Ashimine <eltociear@gmail.com>
MrBrain295 <66077254+MrBrain295@users.noreply.github.com>
kumavis <aaron@kumavis.me>
Christof Lemke <christoflemke@github.com>
35 changes: 34 additions & 1 deletion deps/npm/CHANGELOG.md
Original file line numberDiff line numberDiff 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 `eslint@7.20.0`
([@wraithgar](https://github.com/wraithgar))
* [`28d036ae9`](https://github.com/npm/cli/commit/28d036ae9179f742bd0518e558a54f014a7a895e)
`arborist@2.2.5`
* 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-unpublish.html
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
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
1 change: 1 addition & 0 deletions deps/npm/.npmignore
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff line change
Expand Up@@ -753,3 +753,5 @@ Alexander Riccio <test35965@gmail.com>
RA80533 <32469082+RA80533@users.noreply.github.com>
Ikko Ashimine <eltociear@gmail.com>
MrBrain295 <66077254+MrBrain295@users.noreply.github.com>
kumavis <aaron@kumavis.me>
Christof Lemke <christoflemke@github.com>
35 changes: 34 additions & 1 deletion deps/npm/CHANGELOG.md
Original file line numberDiff line numberDiff 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 `eslint@7.20.0`
([@wraithgar](https://github.com/wraithgar))
* [`28d036ae9`](https://github.com/npm/cli/commit/28d036ae9179f742bd0518e558a54f014a7a895e)
`arborist@2.2.5`
* 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-unpublish.html
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 DownExpand 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