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

smaller v10 breaks #6641

Merged
merged 8 commits into from
Jul 26, 2023
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
1 change: 0 additions & 1 deletion DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@ graph LR;
libnpmpack-->spawk;
libnpmpack-->tap;
libnpmpublish-->ci-info;
libnpmpublish-->lodash.clonedeep;
libnpmpublish-->nock;
libnpmpublish-->normalize-package-data;
libnpmpublish-->npm-package-arg;
Expand Down
16 changes: 1 addition & 15 deletions lib/commands/run-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,24 +207,10 @@ class RunScript extends BaseCommand {
log.error(err)
log.error(` in workspace: ${pkg._id || pkg.name}`)
log.error(` at location: ${workspacePath}`)

const scriptMissing = err.message.startsWith('Missing script')

// avoids exiting with error code in case there's scripts missing
// in some workspaces since other scripts might have succeeded
if (!scriptMissing) {
process.exitCode = 1
}

return scriptMissing
process.exitCode = 1
})
res.push(runResult)
}

// in case **all** tests are missing, then it should exit with error code
if (res.every(Boolean)) {
throw new Error(`Missing script: ${args[0]}`)
}
}

async listWorkspaces (args, filters) {
Expand Down
7 changes: 0 additions & 7 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -7762,12 +7762,6 @@
"integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==",
"dev": true
},
"node_modules/lodash.clonedeep": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==",
"dev": true
},
"node_modules/lodash.flattendeep": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz",
Expand Down Expand Up @@ -15850,7 +15844,6 @@
"@npmcli/mock-globals": "^1.0.0",
"@npmcli/mock-registry": "^1.0.0",
"@npmcli/template-oss": "4.18.0",
"lodash.clonedeep": "^4.5.0",
"nock": "^13.3.0",
"tap": "^16.3.4"
},
Expand Down
8 changes: 1 addition & 7 deletions tap-snapshots/test/lib/commands/config.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"cafile": null,
"call": "",
"cert": null,
"ci-name": null,
"cidr": null,
"color": true,
"commit-hooks": true,
Expand Down Expand Up @@ -147,7 +146,6 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"tag": "latest",
"tag-version-prefix": "v",
"timing": false,
"tmp": "{TMP}",
"umask": 0,
"unicode": false,
"update-notifier": true,
Expand All @@ -161,8 +159,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"workspaces": null,
"workspaces-update": true,
"yes": null,
"npm-version": "{NPM-VERSION}",
"metrics-registry": "https://registry.npmjs.org/"
"npm-version": "{NPM-VERSION}"
}
`

Expand All @@ -187,7 +184,6 @@ cache-min = 0
cafile = null
call = ""
cert = null
ci-name = null
cidr = null
color = true
commit-hooks = true
Expand Down Expand Up @@ -254,7 +250,6 @@ logs-max = 10
; long = false ; overridden by cli
maxsockets = 15
message = "%s"
metrics-registry = "https://registry.npmjs.org/"
node-options = null
noproxy = [""]
npm-version = "{NPM-VERSION}"
Expand Down Expand Up @@ -306,7 +301,6 @@ strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
timing = false
tmp = "{TMP}"
umask = 0
unicode = false
update-notifier = true
Expand Down
34 changes: 0 additions & 34 deletions tap-snapshots/test/lib/docs.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1822,20 +1822,6 @@ registry-scoped "certfile" path like



#### \`ci-name\`

* Default: The name of the current CI system, or \`null\` when not on a known CI
platform.
* Type: null or String
* DEPRECATED: This config is deprecated and will not be changeable in future
version of npm.

The name of a continuous integration system. If not set explicitly, npm will
detect the current CI environment using the
[\`ci-info\`](http://npm.im/ci-info) module.



#### \`dev\`

* Default: false
Expand Down Expand Up @@ -1995,20 +1981,6 @@ Alias for \`--omit=dev\`
Alias for --package-lock



#### \`tmp\`

* Default: The value returned by the Node.js \`os.tmpdir()\` method
<https://nodejs.org/api/os.html#os_os_tmpdir>
* Type: Path
* DEPRECATED: This setting is no longer used. npm stores temporary files in a
special location in the cache, and they are managed by
[\`cacache\`](http://npm.im/cacache).

Historically, the location where temporary files were stored. No longer
relevant.


`

