| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2b7c4b4 commit b578328
229 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -838,6 +838,10 @@ include any versions, as that information is specified in `dependencies`. | |||
| 838 | 838 | ||
| 839 | 839 | If this is spelled `"bundleDependencies"`, then that is also honored. | |
| 840 | 840 | ||
| 841 | + Alternatively, `"bundledDependencies"` can be defined as a boolean value. A | ||
| 842 | + value of `true` will bundle all dependencies, a value of `false` will bundle | ||
| 843 | + none. | ||
| 844 | + | ||
| 841 | 845 | ### optionalDependencies | |
| 842 | 846 | ||
| 843 | 847 | If a dependency can be used, but you would like npm to proceed if it cannot | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1190,6 +1190,8 @@ When package package-locks are disabled, automatic pruning of extraneous | |||
| 1190 | 1190 | modules will also be disabled. To remove extraneous modules with | |
| 1191 | 1191 | package-locks disabled use `npm prune`. | |
| 1192 | 1192 | ||
| 1193 | + This configuration does not affect `npm ci`. | ||
| 1194 | + | ||
| 1193 | 1195 | <!-- automatically generated, do not edit manually --> | |
| 1194 | 1196 | <!-- see lib/utils/config/definitions.js --> | |
| 1195 | 1197 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -160,7 +160,7 @@ <h3 id="description">Description</h3> | |||
| 160 | 160 | the results to only the paths to the packages named. Note that nested | |
| 161 | 161 | packages will <em>also</em> show the paths to the specified packages. For | |
| 162 | 162 | example, running <code>npm ls promzard</code> in npm's source tree will show:</p> | |
| 163 | - <pre lang="bash"><code>npm@8.3.2 /path/to/npm | ||
| 163 | + <pre lang="bash"><code>npm@8.4.1 /path/to/npm | ||
| 164 | 164 | └─┬ init-package-json@0.0.4 | |
| 165 | 165 | └── promzard@0.1.5 | |
| 166 | 166 | </code></pre> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -149,7 +149,7 @@ <h2 id="table-of-contents">Table of contents</h2> | |||
| 149 | 149 | <pre lang="bash"><code>npm <command> [args] | |
| 150 | 150 | </code></pre> | |
| 151 | 151 | <h3 id="version">Version</h3> | |
| 152 | - <p>8.3.2</p> | ||
| 152 | + <p>8.4.1</p> | ||
| 153 | 153 | <h3 id="description">Description</h3> | |
| 154 | 154 | <p>npm is the package manager for the Node JavaScript platform. It puts | |
| 155 | 155 | modules in place so that node can find them, and manages dependency | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -774,6 +774,9 @@ <h3 id="bundleddependencies">bundledDependencies</h3> | |||
| 774 | 774 | can be installed in a new project by executing <code>npm install awesome-web-framework-1.0.0.tgz</code>. Note that the package names do not | |
| 775 | 775 | include any versions, as that information is specified in <code>dependencies</code>.</p> | |
| 776 | 776 | <p>If this is spelled <code>"bundleDependencies"</code>, then that is also honored.</p> | |
| 777 | + <p>Alternatively, <code>"bundledDependencies"</code> can be defined as a boolean value. A | ||
| 778 | + value of <code>true</code> will bundle all dependencies, a value of <code>false</code> will bundle | ||
| 779 | + none.</p> | ||
| 777 | 780 | <h3 id="optionaldependencies">optionalDependencies</h3> | |
| 778 | 781 | <p>If a dependency can be used, but you would like npm to proceed if it cannot | |
| 779 | 782 | be found or fails to install, then you may put it in the | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1100,6 +1100,7 @@ <h4 id="package-lock"><code>package-lock</code></h4> | |||
| 1100 | 1100 | <p>When package package-locks are disabled, automatic pruning of extraneous | |
| 1101 | 1101 | modules will also be disabled. To remove extraneous modules with | |
| 1102 | 1102 | package-locks disabled use <code>npm prune</code>.</p> | |
| 1103 | + <p>This configuration does not affect <code>npm ci</code>.</p> | ||
| 1103 | 1104 | <!-- raw HTML omitted --> | |
| 1104 | 1105 | <!-- raw HTML omitted --> | |
| 1105 | 1106 | <h4 id="package-lock-only"><code>package-lock-only</code></h4> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,7 @@ const path = require('path') | |||
| 3 | 3 | const libaccess = require('libnpmaccess') | |
| 4 | 4 | const readPackageJson = require('read-package-json-fast') | |
| 5 | 5 | ||
| 6 | + const log = require('../utils/log-shim.js') | ||
| 6 | 7 | const otplease = require('../utils/otplease.js') | |
| 7 | 8 | const getIdentity = require('../utils/get-identity.js') | |
| 8 | 9 | const BaseCommand = require('../base-command.js') | |
@@ -76,7 +77,10 @@ class Access extends BaseCommand { | |||
| 76 | 77 | throw this.usageError(`${cmd} is not a recognized subcommand.`) | |
| 77 | 78 | } | |
| 78 | 79 | ||
| 79 | - return this[cmd](args, this.npm.flatOptions) | ||
| 80 | + return this[cmd](args, { | ||
| 81 | + ...this.npm.flatOptions, | ||
| 82 | + log, | ||
| 83 | + }) | ||
| 80 | 84 | } | |
| 81 | 85 | ||
| 82 | 86 | public ([pkg], opts) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,7 @@ const runScript = require('@npmcli/run-script') | |||
| 6 | 6 | const fs = require('fs') | |
| 7 | 7 | const readdir = util.promisify(fs.readdir) | |
| 8 | 8 | const log = require('../utils/log-shim.js') | |
| 9 | + const validateLockfile = require('../utils/validate-lockfile.js') | ||
| 9 | 10 | ||
| 10 | 11 | const removeNodeModules = async where => { | |
| 11 | 12 | const rimrafOpts = { glob: false } | |
@@ -37,6 +38,7 @@ class CI extends ArboristWorkspaceCmd { | |||
| 37 | 38 | const where = this.npm.prefix | |
| 38 | 39 | const opts = { | |
| 39 | 40 | ...this.npm.flatOptions, | |
| 41 | + packageLock: true, // npm ci should never skip lock files | ||
| 40 | 42 | path: where, | |
| 41 | 43 | log, | |
| 42 | 44 | save: false, // npm ci should never modify the lockfile or package.json | |
@@ -55,6 +57,28 @@ class CI extends ArboristWorkspaceCmd { | |||
| 55 | 57 | }), | |
| 56 | 58 | removeNodeModules(where), | |
| 57 | 59 | ]) | |
| 60 | + | ||
| 61 | + // retrieves inventory of packages from loaded virtual tree (lock file) | ||
| 62 | + const virtualInventory = new Map(arb.virtualTree.inventory) | ||
| 63 | + | ||
| 64 | + // build ideal tree step needs to come right after retrieving the virtual | ||
| 65 | + // inventory since it's going to erase the previous ref to virtualTree | ||
| 66 | + await arb.buildIdealTree() | ||
| 67 | + | ||
| 68 | + // verifies that the packages from the ideal tree will match | ||
| 69 | + // the same versions that are present in the virtual tree (lock file) | ||
| 70 | + // throws a validation error in case of mismatches | ||
| 71 | + const errors = validateLockfile(virtualInventory, arb.idealTree.inventory) | ||
| 72 | + if (errors.length) { | ||
| 73 | + throw new Error( | ||
| 74 | + '`npm ci` can only install packages when your package.json and ' + | ||
| 75 | + 'package-lock.json or npm-shrinkwrap.json are in sync. Please ' + | ||
| 76 | + 'update your lock file with `npm install` ' + | ||
| 77 | + 'before continuing.\n\n' + | ||
| 78 | + errors.join('\n') + '\n' | ||
| 79 | + ) | ||
| 80 | + } | ||
| 81 | + | ||
| 58 | 82 | await arb.reify(opts) | |
| 59 | 83 | ||
| 60 | 84 | const ignoreScripts = this.npm.config.get('ignore-scripts') | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,5 @@ | |||
| 1 | 1 | const fetch = require('npm-registry-fetch') | |
| 2 | + const log = require('../utils/log-shim.js') | ||
| 2 | 3 | const otplease = require('../utils/otplease.js') | |
| 3 | 4 | const npa = require('npm-package-arg') | |
| 4 | 5 | const semver = require('semver') | |
@@ -50,6 +51,7 @@ class Deprecate extends BaseCommand { | |||
| 50 | 51 | ...this.npm.flatOptions, | |
| 51 | 52 | spec: p, | |
| 52 | 53 | query: { write: true }, | |
| 54 | + log, | ||
| 53 | 55 | }) | |
| 54 | 56 | ||
| 55 | 57 | Object.keys(packument.versions) | |
@@ -64,6 +66,7 @@ class Deprecate extends BaseCommand { | |||
| 64 | 66 | method: 'PUT', | |
| 65 | 67 | body: packument, | |
| 66 | 68 | ignoreBody: true, | |
| 69 | + log, | ||
| 67 | 70 | })) | |
| 68 | 71 | } | |
| 69 | 72 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,6 +61,7 @@ class Diff extends BaseCommand { | |||
| 61 | 61 | ...this.npm.flatOptions, | |
| 62 | 62 | diffFiles: args, | |
| 63 | 63 | where: this.top, | |
| 64 | + log, | ||
| 64 | 65 | }) | |
| 65 | 66 | return this.npm.output(res) | |
| 66 | 67 | } | |
@@ -193,6 +194,7 @@ class Diff extends BaseCommand { | |||
| 193 | 194 | const packument = await pacote.packument(spec, { | |
| 194 | 195 | ...this.npm.flatOptions, | |
| 195 | 196 | preferOnline: true, | |
| 197 | + log, | ||
| 196 | 198 | }) | |
| 197 | 199 | bSpec = pickManifest( | |
| 198 | 200 | packument, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments