diff options
Diffstat (limited to 'deps/npm/docs')
-rw-r--r-- | deps/npm/docs/content/commands/npm-unpublish.md | 2 | ||||
-rw-r--r-- | deps/npm/docs/content/using-npm/developers.md | 4 | ||||
-rw-r--r-- | deps/npm/docs/dockhand.js | 97 | ||||
-rw-r--r-- | deps/npm/docs/output/commands/npm-ls.html | 2 | ||||
-rw-r--r-- | deps/npm/docs/output/commands/npm-unpublish.html | 2 | ||||
-rw-r--r-- | deps/npm/docs/output/commands/npm.html | 2 | ||||
-rw-r--r-- | deps/npm/docs/output/using-npm/developers.html | 6 |
7 files changed, 100 insertions, 15 deletions
diff --git a/deps/npm/docs/content/commands/npm-unpublish.md b/deps/npm/docs/content/commands/npm-unpublish.md index e9d6e9045c6..14813e94341 100644 --- a/deps/npm/docs/content/commands/npm-unpublish.md +++ b/deps/npm/docs/content/commands/npm-unpublish.md @@ -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 diff --git a/deps/npm/docs/content/using-npm/developers.md b/deps/npm/docs/content/using-npm/developers.md index 627ce7c7073..a76808ca675 100644 --- a/deps/npm/docs/content/using-npm/developers.md +++ b/deps/npm/docs/content/using-npm/developers.md @@ -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 @@ -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: diff --git a/deps/npm/docs/dockhand.js b/deps/npm/docs/dockhand.js index ae68e3fbb83..7f2c90dae9b 100644 --- a/deps/npm/docs/dockhand.js +++ b/deps/npm/docs/dockhand.js @@ -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); @@ -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); @@ -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$/)) { @@ -119,7 +205,6 @@ async function translate(childPath) { console.log(`warning: unknown token '${token}' in ${inputPath}`); return ''; } - console.log(key); return key; }); diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index f4cfc919c07..aaa6f3ea28c 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -159,7 +159,7 @@ tree at all, use <a href="../commands/npm-explain.html"><code>npm explain</code> 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> diff --git a/deps/npm/docs/output/commands/npm-unpublish.html b/deps/npm/docs/output/commands/npm-unpublish.html index 75751d3408c..3ec254a109d 100644 --- a/deps/npm/docs/output/commands/npm-unpublish.html +++ b/deps/npm/docs/output/commands/npm-unpublish.html @@ -166,7 +166,7 @@ versions then the registry will remove the root package entry entirely.</p> <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> diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index 9cc6b055db0..610396038ca 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -148,7 +148,7 @@ npm command-line interface <pre lang="bash"><code>npm <command> [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 diff --git a/deps/npm/docs/output/using-npm/developers.html b/deps/npm/docs/output/using-npm/developers.html index 25d6ae8fa1e..7553ac5a673 100644 --- a/deps/npm/docs/output/using-npm/developers.html +++ b/deps/npm/docs/output/using-npm/developers.html @@ -141,7 +141,7 @@ npm command-line interface <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> @@ -223,7 +223,7 @@ full of man pages, they’ll get installed just like these ones.</p> </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 @@ -310,7 +310,7 @@ bring in your module’s main module.</p> </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> |