+30
-40
lines changedFilter options
+30
-40
lines changed Original file line number Diff line number Diff line change
@@ -38,11 +38,9 @@ const LEVEL_OPTIONS = {
38
38
},
39
39
error: {
40
40
index: 1,
41
-
label: 'ERR!',
42
41
},
43
42
warn: {
44
43
index: 2,
45
-
label: 'WARN',
46
44
},
47
45
notice: {
48
46
index: 3,
@@ -55,11 +53,9 @@ const LEVEL_OPTIONS = {
55
53
},
56
54
verbose: {
57
55
index: 6,
58
-
label: 'verb',
59
56
},
60
57
silly: {
61
58
index: 7,
62
-
label: 'sill',
63
59
},
64
60
}
65
61
@@ -338,7 +334,7 @@ class Display {
338
334
const title = args.shift()
339
335
const prefix = [
340
336
this.#logColors.heading(this.#heading),
341
-
this.#logColors[level](levelOpts.label ?? level),
337
+
this.#logColors[level](level),
342
338
title ? this.#logColors.title(title) : null,
343
339
]
344
340
this.#stderrWrite({ prefix }, ...args)
Original file line number Diff line number Diff line change
@@ -43,31 +43,31 @@ npm {NPM}
43
43
`
44
44
45
45
exports[`test/index.js TAP basic npm ci > should throw mismatch deps in lock file error 1`] = `
46
-
npm ERR! code EUSAGE
47
-
npm ERR!
48
-
npm ERR! \`npm ci\` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with \`npm install\` before continuing.
49
-
npm ERR!
50
-
npm ERR! Invalid: lock file's abbrev@1.0.4 does not satisfy abbrev@1.1.1
51
-
npm ERR!
52
-
npm ERR! Clean install a project
53
-
npm ERR!
54
-
npm ERR! Usage:
55
-
npm ERR! npm ci
56
-
npm ERR!
57
-
npm ERR! Options:
58
-
npm ERR! [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
59
-
npm ERR! [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
60
-
npm ERR! [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
61
-
npm ERR! [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
62
-
npm ERR! [--no-bin-links] [--no-fund] [--dry-run]
63
-
npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
64
-
npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
65
-
npm ERR!
66
-
npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
67
-
npm ERR!
68
-
npm ERR! Run "npm help ci" for more info
69
-
70
-
npm ERR! A complete log of this run can be found in: {NPM}/{TESTDIR}/cache/_logs/{LOG}
46
+
npm error code EUSAGE
47
+
npm error
48
+
npm error \`npm ci\` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with \`npm install\` before continuing.
49
+
npm error
50
+
npm error Invalid: lock file's abbrev@1.0.4 does not satisfy abbrev@1.1.1
51
+
npm error
52
+
npm error Clean install a project
53
+
npm error
54
+
npm error Usage:
55
+
npm error npm ci
56
+
npm error
57
+
npm error Options:
58
+
npm error [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
59
+
npm error [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
60
+
npm error [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
61
+
npm error [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
62
+
npm error [--no-bin-links] [--no-fund] [--dry-run]
63
+
npm error [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
64
+
npm error [-ws|--workspaces] [--include-workspace-root] [--install-links]
65
+
npm error
66
+
npm error aliases: clean-install, ic, install-clean, isntall-clean
67
+
npm error
68
+
npm error Run "npm help ci" for more info
69
+
70
+
npm error A complete log of this run can be found in: {NPM}/{TESTDIR}/cache/_logs/{LOG}
71
71
`
72
72
73
73
exports[`test/index.js TAP basic npm diff > should have expected diff output 1`] = `
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
1
1
const { log: { LEVELS } } = require('proc-log')
2
2
const { stripVTControlCharacters: stripAnsi } = require('util')
3
3
4
-
const labels = new Map([
5
-
['error', 'ERR!'],
6
-
['warn', 'WARN'],
7
-
['verbose', 'verb'],
8
-
['silly', 'sill'],
9
-
].reduce((acc, v) => acc.concat([v, v.slice(0).reverse()]), []))
10
-
const logPrefix = new RegExp(`^npm (${LEVELS.map(l => labels.get(l) ?? l).join('|')})\\s`)
4
+
const logPrefix = new RegExp(`^npm (${LEVELS.join('|')})\\s`)
11
5
const isLog = (str) => logPrefix.test(stripAnsi(str))
12
6
13
7
// We only strip trailing newlines since some output will
@@ -63,15 +57,15 @@ module.exports = () => {
63
57
// Split on spaces for the heading and level/label. We know that
64
58
// none of those have spaces but could be colorized so there's no
65
59
// other good way to get each of those including control chars
66
-
const [rawHeading, rawLabel] = str.split(' ')
67
-
const rawPrefix = `${rawHeading} ${rawLabel} `
60
+
const [rawHeading, rawLevel] = str.split(' ')
61
+
const rawPrefix = `${rawHeading} ${rawLevel} `
68
62
// If message is colorized we can just replaceAll with the string since
69
63
// it will be unique due to control chars. Otherwise we create a regex
70
64
// that will only match the beginning of each line.
71
65
const prefix = stripAnsi(str) !== str ? rawPrefix : new RegExp(`^${rawPrefix}`, 'gm')
72
66
73
67
// The level needs color stripped always because we use it to filter logs
74
-
const level = labels.get(stripAnsi(rawLabel)) ?? stripAnsi(rawLabel)
68
+
const level = stripAnsi(rawLevel)
75
69
76
70
logs.push(str.replaceAll(prefix, `${level} `))
77
71
levelLogs.push({ level, message: str.replaceAll(prefix, '') })
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4