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.18.0 #3434

Merged
merged 20 commits into from
Jun 17, 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
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,47 @@ jobs:
env:
DEPLOY_VERSION: testing

workspaces-tests:
strategy:
fail-fast: false
matrix:
node-version: [10.x, 12.x, 14.x, 16.x]
platform:
- os: ubuntu-latest
shell: bash
- os: macos-latest
shell: bash
- os: windows-latest
shell: bash
- os: windows-latest
shell: powershell

runs-on: ${{ matrix.platform.os }}
defaults:
run:
shell: ${{ matrix.platform.shell }}

steps:
# Checkout the npm/cli repo
- uses: actions/checkout@v2

# Installs the specific version of Node.js
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

# Run the installer script
- name: Install dependencies
run: |
node . install --ignore-scripts --no-audit
node . rebuild

- name: Run workspaces tests
run: node . test -w ./packages -- --no-check-coverage -t600 -Rbase -c
env:
DEPLOY_VERSION: testing

build:
strategy:
fail-fast: false
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -783,3 +783,4 @@ rethab <[email protected]>
Spencer Wilson <[email protected]>
Daniel Park <[email protected]>
Daniel Park <[email protected]>
Luke Karrys <[email protected]>
76 changes: 76 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,79 @@
## v7.18.0 (2021-06-17)

## FEATURES

