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.0.0 beta.13 #1877

Merged
merged 14 commits into from
Sep 29, 2020
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -704,3 +704,5 @@ Mickael Jeanroy <mickael.jeanroy@gmail.com>
Myles Borins <mylesborins@github.com>
Nathan LaFreniere <quitlahok@gmail.com>
Lucio Martinez <lucio.martinez@sixt.com>
Brian Jenkins <brian@npmjs.com>
nlf <quitlahok@gmail.com>
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
## v7.0.0-beta.13 (2020-09-29)

* [`405e051f7`](https://github.com/npm/cli/commit/405e051f724a2e79844f78f8ea9ba019fdc513aa)
Fix EBADPLATFORM error message
([@#1876](https://github.com/#1876))
* [`e4d911d21`](https://github.com/npm/cli/commit/e4d911d219899c0fdc12f8951b7d70e0887909f8)
`@npmcli/arborist@0.0.28`
* fix: workspaces install entering an infinite loop
* Save provided range if not a subset of savePrefix
* package-lock.json custom indentation
* Check engine and platform when building ideal tree
* [`90550b2e0`](https://github.com/npm/cli/commit/90550b2e023e7638134e91c80ed96828afb41539)
[#1853](https://github.com/npm/cli/pull/1853)
test coverage and refactor for token command
([@nlf](https://github.com/nlf))
* [`2715220c9`](https://github.com/npm/cli/commit/2715220c9b5d3f325e65e95bae2b5af8a485a579)
[#1858](https://github.com/npm/cli/pull/1858)
[#1813](https://github.com/npm/cli/issues/1813)
do not include omitted optional dependencies in install output
([@ruyadorno](https://github.com/ruyadorno))
* [`e225ddcf8`](https://github.com/npm/cli/commit/e225ddcf8d74a6b1cfb24ec49e37e3f5d06e5151)
[#1862](https://github.com/npm/cli/pull/1862)
[#1861](https://github.com/npm/cli/issues/1861)
respect depth when running `npm ls <pkg>`
([@ruyadorno](https://github.com/ruyadorno))
* [`2469ae515`](https://github.com/npm/cli/commit/2469ae5153fa4114a72684376a1b226aa07edf81)
[#1870](https://github.com/npm/cli/pull/1870)
[#1780](https://github.com/npm/cli/issues/1780)
Add 'fetch-timeout' config
([@isaacs](https://github.com/isaacs))
* [`52114b75e`](https://github.com/npm/cli/commit/52114b75e83db8a5e08f23889cce41c89af9eb93)
[#1871](https://github.com/npm/cli/pull/1871)
fix `npm ls` for linked dependencies
([@ruyadorno](https://github.com/ruyadorno))
* [`9981211c0`](https://github.com/npm/cli/commit/9981211c070ce2b1e34d30223d12bd275adcacf5)
[#1857](https://github.com/npm/cli/pull/1857)
[#1703](https://github.com/npm/cli/issues/1703)
fix `npm outdated` parsing invalid specs
([@ruyadorno](https://github.com/ruyadorno))

## v7.0.0-beta.12 (2020-09-22)

* [`24f3a5448`](https://github.com/npm/cli/commit/24f3a5448f021ad603046dfb9fd97ed66bd63bba)
Expand Down
7 changes: 7 additions & 0 deletions docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,13 @@ packages.
The "maxTimeout" config for the `retry` module to use when fetching
packages.

#### fetch-timeout

* Default: 300000 (5 minutes)
* Type: Number

The maximum amount of time to wait for HTTP requests to complete.

#### fund

* Default: true
Expand Down
9 changes: 7 additions & 2 deletions lib/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,12 @@ const ls = async (args) => {
const seenItems = new Set()
const seenNodes = new Map()
const problems = new Set()
const depthToPrint = (all || args.length) ? Infinity : (depth || 0)

// defines special handling of printed depth when filtering with args
const filterDefaultDepth = depth === null ? Infinity : depth
const depthToPrint = (all || args.length)
? filterDefaultDepth
: (depth || 0)

// add root node of tree to list of seenNodes
seenNodes.set(tree.path, tree)
Expand All @@ -423,7 +428,7 @@ const ls = async (args) => {
!(node instanceof Arborist.Node) || (node[_depth] > depthToPrint)
return (shouldSkipChildren)
? []
: [...node.edgesOut.values()]
: [...(node.target || node).edgesOut.values()]
.filter(filterByEdgesTypes({
dev,
development,
Expand Down
9 changes: 6 additions & 3 deletions lib/outdated.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,11 @@ async function outdated_ (tree, deps, opts) {
const packument = await getPackument(spec)
const expected = edge.spec
// if it's not a range, version, or tag, skip it
/* istanbul ignore next */
if (!npa(`${edge.name}@${edge.spec}`).registry) {
try {
if (!npa(`${edge.name}@${edge.spec}`).registry) {
return null
}
} catch (err) {
return null
}
const wanted = pickManifest(packument, expected, npm.flatOptions)
Expand Down Expand Up @@ -170,7 +173,7 @@ async function outdated_ (tree, deps, opts) {
err.code === 'E403' ||
err.code === 'E404')
) {
throw (err)
throw err
}
}
}
Expand Down
23 changes: 17 additions & 6 deletions lib/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,21 @@ token.usage = usageUtil('token',
'npm token revoke <tokenKey>\n' +
'npm token create [--read-only] [--cidr=list]')

const UsageError = (msg) =>
Object.assign(new Error(`\nUsage: ${msg}\n\n` + token.usage), {
code: 'EUSAGE'
})

const InvalidCIDRError = (msg) =>
Object.assign(new Error(msg), { code: 'EINVALIDCIDR' })

token.subcommands = ['list', 'revoke', 'create']

token.completion = function (opts, cb) {
var argv = opts.conf.argv.remain
if (argv.length === 2) {
return cb(null, token.subcommands)
}

switch (argv[2]) {
case 'list':
Expand Down Expand Up @@ -59,7 +70,7 @@ function token (args, cb) {
withCb(create(args.slice(1)), cb)
break
default:
cb(new Error('Unknown profile command: ' + args[0]))
cb(UsageError(`${args[0]} is not a recognized subcommand.`))
}
}

Expand Down Expand Up @@ -146,7 +157,7 @@ function list (args) {

function rm (args) {
if (args.length === 0) {
throw new Error('npm token revoke <tokenKey>')
return Promise.reject(UsageError('`<tokenKey>` argument is required.'))
}
const conf = config()
const toRemove = []
Expand All @@ -161,7 +172,7 @@ function rm (args) {
throw new Error(`Token ID "${id}" was ambiguous, a new token may have been created since you last ran \`npm token list\`.`)
} else {
const tokenMatches = tokens.filter((token) => id.indexOf(token.token) === 0)
if (tokenMatches === 0) {
if (tokenMatches.length === 0) {
throw new Error(`Unknown token id or value "${id}".`)
}
toRemove.push(id)
Expand All @@ -188,8 +199,8 @@ function create (args) {
const cidr = conf.cidr
const readonly = conf.readOnly

const validCIDR = validateCIDRList(cidr)
return readUserInfo.password().then((password) => {
const validCIDR = validateCIDRList(cidr)
log.info('token', 'creating')
return pulseTillDone.withPromise(otplease(conf, conf => {
return profile.createToken(password, readonly, validCIDR, conf)
Expand All @@ -211,10 +222,10 @@ function create (args) {

function validateCIDR (cidr) {
if (isCidrV6(cidr)) {
throw new Error('CIDR whitelist can only contain IPv4 addresses, ' + cidr + ' is IPv6')
throw InvalidCIDRError('CIDR whitelist can only contain IPv4 addresses, ' + cidr + ' is IPv6')
}
if (!isCidrV4(cidr)) {
throw new Error('CIDR whitelist contains invalid CIDR entry: ' + cidr)
throw InvalidCIDRError('CIDR whitelist contains invalid CIDR entry: ' + cidr)
}
}

Expand Down
6 changes: 4 additions & 2 deletions lib/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const defaults = {

color: process.env.NO_COLOR == null,
call: '',
depth: 0,
depth: null,
description: true,
dev: false,
'dry-run': false,
Expand All @@ -88,6 +88,7 @@ const defaults = {
'fetch-retry-factor': 10,
'fetch-retry-mintimeout': 10000,
'fetch-retry-maxtimeout': 60000,
'fetch-timeout': 5 * 60 * 1000,

git: 'git',
'git-tag-version': true,
Expand Down Expand Up @@ -208,7 +209,7 @@ const types = {
cidr: [null, String, Array],
color: ['always', Boolean],
call: String,
depth: Number,
depth: [null, Number],
description: Boolean,
dev: Boolean,
'dry-run': Boolean,
Expand All @@ -221,6 +222,7 @@ const types = {
'fetch-retry-factor': Number,
'fetch-retry-mintimeout': Number,
'fetch-retry-maxtimeout': Number,
'fetch-timeout': Number,
git: String,
'git-tag-version': Boolean,
'commit-hooks': Boolean,
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/flat-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ const flatOptions = npm => npm.flatOptions || Object.freeze({
minTimeout: npm.config.get('fetch-retry-mintimeout')
},

timeout: npm.config.get('fetch-timeout'),

force: npm.config.get('force'),

formatPackageLock: npm.config.get('format-package-lock'),
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/reify-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const reifyOutput = arb => {
summary.removed++
break
case 'ADD':
summary.added++
actualTree.inventory.has(d.ideal) && summary.added++
break
case 'CHANGE':
summary.changed++
Expand Down
16 changes: 6 additions & 10 deletions node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions node_modules/@npmcli/arborist/lib/arborist/audit.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.