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.7.0 #2922

Merged
merged 42 commits into from Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
111e284
npm-package-arg@8.1.2
ruyadorno Mar 18, 2021
33c8536
normalize-package-data@3.0.2
ruyadorno Mar 18, 2021
af7eaac
hosted-git-info@4.0.1
ruyadorno Mar 18, 2021
9166230
@npmcli/run-script@1.8.4
ruyadorno Mar 18, 2021
f06c12e
eslint@7.22.0
ruyadorno Mar 18, 2021
966057c
jsdom@16.5.1
ruyadorno Mar 18, 2021
b395763
yaml@1.10.2
ruyadorno Mar 18, 2021
46e14bd
chore(config): remove flatOptions references
wraithgar Mar 9, 2021
8cce428
fix(publish): handle case where multiple config list is present
kenrick95 Mar 15, 2021
6598bfe
New consolidated config definitions
isaacs Mar 15, 2021
68db124
Auto-generate 'npm help 7 config' from actual definitions
isaacs Mar 15, 2021
f52c51d
@npmcli/config@2.0.0
isaacs Mar 15, 2021
7c89e74
update lib/*.js to use new config structures
isaacs Mar 15, 2021
aaafab8
Remove old config definitions and flattening logic
isaacs Mar 16, 2021
a8d0751
npm-pick-manifest@6.1.1
isaacs Mar 18, 2021
41facf6
feat(help): refactor npm help/help-search
wraithgar Mar 11, 2021
ad65bd9
docs(configuring-npm): Fix broken link
Mar 13, 2021
0a331ac
bump version in v7 bug template
jansepke Mar 15, 2021
78cb830
docs: add asdf-nodejs as a viable version manager
augustobmoura Mar 15, 2021
7e99515
chore: fix rebuild win tests
ruyadorno Mar 18, 2021
fc8a1ff
fix(tests): go back to mockNpm in test
wraithgar Mar 18, 2021
b419bfb
Update test-coverage command
chowkapow Mar 15, 2021
8a38afe
docs(package-json): document default main behavior
klausbayrhammer Mar 16, 2021
33c4189
feat: add run-script workspaces
ruyadorno Mar 7, 2021
d98edd1
restore npm.flatOptions.npmCommand
isaacs Mar 18, 2021
e94a458
fix(suggestions): clarify Unknown command output
wraithgar Mar 19, 2021
629aaf3
cacache@15.0.6
wraithgar Mar 22, 2021
b876442
fix(usage): tie usage to config
wraithgar Mar 19, 2021
e1b3b31
feat: add exec workspaces
ruyadorno Mar 7, 2021
93a061d
fix(usage): add action items to error output
wraithgar Mar 22, 2021
15ee1ae
fix: yes config
ruyadorno Mar 22, 2021
b7b4491
fix: which config
ruyadorno Mar 22, 2021
4fb6e2f
fix: npm birthday
ruyadorno Mar 22, 2021
1924eb4
libnpmversion@1.0.12
wraithgar Mar 23, 2021
8e4621d
fix(run-script): remove log.disableProgress
ruyadorno Mar 23, 2021
f76e7c2
pacote@11.3.1
ruyadorno Mar 23, 2021
4928512
semver@7.3.5
ruyadorno Mar 23, 2021
7b5606b
@npmcli/arborist@2.2.9
ruyadorno Mar 23, 2021
b043bf9
fix docs generation for yes config
ruyadorno Mar 23, 2021
7706557
docs: changelog for v7.7.0
ruyadorno Mar 23, 2021
0364be0
update AUTHORS
ruyadorno Mar 23, 2021
581b60b
7.7.0
ruyadorno Mar 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_7.md
Expand Up @@ -31,5 +31,5 @@ ex. steps to reproduce the behavior:
ex.
- OS: Ubuntu 20.04
- Node: 13.14.0
- npm: 6.4.12
- npm: 7.6.3
-->
6 changes: 6 additions & 0 deletions AUTHORS
Expand Up @@ -759,3 +759,9 @@ Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Bjørn Johansen <bjjohans@microsoft.com>
Fraqe <f@fraqe.ca>
Edward Grech <dwardu@gmail.com>
Kenrick <kenrick95@gmail.com>
Karthik Sundari <karthik_sundari@comcast.com>
Jan Sepke <625043+jansepke@users.noreply.github.com>
Augusto Moura <augusto.borgesm@gmail.com>
Eric Chow <eric.zjp.chow@gmail.com>
kbayrhammer <klaus.bayrhammer@redbull.com>
76 changes: 76 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,79 @@
## v7.7.0 (2021-03-23)

### FEATURES

* [`33c4189f9`](https://github.com/npm/cli/commit/33c4189f939aebdfaf85ea419e6ea01d0977b79d)
[#2864](https://github.com/npm/cli/issues/2864)
add `npm run-script` workspaces support
([@ruyadorno](https://github.com/ruyadorno))
* [`e1b3b318f`](https://github.com/npm/cli/commit/e1b3b318f095a7e1a7cc4b131907de4955275d9d)
[#2886](https://github.com/npm/cli/issues/2886)
add `npm exec` workspaces support
([@ruyadorno](https://github.com/ruyadorno))
* [`41facf643`](https://github.com/npm/cli/commit/41facf6435ced4e416d74111d9c3ff00ee19ab7d)
[#2859](https://github.com/npm/cli/issues/2859)
expanded "Did you mean?" suggestions for missing cmds and scripts
([@wraithgar](https://github.com/wraithgar))

### BUG FIXES

* [`8cce4282f`](https://github.com/npm/cli/commit/8cce4282f7bef11aeeb73cffd532b477b241985e)
[#2865](https://github.com/npm/cli/issues/2865)
`npm publish`: handle case where multiple config list is present
([@kenrick95](https://github.com/kenrick95))
* [`6598bfe86`](https://github.com/npm/cli/commit/6598bfe8697439e827d84981f8504febca64a55a)
mark deprecated configs
([@isaacs](https://github.com/isaacs))
* [`8a38afe77`](https://github.com/npm/cli/commit/8a38afe779ce71a10178ed62b13709d06adf7a66)
[#2881](https://github.com/npm/cli/issues/2881)
docs(package-json): document default main behavior
([@klausbayrhammer](https://github.com/klausbayrhammer))
* [`93a061d73`](https://github.com/npm/cli/commit/93a061d737dc769663652368e8586e4202267b9e)
[#2917](https://github.com/npm/cli/issues/2917)
add action items to `npm run` error output
([@wraithgar](https://github.com/wraithgar))

### DOCUMENTATION

* [`ad65bd910`](https://github.com/npm/cli/commit/ad65bd9101aa8e8b94bc1e48df3ef93deca6d30c)
[#2860](https://github.com/npm/cli/issues/2860)
fix link in configuring-npm
([@varmakarthik12](https://github.com/varmakarthik12))
* [`b419bfb02`](https://github.com/npm/cli/commit/b419bfb0259596fb338d45b2eaeab25a7a0d1f1e)
[#2876](https://github.com/npm/cli/issues/2876)
fix test-coverage command in contributing guide
([@chowkapow](https://github.com/chowkapow))

### DEPENDENCIES

* [`7b5606b93`](https://github.com/npm/cli/commit/7b5606b931083e8a70f5ea094c2b46f0b7a38a18)
`@npmcli/arborist@2.2.9`
* [#254](https://github.com/npm/arborist/pull/254) Honor explicit
prefix when saving dependencies
([@jameschensmith](https://github.com/jameschensmith))
* [#255](https://github.com/npm/arborist/pull/255) Never save to
`bundleDependencies` when saving a `peer` or `peerOptional`
dependency. ([@isaacs](https://github.com/isaacs))
* [`f76e7c21f`](https://github.com/npm/cli/commit/f76e7c21ffd87b08593d8c396a78ab9c5fa790bd)
`pacote@11.3.1`
* increases tarball compression level
* [`4928512bc`](https://github.com/npm/cli/commit/4928512bcefd8448ff5852978cfc7f903e3ae996)
`semver@7.3.5`
* fix handling prereleases/ANY ranges in subset
* [`1924eb457`](https://github.com/npm/cli/commit/1924eb457aea7c93dfaf4a911355a63d84d66eee)
`libnpmversion@1.0.12`
* fix removing undescored-prefixed package.json properties in `npm version`
* [`916623056`](https://github.com/npm/cli/commit/91662305643509eebd2f79ed7e3ff01562aa4968)
`@npmcli/run-script@1.8.4`
* fix expanding windows-style environment variables
* [`a8d0751e4`](https://github.com/npm/cli/commit/a8d0751e4b7c7d8b808c8a49f288fc7272f729b0)
`npm-pick-manifest@6.1.1`
* fix running packages with a single executable binary with `npm exec`
* [`af7eaac50`](https://github.com/npm/cli/commit/af7eaac5018ed821d72d43d08f1d7e49e7491453)
`hosted-git-info@4.0.1`
* [`f52c51db1`](https://github.com/npm/cli/commit/f52c51db13c39cfbaed18dbd13ba7302a4b6a0d9)
`@npmcli/config@2.0.0`

## v7.6.3 (2021-03-11)

### DOCUMENTATION
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -38,7 +38,7 @@ We expect that every new feature or bug fix comes with corresponding tests that
**You can find out what the current test coverage percentage is by running...**

```bash
$ npm run test-coverage
$ npm run check-coverage
```

## Performance & Benchmarks
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Expand Up @@ -47,7 +47,7 @@ docs-clean:

## build-time dependencies for the documentation
dev-deps:
node bin/npm-cli.js install --only=dev --no-audit --ignore-scripts
node bin/npm-cli.js install --no-audit --ignore-scripts

## targets for man files, these are encouraged to be only built by running `make docs` or `make mandocs`
man/man1/%.1: docs/content/commands/%.md scripts/docs-build.js
Expand All @@ -68,6 +68,11 @@ man/man7/%.7: docs/content/using-npm/%.md scripts/docs-build.js
@[ -d man/man7 ] || mkdir -p man/man7
node scripts/docs-build.js $< $@

# Any time the config definitions description changes, automatically
# update the documentation to account for it
docs/content/using-npm/config.md: scripts/config-doc.js lib/utils/config/*.js
node scripts/config-doc.js

test: dev-deps
node bin/npm-cli.js test

Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -28,6 +28,7 @@ If you're looking to manage multiple versions of **`node`** &/or **`npm`**, cons
* [**`n`**](https://github.com/tj/n)
* [**`volta`**](https://github.com/volta-cli/volta)
* [**`nodenv`**](https://github.com/nodenv/nodenv)
* [**`asdf-nodejs`**](https://github.com/asdf-vm/asdf-nodejs)

### Usage

Expand Down
8 changes: 4 additions & 4 deletions bin/npx-cli.js
Expand Up @@ -24,11 +24,11 @@ const removed = new Set([
...removedOpts
])

const { types, shorthands } = require('../lib/utils/config.js')
const npmSwitches = Object.entries(types)
.filter(([key, type]) => type === Boolean ||
const { definitions, shorthands } = require('../lib/utils/config/index.js')
const npmSwitches = Object.entries(definitions)
.filter(([key, {type}]) => type === Boolean ||
(Array.isArray(type) && type.includes(Boolean)))
.map(([key, type]) => key)
.map(([key]) => key)

// things that don't take a value
const switches = new Set([
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-adduser.md
Expand Up @@ -12,6 +12,8 @@ npm adduser [--registry=url] [--scope=@orgname] [--always-auth] [--auth-type=leg
aliases: login, add-user
```

Note: This command is unaware of workspaces.

### Description

Create or verify a user named `<username>` in the specified registry, and
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-bin.md
Expand Up @@ -10,6 +10,8 @@ description: Display npm bin folder
npm bin [-g|--global]
```

Note: This command is unaware of workspaces.

### Description

Print the folder where npm will install executables.
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-cache.md
Expand Up @@ -18,6 +18,8 @@ aliases: npm cache clear, npm cache rm
npm cache verify
```

Note: This command is unaware of workspaces.

### Description

Used to add, list, or clean the npm cache folder.
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-completion.md
Expand Up @@ -10,6 +10,8 @@ description: Tab Completion for npm
source <(npm completion)
```

Note: This command is unaware of workspaces.

### Description

Enables tab-completion in all npm commands.
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-config.md
Expand Up @@ -18,6 +18,8 @@ npm get [<key> [<key> ...]]
alias: c
```

Note: This command is unaware of workspaces.

### Description

npm gets its config settings from the command line, environment
Expand Down
5 changes: 3 additions & 2 deletions docs/content/commands/npm-dedupe.md
@@ -1,7 +1,7 @@
---
title: npm-dedupe
section: 1
description: Reduce duplication
description: Reduce duplication in the package tree
---

### Synopsis
Expand All @@ -10,7 +10,7 @@ description: Reduce duplication
npm dedupe
npm ddp

aliases: find-dupes, ddp
aliases: ddp
```

### Description
Expand Down Expand Up @@ -74,6 +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)
2 changes: 2 additions & 0 deletions docs/content/commands/npm-deprecate.md
Expand Up @@ -10,6 +10,8 @@ description: Deprecate a version of a package
npm deprecate <pkg>[@<version range>] <message>
```

Note: This command is unaware of workspaces.

### Description

This command will update the npm registry entry for a package, providing a
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-doctor.md
Expand Up @@ -10,6 +10,8 @@ description: Check your npm environment
npm doctor
```

Note: This command is unaware of workspaces.

### Description

`npm doctor` runs a set of checks to ensure that your npm installation has
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-edit.md
Expand Up @@ -10,6 +10,8 @@ description: Edit an installed package
npm edit <pkg>
```

Note: This command is unaware of workspaces.

### Description

Selects a dependency in the current project and opens the package folder in
Expand Down
87 changes: 87 additions & 0 deletions docs/content/commands/npm-exec.md
Expand Up @@ -11,6 +11,7 @@ npm exec -- <pkg>[@<version>] [args...]
npm exec --package=<pkg>[@<version>] -- <cmd> [args...]
npm exec -c '<cmd> [args...]'
npm exec --package=foo -c '<cmd> [args...]'
npm exec [-ws] [-w <workspace-name] [args...]

npx <pkg>[@<specifier>] [args...]
npx -p <pkg>[@<specifier>] <cmd> [args...]
Expand Down Expand Up @@ -145,6 +146,68 @@ $ npm x -c 'eslint && say "hooray, lint passed"'
$ npx -c 'eslint && say "hooray, lint passed"'
```

### Workspaces support

You may use the `workspace` or `workspaces` configs in order to run an
arbitrary command from an npm package (either one installed locally, or fetched
remotely) in the context of the specified workspaces.
If no positional argument or `--call` option is provided, it will open an
interactive subshell in the context of each of these configured workspaces one
at a time.

Given a project with configured workspaces, e.g:

```
.
+-- package.json
`-- packages
+-- a
| `-- package.json
+-- b
| `-- package.json
`-- c
`-- package.json
```

Assuming the workspace configuration is properly set up at the root level
`package.json` file. e.g:

```
{
"workspaces": [ "./packages/*" ]
}
```

You can execute an arbitrary command from a package in the context of each of
the configured workspaces when using the `workspaces` configuration options,
in this example we're using **eslint** to lint any js file found within each
workspace folder:

```
npm exec -ws -- eslint ./*.js
```

#### Filtering workspaces

It's also possible to execute a command in a single workspace using the
`workspace` config along with a name or directory path:

```
npm exec --workspace=a -- eslint ./*.js
```

The `workspace` config can also be specified multiple times in order to run a
specific script in the context of multiple workspaces. When defining values for
the `workspace` config in the command line, it also possible to use `-w` as a
shorthand, e.g:

```
npm exec -w a -w b -- eslint ./*.js
```

This last command will run the `eslint` command in both `./packages/a` and
`./packages/b` folders.

### Compatibility with Older npx Versions

The `npx` binary was rewritten in npm v7.0.0, and the standalone `npx`
Expand Down Expand Up @@ -195,6 +258,30 @@ requested from the server. To force full offline mode, use `offline`.
Forces full offline mode. Any packages not locally cached will result in
an error.

#### workspace

* Alias: `-w`
* Type: Array
* Default: `[]`

Enable running scripts in the context of workspaces while also filtering by
the provided names or paths provided.

Valid values for the `workspace` config are either:
- Workspace names
- Path to a workspace directory
- Path to a parent workspace directory (will result to selecting all of the
children workspaces)

#### workspaces

* Alias: `-ws`
* Type: Boolean
* Default: `false`

Run scripts in the context of all configured workspaces for the current
project.

### See Also

* [npm run-script](/commands/npm-run-script)
Expand Down
2 changes: 2 additions & 0 deletions docs/content/commands/npm-explore.md
Expand Up @@ -10,6 +10,8 @@ description: Browse an installed package
npm explore <pkg> [ -- <command>]
```

Note: This command is unaware of workspaces.

### Description

Spawn a subshell in the directory of the installed package specified.
Expand Down
24 changes: 24 additions & 0 deletions docs/content/commands/npm-find-dupes.md
@@ -0,0 +1,24 @@
---
title: npm-find-dupes
section: 1
description: Find duplication in the package tree
---

### Synopsis

```bash
npm find-dupes
```

### Description

Runs `npm dedupe` in `--dry-run` mode, making npm only output the
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)

2 changes: 2 additions & 0 deletions docs/content/commands/npm-help-search.md
Expand Up @@ -10,6 +10,8 @@ description: Search npm help documentation
npm help-search <text>
```

Note: This command is unaware of workspaces.

### Description

This command will search the npm markdown documentation files for the terms
Expand Down