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.16.0 #3361

Merged
merged 11 commits into from
Jun 3, 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
2 changes: 1 addition & 1 deletion .github/workflows/create-cli-deps-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ jobs:
git push origin "npm-$npm_tag"
gh_release_body=`gh release view v"$npm_tag" -R npm/cli --json body | jq -r '.body'`

gh pr create -R "nodejs/node" -B "$base_branch" -H "npm:npm-$npm_tag" --title "deps: upgrade npm to $npm_tag" --body "$json_body"
gh pr create -R "nodejs/node" -B "$base_branch" -H "npm:npm-$npm_tag" --title "deps: upgrade npm to $npm_tag" --body "$gh_release_body"
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ docs/nav.yml
docs/config.json
docs/dockhand.js
docs/template.html
docs/package.json
docs/node_modules
# docs source files are required by `npm help-search` do not exclude those
!docs/content/

# don't ignore .npmignore files
# these are used in some tests.
Expand Down
64 changes: 64 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
## v7.16.0 (2021-06-03)

## FEATURES

* [`e92b5f2ba`](https://github.com/npm/cli/commit/e92b5f2ba07746ae07646566f3dc73c9e004a2fc)
`npm-registry-fetch@11.0.0`
* feat: improved logging of cache status

## BUG FIXES

* [`e864bd3ce`](https://github.com/npm/cli/commit/e864bd3ce8e8467e0f8ebb499dc2daf06143bc33)
[#3345](https://github.com/npm/cli/issues/3345)
fix(update-notifier): do not update notify when installing npm@spec
([@isaacs](https://github.com/isaacs))
* [`aafe23572`](https://github.com/npm/cli/commit/aafe2357279230e333d3342752a28fce6b9cd152)
[#3348](https://github.com/npm/cli/issues/3348)
fix(update-notifier): parallelize check for updates
([@isaacs](https://github.com/isaacs))

## DOCUMENTATION

* [`bc9c57dda`](https://github.com/npm/cli/commit/bc9c57dda7cf3abcdee17550205daf1a82e90438)
[#3353](https://github.com/npm/cli/issues/3353)
fix(docs): remove documentation for '--scripts-prepend-node-path' as it was removed in npm@7
([@gimli01](https://github.com/gimli01))
* [`ca2822110`](https://github.com/npm/cli/commit/ca28221103aa0e9ccba7043ac515a541b625c53a)
[#3360](https://github.com/npm/cli/issues/3360)
fix(docs): link foreground-scripts w/ loglevel
([@wraithgar](https://github.com/wraithgar))
* [`fb630b5a9`](https://github.com/npm/cli/commit/fb630b5a9af86c71602803297634ec291eeedee0)
[#3342](https://github.com/npm/cli/issues/3342)
chore(docs): manage docs as a workspace
([@ruyadorno](https://github.com/ruyadorno))

## DEPENDENCIES

* [`54de5c6a4`](https://github.com/npm/cli/commit/54de5c6a4cd593bbbe364132f3f7348586441b31)
`npm-package-arg@8.1.4`:
* fix: trim whitespace from fetchSpec
* fix: handle file: when root directory begins with a special character
* [`e92b5f2ba`](https://github.com/npm/cli/commit/e92b5f2ba07746ae07646566f3dc73c9e004a2fc)
`make-fetch-happen@9.0.1`
* breaking: complete refactor of caching. drops warning headers,
prevents cache indexes from growing for every request, correctly
handles varied requests to the same url, and now caches redirects.
* fix: support url-encoded proxy authorization
* fix: do not lazy-load proxy agents or agentkeepalive. fixes the
intermittent failures to update npm on slower connections.
`npm-registry-fetch@11.0.0`
* breaking: drop handling of deprecated warning headers
* docs: fix header type for npm-command
* docs: update registry param
* feat: improved logging of cache status
* [`23c50a45f`](https://github.com/npm/cli/commit/23c50a45f59ea3ed4c36f35df15e54adc5603034)
`make-fetch-happen@9.0.2`:
* fix: work around negotiator's lazy loading

## AUTOMATION

* [`c4ef78b08`](https://github.com/npm/cli/commit/c4ef78b08e6859fc191cabbe58c8d88c070e0612)
[#3344](https://github.com/npm/cli/issues/3344)
fix(automation): update incorrect variable name in create-cli-deps-pr workflow
([@gimli01](https://github.com/gimli01))

## v7.15.1 (2021-05-31)

### BUG FIXES
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $(version_mandocs): package.json

htmldocs: dev-deps
node bin/npm-cli.js rebuild
cd docs && node dockhand.js >&2
node bin/npm-cli.js run -w docs build

clean: docs-clean gitclean

Expand Down
7 changes: 1 addition & 6 deletions docs/content/commands/npm-run-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ can use the `INIT_CWD` environment variable, which holds the full path you
were in when you ran `npm run`.

`npm run` sets the `NODE` environment variable to the `node` executable
with which `npm` is executed. Also, if the `--scripts-prepend-node-path` is
passed, the directory within which `node` resides is added to the `PATH`.
If `--scripts-prepend-node-path=auto` is passed (which has been the default
in `npm` v3), this is only performed when that `node` executable is not
found in the `PATH`.
with which `npm` is executed.

If you try to run a script without having a `node_modules` directory and it
fails, you will be given a warning to run `npm install`, just in case you've
Expand Down Expand Up @@ -138,7 +134,6 @@ npm test -w a -w b
This last command will run `test` in both `./packages/a` and `./packages/b`
packages.


### Configuration

<!-- AUTOGENERATED CONFIG DESCRIPTIONS START -->
Expand Down
2 changes: 2 additions & 0 deletions docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,8 @@ What level of logs to report. On failure, *all* logs are written to
Any logs of a higher level than the setting are shown. The default is
"notice".

See also the `foreground-scripts` config.

#### `logs-max`

* Default: 10
Expand Down
19 changes: 19 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "docs",
"description": "The npm cli documentation",
"version": "1.0.0",
"scripts": {
"build": "node dockhand"
},
"repository": {
"type": "git",
"url": "https://github.com/npm/cli"
},
"devDependencies": {
"@mdx-js/mdx": "^1.6.22",
"cmark-gfm": "^0.8.3",
"jsdom": "^16.4.0",
"marked-man": "^0.7.0",
"yaml": "^1.10.0"
}
}
2 changes: 1 addition & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module.exports = (process) => {
npm.config.set('usage', false, 'cli')
}

npm.updateNotification = await updateNotifier(npm)
updateNotifier(npm)

const cmd = npm.argv.shift()
const impl = npm.commands[cmd]
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/config/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,8 @@ define('loglevel', {

Any logs of a higher level than the setting are shown. The default is
"notice".

See also the \`foreground-scripts\` config.
`,
})

Expand Down
4 changes: 3 additions & 1 deletion lib/utils/error-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ const errorHandler = (er) => {
if (cbCalled)
er = er || new Error('Callback called more than once.')

if (npm.updateNotification) {
// only show the notification if it finished before the other stuff we
// were doing. no need to hang on `npm -v` or something.
if (typeof npm.updateNotification === 'string') {
const { level } = log
log.level = log.levels.notice
log.notice('', npm.updateNotification)
Expand Down
36 changes: 23 additions & 13 deletions lib/utils/update-notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,32 @@ const { resolve } = require('path')
const isGlobalNpmUpdate = npm => {
return npm.flatOptions.global &&
['install', 'update'].includes(npm.command) &&
npm.argv.includes('npm')
npm.argv.some(arg => /^npm(@|$)/.test(arg))
}

// update check frequency
const DAILY = 1000 * 60 * 60 * 24
const WEEKLY = DAILY * 7

const updateTimeout = async (npm, duration) => {
// don't put it in the _cacache folder, just in npm's cache
const lastCheckedFile = npm =>
resolve(npm.flatOptions.cache, '../_update-notifier-last-checked')

const checkTimeout = async (npm, duration) => {
const t = new Date(Date.now() - duration)
// don't put it in the _cacache folder, just in npm's cache
const f = resolve(npm.flatOptions.cache, '../_update-notifier-last-checked')
const f = lastCheckedFile(npm)
// if we don't have a file, then definitely check it.
const st = await stat(f).catch(() => ({ mtime: t - 1 }))
return t > st.mtime
}

if (t > st.mtime) {
// best effort, if this fails, it's ok.
// might be using /dev/null as the cache or something weird like that.
await writeFile(f, '').catch(() => {})
return true
} else
return false
const updateTimeout = async npm => {
// best effort, if this fails, it's ok.
// might be using /dev/null as the cache or something weird like that.
await writeFile(lastCheckedFile(npm), '').catch(() => {})
}

const updateNotifier = module.exports = async (npm, spec = 'latest') => {
const updateNotifier = async (npm, spec = 'latest') => {
// never check for updates in CI, when updating npm already, or opted out
if (!npm.config.get('update-notifier') ||
isGlobalNpmUpdate(npm) ||
Expand All @@ -57,7 +59,7 @@ const updateNotifier = module.exports = async (npm, spec = 'latest') => {
const duration = spec !== 'latest' ? DAILY : WEEKLY

// if we've already checked within the specified duration, don't check again
if (!(await updateTimeout(npm, duration)))
if (!(await checkTimeout(npm, duration)))
return null

// if they're currently using a prerelease, nudge to the next prerelease
Expand Down Expand Up @@ -113,3 +115,11 @@ const updateNotifier = module.exports = async (npm, spec = 'latest') => {

return messagec
}

// only update the notification timeout if we actually finished checking
module.exports = async npm => {
const notification = await updateNotifier(npm)
// intentional. do not await this. it's a best-effort update.
updateTimeout(npm)
npm.updateNotification = notification
}
3 changes: 2 additions & 1 deletion node_modules/.gitignore

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/package.json

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

Loading