From 7772d9f9f9f853573a7ff8e7fb60c5e46566f596 Mon Sep 17 00:00:00 2001 From: Gar Date: Mon, 25 Jan 2021 14:07:02 -0800 Subject: [PATCH] fix(docs): add caching docs to exec, init fix grammar on caching docs for search PR-URL: https://github.com/npm/cli/pull/2542 Credit: @wraithgar Close: #2542 Reviewed-by: @ruyadorno --- docs/content/commands/npm-exec.md | 22 ++++++++++++++++++++++ docs/content/commands/npm-init.md | 23 +++++++++++++++++++++++ docs/content/commands/npm-search.md | 6 +++--- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/docs/content/commands/npm-exec.md b/docs/content/commands/npm-exec.md index 3ae30fa0cba9..cb3e51c8255d 100644 --- a/docs/content/commands/npm-exec.md +++ b/docs/content/commands/npm-exec.md @@ -173,6 +173,28 @@ This resulted in some shifts in its functionality: - The `--shell` option is replaced with `--script-shell`, but maintained in the `npx` executable for backwards compatibility. +### A note on caching + +The npm cli utilizes its internal package cache when using the package +name specified. You can use the following to change how and when the +cli uses this cache. See [`npm cache`](/commands/npm-cache) for more on +how the cache works. + +#### prefer-online + +Forces staleness checks for packages, making the cli look for updates +immediately even if the package is already in the cache. + +#### prefer-offline + +Bypasses staleness checks for packages. Missing data will still be +requested from the server. To force full offline mode, use `offline`. + +#### offline + +Forces full offline mode. Any packages not locally cached will result in +an error. + ### See Also * [npm run-script](/commands/npm-run-script) diff --git a/docs/content/commands/npm-init.md b/docs/content/commands/npm-init.md index 3eac923175b5..8a40d90e8354 100644 --- a/docs/content/commands/npm-init.md +++ b/docs/content/commands/npm-init.md @@ -71,9 +71,32 @@ Generate it without having it ask any questions: $ npm init -y ``` +### A note on caching + +The npm cli utilizes its internal package cache when using the package +name specified. You can use the following to change how and when the +cli uses this cache. See [`npm cache`](/commands/npm-cache) for more on +how the cache works. + +#### prefer-online + +Forces staleness checks for packages, making the cli look for updates +immediately even if the package is already in the cache. + +#### prefer-offline + +Bypasses staleness checks for packages. Missing data will still be +requested from the server. To force full offline mode, use `offline`. + +#### offline + +Forces full offline mode. Any packages not locally cached will result in +an error. + ### See Also * [init-package-json module](http://npm.im/init-package-json) * [package.json](/configuring-npm/package-json) * [npm version](/commands/npm-version) * [npm scope](/using-npm/scope) +* [npm exec](/commands/npm-exec) diff --git a/docs/content/commands/npm-search.md b/docs/content/commands/npm-search.md index 33864d472d4a..35178bcb0a58 100644 --- a/docs/content/commands/npm-search.md +++ b/docs/content/commands/npm-search.md @@ -110,13 +110,13 @@ on how the cache works. #### prefer-online -Forced staleness checks for cached searches, making the cli look for +Forces staleness checks for cached searches, making the cli look for updates immediately even for fresh search results. #### prefer-offline -Bypasses staleness checks for cached. Missing data will still be -requested from the server. To force full offline mode, use `offline`. +Bypasses staleness checks for cached searches. Missing data will still +be requested from the server. To force full offline mode, use `offline`. #### offline