| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -194,7 +194,7 @@ <h3 id="see-also">See Also</h3> | |||
| 194 | 194 | <li><a href="../commands/npm-publish.html">npm publish</a></li> | |
| 195 | 195 | <li><a href="../using-npm/registry.html">npm registry</a></li> | |
| 196 | 196 | <li><a href="../commands/npm-owner.html">npm owner</a></li> | |
| 197 | - <li><a href="../commands/npm-adduser.html">npm owner</a></li> | ||
| 197 | + <li><a href="../commands/npm-adduser.html">npm adduser</a></li> | ||
| 198 | 198 | </ul> | |
| 199 | 199 | </div> | |
| 200 | 200 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -159,7 +159,7 @@ <h3 id="description">Description</h3> | |||
| 159 | 159 | the results to only the paths to the packages named. Note that nested | |
| 160 | 160 | packages will <em>also</em> show the paths to the specified packages. For | |
| 161 | 161 | example, running <code>npm ls promzard</code> in npm’s source tree will show:</p> | |
| 162 | - <pre lang="bash"><code>npm@7.21.1 /path/to/npm | ||
| 162 | + <pre lang="bash"><code>npm@7.23.0 /path/to/npm | ||
| 163 | 163 | └─┬ init-package-json@0.0.4 | |
| 164 | 164 | └── promzard@0.1.5 | |
| 165 | 165 | </code></pre> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -148,7 +148,7 @@ <h2 id="table-of-contents">Table of contents</h2> | |||
| 148 | 148 | <pre lang="bash"><code>npm <command> [args] | |
| 149 | 149 | </code></pre> | |
| 150 | 150 | <h3 id="version">Version</h3> | |
| 151 | - <p>7.21.1</p> | ||
| 151 | + <p>7.23.0</p> | ||
| 152 | 152 | <h3 id="description">Description</h3> | |
| 153 | 153 | <p>npm is the package manager for the Node JavaScript platform. It puts | |
| 154 | 154 | modules in place so that node can find them, and manages dependency | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -141,7 +141,7 @@ <h1 id="workspaces">workspaces</h1> | |||
| 141 | 141 | ||
| 142 | 142 | <section id="table_of_contents"> | |
| 143 | 143 | <h2 id="table-of-contents">Table of contents</h2> | |
| 144 | - <div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#defining-workspaces">Defining workspaces</a></li><li><a href="#getting-started-with-workspaces">Getting started with workspaces</a></li><li><a href="#adding-dependencies-to-a-workspace">Adding dependencies to a workspace</a></li><li><a href="#using-workspaces">Using workspaces</a></li><li><a href="#running-commands-in-the-context-of-workspaces">Running commands in the context of workspaces</a></li><li><a href="#see-also">See also</a></li></ul></div> | ||
| 144 | + <div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#defining-workspaces">Defining workspaces</a></li><li><a href="#getting-started-with-workspaces">Getting started with workspaces</a></li><li><a href="#adding-dependencies-to-a-workspace">Adding dependencies to a workspace</a></li><li><a href="#using-workspaces">Using workspaces</a></li><li><a href="#running-commands-in-the-context-of-workspaces">Running commands in the context of workspaces</a></li><li><a href="#ignoring-missing-scripts">Ignoring missing scripts</a></li><li><a href="#see-also">See also</a></li></ul></div> | ||
| 145 | 145 | </section> | |
| 146 | 146 | ||
| 147 | 147 | <div id="_content"><h3 id="description">Description</h3> | |
@@ -264,6 +264,11 @@ <h3 id="running-commands-in-the-context-of-workspaces">Running commands in the c | |||
| 264 | 264 | <pre><code>npm run test --workspaces | |
| 265 | 265 | </code></pre> | |
| 266 | 266 | <p>Will run the <code>test</code> script in both <code>./packages/a</code> and <code>./packages/b</code>.</p> | |
| 267 | + <h3 id="ignoring-missing-scripts">Ignoring missing scripts</h3> | ||
| 268 | + <p>It is not required for all of the workspaces to implement scripts run with the <code>npm run</code> command.</p> | ||
| 269 | + <p>By running the command with the <code>--if-present</code> flag, npm will ignore workspaces missing target script.</p> | ||
| 270 | + <pre><code>npm run test --workspaces --if-present | ||
| 271 | + </code></pre> | ||
| 267 | 272 | <h3 id="see-also">See also</h3> | |
| 268 | 273 | <ul> | |
| 269 | 274 | <li><a href="../commands/npm-install.html">npm install</a></li> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,8 @@ const log = require('npmlog') | |||
| 8 | 8 | const { resolve, join } = require('path') | |
| 9 | 9 | const Arborist = require('@npmcli/arborist') | |
| 10 | 10 | const runScript = require('@npmcli/run-script') | |
| 11 | + const pacote = require('pacote') | ||
| 12 | + const checks = require('npm-install-checks') | ||
| 11 | 13 | ||
| 12 | 14 | const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js') | |
| 13 | 15 | class Install extends ArboristWorkspaceCmd { | |
@@ -126,6 +128,23 @@ class Install extends ArboristWorkspaceCmd { | |||
| 126 | 128 | const ignoreScripts = this.npm.config.get('ignore-scripts') | |
| 127 | 129 | const isGlobalInstall = this.npm.config.get('global') | |
| 128 | 130 | const where = isGlobalInstall ? globalTop : this.npm.prefix | |
| 131 | + const forced = this.npm.config.get('force') | ||
| 132 | + const isDev = this.npm.config.get('dev') | ||
| 133 | + const scriptShell = this.npm.config.get('script-shell') || undefined | ||
| 134 | + | ||
| 135 | + // be very strict about engines when trying to update npm itself | ||
| 136 | + const npmInstall = args.find(arg => arg.startsWith('npm@') || arg === 'npm') | ||
| 137 | + if (isGlobalInstall && npmInstall) { | ||
| 138 | + const npmManifest = await pacote.manifest(npmInstall) | ||
| 139 | + try { | ||
| 140 | + checks.checkEngine(npmManifest, npmManifest.version, process.version) | ||
| 141 | + } catch (e) { | ||
| 142 | + if (forced) | ||
| 143 | + this.npm.log.warn('install', `Forcing global npm install with incompatible version ${npmManifest.version} into node ${process.version}`) | ||
| 144 | + else | ||
| 145 | + throw e | ||
| 146 | + } | ||
| 147 | + } | ||
| 129 | 148 | ||
| 130 | 149 | // don't try to install the prefix into itself | |
| 131 | 150 | args = args.filter(a => resolve(a) !== this.npm.prefix) | |
@@ -135,7 +154,7 @@ class Install extends ArboristWorkspaceCmd { | |||
| 135 | 154 | args = ['.'] | |
| 136 | 155 | ||
| 137 | 156 | // TODO: Add warnings for other deprecated flags? or remove this one? | |
| 138 | - if (this.npm.config.get('dev')) | ||
| 157 | + if (isDev) | ||
| 139 | 158 | log.warn('install', 'Usage of the `--dev` option is deprecated. Use `--include=dev` instead.') | |
| 140 | 159 | ||
| 141 | 160 | const opts = { | |
@@ -150,7 +169,6 @@ class Install extends ArboristWorkspaceCmd { | |||
| 150 | 169 | await arb.reify(opts) | |
| 151 | 170 | ||
| 152 | 171 | if (!args.length && !isGlobalInstall && !ignoreScripts) { | |
| 153 | - const scriptShell = this.npm.config.get('script-shell') || undefined | ||
| 154 | 172 | const scripts = [ | |
| 155 | 173 | 'preinstall', | |
| 156 | 174 | 'install', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -181,7 +181,7 @@ module.exports = (er, npm) => { | |||
| 181 | 181 | const pkg = er.pkgid.replace(/(?!^)@.*$/, '') | |
| 182 | 182 | ||
| 183 | 183 | detail.push(['404', '']) | |
| 184 | - detail.push(['404', '', "'" + er.pkgid + "' is not in the npm registry."]) | ||
| 184 | + detail.push(['404', '', `'${replaceInfo(er.pkgid)}' is not in this registry.`]) | ||
| 185 | 185 | ||
| 186 | 186 | const valResult = nameValidator(pkg) | |
| 187 | 187 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - .TH "NPM\-ACCESS" "1" "August 2021" "" "" | ||
| 1 | + .TH "NPM\-ACCESS" "1" "September 2021" "" "" | ||
| 2 | 2 | .SH "NAME" | |
| 3 | 3 | \fBnpm-access\fR \- Set access level on published packages | |
| 4 | 4 | .SS Synopsis | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - .TH "NPM\-ADDUSER" "1" "August 2021" "" "" | ||
| 1 | + .TH "NPM\-ADDUSER" "1" "September 2021" "" "" | ||
| 2 | 2 | .SH "NAME" | |
| 3 | 3 | \fBnpm-adduser\fR \- Add a registry user account | |
| 4 | 4 | .SS Synopsis | |
| Back | FazBrowse Home | New Git URL |
0 commit comments