exports[`test/lib/docs.js TAP config > all keys 1`] = `
Expand All @@ -2031,7 +2003,6 @@ Array [
"cafile",
"call",
"cert",
"ci-name",
"cidr",
"color",
"commit-hooks",
Expand Down Expand Up @@ -2148,7 +2119,6 @@ Array [
"tag",
"tag-version-prefix",
"timing",
"tmp",
"umask",
"unicode",
"update-notifier",
Expand Down Expand Up @@ -2186,7 +2156,6 @@ Array [
"cafile",
"call",
"cert",
"ci-name",
"cidr",
"color",
"commit-hooks",
Expand Down Expand Up @@ -2314,7 +2283,6 @@ Array [
"node-options",
"prefix",
"timing",
"tmp",
"update-notifier",
"usage",
"userconfig",
Expand Down Expand Up @@ -2343,7 +2311,6 @@ Object {
"call": "",
"cert": null,
"cidr": null,
"ciName": "{ci}",
"color": false,
"commitHooks": true,
"defaultTag": "latest",
Expand All @@ -2367,7 +2334,6 @@ Object {
"gitTagVersion": true,
"global": false,
"globalconfig": "{CWD}/global/etc/npmrc",
"hashAlgorithm": "sha1",
"heading": "npm",
"httpsProxy": null,
"ifPresent": false,
Expand Down
11 changes: 0 additions & 11 deletions test/fixtures/sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ const _get = Symbol('sandbox.proxy.get')
const _set = Symbol('sandbox.proxy.set')
const _logs = Symbol('sandbox.logs')

// these config keys can be redacted widely
const redactedDefaults = [
'tmp',
]

// we can't just replace these values everywhere because they're known to be
// very short strings that could be present all over the place, so we only
// replace them if they're located within quotes for now
Expand Down Expand Up @@ -161,12 +156,6 @@ class Sandbox extends EventEmitter {
// and we replaced the node version first, the real execPath we're trying
// to replace would no longer be represented, and be missed.
if (this[_npm]) {
// replace default config values with placeholders
for (const name of redactedDefaults) {
const value = this[_npm].config.defaults[name]
clean = clean.split(normalize(value)).join(`{${name.toUpperCase()}}`)
}

// replace vague default config values that are present within quotes
// with placeholders
for (const name of vagueRedactedDefaults) {
Expand Down
7 changes: 1 addition & 6 deletions test/lib/commands/run-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,12 +781,7 @@ t.test('workspaces', async t => {
t.test('missing scripts in all workspaces', async t => {
const { runScript, RUN_SCRIPTS, cleanLogs } = await mockWorkspaces(t, { exec: null })

await t.rejects(
runScript.exec(['missing-script']),
/Missing script: missing-script/,
'should throw missing script error'
)

await runScript.exec(['missing-script'])
t.match(RUN_SCRIPTS(), [])
t.strictSame(
cleanLogs(),
Expand Down
40 changes: 2 additions & 38 deletions workspaces/config/lib/definitions/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const editor = process.env.EDITOR ||
const shell = isWindows ? process.env.ComSpec || 'cmd'
: process.env.SHELL || 'sh'

const { tmpdir, networkInterfaces } = require('os')
const { networkInterfaces } = require('os')
const getLocalAddresses = () => {
try {
return Object.values(networkInterfaces()).map(
Expand Down Expand Up @@ -429,24 +429,6 @@ define('cert', {
flatten,
})

define('ci-name', {
default: ciInfo.name ? ciInfo.name.toLowerCase().split(' ').join('-') : null,
defaultDescription: `
The name of the current CI system, or \`null\` when not on a known CI
platform.
`,
type: [null, String],
deprecated: `
This config is deprecated and will not be changeable in future version of npm.
`,
description: `
The name of a continuous integration system. If not set explicitly, npm
will detect the current CI environment using the
[\`ci-info\`](http://npm.im/ci-info) module.
`,
flatten,
})

define('cidr', {
default: null,
type: [null, String, Array],
Expand Down Expand Up @@ -2127,24 +2109,6 @@ define('timing', {
`,
})

define('tmp', {
default: tmpdir(),
defaultDescription: `
The value returned by the Node.js \`os.tmpdir()\` method
<https://nodejs.org/api/os.html#os_os_tmpdir>
`,
type: path,
deprecated: `
This setting is no longer used. npm stores temporary files in a special
location in the cache, and they are managed by
[\`cacache\`](http://npm.im/cacache).
`,
description: `
Historically, the location where temporary files were stored. No longer
relevant.
`,
})

define('umask', {
default: 0,
type: Umask,
Expand Down Expand Up @@ -2222,7 +2186,7 @@ define('user-agent', {
`,
flatten (key, obj, flatOptions) {
const value = obj[key]
const ciName = obj['ci-name']
const ciName = ciInfo.name?.toLowerCase().split(' ').join('-') || null
let inWorkspaces = false
if (obj.workspaces || obj.workspace && obj.workspace.length) {
inWorkspaces = true
Expand Down
3 changes: 0 additions & 3 deletions workspaces/config/lib/definitions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ const flatten = (obj, flat = {}) => {
: /* istanbul ignore next - not configurable property */ undefined
flat.nodeBin = process.env.NODE || process.execPath

// XXX should this be sha512? is it even relevant?
flat.hashAlgorithm = 'sha1'

return flat
}

Expand Down
4 changes: 0 additions & 4 deletions workspaces/config/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,6 @@ class Config {

const { data } = this.data.get('default')

// the metrics-registry defaults to the current resolved value of
// the registry, unless overridden somewhere else.
settableGetter(data, 'metrics-registry', () => this.#get('registry'))

// if the prefix is set on cli, env, or userconfig, then we need to
// default the globalconfig file to that location, instead of the default
// global prefix. It's weird that `npm get globalconfig --prefix=/foo`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ Object {
null,
Function String(),
],
"ci-name": Array [
null,
Function String(),
],
"cidr": Array [
null,
Function String(),
Expand Down Expand Up @@ -477,9 +473,6 @@ Object {
"timing": Array [
"boolean value (true or false)",
],
"tmp": Array [
"valid filesystem path",
],
"umask": Array [
"octal number in range 0o000..0o777 (0..511)",
],
Expand Down
Loading