Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Release/v7.12.0 #3200

Merged
merged 13 commits into from
May 6, 2021
Merged
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
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -772,3 +772,5 @@ Seth Thomas <[email protected]>
Andreas <[email protected]>
Felipe Santos <[email protected]>
Luigi Pinca <[email protected]>
Marco Sirabella <[email protected]>
wangsai <[email protected]>
44 changes: 42 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
## v7.12.0 (2021-05-06)

### FEATURES

* [`701627c51`](https://github.com/npm/cli/commit/701627c5169934e59da2959d76a49c77278cc9dc)
[#3098](https://github.com/npm/cli/issues/3098)
feat(cache): Allow `add` to accept multiple specs
([@mjsir911](https://github.com/mjsir911))
* [`59171f030`](https://github.com/npm/cli/commit/59171f0304f048a009f1697eec6f74f778bc52ff)
[#3187](https://github.com/npm/cli/issues/3187)
feat(config): add workspaces boolean to user-agent
([@nlf](https://github.com/nlf))

### BUG FIXES

* [`2c9b8713c`](https://github.com/npm/cli/commit/2c9b8713c4c88fbd0c3c48eb0de84dbd7269398f)
[#3182](https://github.com/npm/cli/issues/3182)
fix(docs): fix broken links
([@wangsai](https://github.com/wangsai))
* [`88cbc8c44`](https://github.com/npm/cli/commit/88cbc8c447cbaef20b5a8f19246211ce4918f4d8)
[#3198](https://github.com/npm/cli/issues/3198)
fix(tests): reflect new libnpmexec logic

### DEPENDENCIES

* [`d01ce5e13`](https://github.com/npm/cli/commit/d01ce5e132cb4661698012fd5017753c2bdb660b)
`[email protected]`:
* feat: add walk up dir lookup to satisfy local bins
* [`81c1dfaaa`](https://github.com/npm/cli/commit/81c1dfaaaf918229316a975aa8075769ffafdb6d)
`@npmcli/[email protected]`:
* fix(add): save packages in the right place
* fix(reify): do not clean up nodes with no parent
* fix(audit): support alias specs & root package names
* [`87c2303ea`](https://github.com/npm/cli/commit/87c2303eaa6edfa5309da0a30f5ad291b6d57640)
`@npmcli/[email protected]`:
* fix(clone): Do not allow git replacement objects by default
* [`99ff40dff`](https://github.com/npm/cli/commit/99ff40dff5e5e55a5d5f045ba90e76c08174ca38)
`[email protected]`:
* feat(npmignore): Do not force include history, changelogs, notice
* fix(package.json): add missing bin/index.js to files

## v7.11.2 (2021-04-29)

### BUG FIXES
Expand Down Expand Up @@ -76,8 +117,8 @@
[#3126](https://github.com/npm/cli/issues/3126)
fix(logout): use isBasicAuth attribute
([@wraithgar](https://github.com/wraithgar))
### DOCUMENTATION

### DOCUMENTATION

* [`c93f1c39e`](https://github.com/npm/cli/commit/c93f1c39e326feff0857712a10ef6183fbafe1ab)
[#3101](https://github.com/npm/cli/issues/3101)
Expand All @@ -89,7 +130,6 @@
fix(usage): fix refs to ws shorthand
([@ruyadorno](https://github.com/ruyadorno))


### DEPENDENCIES

* [`83166ebcc`](https://github.com/npm/cli/commit/83166ebcc4ba5e3bf215f08151437d96637f4f33)
Expand Down
10 changes: 5 additions & 5 deletions docs/content/commands/npm-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ description: Manipulates packages cache
### Synopsis

```bash
npm cache add <tarball file>
npm cache add <folder>
npm cache add <tarball url>
npm cache add <name>@<version>
npm cache add <tarball file>...
npm cache add <folder>...
npm cache add <tarball url>...
npm cache add <name>@<version>...

npm cache clean
aliases: npm cache clear, npm cache rm
Expand All @@ -25,7 +25,7 @@ Note: This command is unaware of workspaces.
Used to add, list, or clean the npm cache folder.

* add:
Add the specified package to the local cache. This command is primarily
Add the specified packages to the local cache. This command is primarily
intended to be used internally by npm, but it can provide a way to
add data to the local installation cache explicitly.

Expand Down
2 changes: 1 addition & 1 deletion docs/content/commands/npm-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ npm ci

### Description

This command is similar to [`npm install`](/cli-commands/install), except
This command is similar to [`npm install`](/commands/npm-install), except
it's meant to be used in automated environments such as test platforms,
continuous integration, and deployment -- or any situation where you want
to make sure you're doing a clean install of your dependencies.
Expand Down
8 changes: 4 additions & 4 deletions docs/content/commands/npm-dedupe.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Using `npm find-dupes` will run the command in `--dry-run` mode.

### See Also

* [npm find-dupes](/cli-commands/find-dupes)
* [npm ls](/cli-commands/ls)
* [npm update](/cli-commands/update)
* [npm install](/cli-commands/install)
* [npm find-dupes](/commands/npm-find-dupes)
* [npm ls](/commands/npm-ls)
* [npm update](/commands/npm-update)
* [npm install](/commands/npm-install)
4 changes: 2 additions & 2 deletions docs/content/commands/npm-deprecate.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ format an empty string.

* [npm publish](/commands/npm-publish)
* [npm registry](/using-npm/registry)
* [npm owner](/cli-commands/owner)
* [npm owner](/cli-commands/adduser)
* [npm owner](/commands/npm-owner)
* [npm owner](/commands/npm-adduser)
1 change: 0 additions & 1 deletion docs/content/commands/npm-explore.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@ The shell to run for the `npm explore` command.
* [npm folders](/configuring-npm/folders)
* [npm edit](/commands/npm-edit)
* [npm rebuild](/commands/npm-rebuild)
* [npm build](/commands/npm-build)
* [npm install](/commands/npm-install)
8 changes: 4 additions & 4 deletions docs/content/commands/npm-find-dupes.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ duplications, without actually changing the package tree.

### See Also

* [npm dedupe](/cli-commands/dedupe)
* [npm ls](/cli-commands/ls)
* [npm update](/cli-commands/update)
* [npm install](/cli-commands/install)
* [npm dedupe](/commands/npm-dedupe)
* [npm ls](/commands/npm-ls)
* [npm update](/commands/npm-update)
* [npm install](/commands/npm-install)

1 change: 0 additions & 1 deletion docs/content/commands/npm-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ the specific folder structures that npm creates.
* [npm link](/commands/npm-link)
* [npm rebuild](/commands/npm-rebuild)
* [npm scripts](/using-npm/scripts)
* [npm build](/commands/npm-build)
* [npm config](/commands/npm-config)
* [npmrc](/configuring-npm/npmrc)
* [npm registry](/using-npm/registry)
Expand Down
4 changes: 2 additions & 2 deletions docs/content/commands/npm-unpublish.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This removes a package version from the registry, deleting its entry and
removing the tarball.

The npm registry will return an error if you are not [logged
in](/commands/npm-login).
in](/commands/npm-adduser).

If you do not specify a version or if you remove all of a package's
versions then the registry will remove the root package entry entirely.
Expand All @@ -52,4 +52,4 @@ passed.
* [npm registry](/using-npm/registry)
* [npm adduser](/commands/npm-adduser)
* [npm owner](/commands/npm-owner)
* [npm login](/commands/npm-login)
* [npm login](/commands/npm-adduser)
2 changes: 1 addition & 1 deletion docs/content/commands/npm-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ npm view express contributors.name contributors.email

"Person" fields are shown as a string if they would be shown as an
object. So, for example, this will show the list of `npm` contributors in
the shortened string format. (See [`package.json`](/configuring-npm/package.json) for more on this.)
the shortened string format. (See [`package.json`](/configuring-npm/package-json) for more on this.)

```bash
npm view npm contributors
Expand Down
2 changes: 1 addition & 1 deletion docs/content/commands/npm.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ following help topics:
Create an account or log in. When you do this, npm will store
credentials in the user config file config file.
* publish:
Use the [`npm publish`](/commands/npm-publish`) command to upload your
Use the [`npm publish`](/commands/npm-publish) command to upload your
code to the registry.

#### Configuration
Expand Down
2 changes: 1 addition & 1 deletion docs/content/configuring-npm/folders.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ not be included in the package tarball.

This allows a package maintainer to install all of their dependencies
(and dev dependencies) locally, but only re-publish those items that
cannot be found elsewhere. See [`package.json`](/configuring-npm/package.json) for more information.
cannot be found elsewhere. See [`package.json`](/configuring-npm/package-json) for more information.

### See also

Expand Down
2 changes: 1 addition & 1 deletion docs/content/configuring-npm/package-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ tarball or git URL.
**Please do not put test harnesses or transpilers or other "development"
time tools in your `dependencies` object.** See `devDependencies`, below.

See [semver](/using-npm/semver#versions) for more details about specifying version ranges.
See [semver](https://github.com/npm/node-semver#versions) for more details about specifying version ranges.

* `version` Must match `version` exactly
* `>version` Must be greater than `version`
Expand Down
5 changes: 4 additions & 1 deletion docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,8 @@ Show short usage output about the command specified.

#### `user-agent`

* Default: "npm/{npm-version} node/{node-version} {platform} {arch} {ci}"
* Default: "npm/{npm-version} node/{node-version} {platform} {arch}
workspaces/{workspaces} {ci}"
* Type: String

Sets the User-Agent request header. The following fields are replaced with
Expand All @@ -1263,6 +1264,8 @@ their actual counterparts:
* `{node-version}` - The Node.js version in use
* `{platform}` - The value of `process.platform`
* `{arch}` - The value of `process.arch`
* `{workspaces}` - Set to `true` if the `workspaces` or `workspace` options
are set.
* `{ci}` - The value of the `ci-name` config, if set, prefixed with `ci/`, or
an empty string if `ci-name` is empty.

Expand Down
7 changes: 1 addition & 6 deletions docs/content/using-npm/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ The advantage of doing these things at `prepublish` time is that they can be don

* `prepare`

#### [`npm env`](/commands/npm-env)

* `env` (You can override the default behavior of `npm env` by defining
a custom `env` entry in your `scripts` object)

#### [`npm install`](/commands/npm-install)

These also run when you run `npm install -g <pkg-name>`
Expand Down Expand Up @@ -179,7 +174,7 @@ If there is a `restart` script defined, these events are run, otherwise
* `restart`
* `postrestart`

#### [`npm run <user defined>`](/commands/npm-run)
#### [`npm run <user defined>`](/commands/npm-run-script)

* `pre<user-defined>`
* `<user-defined>`
Expand Down
40 changes: 19 additions & 21 deletions lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,32 +86,30 @@ with --force.`)
return rimraf(cachePath)
}

// npm cache add <tarball-url>
// npm cache add <pkg> <ver>
// npm cache add <tarball>
// npm cache add <folder>
// npm cache add <tarball-url>...
// npm cache add <pkg> <ver>...
// npm cache add <tarball>...
// npm cache add <folder>...
async add (args) {
const usage = 'Usage:\n' +
' npm cache add <tarball-url>\n' +
' npm cache add <pkg>@<ver>\n' +
' npm cache add <tarball>\n' +
' npm cache add <folder>\n'
' npm cache add <tarball-url>...\n' +
' npm cache add <pkg>@<ver>...\n' +
' npm cache add <tarball>...\n' +
' npm cache add <folder>...\n'
log.silly('cache add', 'args', args)
const spec = args[0] && args[0] +
(args[1] === undefined || args[1] === null ? '' : `@${args[1]}`)

if (!spec)
if (args.length === 0)
throw Object.assign(new Error(usage), { code: 'EUSAGE' })

log.silly('cache add', 'spec', spec)

// we ask pacote for the thing, and then just throw the data
// away so that it tee-pipes it into the cache like it does
// for a normal request.
await pacote.tarball.stream(spec, stream => {
stream.resume()
return stream.promise()
}, this.npm.flatOptions)
return Promise.all(args.map(spec => {
log.silly('cache add', 'spec', spec)
// we ask pacote for the thing, and then just throw the data
// away so that it tee-pipes it into the cache like it does
// for a normal request.
return pacote.tarball.stream(spec, stream => {
stream.resume()
return stream.promise()
}, this.npm.flatOptions)
}))
}

async verify () {
Expand Down
7 changes: 7 additions & 0 deletions lib/utils/config/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,7 @@ define('user-agent', {
'node/{node-version} ' +
'{platform} ' +
'{arch} ' +
'workspaces/{workspaces} ' +
'{ci}',
type: String,
description: `
Expand All @@ -1953,17 +1954,23 @@ define('user-agent', {
* \`{node-version}\` - The Node.js version in use
* \`{platform}\` - The value of \`process.platform\`
* \`{arch}\` - The value of \`process.arch\`
* \`{workspaces}\` - Set to \`true\` if the \`workspaces\` or \`workspace\`
options are set.
* \`{ci}\` - The value of the \`ci-name\` config, if set, prefixed with
\`ci/\`, or an empty string if \`ci-name\` is empty.
`,
flatten (key, obj, flatOptions) {
const value = obj[key]
const ciName = obj['ci-name']
let inWorkspaces = false
if (obj.workspaces || obj.workspace && obj.workspace.length)
inWorkspaces = true
flatOptions.userAgent =
value.replace(/\{node-version\}/gi, obj['node-version'])
.replace(/\{npm-version\}/gi, obj['npm-version'])
.replace(/\{platform\}/gi, process.platform)
.replace(/\{arch\}/gi, process.arch)
.replace(/\{workspaces\}/gi, inWorkspaces)
.replace(/\{ci\}/gi, ciName ? `ci/${ciName}` : '')
.trim()
// user-agent is a unique kind of config item that gets set from a template
Expand Down
Loading