* [`ae285b391`](https://github.com/npm/cli/commit/ae285b39191f3a0c4edfb045a334057bef4567b5)
[#3408](https://github.com/npm/cli/issues/3408)
feat(ls): support `--package-lock-only` flag
([@G-Rath](https://github.com/G-Rath))
* [`c984fb59c`](https://github.com/npm/cli/commit/c984fb59c5af087b91acd927cbbacad7c6a46576)
[#3420](https://github.com/npm/cli/issues/3420)
feat(pack): add pack-destination config
([@wraithgar](https://github.com/wraithgar))

## BUG FIXES

* [`40829ec40`](https://github.com/npm/cli/commit/40829ec40c33a6d23f18715e60e3395bdcb0467e)
[#2554](https://github.com/npm/cli/issues/2554)
[#3399](https://github.com/npm/cli/issues/3399)
fix(link): do not prune packages
([@ruyadorno](https://github.com/ruyadorno))
* [`102d4e6fb`](https://github.com/npm/cli/commit/102d4e6fb3c3b02148dbeee977a7d1e6372340d5)
[#3417](https://github.com/npm/cli/issues/3417)
fix(workspaces): explicitly error in global mode
([@wraithgar](https://github.com/wraithgar))
* [`993df3041`](https://github.com/npm/cli/commit/993df3041f5bdaa496c3c8d80f00d16b9cf0a1e6)
[#3423](https://github.com/npm/cli/issues/3423)
fix(docs): ls command usage instructions
([@gurdiga](https://github.com/gurdiga))
* [`dcc13662c`](https://github.com/npm/cli/commit/dcc13662c1d3e22eaf392647a9cddbb5b0710d24)
[#3418](https://github.com/npm/cli/issues/3418)
fix(config): update link definition
([@wraithgar](https://github.com/wraithgar))
* [`b19e56c2e`](https://github.com/npm/cli/commit/b19e56c2e54c035518165470c10480201cefa997)
[#3382](https://github.com/npm/cli/issues/3382)
[#3429](https://github.com/npm/cli/issues/3429)
fix(ls): respect prod config for workspaces
([@ruyadorno](https://github.com/ruyadorno))
* [`c99b8b53c`](https://github.com/npm/cli/commit/c99b8b53c3d7a9b0daa6d4416e9c40202ddd59a2)
[#3430](https://github.com/npm/cli/issues/3430)
fix(config): add flatOptions.npxCache
([@wraithgar](https://github.com/wraithgar))
* [`e5abf2a21`](https://github.com/npm/cli/commit/e5abf2a2171d95bafc0993f337230d2b6633a6ed)
[#3386](https://github.com/npm/cli/issues/3386)
chore(libnpmdiff): added as workspace
([@ruyadorno](https://github.com/ruyadorno))
* [`c6a8734d7`](https://github.com/npm/cli/commit/c6a8734d7d6e4b6d061110a01e45e1d418d56489)
[#3388](https://github.com/npm/cli/issues/3388)
chore(refactor): finish passing npm context
([@wraithgar](https://github.com/wraithgar))
* [`d16ee452a`](https://github.com/npm/cli/commit/d16ee452a4a034caada4e9b96faf5c453a658876)
[#3426](https://github.com/npm/cli/issues/3426)
chore(tests): use path.resolve
([@wraithgar](https://github.com/wraithgar))

## DEPENDENCIES

* [`6b951c042`](https://github.com/npm/cli/commit/6b951c042084e639be929a7ea783c2d85b311bad)
`[email protected]`:
* fix(retrieve-tag): pass match in a way git accepts
* [`de820a021`](https://github.com/npm/cli/commit/de820a0213f54bbcd155dff25b05d072d5c4a57a)
`[email protected]`:
* fix: Make file: URLs (mostly) RFC 8909 compliant
* [`16a95c647`](https://github.com/npm/cli/commit/16a95c64731609c69630c17c45b16edb53ee81b2)
`@npmcli/[email protected]`:
* fix(inventory) handle old and british forms of 'license'
* fix: removes [_complete] check to apply correct metadata
* ensure node.fsParent is not set to node itself
* fix extraneous deps on load-actual
* [`d341bd86c`](https://github.com/npm/cli/commit/d341bd86ce05fabe44f3be5888ba2611b61914b4)
`[email protected]`:
* fix: implement cache modes correctly
* [`c90612cf5`](https://github.com/npm/cli/commit/c90612cf566d563199553749900d8b05367e2532)
`[email protected]`:
* use new npxCache option


## v7.17.0 (2021-06-10)

## FEATURES
Expand Down
10 changes: 8 additions & 2 deletions docs/content/commands/npm-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,14 @@ Not supported by all npm commands.
* Default: false
* Type: Boolean

If set to true, it will update only the `package-lock.json`, instead of
checking `node_modules` and downloading dependencies.
If set to true, the current operation will only use the `package-lock.json`,
ignoring `node_modules`.

For `update` this means only the `package-lock.json` will be updated,
instead of checking `node_modules` and downloading dependencies.

For `list` this means the output will be based on the tree described by the
`package-lock.json`, rather than the contents of `node_modules`.

#### `omit`

Expand Down
21 changes: 12 additions & 9 deletions docs/content/commands/npm-ls.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,21 @@ variable will be set to `'production'` for all lifecycle scripts.
* Default: false
* Type: Boolean

If true, then local installs will link if there is a suitable globally
installed package.
Used with `npm ls`, limiting output to only those packages that are linked.

Note that this means that local installs can cause things to be installed
into the global space at the same time. The link is only done if one of the
two conditions are met:
#### `package-lock-only`

* The package is not already installed globally, or
* the globally installed version is identical to the version that is being
installed locally.
* Default: false
* Type: Boolean

If set to true, the current operation will only use the `package-lock.json`,
ignoring `node_modules`.

For `update` this means only the `package-lock.json` will be updated,
instead of checking `node_modules` and downloading dependencies.

When used with `npm ls`, only show packages that are linked.
For `list` this means the output will be based on the tree described by the
`package-lock.json`, rather than the contents of `node_modules`.

#### `unicode`

Expand Down
7 changes: 7 additions & 0 deletions docs/content/commands/npm-pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ Whether or not to output JSON data, rather than the normal output.

Not supported by all npm commands.

#### `pack-destination`

* Default: "."
* Type: String

Directory in which `npm pack` will save tarballs.

#### `workspace`

* Default:
Expand Down
20 changes: 8 additions & 12 deletions docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -743,18 +743,7 @@ Use of `legacy-peer-deps` is not recommended, as it will not enforce the
* Default: false
* Type: Boolean

If true, then local installs will link if there is a suitable globally
installed package.

Note that this means that local installs can cause things to be installed
into the global space at the same time. The link is only done if one of the
two conditions are met:

* The package is not already installed globally, or
* the globally installed version is identical to the version that is being
installed locally.

When used with `npm ls`, only show packages that are linked.
Used with `npm ls`, limiting output to only those packages that are linked.

#### `local-address`

Expand Down Expand Up @@ -878,6 +867,13 @@ when publishing or changing package permissions with `npm access`.
If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.

#### `pack-destination`

* Default: "."
* Type: String

Directory in which `npm pack` will save tarballs.

#### `package`

* Default:
Expand Down
2 changes: 1 addition & 1 deletion lib/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Audit extends ArboristWorkspaceCmd {
audit: true,
path: this.npm.prefix,
reporter,
workspaces: this.workspaces,
workspaces: this.workspaceNames,
}

const arb = new Arborist(opts)
Expand Down
9 changes: 9 additions & 0 deletions lib/base-command.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Base class for npm.commands[cmd]
const usageUtil = require('./utils/usage.js')
const ConfigDefinitions = require('./utils/config/definitions.js')
const getWorkspaces = require('./workspaces/get-workspaces.js')

class BaseCommand {
constructor (npm) {
Expand Down Expand Up @@ -72,5 +73,13 @@ class BaseCommand {
{ code: 'ENOWORKSPACES' }
)
}

async setWorkspaces (filters) {
// TODO npm guards workspaces/global mode so we should use this.npm.prefix?
const ws = await getWorkspaces(filters, { path: this.npm.localPrefix })
this.workspaces = ws
this.workspaceNames = [...ws.keys()]
this.workspacePaths = [...ws.values()]
}
}
module.exports = BaseCommand
2 changes: 1 addition & 1 deletion lib/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CI extends ArboristWorkspaceCmd {
path: where,
log: this.npm.log,
save: false, // npm ci should never modify the lockfile or package.json
workspaces: this.workspaces,
workspaces: this.workspaceNames,
}

const arb = new Arborist(opts)
Expand Down
1 change: 1 addition & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = (process) => {

const npm = require('../lib/npm.js')
const errorHandler = require('../lib/utils/error-handler.js')
errorHandler.setNpm(npm)

// if npm is called as "npmg" or "npm_g", then
// run in global mode.
Expand Down
2 changes: 1 addition & 1 deletion lib/dedupe.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Dedupe extends ArboristWorkspaceCmd {
log: this.npm.log,
path: where,
dryRun,
workspaces: this.workspaces,
workspaces: this.workspaceNames,
}
const arb = new Arborist(opts)
await arb.dedupe(opts)
Expand Down
7 changes: 2 additions & 5 deletions lib/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const npmlog = require('npmlog')
const pacote = require('pacote')
const pickManifest = require('npm-pick-manifest')

const getWorkspaces = require('./workspaces/get-workspaces.js')
const readPackageName = require('./utils/read-package-name.js')
const BaseCommand = require('./base-command.js')

Expand Down Expand Up @@ -90,9 +89,8 @@ class Diff extends BaseCommand {
}

async diffWorkspaces (args, filters) {
const workspaces =
await getWorkspaces(filters, { path: this.npm.localPrefix })
for (const workspacePath of workspaces.values()) {
await this.setWorkspaces(filters)
for (const workspacePath of this.workspacePaths) {
this.top = workspacePath
this.prefix = workspacePath
await this.diff(args)
Expand All @@ -104,7 +102,6 @@ class Diff extends BaseCommand {
async packageName (path) {
let name
try {
// TODO this won't work as expected in global mode
name = await readPackageName(this.prefix)
} catch (e) {
npmlog.verbose('diff', 'could not read project dir package.json')
Expand Down
6 changes: 2 additions & 4 deletions lib/dist-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const semver = require('semver')

const otplease = require('./utils/otplease.js')
const readPackageName = require('./utils/read-package-name.js')
const getWorkspaces = require('./workspaces/get-workspaces.js')
const BaseCommand = require('./base-command.js')

class DistTag extends BaseCommand {
Expand Down Expand Up @@ -180,10 +179,9 @@ class DistTag extends BaseCommand {
}

async listWorkspaces (filters) {
const workspaces =
await getWorkspaces(filters, { path: this.npm.localPrefix })
await this.setWorkspaces(filters)

for (const [name] of workspaces) {
for (const name of this.workspaceNames) {
try {
this.npm.output(`${name}:`)
await this.list(npa(name), this.npm.flatOptions)
Expand Down
6 changes: 2 additions & 4 deletions lib/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const log = require('npmlog')
const pacote = require('pacote')
const openUrl = require('./utils/open-url.js')
const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js')
const getWorkspaces = require('./workspaces/get-workspaces.js')

const BaseCommand = require('./base-command.js')
class Docs extends BaseCommand {
Expand Down Expand Up @@ -42,9 +41,8 @@ class Docs extends BaseCommand {
}

async docsWorkspaces (args, filters) {
const workspaces =
await getWorkspaces(filters, { path: this.npm.localPrefix })
return this.docs([...workspaces.values()])
await this.setWorkspaces(filters)
return this.docs(this.workspacePaths)
}

async getDocs (pkg) {
Expand Down
Loading