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.17.0 #3398

Merged
merged 11 commits into from
Jun 10, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
49 changes: 0 additions & 49 deletions .npmignore

This file was deleted.

47 changes: 47 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,50 @@
## v7.17.0 (2021-06-10)

## FEATURES

* [`ef668ab57`](https://github.com/npm/cli/commit/ef668ab57b15789c6e2971ac39d8ecb3757629fa)
[#3368](https://github.com/npm/cli/issues/3368)
feat(diff): add workspace support
([@wraithgar](https://github.com/wraithgar))

## BUG FIXES

* [`26d00c477`](https://github.com/npm/cli/commit/26d00c47785dfb300eab6a926f9d7c4d566776b1)
[#3364](https://github.com/npm/cli/issues/3364)
fix(tests): mock writeFile in pack tests so we dont create 0 byte files in the repo
([@nlf](https://github.com/nlf))
* [`f130a81d6`](https://github.com/npm/cli/commit/f130a81d62bf4f540ab252a09ff5a618827f9265)
[#3367](https://github.com/npm/cli/issues/3367)
fix(linting): add scripts, docs, smoke-tests
([@wraithgar](https://github.com/wraithgar))
* [`992799cd8`](https://github.com/npm/cli/commit/992799cd8c4427ed8c57270b399b2d6bbc94f2a8)
[#3383](https://github.com/npm/cli/issues/3383)
fix(login): properly save scope if defined
([@wraithgar](https://github.com/wraithgar))

## DOCUMENTATION

* [`844229519`](https://github.com/npm/cli/commit/844229519dd51d0bcafc8c39109a671b6333cf6c)
[#3392](https://github.com/npm/cli/issues/3392)
docs(workspaces): update using npm section
Added examples of using `npm init` to bootstrap a new workspace and a
section on how to add/manage dependencies to workspaces.
([@ruyadorno](https://github.com/ruyadorno))

## DEPENDENCIES

* [`3654890fb`](https://github.com/npm/cli/commit/3654890fb3be8b57e73f7e6ac4d895017603ca9e)
remove ignored dep
([@nlf](https://github.com/nlf))
* [`a4a0e68a9`](https://github.com/npm/cli/commit/a4a0e68a9e34a4c99e10e4fb8c5f89d323a4192f)
[#3362](https://github.com/npm/cli/issues/3362)
check less stuff into node_modules
([@isaacs](https://github.com/isaacs))
* [`7d5b049b6`](https://github.com/npm/cli/commit/7d5b049b654f96fc4c49d2f18a19adb4aa0f7d3c)
[#3365](https://github.com/npm/cli/issues/3365)
chore(package) Use a "files" list
([@isaacs](https://github.com/isaacs))

## v7.16.0 (2021-06-03)

## FEATURES
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ link: uninstall
node bin/npm-cli.js link -f --ignore-scripts

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

Expand Down
32 changes: 32 additions & 0 deletions docs/content/commands/npm-diff.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,38 @@ command, if no explicit tag is given.
When used by the `npm diff` command, this is the tag used to fetch the
tarball that will be compared with the local files by default.

#### `workspace`

* Default:
* Type: String (can be set multiple times)

Enable running a command in the context of the configured workspaces of the
current project while filtering by running only the workspaces defined by
this configuration option.

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
nested workspaces)

When set for the `npm init` command, this may be set to the folder of a
workspace which does not yet exist, to create the folder and set it up as a
brand new workspace within the project.

This value is not exported to the environment for child processes.

#### `workspaces`

* Default: false
* Type: Boolean

Enable running a command in the context of **all** the configured
workspaces.

This value is not exported to the environment for child processes.

<!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
## See Also

Expand Down
46 changes: 45 additions & 1 deletion docs/content/using-npm/workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ single **workspace**, meaning it's a nested package within the current local
file system that is explicitly defined in the [`package.json`](/configuring-npm/package-json#workspaces)
`workspaces` configuration.

### Installing workspaces
### Defining workspaces

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

### Getting started with workspaces

You may automate the required steps to define a new workspace using
[npm init](/commands/npm-init). For example in a project that already has a
`package.json` defined you can run:

```
npm init -w ./packages/a
```

This command will create the missing folders and a new `package.json`
file (if needed) while also making sure to properly configure the
`"workspaces"` property of your root project `package.json`.

### Adding dependencies to a workspace

It's possible to directly add/remove/update dependencies of your workspaces
using the [`workspace` config](/using-npm/config#workspace).

For example, assuming the following structure:

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

If you want to add a dependency named `abbrev` from the registry as a
dependency of your workspace **a**, you may use the workspace config to tell
the npm installer that package should be added as a dependency of the provided
workspace:

```
npm install abbrev -w a
```

Note: other installing commands such as `uninstall`, `ci`, etc will also
respect the provided `workspace` configuration.

### Using workspaces

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
Expand Down Expand Up @@ -138,4 +181,5 @@ Will run the `test` script in both `./packages/a` and `./packages/b`.
* [npm install](/commands/npm-install)
* [npm publish](/commands/npm-publish)
* [npm run-script](/commands/npm-run-script)
* [config](/using-npm/config)

Loading