Skip to content
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
1 change: 1 addition & 0 deletions lib/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Install extends ArboristWorkspaceCmd {
'audit',
'before',
'min-release-age',
'min-release-age-exclude',
'bin-links',
'fund',
'dry-run',
Expand Down
12 changes: 10 additions & 2 deletions lib/commands/outdated.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const pacote = require('pacote')
const table = require('text-table')
const npa = require('npm-package-arg')
const pickManifest = require('npm-pick-manifest')
const { isReleaseAgeExcluded } = require('@npmcli/arborist/lib/release-age-exclude.js')
const { output } = require('proc-log')
const localeCompare = require('@isaacs/string-locale-compare')('en')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
Expand Down Expand Up @@ -32,6 +33,7 @@ class Outdated extends ArboristWorkspaceCmd {
'workspace',
'before',
'min-release-age',
'min-release-age-exclude',
]

#tree
Expand Down Expand Up @@ -183,8 +185,14 @@ class Outdated extends ArboristWorkspaceCmd {
try {
const packument = await this.#getPackument(spec)
const expected = alias ? alias.fetchSpec : edge.spec
const wanted = pickManifest(packument, expected, this.npm.flatOptions)
const latest = pickManifest(packument, '*', this.npm.flatOptions)
const { minReleaseAgeExclude } = this.npm.flatOptions
// Packages matching `min-release-age-exclude` resolve to their newest
// version, so drop the `before` constraint for them.
const pickOpts = isReleaseAgeExcluded(packument.name, minReleaseAgeExclude)
? { ...this.npm.flatOptions, before: null }
: this.npm.flatOptions
const wanted = pickManifest(packument, expected, pickOpts)
const latest = pickManifest(packument, '*', pickOpts)
if (!current || current !== wanted.version || wanted.version !== latest.version) {
this.#list.push({
name: alias ? edge.spec.replace('npm', edge.name) : edge.name,
Expand Down
3 changes: 3 additions & 0 deletions lib/commands/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class Query extends BaseCommand {
'include-workspace-root',
'package-lock-only',
'expect-results',
'before',
'min-release-age',
'min-release-age-exclude',
]

constructor (...args) {
Expand Down
1 change: 1 addition & 0 deletions lib/commands/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Update extends ArboristWorkspaceCmd {
'audit',
'before',
'min-release-age',
'min-release-age-exclude',
'bin-links',
'fund',
'dry-run',
Expand Down
2 changes: 1 addition & 1 deletion smoke-tests/tap-snapshots/test/index.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ npm error --allow-scripts
npm error Comma-separated list of packages whose install-time lifecycle scripts
npm error
npm error --strict-allow-scripts
npm error If \`true\`, turn the install-script policy from a silent skip into a
npm error If \`true\`, turn the install-script policy from a warning into a hard
npm error
npm error --dangerously-allow-all-scripts
npm error If \`true\`, bypass the \`allowScripts\` policy entirely and run every
Expand Down
2 changes: 2 additions & 0 deletions tap-snapshots/test/lib/commands/config.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"maxsockets": 15,
"message": "%s",
"min-release-age": null,
"min-release-age-exclude": [],
"node-gyp": "{CWD}/node_modules/node-gyp/bin/node-gyp.js",
"node-options": null,
"noproxy": [
Expand Down Expand Up @@ -299,6 +300,7 @@ logs-max = 10
maxsockets = 15
message = "%s"
min-release-age = null
min-release-age-exclude = []
name = null
node-gyp = "{CWD}/node_modules/node-gyp/bin/node-gyp.js"
node-options = null
Expand Down
113 changes: 93 additions & 20 deletions tap-snapshots/test/lib/docs.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ sources, the standard precedence applies (cli > env > project > user >
global), so a higher-priority source can always relax or override a
lower-priority one.

Packages whose names match \`min-release-age-exclude\` are exempt from this
filter.



#### \`bin-links\`
Expand Down Expand Up @@ -1300,6 +1303,37 @@ your \`.npmrc\` is preserved when npm internally spawns a sub-process with
apply, \`before\` wins within a single source and across sources the standard
precedence rules apply.

Packages whose names match \`min-release-age-exclude\` are exempt from this
filter.

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

#### \`min-release-age-exclude\`

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

A list of package names or \`minimatch\` glob patterns that are exempt from
the \`min-release-age\` (and \`before\`) filter. A matching package can always
resolve to its newest version, even when a release-age window is set.

For example, to apply a release-age window to third-party dependencies while
letting internally maintained packages update immediately:

\`\`\`
min-release-age=7
min-release-age-exclude[]=@myorg/*
min-release-age-exclude[]=my-internal-pkg
\`\`\`

Only the named package is exempt; its own dependencies still follow the
release-age policy unless they also match a pattern. Patterns match against
the package name, so \`@myorg/*\` matches \`@myorg/shared-utils\`.

Excluding a package does not change which registry it is fetched from. You
should own your private scope on the public registry so that nobody else can
publish a package with the same name.

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

#### \`name\`
Expand Down Expand Up @@ -1912,13 +1946,13 @@ this to work properly.
* Default: false
* Type: Boolean

If \`true\`, turn the install-script policy from a silent skip into a hard
error: any dependency with install scripts not covered by \`allowScripts\`
will fail the install instead of being silently skipped.
If \`true\`, turn the install-script policy from a warning into a hard error:
any dependency with install scripts that is not covered by \`allowScripts\`
will fail the install instead of being blocked with a warning.

By default, dependencies whose install scripts are not approved in
\`allowScripts\` are silently skipped; this setting promotes that silent skip
into a hard failure, which is the recommended posture for CI.
Dependencies explicitly denied with \`false\` in \`allowScripts\` are always
silently skipped; this setting only affects unreviewed entries (packages
with install scripts that are neither approved nor denied).
\`--ignore-scripts\` and \`--dangerously-allow-all-scripts\` both override this
setting.

Expand Down Expand Up @@ -2513,6 +2547,7 @@ Array [
"maxsockets",
"message",
"min-release-age",
"min-release-age-exclude",
"node-gyp",
"node-options",
"noproxy",
Expand Down Expand Up @@ -2679,6 +2714,7 @@ Array [
"maxsockets",
"message",
"min-release-age",
"min-release-age-exclude",
"node-gyp",
"noproxy",
"offline",
Expand Down Expand Up @@ -2856,6 +2892,7 @@ Object {
"logColor": false,
"maxSockets": 15,
"message": "%s",
"minReleaseAgeExclude": Array [],
"name": null,
"nodeBin": "{NODE}",
"nodeGyp": "{CWD}/node_modules/node-gyp/bin/node-gyp.js",
Expand Down Expand Up @@ -3284,7 +3321,7 @@ Options:
Comma-separated list of packages whose install-time lifecycle scripts

--strict-allow-scripts
If \`true\`, turn the install-script policy from a silent skip into a
If \`true\`, turn the install-script policy from a warning into a hard

--dangerously-allow-all-scripts
If \`true\`, bypass the \`allowScripts\` policy entirely and run every
Expand Down Expand Up @@ -3846,7 +3883,7 @@ Options:
Comma-separated list of packages whose install-time lifecycle scripts

--strict-allow-scripts
If \`true\`, turn the install-script policy from a silent skip into a
If \`true\`, turn the install-script policy from a warning into a hard

--dangerously-allow-all-scripts
If \`true\`, bypass the \`allowScripts\` policy entirely and run every
Expand Down Expand Up @@ -4231,8 +4268,10 @@ Options:
[--allow-remote <all|none|root>]
[--allow-scripts <package-list> [--allow-scripts <package-list> ...]]
[--strict-allow-scripts] [--dangerously-allow-all-scripts] [--no-audit]
[--before <date>] [--min-release-age <days>] [--no-bin-links] [--no-fund]
[--dry-run] [--cpu <cpu>] [--os <os>] [--libc <libc>]
[--before <date>] [--min-release-age <days>]
[--min-release-age-exclude <pkg|glob> [--min-release-age-exclude <pkg|glob> ...]]
[--no-bin-links] [--no-fund] [--dry-run] [--cpu <cpu>] [--os <os>]
[--libc <libc>]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[--workspaces] [--include-workspace-root] [--install-links]

Expand Down Expand Up @@ -4294,7 +4333,7 @@ Options:
Comma-separated list of packages whose install-time lifecycle scripts

--strict-allow-scripts
If \`true\`, turn the install-script policy from a silent skip into a
If \`true\`, turn the install-script policy from a warning into a hard

--dangerously-allow-all-scripts
If \`true\`, bypass the \`allowScripts\` policy entirely and run every
Expand All @@ -4308,6 +4347,9 @@ Options:
--min-release-age
If set, npm will build the npm tree such that only versions that were

--min-release-age-exclude
A list of package names or \`minimatch\` glob patterns that are exempt

--bin-links
Tells npm to create symlinks (or \`.cmd\` shims on Windows) for package

Expand Down Expand Up @@ -4373,6 +4415,7 @@ aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall
#### \`audit\`
#### \`before\`
#### \`min-release-age\`
#### \`min-release-age-exclude\`
#### \`bin-links\`
#### \`fund\`
#### \`dry-run\`
Expand Down Expand Up @@ -4444,7 +4487,7 @@ Options:
Comma-separated list of packages whose install-time lifecycle scripts

--strict-allow-scripts
If \`true\`, turn the install-script policy from a silent skip into a
If \`true\`, turn the install-script policy from a warning into a hard

--dangerously-allow-all-scripts
If \`true\`, bypass the \`allowScripts\` policy entirely and run every
Expand Down Expand Up @@ -4527,8 +4570,10 @@ Options:
[--allow-remote <all|none|root>]
[--allow-scripts <package-list> [--allow-scripts <package-list> ...]]
[--strict-allow-scripts] [--dangerously-allow-all-scripts] [--no-audit]
[--before <date>] [--min-release-age <days>] [--no-bin-links] [--no-fund]
[--dry-run] [--cpu <cpu>] [--os <os>] [--libc <libc>]
[--before <date>] [--min-release-age <days>]
[--min-release-age-exclude <pkg|glob> [--min-release-age-exclude <pkg|glob> ...]]
[--no-bin-links] [--no-fund] [--dry-run] [--cpu <cpu>] [--os <os>]
[--libc <libc>]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[--workspaces] [--include-workspace-root] [--install-links]

Expand Down Expand Up @@ -4590,7 +4635,7 @@ Options:
Comma-separated list of packages whose install-time lifecycle scripts

--strict-allow-scripts
If \`true\`, turn the install-script policy from a silent skip into a
If \`true\`, turn the install-script policy from a warning into a hard

--dangerously-allow-all-scripts
If \`true\`, bypass the \`allowScripts\` policy entirely and run every
Expand All @@ -4604,6 +4649,9 @@ Options:
--min-release-age
If set, npm will build the npm tree such that only versions that were

--min-release-age-exclude
A list of package names or \`minimatch\` glob patterns that are exempt

--bin-links
Tells npm to create symlinks (or \`.cmd\` shims on Windows) for package

Expand Down Expand Up @@ -4669,6 +4717,7 @@ alias: it
#### \`audit\`
#### \`before\`
#### \`min-release-age\`
#### \`min-release-age-exclude\`
#### \`bin-links\`
#### \`fund\`
#### \`dry-run\`
Expand Down Expand Up @@ -5115,6 +5164,7 @@ Options:
[-a|--all] [--json] [-l|--long] [-p|--parseable] [-g|--global]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[--before <date>] [--min-release-age <days>]
[--min-release-age-exclude <pkg|glob> [--min-release-age-exclude <pkg|glob> ...]]

-a|--all
Show or act on all packages, not just the ones your project directly
Expand All @@ -5140,6 +5190,9 @@ Options:
--min-release-age
If set, npm will build the npm tree such that only versions that were

--min-release-age-exclude
A list of package names or \`minimatch\` glob patterns that are exempt


Run "npm help outdated" for more info

Expand All @@ -5155,6 +5208,7 @@ npm outdated [<package-spec> ...]
#### \`workspace\`
#### \`before\`
#### \`min-release-age\`
#### \`min-release-age-exclude\`
`

exports[`test/lib/docs.js TAP usage owner > must match snapshot 1`] = `
Expand Down Expand Up @@ -5510,7 +5564,9 @@ Options:
[-g|--global]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[--workspaces] [--include-workspace-root] [--package-lock-only]
[--expect-results|--expect-result-count <count>]
[--expect-results|--expect-result-count <count>] [--before <date>]
[--min-release-age <days>]
[--min-release-age-exclude <pkg|glob> [--min-release-age-exclude <pkg|glob> ...]]

-g|--global
Operates in "global" mode, so that packages are installed into the
Expand All @@ -5530,6 +5586,15 @@ Options:
--expect-results
Tells npm whether or not to expect results from the command.

--before
If passed to \`npm install\`, will rebuild the npm tree such that only

--min-release-age
If set, npm will build the npm tree such that only versions that were

--min-release-age-exclude
A list of package names or \`minimatch\` glob patterns that are exempt


Run "npm help query" for more info

Expand All @@ -5544,6 +5609,9 @@ npm query <selector>
#### \`package-lock-only\`
#### \`expect-results\`
#### \`expect-result-count\`
#### \`before\`
#### \`min-release-age\`
#### \`min-release-age-exclude\`
`

exports[`test/lib/docs.js TAP usage rebuild > must match snapshot 1`] = `
Expand Down Expand Up @@ -5575,7 +5643,7 @@ Options:
Comma-separated list of packages whose install-time lifecycle scripts

--strict-allow-scripts
If \`true\`, turn the install-script policy from a silent skip into a
If \`true\`, turn the install-script policy from a warning into a hard

--dangerously-allow-all-scripts
If \`true\`, bypass the \`allowScripts\` policy entirely and run every
Expand Down Expand Up @@ -6351,8 +6419,9 @@ Options:
[--ignore-scripts]
[--allow-scripts <package-list> [--allow-scripts <package-list> ...]]
[--strict-allow-scripts] [--dangerously-allow-all-scripts] [--no-audit]
[--before <date>] [--min-release-age <days>] [--no-bin-links] [--no-fund]
[--dry-run]
[--before <date>] [--min-release-age <days>]
[--min-release-age-exclude <pkg|glob> [--min-release-age-exclude <pkg|glob> ...]]
[--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[--workspaces] [--include-workspace-root] [--install-links]

Expand Down Expand Up @@ -6393,7 +6462,7 @@ Options:
Comma-separated list of packages whose install-time lifecycle scripts

--strict-allow-scripts
If \`true\`, turn the install-script policy from a silent skip into a
If \`true\`, turn the install-script policy from a warning into a hard

--dangerously-allow-all-scripts
If \`true\`, bypass the \`allowScripts\` policy entirely and run every
Expand All @@ -6407,6 +6476,9 @@ Options:
--min-release-age
If set, npm will build the npm tree such that only versions that were

--min-release-age-exclude
A list of package names or \`minimatch\` glob patterns that are exempt

--bin-links
Tells npm to create symlinks (or \`.cmd\` shims on Windows) for package

Expand Down Expand Up @@ -6456,6 +6528,7 @@ aliases: u, up, upgrade, udpate
#### \`audit\`
#### \`before\`
#### \`min-release-age\`
#### \`min-release-age-exclude\`
#### \`bin-links\`
#### \`fund\`
#### \`dry-run\`
Expand Down
Loading
Loading