Skip to content

Commit df78b27

Browse files
authored
Merge branch 'release-next' into add-libnpmdiff-as-workspace
2 parents bd0763d + 3f202cd commit df78b27

File tree

376 files changed

+398
-39252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

376 files changed

+398
-39252
lines changed

.github/workflows/create-cli-deps-pr.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ jobs:
3030
ref: master
3131
repository: "npm/node"
3232
token: ${{ secrets.NPM_ROBOT_USER_PAT }}
33+
- name: Pull (Fast-Forward) upstream
34+
id: sync
35+
uses: aormsby/[email protected]
36+
with:
37+
upstream_repository: nodejs/node
38+
upstream_branch: master
39+
target_branch: master
40+
git_pull_args: --ff-only # optional arg use, defaults to simple 'pull'
41+
github_token: ${{ secrets.NPM_ROBOT_USER_PAT }} # optional, for accessing repos that require authentication
3342
- name: Run dependency updates and create PR
3443
run: |
3544
npm_tag=""

.npmignore

Lines changed: 0 additions & 49 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
1+
## v7.17.0 (2021-06-10)
2+
3+
## FEATURES
4+
5+
* [`ef668ab57`](https://github.com/npm/cli/commit/ef668ab57b15789c6e2971ac39d8ecb3757629fa)
6+
[#3368](https://github.com/npm/cli/issues/3368)
7+
feat(diff): add workspace support
8+
([@wraithgar](https://github.com/wraithgar))
9+
10+
## BUG FIXES
11+
12+
* [`26d00c477`](https://github.com/npm/cli/commit/26d00c47785dfb300eab6a926f9d7c4d566776b1)
13+
[#3364](https://github.com/npm/cli/issues/3364)
14+
fix(tests): mock writeFile in pack tests so we dont create 0 byte files in the repo
15+
([@nlf](https://github.com/nlf))
16+
* [`f130a81d6`](https://github.com/npm/cli/commit/f130a81d62bf4f540ab252a09ff5a618827f9265)
17+
[#3367](https://github.com/npm/cli/issues/3367)
18+
fix(linting): add scripts, docs, smoke-tests
19+
([@wraithgar](https://github.com/wraithgar))
20+
* [`992799cd8`](https://github.com/npm/cli/commit/992799cd8c4427ed8c57270b399b2d6bbc94f2a8)
21+
[#3383](https://github.com/npm/cli/issues/3383)
22+
fix(login): properly save scope if defined
23+
([@wraithgar](https://github.com/wraithgar))
24+
25+
## DOCUMENTATION
26+
27+
* [`844229519`](https://github.com/npm/cli/commit/844229519dd51d0bcafc8c39109a671b6333cf6c)
28+
[#3392](https://github.com/npm/cli/issues/3392)
29+
docs(workspaces): update using npm section
30+
Added examples of using `npm init` to bootstrap a new workspace and a
31+
section on how to add/manage dependencies to workspaces.
32+
([@ruyadorno](https://github.com/ruyadorno))
33+
34+
## DEPENDENCIES
35+
36+
* [`3654890fb`](https://github.com/npm/cli/commit/3654890fb3be8b57e73f7e6ac4d895017603ca9e)
37+
remove ignored dep
38+
([@nlf](https://github.com/nlf))
39+
* [`a4a0e68a9`](https://github.com/npm/cli/commit/a4a0e68a9e34a4c99e10e4fb8c5f89d323a4192f)
40+
[#3362](https://github.com/npm/cli/issues/3362)
41+
check less stuff into node_modules
42+
([@isaacs](https://github.com/isaacs))
43+
* [`7d5b049b6`](https://github.com/npm/cli/commit/7d5b049b654f96fc4c49d2f18a19adb4aa0f7d3c)
44+
[#3365](https://github.com/npm/cli/issues/3365)
45+
chore(package) Use a "files" list
46+
([@isaacs](https://github.com/isaacs))
47+
148
## v7.16.0 (2021-06-03)
249

350
## FEATURES

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ link: uninstall
9595
node bin/npm-cli.js link -f --ignore-scripts
9696

9797
prune:
98+
node bin/npm-cli.js run resetdeps
9899
node bin/npm-cli.js prune --production --no-save --no-audit
99100
@[[ "$(shell git status -s)" != "" ]] && echo "ERR: found unpruned files" && exit 1 || echo "git status is clean"
100101

docs/content/commands/npm-diff.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,38 @@ command, if no explicit tag is given.
242242
When used by the `npm diff` command, this is the tag used to fetch the
243243
tarball that will be compared with the local files by default.
244244
245+
#### `workspace`
246+
247+
* Default:
248+
* Type: String (can be set multiple times)
249+
250+
Enable running a command in the context of the configured workspaces of the
251+
current project while filtering by running only the workspaces defined by
252+
this configuration option.
253+
254+
Valid values for the `workspace` config are either:
255+
256+
* Workspace names
257+
* Path to a workspace directory
258+
* Path to a parent workspace directory (will result to selecting all of the
259+
nested workspaces)
260+
261+
When set for the `npm init` command, this may be set to the folder of a
262+
workspace which does not yet exist, to create the folder and set it up as a
263+
brand new workspace within the project.
264+
265+
This value is not exported to the environment for child processes.
266+
267+
#### `workspaces`
268+
269+
* Default: false
270+
* Type: Boolean
271+
272+
Enable running a command in the context of **all** the configured
273+
workspaces.
274+
275+
This value is not exported to the environment for child processes.
276+
245277
<!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
246278
## See Also
247279

docs/content/using-npm/workspaces.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ single **workspace**, meaning it's a nested package within the current local
2121
file system that is explicitly defined in the [`package.json`](/configuring-npm/package-json#workspaces)
2222
`workspaces` configuration.
2323

24-
### Installing workspaces
24+
### Defining workspaces
2525

2626
Workspaces are usually defined via the `workspaces` property of the
2727
[`package.json`](/configuring-npm/package-json#workspaces) file, e.g:
@@ -63,6 +63,49 @@ structure of files and folders:
6363
`-- package.json
6464
```
6565

66+
### Getting started with workspaces
67+
68+
You may automate the required steps to define a new workspace using
69+
[npm init](/commands/npm-init). For example in a project that already has a
70+
`package.json` defined you can run:
71+
72+
```
73+
npm init -w ./packages/a
74+
```
75+
76+
This command will create the missing folders and a new `package.json`
77+
file (if needed) while also making sure to properly configure the
78+
`"workspaces"` property of your root project `package.json`.
79+
80+
### Adding dependencies to a workspace
81+
82+
It's possible to directly add/remove/update dependencies of your workspaces
83+
using the [`workspace` config](/using-npm/config#workspace).
84+
85+
For example, assuming the following structure:
86+
87+
```
88+
.
89+
+-- package.json
90+
`-- packages
91+
+-- a
92+
| `-- package.json
93+
`-- b
94+
`-- package.json
95+
```
96+
97+
If you want to add a dependency named `abbrev` from the registry as a
98+
dependency of your workspace **a**, you may use the workspace config to tell
99+
the npm installer that package should be added as a dependency of the provided
100+
workspace:
101+
102+
```
103+
npm install abbrev -w a
104+
```
105+
106+
Note: other installing commands such as `uninstall`, `ci`, etc will also
107+
respect the provided `workspace` configuration.
108+
66109
### Using workspaces
67110

68111
Given the [specifities of how Node.js handles module resolution](https://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_all_together) it's possible to consume any defined workspace
@@ -138,4 +181,5 @@ Will run the `test` script in both `./packages/a` and `./packages/b`.
138181
* [npm install](/commands/npm-install)
139182
* [npm publish](/commands/npm-publish)
140183
* [npm run-script](/commands/npm-run-script)
184+
* [config](/using-npm/config)
141185

lib/adduser.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,9 @@ class AddUser extends BaseCommand {
7575

7676
async updateConfig ({ newCreds, registry, scope }) {
7777
this.npm.config.delete('_token', 'user') // prevent legacy pollution
78-
78+
this.npm.config.setCredentialsByURI(registry, newCreds)
7979
if (scope)
8080
this.npm.config.set(scope + ':registry', registry, 'user')
81-
82-
this.npm.config.setCredentialsByURI(registry, newCreds)
8381
await this.npm.config.save('user')
8482
}
8583
}

0 commit comments

Comments
 (0)