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.24.0 #3770

Merged
merged 16 commits into from Sep 16, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions AUTHORS
Expand Up @@ -794,3 +794,8 @@ austincho <austin.cho14@gmail.com>
Nathan Fritz <fritzy@github.com>
tripu <1016538+tripu@users.noreply.github.com>
Matsuuu <huhta.matias@gmail.com>
Anders Kaseorg <andersk@mit.edu>
John Gee <john@ruru.gen.nz>
Ayush Rawal <royalrawal.2001@gmail.com>
Nate Green <heynategreen@gmail.com>
Jacob Yacovelli <jjyacovelli@gmail.com>
55 changes: 55 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,58 @@
## v7.24.0 (2021-09-16)

### FEATURES

* [`c7787b3fb`](https://github.com/npm/cli/commit/c7787b3fb7630aab84aae83ebf9a7117c7173b6b)
[`1fbbe1e04`](https://github.com/npm/cli/commit/1fbbe1e04be5d79c7b49910324e64c19ed599eeb)
bundled npm-install-checks ([@wraithgar](https://github.com/wraithgar))

### BUG FIXES

* [`0320bd77e`](https://github.com/npm/cli/commit/0320bd77e2a38f48a88e377df4b122fd21043a83)
[#3739](https://github.com/npm/cli/issues/3739)
fix(view): Show the correct publish date for versions selected by range ([@andersk](https://github.com/andersk))
* [`e4a521857`](https://github.com/npm/cli/commit/e4a5218573583149af795982a39fa64a4116cdab)
[#3748](https://github.com/npm/cli/issues/3748)
fix(install.sh): don't remove old npm first
([@wraithgar](https://github.com/wraithgar))
* [`b4aac345b`](https://github.com/npm/cli/commit/b4aac345b0a7cdec4d713c5be4daea37330b2b26)
[#3754](https://github.com/npm/cli/issues/3754)
fix(config): user-agent properly shows ci
([@wraithgar](https://github.com/wraithgar))
* [`b807cd62e`](https://github.com/npm/cli/commit/b807cd62eabe337e3243415c9870ea36d9289e12)
[#3738](https://github.com/npm/cli/issues/3738)
fix(search): return valid json for no results
([@AyushRawal](https://github.com/AyushRawal))
* [`2def17a3b`](https://github.com/npm/cli/commit/2def17a3b625b92b40c6185ff4b47e8ed006492c)
[#3760](https://github.com/npm/cli/issues/3760)
fix(install): use configured registry when checking manifest
([@yacoman89](https://github.com/yacoman89))
* [`ca792acdd`](https://github.com/npm/cli/commit/ca792acdd4ba683d8415c88188ec6739033fb4fd)
[#3761](https://github.com/npm/cli/issues/3761)
fix(logs): clean args for failed commands
([@wraithgar](https://github.com/wraithgar))

### DEPENDENCIES

* [`59743972c`](https://github.com/npm/cli/commit/59743972c2ae1d2dd601aaa6c59974c686b1cb29)
[#3747](https://github.com/npm/cli/issues/3747)
fix(did-you-mean): succeed if cwd is not a package
([@wraithgar](https://github.com/wraithgar))
* [`ac8e4ad18`](https://github.com/npm/cli/commit/ac8e4ad18a6b726dd2c3abcb0f605701cca0ae2c)
`init-package-json@2.0.5`:
* fix: bin script path
* [`371655a6b`](https://github.com/npm/cli/commit/371655a6b0e6664fec67f16cb247cc9f174a5197)
`minipass@3.1.5`:
* fix: re-emit 'error' event if missed and new listener added
* fix: do not blow up if process is missing

### DOCUMENTATION

* [`4d93b484a`](https://github.com/npm/cli/commit/4d93b484abb50e3704fb436db572b93fb36c7ac3)
[#3759](https://github.com/npm/cli/issues/3759)
fix(docs): use correct hyperlink to package-json
([@nategreen](https://github.com/nategreen))

## v7.23.0 (2021-09-09)

### FEATURES
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -63,4 +63,4 @@ It should be noted that our team does not accept third-party dependency updates/

### Tools/Automation

Our core team is responsible for the maintaince of the tooling/automation in this project & we ask collaborators to kindle not make changes to these when contributing (ex. `.github/*`, `.eslintrc.json`, `.licensee.json` etc.)
Our core team is responsible for the maintenance of the tooling/automation in this project & we ask collaborators to kindly not make changes to these when contributing (ex. `.github/*`, `.eslintrc.json`, `.licensee.json` etc.)
2 changes: 1 addition & 1 deletion docs/content/using-npm/scripts.md
Expand Up @@ -259,7 +259,7 @@ package.json file, then your package scripts would have the
in your code with `process.env.npm_package_name` and
`process.env.npm_package_version`, and so on for other fields.

See [`package-json.md`](/using-npm/package-json) for more on package configs.
See [`package-json.md`](/configuring-npm/package-json) for more on package configs.

#### current lifecycle event

Expand Down
3 changes: 2 additions & 1 deletion lib/install.js
Expand Up @@ -135,7 +135,8 @@ class Install extends ArboristWorkspaceCmd {
// be very strict about engines when trying to update npm itself
const npmInstall = args.find(arg => arg.startsWith('npm@') || arg === 'npm')
if (isGlobalInstall && npmInstall) {
const npmManifest = await pacote.manifest(npmInstall)
const npmOptions = this.npm.flatOptions
const npmManifest = await pacote.manifest(npmInstall, npmOptions)
try {
checks.checkEngine(npmManifest, npmManifest.version, process.version)
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion lib/search/format-package-stream.js
Expand Up @@ -42,7 +42,7 @@ class JSONOutputStream extends Minipass {
}

end () {
super.write(this._didFirst ? ']\n' : '\n]\n')
super.write(this._didFirst ? ']\n' : '\n[]\n')
super.end()
}
}
Expand Down
12 changes: 11 additions & 1 deletion lib/utils/config/definitions.js
Expand Up @@ -2053,10 +2053,14 @@ define('user-agent', {
.replace(/\{workspaces\}/gi, inWorkspaces)
.replace(/\{ci\}/gi, ciName ? `ci/${ciName}` : '')
.trim()

// We can't clobber the original or else subsequent flattening will fail
// (i.e. when we change the underlying config values)
// obj[key] = flatOptions.userAgent

// user-agent is a unique kind of config item that gets set from a template
// and ends up translated. Because of this, the normal "should we set this
// to process.env also doesn't work
obj[key] = flatOptions.userAgent
process.env.npm_config_user_agent = flatOptions.userAgent
},
})
Expand Down Expand Up @@ -2140,6 +2144,9 @@ define('workspace', {
a workspace which does not yet exist, to create the folder and set it
up as a brand new workspace within the project.
`,
flatten: (key, obj, flatOptions) => {
definitions['user-agent'].flatten('user-agent', obj, flatOptions)
},
})

define('workspaces', {
Expand All @@ -2151,6 +2158,9 @@ define('workspaces', {
Enable running a command in the context of **all** the configured
workspaces.
`,
flatten: (key, obj, flatOptions) => {
definitions['user-agent'].flatten('user-agent', obj, flatOptions)
},
})

define('yes', {
Expand Down
29 changes: 15 additions & 14 deletions lib/utils/did-you-mean.js
Expand Up @@ -3,25 +3,26 @@ const readJson = require('read-package-json-fast')
const { cmdList } = require('./cmd-list.js')

const didYouMean = async (npm, path, scmd) => {
const bestCmd = cmdList
let best = cmdList
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 && scmd !== cmd)
.map(str => ` npm ${str} # ${npm.commands[str].description}`)

const pkg = await readJson(`${path}/package.json`)
const { scripts } = pkg
// We would already be suggesting this in `npm x` so omit them here
const runScripts = ['stop', 'start', 'test', 'restart']
const bestRun = Object.keys(scripts || {})
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 &&
!runScripts.includes(cmd))
.map(str => ` npm run ${str} # run the "${str}" package script`)

const { bin } = pkg
const bestBin = Object.keys(bin || {})
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4)
.map(str => ` npm exec ${str} # run the "${str}" command from either this or a remote npm package`)

const best = [...bestCmd, ...bestRun, ...bestBin]
try {
const { bin, scripts } = await readJson(`${path}/package.json`)
best = best.concat(
Object.keys(scripts || {})
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 &&
!runScripts.includes(cmd))
.map(str => ` npm run ${str} # run the "${str}" package script`),
Object.keys(bin || {})
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4)
.map(str => ` npm exec ${str} # run the "${str}" command from either this or a remote npm package`)
)
} catch (_) {
// gracefully ignore not being in a folder w/ a package.json
}

if (best.length === 0)
return ''
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/error-message.js
Expand Up @@ -367,7 +367,7 @@ module.exports = (er, npm) => {
detail.push(['signal', er.signal])

if (er.cmd && Array.isArray(er.args))
detail.push(['command', ...[er.cmd, ...er.args]])
detail.push(['command', ...[er.cmd, ...er.args.map(replaceInfo)]])

if (er.stdout)
detail.push(['', er.stdout.trim()])
Expand Down
2 changes: 1 addition & 1 deletion lib/view.js
Expand Up @@ -336,7 +336,7 @@ class View extends BaseCommand {
email: color.cyan(manifest._npmUser.email),
}),
modified: !packument.time ? undefined
: color.yellow(relativeDate(packument.time[packument.version])),
: color.yellow(relativeDate(packument.time[manifest.version])),
maintainers: (packument.maintainers || []).map((u) => unparsePerson({
name: color.yellow(u.name),
email: color.cyan(u.email),
Expand Down
15 changes: 0 additions & 15 deletions node_modules/init-package-json/LICENSE

This file was deleted.

18 changes: 18 additions & 0 deletions node_modules/init-package-json/LICENSE.md

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