deps: upgrade npm to 7.9.0
PR-URL: https://github.com/nodejs/node/pull/38156 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
7e516aaac0
commit
c748668704
19
deps/npm/CHANGELOG.md
vendored
19
deps/npm/CHANGELOG.md
vendored
@ -1,4 +1,23 @@
|
|||||||
|
## v7.9.0 (2021-04-08)
|
||||||
|
|
||||||
|
### FEATURES
|
||||||
|
|
||||||
|
* [`1f3e88eba`](https://github.com/npm/cli/commit/1f3e88ebaf4901d8f9f07b43404d824fef7e5ff5)
|
||||||
|
[#3032](https://github.com/npm/cli/issues/3032)
|
||||||
|
feat(dist-tag): add workspace support
|
||||||
|
([@nlf](https://github.com/nlf))
|
||||||
|
* [`6e31df4e7`](https://github.com/npm/cli/commit/6e31df4e7957337962fd3d93e495931e3592bb9e)
|
||||||
|
[#3033](https://github.com/npm/cli/issues/3033)
|
||||||
|
feat(pack): add workspace support
|
||||||
|
([@wraithgar](https://github.com/wraithgar))
|
||||||
|
|
||||||
|
### DEPENDENCIES
|
||||||
|
|
||||||
|
* [`ba4f7fea8`](https://github.com/npm/cli/commit/ba4f7fea8fca8e3509469a218f094fe69095888b)
|
||||||
|
`licensee@8.2.0`
|
||||||
|
|
||||||
## v7.8.0 (2021-04-01)
|
## v7.8.0 (2021-04-01)
|
||||||
|
|
||||||
### FEATURES
|
### FEATURES
|
||||||
|
|
||||||
|
|
||||||
|
12
deps/npm/docs/content/commands/npm-dist-tag.md
vendored
12
deps/npm/docs/content/commands/npm-dist-tag.md
vendored
@ -88,6 +88,18 @@ semver as `>=1.4.0 <1.5.0`. See <https://github.com/npm/npm/issues/6082>.
|
|||||||
The simplest way to avoid semver problems with tags is to use tags that do
|
The simplest way to avoid semver problems with tags is to use tags that do
|
||||||
not begin with a number or the letter `v`.
|
not begin with a number or the letter `v`.
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
#### workspaces
|
||||||
|
|
||||||
|
Only supported by `ls`. Enables listing dist-tags of all workspace
|
||||||
|
contexts defined in the current `package.json`.
|
||||||
|
|
||||||
|
#### workspace
|
||||||
|
|
||||||
|
Only supported by `ls`. Enables listing dist-tags of workspace contexts
|
||||||
|
limiting results to only those specified by this config item.
|
||||||
|
|
||||||
### See Also
|
### See Also
|
||||||
|
|
||||||
* [npm publish](/commands/npm-publish)
|
* [npm publish](/commands/npm-publish)
|
||||||
|
23
deps/npm/docs/content/commands/npm-pack.md
vendored
23
deps/npm/docs/content/commands/npm-pack.md
vendored
@ -10,6 +10,25 @@ description: Create a tarball from a package
|
|||||||
npm pack [[<@scope>/]<pkg>...] [--dry-run]
|
npm pack [[<@scope>/]<pkg>...] [--dry-run]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
#### dry-run
|
||||||
|
|
||||||
|
Do everything that pack usually does without actually packing anything.
|
||||||
|
That is, report on what would have gone into the tarball, but nothing
|
||||||
|
else.
|
||||||
|
|
||||||
|
#### workspaces
|
||||||
|
|
||||||
|
Enables workspaces context while creating tarballs. Tarballs for each
|
||||||
|
workspaces will be generated.
|
||||||
|
|
||||||
|
#### workspace
|
||||||
|
|
||||||
|
Enables workspaces context and limits results to only those specified by
|
||||||
|
this config item. Tarballs will only be generated for the packages
|
||||||
|
named in the workspaces given here.
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
For anything that's installable (that is, a package folder, tarball,
|
For anything that's installable (that is, a package folder, tarball,
|
||||||
@ -23,10 +42,6 @@ overwritten the second time.
|
|||||||
|
|
||||||
If no arguments are supplied, then npm packs the current package folder.
|
If no arguments are supplied, then npm packs the current package folder.
|
||||||
|
|
||||||
The `--dry-run` argument will do everything that pack usually does without
|
|
||||||
actually packing anything. That is, it reports on what would have gone
|
|
||||||
into the tarball, but nothing else.
|
|
||||||
|
|
||||||
### See Also
|
### See Also
|
||||||
|
|
||||||
* [npm-packlist package](http://npm.im/npm-packlist)
|
* [npm-packlist package](http://npm.im/npm-packlist)
|
||||||
|
@ -141,7 +141,7 @@ npm command-line interface
|
|||||||
|
|
||||||
<section id="table_of_contents">
|
<section id="table_of_contents">
|
||||||
<h2 id="table-of-contents">Table of contents</h2>
|
<h2 id="table-of-contents">Table of contents</h2>
|
||||||
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#purpose">Purpose</a></li><li><a href="#caveats">Caveats</a></li><li><a href="#see-also">See Also</a></li></ul></div>
|
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#purpose">Purpose</a></li><li><a href="#caveats">Caveats</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#workspaces">workspaces</a></li><li><a href="#workspace">workspace</a></li></ul><li><a href="#see-also">See Also</a></li></ul></div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div id="_content"><h3 id="synopsis">Synopsis</h3>
|
<div id="_content"><h3 id="synopsis">Synopsis</h3>
|
||||||
@ -208,6 +208,13 @@ example, <code>v1.4</code> cannot be used as a tag, because it is interpreted by
|
|||||||
semver as <code>>=1.4.0 <1.5.0</code>. See <a href="https://github.com/npm/npm/issues/6082">https://github.com/npm/npm/issues/6082</a>.</p>
|
semver as <code>>=1.4.0 <1.5.0</code>. See <a href="https://github.com/npm/npm/issues/6082">https://github.com/npm/npm/issues/6082</a>.</p>
|
||||||
<p>The simplest way to avoid semver problems with tags is to use tags that do
|
<p>The simplest way to avoid semver problems with tags is to use tags that do
|
||||||
not begin with a number or the letter <code>v</code>.</p>
|
not begin with a number or the letter <code>v</code>.</p>
|
||||||
|
<h3 id="configuration">Configuration</h3>
|
||||||
|
<h4 id="workspaces">workspaces</h4>
|
||||||
|
<p>Only supported by <code>ls</code>. Enables listing dist-tags of all workspace
|
||||||
|
contexts defined in the current <code>package.json</code>.</p>
|
||||||
|
<h4 id="workspace">workspace</h4>
|
||||||
|
<p>Only supported by <code>ls</code>. Enables listing dist-tags of workspace contexts
|
||||||
|
limiting results to only those specified by this config item.</p>
|
||||||
<h3 id="see-also">See Also</h3>
|
<h3 id="see-also">See Also</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="../commands/npm-publish.html">npm publish</a></li>
|
<li><a href="../commands/npm-publish.html">npm publish</a></li>
|
||||||
|
2
deps/npm/docs/output/commands/npm-ls.html
vendored
2
deps/npm/docs/output/commands/npm-ls.html
vendored
@ -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
|
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
|
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>
|
example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
|
||||||
<pre lang="bash"><code>npm@7.8.0 /path/to/npm
|
<pre lang="bash"><code>npm@7.9.0 /path/to/npm
|
||||||
└─┬ init-package-json@0.0.4
|
└─┬ init-package-json@0.0.4
|
||||||
└── promzard@0.1.5
|
└── promzard@0.1.5
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
17
deps/npm/docs/output/commands/npm-pack.html
vendored
17
deps/npm/docs/output/commands/npm-pack.html
vendored
@ -141,12 +141,24 @@ npm command-line interface
|
|||||||
|
|
||||||
<section id="table_of_contents">
|
<section id="table_of_contents">
|
||||||
<h2 id="table-of-contents">Table of contents</h2>
|
<h2 id="table-of-contents">Table of contents</h2>
|
||||||
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#see-also">See Also</a></li></ul></div>
|
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#dry-run">dry-run</a></li><li><a href="#workspaces">workspaces</a></li><li><a href="#workspace">workspace</a></li></ul><li><a href="#description">Description</a></li><li><a href="#see-also">See Also</a></li></ul></div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div id="_content"><h3 id="synopsis">Synopsis</h3>
|
<div id="_content"><h3 id="synopsis">Synopsis</h3>
|
||||||
<pre lang="bash"><code>npm pack [[<@scope>/]<pkg>...] [--dry-run]
|
<pre lang="bash"><code>npm pack [[<@scope>/]<pkg>...] [--dry-run]
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
<h3 id="configuration">Configuration</h3>
|
||||||
|
<h4 id="dry-run">dry-run</h4>
|
||||||
|
<p>Do everything that pack usually does without actually packing anything.
|
||||||
|
That is, report on what would have gone into the tarball, but nothing
|
||||||
|
else.</p>
|
||||||
|
<h4 id="workspaces">workspaces</h4>
|
||||||
|
<p>Enables workspaces context while creating tarballs. Tarballs for each
|
||||||
|
workspaces will be generated.</p>
|
||||||
|
<h4 id="workspace">workspace</h4>
|
||||||
|
<p>Enables workspaces context and limits results to only those specified by
|
||||||
|
this config item. Tarballs will only be generated for the packages
|
||||||
|
named in the workspaces given here.</p>
|
||||||
<h3 id="description">Description</h3>
|
<h3 id="description">Description</h3>
|
||||||
<p>For anything that’s installable (that is, a package folder, tarball,
|
<p>For anything that’s installable (that is, a package folder, tarball,
|
||||||
tarball url, git url, name@tag, name@version, name, or scoped name), this
|
tarball url, git url, name@tag, name@version, name, or scoped name), this
|
||||||
@ -156,9 +168,6 @@ stdout.</p>
|
|||||||
<p>If the same package is specified multiple times, then the file will be
|
<p>If the same package is specified multiple times, then the file will be
|
||||||
overwritten the second time.</p>
|
overwritten the second time.</p>
|
||||||
<p>If no arguments are supplied, then npm packs the current package folder.</p>
|
<p>If no arguments are supplied, then npm packs the current package folder.</p>
|
||||||
<p>The <code>--dry-run</code> argument will do everything that pack usually does without
|
|
||||||
actually packing anything. That is, it reports on what would have gone
|
|
||||||
into the tarball, but nothing else.</p>
|
|
||||||
<h3 id="see-also">See Also</h3>
|
<h3 id="see-also">See Also</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="http://npm.im/npm-packlist">npm-packlist package</a></li>
|
<li><a href="http://npm.im/npm-packlist">npm-packlist package</a></li>
|
||||||
|
2
deps/npm/docs/output/commands/npm.html
vendored
2
deps/npm/docs/output/commands/npm.html
vendored
@ -148,7 +148,7 @@ npm command-line interface
|
|||||||
<pre lang="bash"><code>npm <command> [args]
|
<pre lang="bash"><code>npm <command> [args]
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<h3 id="version">Version</h3>
|
<h3 id="version">Version</h3>
|
||||||
<p>7.8.0</p>
|
<p>7.9.0</p>
|
||||||
<h3 id="description">Description</h3>
|
<h3 id="description">Description</h3>
|
||||||
<p>npm is the package manager for the Node JavaScript platform. It puts
|
<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
|
modules in place so that node can find them, and manages dependency
|
||||||
|
56
deps/npm/lib/dist-tag.js
vendored
56
deps/npm/lib/dist-tag.js
vendored
@ -5,6 +5,7 @@ const semver = require('semver')
|
|||||||
|
|
||||||
const otplease = require('./utils/otplease.js')
|
const otplease = require('./utils/otplease.js')
|
||||||
const readLocalPkgName = require('./utils/read-local-package.js')
|
const readLocalPkgName = require('./utils/read-local-package.js')
|
||||||
|
const getWorkspaces = require('./workspaces/get-workspaces.js')
|
||||||
const BaseCommand = require('./base-command.js')
|
const BaseCommand = require('./base-command.js')
|
||||||
|
|
||||||
class DistTag extends BaseCommand {
|
class DistTag extends BaseCommand {
|
||||||
@ -12,6 +13,11 @@ class DistTag extends BaseCommand {
|
|||||||
return 'Modify package distribution tags'
|
return 'Modify package distribution tags'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||||
|
static get params () {
|
||||||
|
return ['workspace', 'workspaces']
|
||||||
|
}
|
||||||
|
|
||||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||||
static get name () {
|
static get name () {
|
||||||
return 'dist-tag'
|
return 'dist-tag'
|
||||||
@ -43,15 +49,14 @@ class DistTag extends BaseCommand {
|
|||||||
|
|
||||||
async distTag ([cmdName, pkg, tag]) {
|
async distTag ([cmdName, pkg, tag]) {
|
||||||
const opts = this.npm.flatOptions
|
const opts = this.npm.flatOptions
|
||||||
const has = (items) => new Set(items).has(cmdName)
|
|
||||||
|
|
||||||
if (has(['add', 'a', 'set', 's']))
|
if (['add', 'a', 'set', 's'].includes(cmdName))
|
||||||
return this.add(pkg, tag, opts)
|
return this.add(pkg, tag, opts)
|
||||||
|
|
||||||
if (has(['rm', 'r', 'del', 'd', 'remove']))
|
if (['rm', 'r', 'del', 'd', 'remove'].includes(cmdName))
|
||||||
return this.remove(pkg, tag, opts)
|
return this.remove(pkg, tag, opts)
|
||||||
|
|
||||||
if (has(['ls', 'l', 'sl', 'list']))
|
if (['ls', 'l', 'sl', 'list'].includes(cmdName))
|
||||||
return this.list(pkg, opts)
|
return this.list(pkg, opts)
|
||||||
|
|
||||||
if (!pkg) {
|
if (!pkg) {
|
||||||
@ -62,6 +67,33 @@ class DistTag extends BaseCommand {
|
|||||||
throw this.usage
|
throw this.usage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
execWorkspaces (args, filters, cb) {
|
||||||
|
this.distTagWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||||
|
}
|
||||||
|
|
||||||
|
async distTagWorkspaces ([cmdName, pkg, tag], filters) {
|
||||||
|
// cmdName is some form of list
|
||||||
|
// pkg is one of:
|
||||||
|
// - unset
|
||||||
|
// - .
|
||||||
|
// - .@version
|
||||||
|
if (['ls', 'l', 'sl', 'list'].includes(cmdName) && (!pkg || pkg === '.' || /^\.@/.test(pkg)))
|
||||||
|
return this.listWorkspaces(filters)
|
||||||
|
|
||||||
|
// pkg is unset
|
||||||
|
// cmdName is one of:
|
||||||
|
// - unset
|
||||||
|
// - .
|
||||||
|
// - .@version
|
||||||
|
if (!pkg && (!cmdName || cmdName === '.' || /^\.@/.test(cmdName)))
|
||||||
|
return this.listWorkspaces(filters)
|
||||||
|
|
||||||
|
// anything else is just a regular dist-tag command
|
||||||
|
// so we fallback to the non-workspaces implementation
|
||||||
|
log.warn('Ignoring workspaces for specified package')
|
||||||
|
return this.distTag([cmdName, pkg, tag])
|
||||||
|
}
|
||||||
|
|
||||||
async add (spec, tag, opts) {
|
async add (spec, tag, opts) {
|
||||||
spec = npa(spec || '')
|
spec = npa(spec || '')
|
||||||
const version = spec.rawSpec
|
const version = spec.rawSpec
|
||||||
@ -145,6 +177,22 @@ class DistTag extends BaseCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async listWorkspaces (filters) {
|
||||||
|
const workspaces =
|
||||||
|
await getWorkspaces(filters, { path: this.npm.localPrefix })
|
||||||
|
|
||||||
|
for (const [name] of workspaces) {
|
||||||
|
try {
|
||||||
|
this.npm.output(`${name}:`)
|
||||||
|
await this.list(npa(name), this.npm.flatOptions)
|
||||||
|
} catch (err) {
|
||||||
|
// set the exitCode directly, but ignore the error
|
||||||
|
// since it will have already been logged by this.list()
|
||||||
|
process.exitCode = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async fetchTags (spec, opts) {
|
async fetchTags (spec, opts) {
|
||||||
const data = await regFetch.json(
|
const data = await regFetch.json(
|
||||||
`/-/package/${spec.escapedName}/dist-tags`,
|
`/-/package/${spec.escapedName}/dist-tags`,
|
||||||
|
23
deps/npm/lib/pack.js
vendored
23
deps/npm/lib/pack.js
vendored
@ -3,6 +3,7 @@ const log = require('npmlog')
|
|||||||
const pacote = require('pacote')
|
const pacote = require('pacote')
|
||||||
const libpack = require('libnpmpack')
|
const libpack = require('libnpmpack')
|
||||||
const npa = require('npm-package-arg')
|
const npa = require('npm-package-arg')
|
||||||
|
const getWorkspaces = require('./workspaces/get-workspaces.js')
|
||||||
|
|
||||||
const { getContents, logTar } = require('./utils/tar.js')
|
const { getContents, logTar } = require('./utils/tar.js')
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ class Pack extends BaseCommand {
|
|||||||
|
|
||||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||||
static get params () {
|
static get params () {
|
||||||
return ['dry-run']
|
return ['dry-run', 'workspace', 'workspaces']
|
||||||
}
|
}
|
||||||
|
|
||||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||||
@ -35,6 +36,10 @@ class Pack extends BaseCommand {
|
|||||||
this.pack(args).then(() => cb()).catch(cb)
|
this.pack(args).then(() => cb()).catch(cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
execWorkspaces (args, filters, cb) {
|
||||||
|
this.packWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||||
|
}
|
||||||
|
|
||||||
async pack (args) {
|
async pack (args) {
|
||||||
if (args.length === 0)
|
if (args.length === 0)
|
||||||
args = ['.']
|
args = ['.']
|
||||||
@ -62,5 +67,21 @@ class Pack extends BaseCommand {
|
|||||||
this.npm.output(tar.filename.replace(/^@/, '').replace(/\//, '-'))
|
this.npm.output(tar.filename.replace(/^@/, '').replace(/\//, '-'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async packWorkspaces (args, filters) {
|
||||||
|
// If they either ask for nothing, or explicitly include '.' in the args,
|
||||||
|
// we effectively translate that into each workspace requested
|
||||||
|
|
||||||
|
const useWorkspaces = args.length === 0 || args.includes('.')
|
||||||
|
|
||||||
|
if (!useWorkspaces) {
|
||||||
|
this.npm.log.warn('Ignoring workspaces for specified package(s)')
|
||||||
|
return this.pack(args)
|
||||||
|
}
|
||||||
|
|
||||||
|
const workspaces =
|
||||||
|
await getWorkspaces(filters, { path: this.npm.localPrefix })
|
||||||
|
return this.pack([...workspaces.values(), ...args.filter(a => a !== '.')])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
module.exports = Pack
|
module.exports = Pack
|
||||||
|
2
deps/npm/lib/view.js
vendored
2
deps/npm/lib/view.js
vendored
@ -151,7 +151,7 @@ class View extends BaseCommand {
|
|||||||
|
|
||||||
const local = /^\.@/.test(pkg) || pkg === '.'
|
const local = /^\.@/.test(pkg) || pkg === '.'
|
||||||
if (!local) {
|
if (!local) {
|
||||||
this.npm.log.warn('Ignoring workspaces for remote package')
|
this.npm.log.warn('Ignoring workspaces for specified package(s)')
|
||||||
return this.view([pkg, ...args])
|
return this.view([pkg, ...args])
|
||||||
}
|
}
|
||||||
let wholePackument = false
|
let wholePackument = false
|
||||||
|
9
deps/npm/man/man1/npm-dist-tag.1
vendored
9
deps/npm/man/man1/npm-dist-tag.1
vendored
@ -90,6 +90,15 @@ semver as \fB>=1\.4\.0 <1\.5\.0\fP\|\. See https://github\.com/npm/npm/issues/6
|
|||||||
.P
|
.P
|
||||||
The simplest way to avoid semver problems with tags is to use tags that do
|
The simplest way to avoid semver problems with tags is to use tags that do
|
||||||
not begin with a number or the letter \fBv\fP\|\.
|
not begin with a number or the letter \fBv\fP\|\.
|
||||||
|
.SS Configuration
|
||||||
|
.SS workspaces
|
||||||
|
.P
|
||||||
|
Only supported by \fBls\fP\|\. Enables listing dist\-tags of all workspace
|
||||||
|
contexts defined in the current \fBpackage\.json\fP\|\.
|
||||||
|
.SS workspace
|
||||||
|
.P
|
||||||
|
Only supported by \fBls\fP\|\. Enables listing dist\-tags of workspace contexts
|
||||||
|
limiting results to only those specified by this config item\.
|
||||||
.SS See Also
|
.SS See Also
|
||||||
.RS 0
|
.RS 0
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
|
2
deps/npm/man/man1/npm-ls.1
vendored
2
deps/npm/man/man1/npm-ls.1
vendored
@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show:
|
|||||||
.P
|
.P
|
||||||
.RS 2
|
.RS 2
|
||||||
.nf
|
.nf
|
||||||
npm@7\.8\.0 /path/to/npm
|
npm@7\.9\.0 /path/to/npm
|
||||||
└─┬ init\-package\-json@0\.0\.4
|
└─┬ init\-package\-json@0\.0\.4
|
||||||
└── promzard@0\.1\.5
|
└── promzard@0\.1\.5
|
||||||
.fi
|
.fi
|
||||||
|
19
deps/npm/man/man1/npm-pack.1
vendored
19
deps/npm/man/man1/npm-pack.1
vendored
@ -8,6 +8,21 @@
|
|||||||
npm pack [[<@scope>/]<pkg>\.\.\.] [\-\-dry\-run]
|
npm pack [[<@scope>/]<pkg>\.\.\.] [\-\-dry\-run]
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
|
.SS Configuration
|
||||||
|
.SS dry\-run
|
||||||
|
.P
|
||||||
|
Do everything that pack usually does without actually packing anything\.
|
||||||
|
That is, report on what would have gone into the tarball, but nothing
|
||||||
|
else\.
|
||||||
|
.SS workspaces
|
||||||
|
.P
|
||||||
|
Enables workspaces context while creating tarballs\. Tarballs for each
|
||||||
|
workspaces will be generated\.
|
||||||
|
.SS workspace
|
||||||
|
.P
|
||||||
|
Enables workspaces context and limits results to only those specified by
|
||||||
|
this config item\. Tarballs will only be generated for the packages
|
||||||
|
named in the workspaces given here\.
|
||||||
.SS Description
|
.SS Description
|
||||||
.P
|
.P
|
||||||
For anything that's installable (that is, a package folder, tarball,
|
For anything that's installable (that is, a package folder, tarball,
|
||||||
@ -20,10 +35,6 @@ If the same package is specified multiple times, then the file will be
|
|||||||
overwritten the second time\.
|
overwritten the second time\.
|
||||||
.P
|
.P
|
||||||
If no arguments are supplied, then npm packs the current package folder\.
|
If no arguments are supplied, then npm packs the current package folder\.
|
||||||
.P
|
|
||||||
The \fB\-\-dry\-run\fP argument will do everything that pack usually does without
|
|
||||||
actually packing anything\. That is, it reports on what would have gone
|
|
||||||
into the tarball, but nothing else\.
|
|
||||||
.SS See Also
|
.SS See Also
|
||||||
.RS 0
|
.RS 0
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
|
2
deps/npm/man/man1/npm.1
vendored
2
deps/npm/man/man1/npm.1
vendored
@ -10,7 +10,7 @@ npm <command> [args]
|
|||||||
.RE
|
.RE
|
||||||
.SS Version
|
.SS Version
|
||||||
.P
|
.P
|
||||||
7\.8\.0
|
7\.9\.0
|
||||||
.SS Description
|
.SS Description
|
||||||
.P
|
.P
|
||||||
npm is the package manager for the Node JavaScript platform\. It puts
|
npm is the package manager for the Node JavaScript platform\. It puts
|
||||||
|
2
deps/npm/package.json
vendored
2
deps/npm/package.json
vendored
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "7.8.0",
|
"version": "7.9.0",
|
||||||
"name": "npm",
|
"name": "npm",
|
||||||
"description": "a package manager for JavaScript",
|
"description": "a package manager for JavaScript",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -15,6 +15,9 @@ npm dist-tag add <pkg>@<version> [<tag>]
|
|||||||
npm dist-tag rm <pkg> <tag>
|
npm dist-tag rm <pkg> <tag>
|
||||||
npm dist-tag ls [<pkg>]
|
npm dist-tag ls [<pkg>]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
|
||||||
|
|
||||||
alias: dist-tags
|
alias: dist-tags
|
||||||
|
|
||||||
Run "npm help dist-tag" for more info
|
Run "npm help dist-tag" for more info
|
||||||
@ -30,6 +33,9 @@ npm dist-tag add <pkg>@<version> [<tag>]
|
|||||||
npm dist-tag rm <pkg> <tag>
|
npm dist-tag rm <pkg> <tag>
|
||||||
npm dist-tag ls [<pkg>]
|
npm dist-tag ls [<pkg>]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
|
||||||
|
|
||||||
alias: dist-tags
|
alias: dist-tags
|
||||||
|
|
||||||
Run "npm help dist-tag" for more info
|
Run "npm help dist-tag" for more info
|
||||||
@ -54,6 +60,9 @@ npm dist-tag add <pkg>@<version> [<tag>]
|
|||||||
npm dist-tag rm <pkg> <tag>
|
npm dist-tag rm <pkg> <tag>
|
||||||
npm dist-tag ls [<pkg>]
|
npm dist-tag ls [<pkg>]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
|
||||||
|
|
||||||
alias: dist-tags
|
alias: dist-tags
|
||||||
|
|
||||||
Run "npm help dist-tag" for more info
|
Run "npm help dist-tag" for more info
|
||||||
@ -75,6 +84,9 @@ npm dist-tag add <pkg>@<version> [<tag>]
|
|||||||
npm dist-tag rm <pkg> <tag>
|
npm dist-tag rm <pkg> <tag>
|
||||||
npm dist-tag ls [<pkg>]
|
npm dist-tag ls [<pkg>]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
|
||||||
|
|
||||||
alias: dist-tags
|
alias: dist-tags
|
||||||
|
|
||||||
Run "npm help dist-tag" for more info
|
Run "npm help dist-tag" for more info
|
||||||
@ -126,6 +138,9 @@ npm dist-tag add <pkg>@<version> [<tag>]
|
|||||||
npm dist-tag rm <pkg> <tag>
|
npm dist-tag rm <pkg> <tag>
|
||||||
npm dist-tag ls [<pkg>]
|
npm dist-tag ls [<pkg>]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
|
||||||
|
|
||||||
alias: dist-tags
|
alias: dist-tags
|
||||||
|
|
||||||
Run "npm help dist-tag" for more info
|
Run "npm help dist-tag" for more info
|
||||||
@ -142,3 +157,100 @@ dist-tag add b to @scoped/another@0.6.0
|
|||||||
dist-tag add b is already set to version 0.6.0
|
dist-tag add b is already set to version 0.6.0
|
||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
|
exports[`test/lib/dist-tag.js TAP workspaces no args > printed the expected output 1`] = `
|
||||||
|
workspace-a:
|
||||||
|
latest-a: 1.0.0
|
||||||
|
latest: 1.0.0
|
||||||
|
workspace-b:
|
||||||
|
latest-b: 2.0.0
|
||||||
|
latest: 2.0.0
|
||||||
|
workspace-c:
|
||||||
|
latest-c: 3.0.0
|
||||||
|
latest: 3.0.0
|
||||||
|
`
|
||||||
|
|
||||||
|
exports[`test/lib/dist-tag.js TAP workspaces no args, one failing workspace sets exitCode to 1 > printed the expected output 1`] = `
|
||||||
|
workspace-a:
|
||||||
|
latest-a: 1.0.0
|
||||||
|
latest: 1.0.0
|
||||||
|
workspace-b:
|
||||||
|
latest-b: 2.0.0
|
||||||
|
latest: 2.0.0
|
||||||
|
workspace-c:
|
||||||
|
latest-c: 3.0.0
|
||||||
|
latest: 3.0.0
|
||||||
|
workspace-d:
|
||||||
|
`
|
||||||
|
|
||||||
|
exports[`test/lib/dist-tag.js TAP workspaces no args, one workspace > printed the expected output 1`] = `
|
||||||
|
workspace-a:
|
||||||
|
latest-a: 1.0.0
|
||||||
|
latest: 1.0.0
|
||||||
|
`
|
||||||
|
|
||||||
|
exports[`test/lib/dist-tag.js TAP workspaces one arg -- . > printed the expected output 1`] = `
|
||||||
|
workspace-a:
|
||||||
|
latest-a: 1.0.0
|
||||||
|
latest: 1.0.0
|
||||||
|
workspace-b:
|
||||||
|
latest-b: 2.0.0
|
||||||
|
latest: 2.0.0
|
||||||
|
workspace-c:
|
||||||
|
latest-c: 3.0.0
|
||||||
|
latest: 3.0.0
|
||||||
|
`
|
||||||
|
|
||||||
|
exports[`test/lib/dist-tag.js TAP workspaces one arg -- .@1, ignores version spec > printed the expected output 1`] = `
|
||||||
|
workspace-a:
|
||||||
|
latest-a: 1.0.0
|
||||||
|
latest: 1.0.0
|
||||||
|
workspace-b:
|
||||||
|
latest-b: 2.0.0
|
||||||
|
latest: 2.0.0
|
||||||
|
workspace-c:
|
||||||
|
latest-c: 3.0.0
|
||||||
|
latest: 3.0.0
|
||||||
|
`
|
||||||
|
|
||||||
|
exports[`test/lib/dist-tag.js TAP workspaces one arg -- list > printed the expected output 1`] = `
|
||||||
|
workspace-a:
|
||||||
|
latest-a: 1.0.0
|
||||||
|
latest: 1.0.0
|
||||||
|
workspace-b:
|
||||||
|
latest-b: 2.0.0
|
||||||
|
latest: 2.0.0
|
||||||
|
workspace-c:
|
||||||
|
latest-c: 3.0.0
|
||||||
|
latest: 3.0.0
|
||||||
|
`
|
||||||
|
|
||||||
|
exports[`test/lib/dist-tag.js TAP workspaces two args -- list, . > printed the expected output 1`] = `
|
||||||
|
workspace-a:
|
||||||
|
latest-a: 1.0.0
|
||||||
|
latest: 1.0.0
|
||||||
|
workspace-b:
|
||||||
|
latest-b: 2.0.0
|
||||||
|
latest: 2.0.0
|
||||||
|
workspace-c:
|
||||||
|
latest-c: 3.0.0
|
||||||
|
latest: 3.0.0
|
||||||
|
`
|
||||||
|
|
||||||
|
exports[`test/lib/dist-tag.js TAP workspaces two args -- list, .@1, ignores version spec > printed the expected output 1`] = `
|
||||||
|
workspace-a:
|
||||||
|
latest-a: 1.0.0
|
||||||
|
latest: 1.0.0
|
||||||
|
workspace-b:
|
||||||
|
latest-b: 2.0.0
|
||||||
|
latest: 2.0.0
|
||||||
|
workspace-c:
|
||||||
|
latest-c: 3.0.0
|
||||||
|
latest: 3.0.0
|
||||||
|
`
|
||||||
|
|
||||||
|
exports[`test/lib/dist-tag.js TAP workspaces two args -- list, @scoped/pkg, logs a warning and ignores workspaces > printed the expected output 1`] = `
|
||||||
|
a: 0.0.1
|
||||||
|
b: 0.5.0
|
||||||
|
latest: 1.0.0
|
||||||
|
`
|
||||||
|
@ -323,6 +323,9 @@ All commands:
|
|||||||
npm dist-tag rm <pkg> <tag>
|
npm dist-tag rm <pkg> <tag>
|
||||||
npm dist-tag ls [<pkg>]
|
npm dist-tag ls [<pkg>]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
|
||||||
|
|
||||||
alias: dist-tags
|
alias: dist-tags
|
||||||
|
|
||||||
Run "npm help dist-tag" for more info
|
Run "npm help dist-tag" for more info
|
||||||
@ -622,7 +625,7 @@ All commands:
|
|||||||
npm pack [[<@scope>/]<pkg>...]
|
npm pack [[<@scope>/]<pkg>...]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
[--dry-run]
|
[--dry-run] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces]
|
||||||
|
|
||||||
Run "npm help pack" for more info
|
Run "npm help pack" for more info
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ dist-tags:
|
|||||||
`
|
`
|
||||||
|
|
||||||
exports[`test/lib/view.js TAP workspaces remote package name > must match snapshot 1`] = `
|
exports[`test/lib/view.js TAP workspaces remote package name > must match snapshot 1`] = `
|
||||||
Ignoring workspaces for remote package
|
Ignoring workspaces for specified package(s)
|
||||||
`
|
`
|
||||||
|
|
||||||
exports[`test/lib/view.js TAP workspaces remote package name > must match snapshot 2`] = `
|
exports[`test/lib/view.js TAP workspaces remote package name > must match snapshot 2`] = `
|
||||||
|
14
deps/npm/test/fixtures/mock-npm.js
vendored
14
deps/npm/test/fixtures/mock-npm.js
vendored
@ -2,10 +2,24 @@
|
|||||||
// npm.config You still need a separate flatOptions but this is the first step
|
// npm.config You still need a separate flatOptions but this is the first step
|
||||||
// to eventually just using npm itself
|
// to eventually just using npm itself
|
||||||
|
|
||||||
|
const mockLog = {
|
||||||
|
clearProgress: () => {},
|
||||||
|
disableProgress: () => {},
|
||||||
|
enableProgress: () => {},
|
||||||
|
http: () => {},
|
||||||
|
info: () => {},
|
||||||
|
levels: [],
|
||||||
|
notice: () => {},
|
||||||
|
pause: () => {},
|
||||||
|
silly: () => {},
|
||||||
|
verbose: () => {},
|
||||||
|
warn: () => {},
|
||||||
|
}
|
||||||
const mockNpm = (base = {}) => {
|
const mockNpm = (base = {}) => {
|
||||||
const config = base.config || {}
|
const config = base.config || {}
|
||||||
const flatOptions = base.flatOptions || {}
|
const flatOptions = base.flatOptions || {}
|
||||||
return {
|
return {
|
||||||
|
log: mockLog,
|
||||||
...base,
|
...base,
|
||||||
flatOptions,
|
flatOptions,
|
||||||
config: {
|
config: {
|
||||||
|
199
deps/npm/test/lib/dist-tag.js
vendored
199
deps/npm/test/lib/dist-tag.js
vendored
@ -1,10 +1,16 @@
|
|||||||
const requireInject = require('require-inject')
|
const requireInject = require('require-inject')
|
||||||
const mockNpm = require('../fixtures/mock-npm')
|
const mockNpm = require('../fixtures/mock-npm')
|
||||||
const { test } = require('tap')
|
const { afterEach, test } = require('tap')
|
||||||
|
|
||||||
let result = ''
|
let result = ''
|
||||||
let log = ''
|
let log = ''
|
||||||
|
|
||||||
|
afterEach((cb) => {
|
||||||
|
result = ''
|
||||||
|
log = ''
|
||||||
|
cb()
|
||||||
|
})
|
||||||
|
|
||||||
const routeMap = {
|
const routeMap = {
|
||||||
'/-/package/@scoped%2fpkg/dist-tags': {
|
'/-/package/@scoped%2fpkg/dist-tags': {
|
||||||
latest: '1.0.0',
|
latest: '1.0.0',
|
||||||
@ -22,6 +28,18 @@ const routeMap = {
|
|||||||
b: '0.6.0',
|
b: '0.6.0',
|
||||||
c: '7.7.7',
|
c: '7.7.7',
|
||||||
},
|
},
|
||||||
|
'/-/package/workspace-a/dist-tags': {
|
||||||
|
latest: '1.0.0',
|
||||||
|
'latest-a': '1.0.0',
|
||||||
|
},
|
||||||
|
'/-/package/workspace-b/dist-tags': {
|
||||||
|
latest: '2.0.0',
|
||||||
|
'latest-b': '2.0.0',
|
||||||
|
},
|
||||||
|
'/-/package/workspace-c/dist-tags': {
|
||||||
|
latest: '3.0.0',
|
||||||
|
'latest-c': '3.0.0',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
let npmRegistryFetchMock = (url, opts) => {
|
let npmRegistryFetchMock = (url, opts) => {
|
||||||
@ -57,7 +75,7 @@ const npm = mockNpm({
|
|||||||
global: false,
|
global: false,
|
||||||
},
|
},
|
||||||
output: msg => {
|
output: msg => {
|
||||||
result = msg
|
result = result ? [result, msg].join('\n') : msg
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const distTag = new DistTag(npm)
|
const distTag = new DistTag(npm)
|
||||||
@ -74,8 +92,6 @@ test('ls in current package', (t) => {
|
|||||||
result,
|
result,
|
||||||
'should list available tags for current package'
|
'should list available tags for current package'
|
||||||
)
|
)
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -92,8 +108,6 @@ test('no args in current package', (t) => {
|
|||||||
result,
|
result,
|
||||||
'should default to listing available tags for current package'
|
'should default to listing available tags for current package'
|
||||||
)
|
)
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -102,8 +116,6 @@ test('borked cmd usage', (t) => {
|
|||||||
npm.prefix = t.testdir({})
|
npm.prefix = t.testdir({})
|
||||||
distTag.exec(['borked', '@scoped/pkg'], (err) => {
|
distTag.exec(['borked', '@scoped/pkg'], (err) => {
|
||||||
t.matchSnapshot(err, 'should show usage error')
|
t.matchSnapshot(err, 'should show usage error')
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -116,8 +128,6 @@ test('ls on named package', (t) => {
|
|||||||
result,
|
result,
|
||||||
'should list tags for the specified package'
|
'should list tags for the specified package'
|
||||||
)
|
)
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -133,8 +143,6 @@ test('ls on missing package', (t) => {
|
|||||||
err,
|
err,
|
||||||
'should throw error message'
|
'should throw error message'
|
||||||
)
|
)
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -150,8 +158,6 @@ test('ls on missing name in current package', (t) => {
|
|||||||
err,
|
err,
|
||||||
'should throw usage error message'
|
'should throw usage error message'
|
||||||
)
|
)
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -164,14 +170,154 @@ test('only named package arg', (t) => {
|
|||||||
result,
|
result,
|
||||||
'should default to listing tags for the specified package'
|
'should default to listing tags for the specified package'
|
||||||
)
|
)
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('workspaces', (t) => {
|
||||||
|
npm.localPrefix = t.testdir({
|
||||||
|
'package.json': JSON.stringify({
|
||||||
|
name: 'root',
|
||||||
|
version: '1.0.0',
|
||||||
|
workspaces: ['workspace-a', 'workspace-b', 'workspace-c'],
|
||||||
|
}),
|
||||||
|
'workspace-a': {
|
||||||
|
'package.json': JSON.stringify({
|
||||||
|
name: 'workspace-a',
|
||||||
|
version: '1.0.0',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
'workspace-b': {
|
||||||
|
'package.json': JSON.stringify({
|
||||||
|
name: 'workspace-b',
|
||||||
|
version: '1.0.0',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
'workspace-c': {
|
||||||
|
'package.json': JSON.stringify({
|
||||||
|
name: 'workspace-c',
|
||||||
|
version: '1.0.0',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('no args', t => {
|
||||||
|
distTag.execWorkspaces([], [], (err) => {
|
||||||
|
t.ifError(err)
|
||||||
|
t.matchSnapshot(result, 'printed the expected output')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('no args, one workspace', t => {
|
||||||
|
distTag.execWorkspaces([], ['workspace-a'], (err) => {
|
||||||
|
t.ifError(err)
|
||||||
|
t.matchSnapshot(result, 'printed the expected output')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('one arg -- .', t => {
|
||||||
|
distTag.execWorkspaces(['.'], [], (err) => {
|
||||||
|
t.ifError(err)
|
||||||
|
t.matchSnapshot(result, 'printed the expected output')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('one arg -- .@1, ignores version spec', t => {
|
||||||
|
distTag.execWorkspaces(['.@'], [], (err) => {
|
||||||
|
t.ifError(err)
|
||||||
|
t.matchSnapshot(result, 'printed the expected output')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('one arg -- list', t => {
|
||||||
|
distTag.execWorkspaces(['list'], [], (err) => {
|
||||||
|
t.ifError(err)
|
||||||
|
t.matchSnapshot(result, 'printed the expected output')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('two args -- list, .', t => {
|
||||||
|
distTag.execWorkspaces(['list', '.'], [], (err) => {
|
||||||
|
t.ifError(err)
|
||||||
|
t.matchSnapshot(result, 'printed the expected output')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('two args -- list, .@1, ignores version spec', t => {
|
||||||
|
distTag.execWorkspaces(['list', '.@'], [], (err) => {
|
||||||
|
t.ifError(err)
|
||||||
|
t.matchSnapshot(result, 'printed the expected output')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('two args -- list, @scoped/pkg, logs a warning and ignores workspaces', t => {
|
||||||
|
distTag.execWorkspaces(['list', '@scoped/pkg'], [], (err) => {
|
||||||
|
t.ifError(err)
|
||||||
|
t.match(log, 'Ignoring workspaces for specified package', 'logs a warning')
|
||||||
|
t.matchSnapshot(result, 'printed the expected output')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('no args, one failing workspace sets exitCode to 1', t => {
|
||||||
|
npm.localPrefix = t.testdir({
|
||||||
|
'package.json': JSON.stringify({
|
||||||
|
name: 'root',
|
||||||
|
version: '1.0.0',
|
||||||
|
workspaces: ['workspace-a', 'workspace-b', 'workspace-c', 'workspace-d'],
|
||||||
|
}),
|
||||||
|
'workspace-a': {
|
||||||
|
'package.json': JSON.stringify({
|
||||||
|
name: 'workspace-a',
|
||||||
|
version: '1.0.0',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
'workspace-b': {
|
||||||
|
'package.json': JSON.stringify({
|
||||||
|
name: 'workspace-b',
|
||||||
|
version: '1.0.0',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
'workspace-c': {
|
||||||
|
'package.json': JSON.stringify({
|
||||||
|
name: 'workspace-c',
|
||||||
|
version: '1.0.0',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
'workspace-d': {
|
||||||
|
'package.json': JSON.stringify({
|
||||||
|
name: 'workspace-d',
|
||||||
|
version: '1.0.0',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
distTag.execWorkspaces([], [], (err) => {
|
||||||
|
t.ifError(err)
|
||||||
|
t.equal(process.exitCode, 1, 'set the error status')
|
||||||
|
process.exitCode = 0
|
||||||
|
t.match(log, 'dist-tag ls Couldn\'t get dist-tag data for workspace-d@latest', 'logs the error')
|
||||||
|
t.matchSnapshot(result, 'printed the expected output')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
test('add new tag', (t) => {
|
test('add new tag', (t) => {
|
||||||
const _nrf = npmRegistryFetchMock
|
const _nrf = npmRegistryFetchMock
|
||||||
|
t.teardown(() => {
|
||||||
|
npmRegistryFetchMock = _nrf
|
||||||
|
})
|
||||||
|
|
||||||
npmRegistryFetchMock = async (url, opts) => {
|
npmRegistryFetchMock = async (url, opts) => {
|
||||||
t.equal(opts.method, 'PUT', 'should trigger request to add new tag')
|
t.equal(opts.method, 'PUT', 'should trigger request to add new tag')
|
||||||
t.equal(opts.body, '7.7.7', 'should point to expected version')
|
t.equal(opts.body, '7.7.7', 'should point to expected version')
|
||||||
@ -183,9 +329,6 @@ test('add new tag', (t) => {
|
|||||||
result,
|
result,
|
||||||
'should return success msg'
|
'should return success msg'
|
||||||
)
|
)
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
npmRegistryFetchMock = _nrf
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -202,8 +345,6 @@ test('add using valid semver range as name', (t) => {
|
|||||||
log,
|
log,
|
||||||
'should return success msg'
|
'should return success msg'
|
||||||
)
|
)
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -212,8 +353,6 @@ test('add missing args', (t) => {
|
|||||||
npm.prefix = t.testdir({})
|
npm.prefix = t.testdir({})
|
||||||
distTag.exec(['add', '@scoped/another@7.7.7'], (err) => {
|
distTag.exec(['add', '@scoped/another@7.7.7'], (err) => {
|
||||||
t.matchSnapshot(err, 'should exit usage error message')
|
t.matchSnapshot(err, 'should exit usage error message')
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -222,8 +361,6 @@ test('add missing pkg name', (t) => {
|
|||||||
npm.prefix = t.testdir({})
|
npm.prefix = t.testdir({})
|
||||||
distTag.exec(['add', null], (err) => {
|
distTag.exec(['add', null], (err) => {
|
||||||
t.matchSnapshot(err, 'should exit usage error message')
|
t.matchSnapshot(err, 'should exit usage error message')
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -236,13 +373,16 @@ test('set existing version', (t) => {
|
|||||||
log,
|
log,
|
||||||
'should log warn msg'
|
'should log warn msg'
|
||||||
)
|
)
|
||||||
log = ''
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('remove existing tag', (t) => {
|
test('remove existing tag', (t) => {
|
||||||
const _nrf = npmRegistryFetchMock
|
const _nrf = npmRegistryFetchMock
|
||||||
|
t.teardown(() => {
|
||||||
|
npmRegistryFetchMock = _nrf
|
||||||
|
})
|
||||||
|
|
||||||
npmRegistryFetchMock = async (url, opts) => {
|
npmRegistryFetchMock = async (url, opts) => {
|
||||||
t.equal(opts.method, 'DELETE', 'should trigger request to remove tag')
|
t.equal(opts.method, 'DELETE', 'should trigger request to remove tag')
|
||||||
}
|
}
|
||||||
@ -251,9 +391,6 @@ test('remove existing tag', (t) => {
|
|||||||
t.ifError(err, 'npm dist-tags rm')
|
t.ifError(err, 'npm dist-tags rm')
|
||||||
t.matchSnapshot(log, 'should log remove info')
|
t.matchSnapshot(log, 'should log remove info')
|
||||||
t.matchSnapshot(result, 'should return success msg')
|
t.matchSnapshot(result, 'should return success msg')
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
npmRegistryFetchMock = _nrf
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -267,8 +404,6 @@ test('remove non-existing tag', (t) => {
|
|||||||
'should exit with error'
|
'should exit with error'
|
||||||
)
|
)
|
||||||
t.matchSnapshot(log, 'should log error msg')
|
t.matchSnapshot(log, 'should log error msg')
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -277,8 +412,6 @@ test('remove missing pkg name', (t) => {
|
|||||||
npm.prefix = t.testdir({})
|
npm.prefix = t.testdir({})
|
||||||
distTag.exec(['rm', null], (err) => {
|
distTag.exec(['rm', null], (err) => {
|
||||||
t.matchSnapshot(err, 'should exit usage error message')
|
t.matchSnapshot(err, 'should exit usage error message')
|
||||||
result = ''
|
|
||||||
log = ''
|
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
103
deps/npm/test/lib/pack.js
vendored
103
deps/npm/test/lib/pack.js
vendored
@ -1,6 +1,7 @@
|
|||||||
const t = require('tap')
|
const t = require('tap')
|
||||||
const requireInject = require('require-inject')
|
const requireInject = require('require-inject')
|
||||||
const mockNpm = require('../fixtures/mock-npm')
|
const mockNpm = require('../fixtures/mock-npm')
|
||||||
|
const pacote = require('pacote')
|
||||||
|
|
||||||
const OUTPUT = []
|
const OUTPUT = []
|
||||||
const output = (...msg) => OUTPUT.push(msg)
|
const output = (...msg) => OUTPUT.push(msg)
|
||||||
@ -11,6 +12,16 @@ const libnpmpack = async (spec, opts) => {
|
|||||||
|
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
const mockPacote = {
|
||||||
|
manifest: (spec) => {
|
||||||
|
if (spec.type === 'directory')
|
||||||
|
return pacote.manifest(spec)
|
||||||
|
return {
|
||||||
|
name: spec.name || 'test-package',
|
||||||
|
version: spec.version || '1.0.0-test',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
t.afterEach(cb => {
|
t.afterEach(cb => {
|
||||||
OUTPUT.length = 0
|
OUTPUT.length = 0
|
||||||
@ -152,3 +163,95 @@ t.test('should log pack contents', (t) => {
|
|||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.test('workspaces', (t) => {
|
||||||
|
const testDir = t.testdir({
|
||||||
|
'package.json': JSON.stringify({
|
||||||
|
name: 'workspaces-test',
|
||||||
|
version: '1.0.0',
|
||||||
|
workspaces: ['workspace-a', 'workspace-b'],
|
||||||
|
}, null, 2),
|
||||||
|
'workspace-a': {
|
||||||
|
'package.json': JSON.stringify({
|
||||||
|
name: 'workspace-a',
|
||||||
|
version: '1.0.0',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
'workspace-b': {
|
||||||
|
'package.json': JSON.stringify({
|
||||||
|
name: 'workspace-b',
|
||||||
|
version: '1.0.0',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const Pack = requireInject('../../lib/pack.js', {
|
||||||
|
libnpmpack,
|
||||||
|
pacote: mockPacote,
|
||||||
|
npmlog: {
|
||||||
|
notice: () => {},
|
||||||
|
showProgress: () => {},
|
||||||
|
clearProgress: () => {},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const npm = mockNpm({
|
||||||
|
localPrefix: testDir,
|
||||||
|
config: {
|
||||||
|
unicode: false,
|
||||||
|
json: false,
|
||||||
|
'dry-run': false,
|
||||||
|
},
|
||||||
|
output,
|
||||||
|
})
|
||||||
|
const pack = new Pack(npm)
|
||||||
|
|
||||||
|
t.test('all workspaces', (t) => {
|
||||||
|
pack.execWorkspaces([], [], er => {
|
||||||
|
if (er)
|
||||||
|
throw er
|
||||||
|
|
||||||
|
t.strictSame(OUTPUT, [
|
||||||
|
['workspace-a-1.0.0.tgz'],
|
||||||
|
['workspace-b-1.0.0.tgz'],
|
||||||
|
])
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('all workspaces, `.` first arg', (t) => {
|
||||||
|
pack.execWorkspaces(['.'], [], er => {
|
||||||
|
if (er)
|
||||||
|
throw er
|
||||||
|
|
||||||
|
t.strictSame(OUTPUT, [
|
||||||
|
['workspace-a-1.0.0.tgz'],
|
||||||
|
['workspace-b-1.0.0.tgz'],
|
||||||
|
])
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('one workspace', (t) => {
|
||||||
|
pack.execWorkspaces([], ['workspace-a'], er => {
|
||||||
|
if (er)
|
||||||
|
throw er
|
||||||
|
|
||||||
|
t.strictSame(OUTPUT, [
|
||||||
|
['workspace-a-1.0.0.tgz'],
|
||||||
|
])
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('specific package', (t) => {
|
||||||
|
pack.execWorkspaces(['abbrev'], [], er => {
|
||||||
|
if (er)
|
||||||
|
throw er
|
||||||
|
|
||||||
|
t.strictSame(OUTPUT, [
|
||||||
|
['abbrev-1.0.0-test.tgz'],
|
||||||
|
])
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user