Skip to content

Commit 79f79c7

Browse files
committed
1 parent 9027266 commit 79f79c7

File tree

107 files changed

+287
-1219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+287
-1219
lines changed

lib/arborist-cmd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const log = require('proc-log')
1+
const { log } = require('proc-log')
22

33
// This is the base for all commands whose execWorkspaces just gets
44
// a list of workspace names and passes it on to new Arborist() to

lib/base-command.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { relative } = require('path')
44

55
const { definitions } = require('@npmcli/config/lib/definitions')
66
const { aliases: cmdAliases } = require('./utils/cmd-list')
7-
const log = require('proc-log')
7+
const { log } = require('proc-log')
88

99
class BaseCommand {
1010
static workspaces = false

lib/cli-entry.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = async (process, validateEngines) => {
1818
exitHandler.setNpm(npm)
1919

2020
// only log node and npm paths in argv initially since argv can contain sensitive info. a cleaned version will be logged later
21-
const log = require('proc-log')
21+
const { log } = require('proc-log')
2222
log.verbose('cli', process.argv.slice(0, 2).join(' '))
2323
log.info('using', 'npm@%s', npm.version)
2424
log.info('using', 'node@%s', process.version)

lib/commands/adduser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const log = require('proc-log')
1+
const { log } = require('proc-log')
22
const { redactLog: replaceInfo } = require('@npmcli/redact')
33
const auth = require('../utils/auth.js')
44

lib/commands/audit.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const tufClient = require('@sigstore/tuf')
88

99
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
1010
const auditError = require('../utils/audit-error.js')
11-
const log = require('proc-log')
11+
const { log } = require('proc-log')
1212
const reifyFinish = require('../utils/reify-finish.js')
1313

1414
const sortAlphabetically = (a, b) => localeCompare(a.name, b.name)

lib/commands/cache.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const BaseCommand = require('../base-command.js')
77
const npa = require('npm-package-arg')
88
const jsonParse = require('json-parse-even-better-errors')
99
const localeCompare = require('@isaacs/string-locale-compare')('en')
10-
const log = require('proc-log')
10+
const { log } = require('proc-log')
1111

1212
const searchCachePackage = async (path, parsed, cacheKeys) => {
1313
/* eslint-disable-next-line max-len */

lib/commands/ci.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const reifyFinish = require('../utils/reify-finish.js')
22
const runScript = require('@npmcli/run-script')
33
const fs = require('fs/promises')
4-
const log = require('proc-log')
4+
const { log } = require('proc-log')
55
const validateLockfile = require('../utils/validate-lockfile.js')
66

77
const ArboristWorkspaceCmd = require('../arborist-cmd.js')

lib/commands/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const ini = require('ini')
66
const localeCompare = require('@isaacs/string-locale-compare')('en')
77
const pkgJson = require('@npmcli/package-json')
88
const { defaults, definitions } = require('@npmcli/config/lib/definitions')
9-
const log = require('proc-log')
9+
const { log } = require('proc-log')
1010

1111
// These are the configs that we can nerf-dart. Not all of them currently even
1212
// *have* config definitions so we have to explicitly validate them here

lib/commands/diff.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const libnpmdiff = require('libnpmdiff')
44
const npa = require('npm-package-arg')
55
const pacote = require('pacote')
66
const pickManifest = require('npm-pick-manifest')
7-
const log = require('proc-log')
7+
const { log } = require('proc-log')
88
const pkgJson = require('@npmcli/package-json')
99
const BaseCommand = require('../base-command.js')
1010

lib/commands/dist-tag.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const npa = require('npm-package-arg')
22
const regFetch = require('npm-registry-fetch')
33
const semver = require('semver')
4-
const log = require('proc-log')
4+
const { log } = require('proc-log')
55
const otplease = require('../utils/otplease.js')
66
const pkgJson = require('@npmcli/package-json')
77
const BaseCommand = require('../base-command.js')

lib/commands/doctor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const pacote = require('pacote')
77
const { resolve } = require('path')
88
const semver = require('semver')
99
const { promisify } = require('util')
10-
const log = require('proc-log')
10+
const { log } = require('proc-log')
1111
const ping = require('../utils/ping.js')
1212
const { defaults } = require('@npmcli/config/lib/definitions')
1313
const lstat = promisify(fs.lstat)

lib/commands/explore.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
const pkgJson = require('@npmcli/package-json')
55
const runScript = require('@npmcli/run-script')
66
const { join, relative } = require('path')
7-
const log = require('proc-log')
7+
const { log } = require('proc-log')
88
const completion = require('../utils/completion/installed-shallow.js')
99
const BaseCommand = require('../base-command.js')
1010

lib/commands/init.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const npa = require('npm-package-arg')
66
const libexec = require('libnpmexec')
77
const mapWorkspaces = require('@npmcli/map-workspaces')
88
const PackageJson = require('@npmcli/package-json')
9-
const log = require('proc-log')
9+
const { log } = require('proc-log')
1010
const updateWorkspaces = require('../workspaces/update-workspaces.js')
1111

1212
const posixPath = p => p.split('\\').join('/')

lib/commands/install.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const fs = require('fs')
33
const util = require('util')
44
const readdir = util.promisify(fs.readdir)
55
const reifyFinish = require('../utils/reify-finish.js')
6-
const log = require('proc-log')
6+
const { log } = require('proc-log')
77
const { resolve, join } = require('path')
88
const runScript = require('@npmcli/run-script')
99
const pacote = require('pacote')

lib/commands/login.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const log = require('proc-log')
1+
const { log } = require('proc-log')
22
const { redactLog: replaceInfo } = require('@npmcli/redact')
33
const auth = require('../utils/auth.js')
44

lib/commands/logout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const npmFetch = require('npm-registry-fetch')
22
const { getAuth } = npmFetch
3-
const log = require('proc-log')
3+
const { log } = require('proc-log')
44
const BaseCommand = require('../base-command.js')
55

66
class Logout extends BaseCommand {

lib/commands/owner.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const npa = require('npm-package-arg')
22
const npmFetch = require('npm-registry-fetch')
33
const pacote = require('pacote')
4-
const log = require('proc-log')
4+
const { log } = require('proc-log')
55
const otplease = require('../utils/otplease.js')
66
const pkgJson = require('@npmcli/package-json')
77
const BaseCommand = require('../base-command.js')

lib/commands/pack.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const pacote = require('pacote')
22
const libpack = require('libnpmpack')
33
const npa = require('npm-package-arg')
4-
const log = require('proc-log')
4+
const { log } = require('proc-log')
55
const { getContents, logTar } = require('../utils/tar.js')
66
const BaseCommand = require('../base-command.js')
77

lib/commands/ping.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { redact } = require('@npmcli/redact')
2-
const log = require('proc-log')
2+
const { log } = require('proc-log')
33
const pingUtil = require('../utils/ping.js')
44
const BaseCommand = require('../base-command.js')
55

lib/commands/profile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const inspect = require('util').inspect
22
const { URL } = require('url')
3-
const log = require('proc-log')
3+
const { log } = require('proc-log')
44
const npmProfile = require('npm-profile')
55
const qrcodeTerminal = require('qrcode-terminal')
66
const Table = require('cli-table3')

lib/commands/publish.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const log = require('proc-log')
1+
const { log } = require('proc-log')
22
const semver = require('semver')
33
const pack = require('libnpmpack')
44
const libpub = require('libnpmpublish').publish

lib/commands/query.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const { resolve } = require('path')
44
const BaseCommand = require('../base-command.js')
5-
const log = require('proc-log')
5+
const { log } = require('proc-log')
66

77
class QuerySelectorItem {
88
constructor (node) {

lib/commands/run-script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const runScript = require('@npmcli/run-script')
22
const { isServerPackage } = runScript
33
const pkgJson = require('@npmcli/package-json')
4-
const log = require('proc-log')
4+
const { log } = require('proc-log')
55
const didYouMean = require('../utils/did-you-mean.js')
66
const { isWindowsShell } = require('../utils/is-windows.js')
77

lib/commands/sbom.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const localeCompare = require('@isaacs/string-locale-compare')('en')
44
const BaseCommand = require('../base-command.js')
5-
const log = require('proc-log')
5+
const { log } = require('proc-log')
66
const { cyclonedxOutput } = require('../utils/sbom-cyclonedx.js')
77
const { spdxOutput } = require('../utils/sbom-spdx.js')
88

lib/commands/search.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { Minipass } = require('minipass')
22
const Pipeline = require('minipass-pipeline')
33
const libSearch = require('libnpmsearch')
4-
const log = require('proc-log')
4+
const { log } = require('proc-log')
55

66
const formatSearchStream = require('../utils/format-search-stream.js')
77

lib/commands/shrinkwrap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { resolve, basename } = require('path')
22
const { unlink } = require('fs').promises
3-
const log = require('proc-log')
3+
const { log } = require('proc-log')
44
const BaseCommand = require('../base-command.js')
55
class Shrinkwrap extends BaseCommand {
66
static description = 'Lock down dependency versions for publication'

lib/commands/star.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const fetch = require('npm-registry-fetch')
22
const npa = require('npm-package-arg')
3-
const log = require('proc-log')
3+
const { log } = require('proc-log')
44
const getIdentity = require('../utils/get-identity')
55

66
const BaseCommand = require('../base-command.js')

lib/commands/stars.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const fetch = require('npm-registry-fetch')
2-
const log = require('proc-log')
2+
const { log } = require('proc-log')
33
const getIdentity = require('../utils/get-identity.js')
44

55
const BaseCommand = require('../base-command.js')

lib/commands/token.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const Table = require('cli-table3')
2-
const log = require('proc-log')
2+
const { log } = require('proc-log')
33
const profile = require('npm-profile')
44

55
const otplease = require('../utils/otplease.js')

lib/commands/unpublish.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const pkgJson = require('@npmcli/package-json')
66

77
const { flatten } = require('@npmcli/config/lib/definitions')
88
const getIdentity = require('../utils/get-identity.js')
9-
const log = require('proc-log')
9+
const { log } = require('proc-log')
1010
const otplease = require('../utils/otplease.js')
1111

1212
const LAST_REMAINING_VERSION_ERROR = 'Refusing to delete the last version of the package. ' +

lib/commands/update.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require('path')
22

3-
const log = require('proc-log')
3+
const { log } = require('proc-log')
44

55
const reifyFinish = require('../utils/reify-finish.js')
66

lib/commands/view.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const columns = require('cli-columns')
22
const fs = require('fs')
33
const jsonParse = require('json-parse-even-better-errors')
4-
const log = require('proc-log')
4+
const { log } = require('proc-log')
55
const npa = require('npm-package-arg')
66
const { resolve } = require('path')
77
const formatBytes = require('../utils/format-bytes.js')

lib/npm.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const usage = require('./utils/npm-usage.js')
1111
const LogFile = require('./utils/log-file.js')
1212
const Timers = require('./utils/timers.js')
1313
const Display = require('./utils/display.js')
14-
const log = require('proc-log')
14+
const { log } = require('proc-log')
1515
const { redactLog: replaceInfo } = require('@npmcli/redact')
1616
const updateNotifier = require('./utils/update-notifier.js')
1717
const pkg = require('../package.json')
@@ -50,14 +50,7 @@ class Npm {
5050

5151
#display = null
5252
#logFile = new LogFile()
53-
#timers = new Timers({
54-
start: 'npm',
55-
listener: (name, ms) => {
56-
const args = [name, `Completed in ${ms}ms`]
57-
this.#logFile.log('timing', ...args)
58-
this.#display.logTiming(...args)
59-
},
60-
})
53+
#timers = new Timers({ start: 'npm' })
6154

6255
// all these options are only used by tests in order to make testing more
6356
// closely resemble real world usage. for now, npm has no programmatic API so

lib/package-url-cmd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const pacote = require('pacote')
44
const hostedGitInfo = require('hosted-git-info')
55

66
const openUrl = require('./utils/open-url.js')
7-
const log = require('proc-log')
7+
const { log } = require('proc-log')
88

99
const BaseCommand = require('./base-command.js')
1010
class PackageUrlCommand extends BaseCommand {

lib/utils/audit-error.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const log = require('proc-log')
1+
const { log } = require('proc-log')
22
const { redactLog: replaceInfo } = require('@npmcli/redact')
33

44
// print an error or just nothing if the audit report has an error

lib/utils/auth.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const profile = require('npm-profile')
2-
const log = require('proc-log')
2+
const { log } = require('proc-log')
33
const openUrlPrompt = require('../utils/open-url-prompt.js')
44
const read = require('../utils/read-user-info.js')
55
const otplease = require('../utils/otplease.js')

lib/utils/display.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const proggy = require('proggy')
2-
const log = require('proc-log')
2+
const { log } = require('proc-log')
33
const { explain } = require('./explain-eresolve.js')
44
const { formatWithOptions, format } = require('./format')
55

@@ -17,7 +17,7 @@ const COLOR_PALETTE = ({ chalk: c }) => ({
1717
silly: c.inverse,
1818
})
1919

20-
const LEVELS = ['timing', ...log.LEVELS].reduce((acc, key) => {
20+
const LEVELS = log.LEVELS.reduce((acc, key) => {
2121
acc[key] = key
2222
return acc
2323
}, {})
@@ -139,10 +139,6 @@ class Display {
139139
}
140140
}
141141

142-
logTiming (...args) {
143-
this.#logHandler(LEVELS.timing, ...args)
144-
}
145-
146142
forceLog (level, ...args) {
147143
// This will show the log regardless of the current loglevel, except when silent
148144
this.#logHandler({ level, force: true }, ...args)

lib/utils/error-message.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { format } = require('util')
22
const { resolve } = require('path')
33
const { redactLog: replaceInfo } = require('@npmcli/redact')
44
const { report } = require('./explain-eresolve.js')
5-
const log = require('proc-log')
5+
const { log } = require('proc-log')
66

77
const messageText = msg => msg.map(line => line.slice(1).join(' ')).join('\n')
88

lib/utils/exit-handler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const os = require('os')
22
const fs = require('fs')
33

4-
const log = require('proc-log')
4+
const { log } = require('proc-log')
55
const errorMessage = require('./error-message.js')
66
const { redactLog: replaceInfo } = require('@npmcli/redact')
77

lib/utils/log-file.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { join, dirname, basename } = require('path')
33
const { Minipass } = require('minipass')
44
const fsMiniPass = require('fs-minipass')
55
const fs = require('fs/promises')
6-
const log = require('proc-log')
6+
const { log } = require('proc-log')
77
const { formatWithOptions } = require('./format')
88

99
const padZero = (n, length) => n.toString().padStart(length.toString().length, '0')

lib/utils/read-user-info.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { read } = require('read')
22
const userValidate = require('npm-user-validate')
3-
const log = require('proc-log')
3+
const { log } = require('proc-log')
44

55
exports.otp = readOTP
66
exports.password = readPassword

lib/utils/reify-output.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// found 37 vulnerabilities (5 low, 7 moderate, 25 high)
1010
// run `npm audit fix` to fix them, or `npm audit` for details
1111

12-
const log = require('proc-log')
12+
const { log } = require('proc-log')
1313
const { depth } = require('treeverse')
1414
const ms = require('ms')
1515
const npmAuditReport = require('npm-audit-report')

lib/utils/tar.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const tar = require('tar')
22
const ssri = require('ssri')
3-
const log = require('proc-log')
3+
const { log } = require('proc-log')
44
const formatBytes = require('./format-bytes.js')
55
const columnify = require('columnify')
66
const localeCompare = require('@isaacs/string-locale-compare')('en', {

0 commit comments

Comments
 (0)