GeezerVison is showing github.com — feat(install-scripts): use install-scripts as the warning log title · npm/cli@42b12c2
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/utils/allow-scripts-writer.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,7 +50,7 @@ const versionedKeyFor = (node) => { | 50 | 50 | // parse (private-registry mirror, alternate CDN URL shape). Leave a | 51 | 51 | // breadcrumb so users notice when policy keys are silently pruned. | 52 | 52 | log.silly( | 53 | | - 'allow-scripts', | | 53 | + 'install-scripts', | 54 | 54 | `unable to derive trusted versioned key for ${node.path || node.name || '<unknown>'} ` + | 55 | 55 | `(resolved: ${resolved}); key will be pruned on next save` | 56 | 56 | ) | |
Collapse file Copy file name to clipboardExpand all lines: lib/utils/reify-output.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -260,7 +260,7 @@ const unreviewedScriptsMessage = (npm, unreviewedScripts) => { | 260 | 260 | }) | 261 | 261 |
| 262 | 262 | log.warn( | 263 | | - 'allow-scripts', | | 263 | + 'install-scripts', | 264 | 264 | [ | 265 | 265 | header, | 266 | 266 | ...lines, | |
Collapse file Copy file name to clipboardExpand all lines: lib/utils/resolve-allow-scripts.js +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -46,15 +46,15 @@ const validatePolicy = (policy, sourceLabel) => { | 46 | 46 | try { | 47 | 47 | parsed = npa(key) | 48 | 48 | } catch { | 49 | | - log.warn('allow-scripts', `${sourceLabel}: ignoring unparseable entry "${key}"`) | | 49 | + log.warn('install-scripts', `${sourceLabel}: ignoring unparseable entry "${key}"`) | 50 | 50 | continue | 51 | 51 | } | 52 | 52 | if (parsed.type === 'tag') { | 53 | 53 | // `pkg@latest`, `pkg@next`, etc. look like a pin but behave name- | 54 | 54 | // only — the matcher has no way to verify what the tag points at | 55 | 55 | // when scripts run. Reject for the same reason as semver ranges. | 56 | 56 | log.warn( | 57 | | - 'allow-scripts', | | 57 | + 'install-scripts', | 58 | 58 | `${sourceLabel}: ignoring "${key}" — dist-tag specs (@latest, @next, ...) are not allowed; ` + | 59 | 59 | 'use exact versions joined by "||", or the bare package name, instead' | 60 | 60 | ) | @@ -66,7 +66,7 @@ const validatePolicy = (policy, sourceLabel) => { | 66 | 66 | || parsed.rawSpec === '*' | 67 | 67 | if (!isNameOnly && !isExactVersionDisjunction(parsed.fetchSpec)) { | 68 | 68 | log.warn( | 69 | | - 'allow-scripts', | | 69 | + 'install-scripts', | 70 | 70 | `${sourceLabel}: ignoring "${key}" — semver ranges (^, ~, >=, <) are not allowed; ` + | 71 | 71 | 'use exact versions joined by "||" instead' | 72 | 72 | ) | @@ -137,7 +137,7 @@ const resolveAllowScripts = async (npm, { skipProjectConfig = false } = {}) => { | 137 | 137 | } | 138 | 138 | } | 139 | 139 | } catch (err) { | 140 | | - log.silly('allow-scripts', 'no package.json at prefix', err.message) | | 140 | + log.silly('install-scripts', 'no package.json at prefix', err.message) | 141 | 141 | } | 142 | 142 | } | 143 | 143 |
| @@ -154,7 +154,7 @@ const resolveAllowScripts = async (npm, { skipProjectConfig = false } = {}) => { | 154 | 154 | // set, package.json is never consulted. | 155 | 155 | if (rc) { | 156 | 156 | log.warn( | 157 | | - 'allow-scripts', | | 157 | + 'install-scripts', | 158 | 158 | '.npmrc allow-scripts setting is being ignored because --allow-scripts was passed on the command line' | 159 | 159 | ) | 160 | 160 | } | @@ -164,7 +164,7 @@ const resolveAllowScripts = async (npm, { skipProjectConfig = false } = {}) => { | 164 | 164 | if (pkg) { | 165 | 165 | if (rc) { | 166 | 166 | log.warn( | 167 | | - 'allow-scripts', | | 167 | + 'install-scripts', | 168 | 168 | '.npmrc allow-scripts setting is being ignored because package.json declares its own allowScripts field' | 169 | 169 | ) | 170 | 170 | } | |
Collapse file Copy file name to clipboardExpand all lines: lib/utils/warn-workspace-allow-scripts.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,7 +28,7 @@ const warnWorkspaceAllowScripts = (tree) => { | 28 | 28 | for (const node of findWorkspaceAllowScripts(tree)) { | 29 | 29 | const name = node.packageName || node.name | 30 | 30 | log.warn( | 31 | | - 'allow-scripts', | | 31 | + 'install-scripts', | 32 | 32 | `allowScripts in workspace ${name} (${node.path}) is ignored. ` + | 33 | 33 | 'Move the field to the project root package.json.' | 34 | 34 | ) | |
Collapse file Copy file name to clipboardExpand all lines: test/lib/commands/approve-scripts.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -627,7 +627,7 @@ t.test('forbidden semver range in package.json#allowScripts is dropped with a wa | 627 | 627 | }) | 628 | 628 | await mock.npm.exec('approve-scripts', []) | 629 | 629 |
| 630 | | - const warnings = mock.logs.warn.byTitle('allow-scripts') | | 630 | + const warnings = mock.logs.warn.byTitle('install-scripts') | 631 | 631 | t.ok( | 632 | 632 | warnings.some(m => /semver ranges/.test(m) && /canvas@\^0\.33\.0/.test(m)), | 633 | 633 | 'resolver emits warning about forbidden range' | |
Collapse file Copy file name to clipboardExpand all lines: test/lib/utils/reify-output.js +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -499,7 +499,7 @@ t.test('prints unreviewed install scripts summary', async t => { | 499 | 499 | ] | 500 | 500 |
| 501 | 501 | const mock = await mockReifyWithExtras(t, baseReify, { unreviewedScripts }) | 502 | | - const warn = mock.logs.warn.byTitle('allow-scripts').join('\n') | | 502 | + const warn = mock.logs.warn.byTitle('install-scripts').join('\n') | 503 | 503 | t.match(warn, /2 packages had install scripts blocked because they are not covered by allowScripts/) | 504 | 504 | t.match(warn, /canvas@2\.11\.0 \(install: node-gyp rebuild\)/) | 505 | 505 | t.match(warn, /sharp@0\.33\.2 \(preinstall: pre; postinstall: post\)/) | @@ -531,7 +531,7 @@ t.test('global install suggests --allow-scripts, not approve-scripts', async t = | 531 | 531 | ] | 532 | 532 |
| 533 | 533 | const mock = await mockReifyWithExtras(t, baseReify, { unreviewedScripts }, { global: true }) | 534 | | - const warn = mock.logs.warn.byTitle('allow-scripts').join('\n') | | 534 | + const warn = mock.logs.warn.byTitle('install-scripts').join('\n') | 535 | 535 | t.match(warn, /2 packages had install scripts blocked because they are not covered by allowScripts/) | 536 | 536 | t.match(warn, /canvas@2\.11\.0 \(install: node-gyp rebuild\)/) | 537 | 537 | t.match(warn, /npm install -g --allow-scripts=canvas,sharp/) | @@ -557,7 +557,7 @@ t.test('single unreviewed script uses singular wording', async t => { | 557 | 557 | }], | 558 | 558 | } | 559 | 559 | ) | 560 | | - t.match(mock.logs.warn.byTitle('allow-scripts').join('\n'), /1 package had install scripts blocked/) | | 560 | + t.match(mock.logs.warn.byTitle('install-scripts').join('\n'), /1 package had install scripts blocked/) | 561 | 561 | }) | 562 | 562 |
| 563 | 563 | t.test('optional dep with blocked scripts appears in the summary', async t => { | @@ -579,7 +579,7 @@ t.test('optional dep with blocked scripts appears in the summary', async t => { | 579 | 579 | }], | 580 | 580 | }) | 581 | 581 | mock.npm.finish() | 582 | | - const warn = mock.logs.warn.byTitle('allow-scripts').join('\n') | | 582 | + const warn = mock.logs.warn.byTitle('install-scripts').join('\n') | 583 | 583 | t.match(warn, /1 package had install scripts blocked/) | 584 | 584 | t.match(warn, /opt@1\.0\.0 \(install: cmd\)/) | 585 | 585 | }) | @@ -617,7 +617,7 @@ t.test('unreviewed script with node.name only (no packageName) still renders', a | 617 | 617 | }], | 618 | 618 | }) | 619 | 619 | mock.npm.finish() | 620 | | - t.match(mock.logs.warn.byTitle('allow-scripts').join('\n'), / fallback \(install: cmd\)/) | | 620 | + t.match(mock.logs.warn.byTitle('install-scripts').join('\n'), / fallback \(install: cmd\)/) | 621 | 621 | }) | 622 | 622 |
| 623 | 623 | t.test('json output includes node.name when packageName is missing', async t => { | |
Collapse file Copy file name to clipboardExpand all lines: test/lib/utils/resolve-allow-scripts.js +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -119,7 +119,7 @@ t.test('package.json wins over .npmrc setting (RFC layer 2 > layer 3)', async t | 119 | 119 | t.equal(result.source, 'package.json') | 120 | 120 | t.strictSame(result.policy, { sharp: true }) | 121 | 121 | t.match( | 122 | | - mock.logs.warn.byTitle('allow-scripts'), | | 122 | + mock.logs.warn.byTitle('install-scripts'), | 123 | 123 | [/\.npmrc allow-scripts setting is being ignored because package.json/] | 124 | 124 | ) | 125 | 125 | }) | @@ -150,7 +150,7 @@ t.test('--allow-scripts CLI flag is accepted via skipProjectConfig (npm exec)', | 150 | 150 | t.equal(result.source, 'cli') | 151 | 151 | t.strictSame(result.policy, { sharp: true }) | 152 | 152 | t.match( | 153 | | - mock.logs.warn.byTitle('allow-scripts'), | | 153 | + mock.logs.warn.byTitle('install-scripts'), | 154 | 154 | [/\.npmrc allow-scripts setting is being ignored because --allow-scripts/] | 155 | 155 | ) | 156 | 156 | }) | @@ -224,7 +224,7 @@ t.test('drops package.json entries with forbidden semver ranges and warns', asyn | 224 | 224 | 'also-good': true, | 225 | 225 | | 226 | 226 | }) | 227 | | - const warnings = mock.logs.warn.byTitle('allow-scripts') | | 227 | + const warnings = mock.logs.warn.byTitle('install-scripts') | 228 | 228 | t.equal(warnings.filter(m => /semver ranges/.test(m)).length, 3) | 229 | 229 | }) | 230 | 230 |
| @@ -245,7 +245,7 @@ t.test('drops package.json entries with dist-tag specs and warns', async t => { | 245 | 245 | const result = await resolveAllowScripts(mock.npm) | 246 | 246 | t.equal(result.source, 'package.json') | 247 | 247 | | 248 | | - const warnings = mock.logs.warn.byTitle('allow-scripts') | | 248 | + const warnings = mock.logs.warn.byTitle('install-scripts') | 249 | 249 | t.equal(warnings.filter(m => /dist-tag specs/.test(m)).length, 2) | 250 | 250 | }) | 251 | 251 |
| @@ -260,7 +260,7 @@ t.test('drops .npmrc forbidden ranges (and warns) but keeps valid entries', asyn | 260 | 260 | const result = await resolveAllowScripts(mock.npm) | 261 | 261 | t.equal(result.source, '.npmrc') | 262 | 262 | | 263 | | - const warnings = mock.logs.warn.byTitle('allow-scripts') | | 263 | + const warnings = mock.logs.warn.byTitle('install-scripts') | 264 | 264 | t.ok(warnings.some(m => /sharp@\^0\.33\.0/.test(m) && /semver ranges/.test(m))) | 265 | 265 | }) | 266 | 266 |
| @@ -280,7 +280,7 @@ t.test('drops package.json entries that fail npa parse', async t => { | 280 | 280 | const result = await resolveAllowScripts(mock.npm) | 281 | 281 | t.equal(result.source, 'package.json') | 282 | 282 | t.strictSame(result.policy, { good: true }) | 283 | | - t.ok(mock.logs.warn.byTitle('allow-scripts').some(m => /unparseable/.test(m))) | | 283 | + t.ok(mock.logs.warn.byTitle('install-scripts').some(m => /unparseable/.test(m))) | 284 | 284 | }) | 285 | 285 |
| 286 | 286 | t.test('returns null when all package.json entries are dropped as invalid', async t => { | |
|