npq 3.11.5 → 3.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/npq-hero.js +11 -1
- package/bin/npq.js +11 -1
- package/lib/cli.js +4 -1
- package/lib/helpers/cliPrompt.js +10 -0
- package/package.json +2 -1
package/bin/npq-hero.js
CHANGED
|
@@ -100,8 +100,18 @@ marshall
|
|
|
100
100
|
}
|
|
101
101
|
})
|
|
102
102
|
.catch((error) => {
|
|
103
|
+
// Ensure errorCode is always a number
|
|
104
|
+
let errorCode = -1
|
|
105
|
+
if (typeof error.code === 'number') {
|
|
106
|
+
errorCode = error.code
|
|
107
|
+
} else if (error.code === 'ABORT_ERR') {
|
|
108
|
+
errorCode = 1
|
|
109
|
+
} else if (error.code === 'USER_ABORT') {
|
|
110
|
+
errorCode = error.exitCode || 1
|
|
111
|
+
}
|
|
112
|
+
|
|
103
113
|
CliParser.exit({
|
|
104
|
-
errorCode
|
|
114
|
+
errorCode,
|
|
105
115
|
message: error.message || 'An error occurred',
|
|
106
116
|
spinner
|
|
107
117
|
})
|
package/bin/npq.js
CHANGED
|
@@ -126,8 +126,18 @@ Promise.resolve()
|
|
|
126
126
|
}
|
|
127
127
|
})
|
|
128
128
|
.catch((error) => {
|
|
129
|
+
// Ensure errorCode is always a number
|
|
130
|
+
let errorCode = -1
|
|
131
|
+
if (typeof error.code === 'number') {
|
|
132
|
+
errorCode = error.code
|
|
133
|
+
} else if (error.code === 'ABORT_ERR') {
|
|
134
|
+
errorCode = 1
|
|
135
|
+
} else if (error.code === 'USER_ABORT') {
|
|
136
|
+
errorCode = error.exitCode || 1
|
|
137
|
+
}
|
|
138
|
+
|
|
129
139
|
CliParser.exit({
|
|
130
|
-
errorCode
|
|
140
|
+
errorCode,
|
|
131
141
|
message: error.message || 'An error occurred',
|
|
132
142
|
spinner
|
|
133
143
|
})
|
package/lib/cli.js
CHANGED
|
@@ -11,10 +11,13 @@ class CliParser {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
if (message) {
|
|
14
|
+
console.error('\n')
|
|
14
15
|
console.error(message)
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
// Ensure errorCode is always a number
|
|
19
|
+
const exitCode = typeof errorCode === 'number' ? errorCode : -1
|
|
20
|
+
process.exit(exitCode)
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
static _extractPackagesFromPositionals(positionals, earlyExitNoInstall = false) {
|
package/lib/helpers/cliPrompt.js
CHANGED
|
@@ -54,6 +54,16 @@ async function prompt(options = {}) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
return { [name]: result }
|
|
57
|
+
} catch (error) {
|
|
58
|
+
// Handle Ctrl+C gracefully - user cancelled the operation
|
|
59
|
+
if (error.code === 'ABORT_ERR') {
|
|
60
|
+
// Throw a specific error that can be caught and handled by the caller
|
|
61
|
+
const abortError = new Error('Operation aborted by user')
|
|
62
|
+
abortError.code = 'USER_ABORT'
|
|
63
|
+
abortError.exitCode = 1
|
|
64
|
+
throw abortError
|
|
65
|
+
}
|
|
66
|
+
throw error
|
|
57
67
|
} finally {
|
|
58
68
|
rl.close()
|
|
59
69
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npq",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.6",
|
|
4
4
|
"description": "marshall your npm/npm package installs with high quality and class 🎖",
|
|
5
5
|
"bin": {
|
|
6
6
|
"npq": "./bin/npq.js",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"fastest-levenshtein": "^1.0.16",
|
|
47
|
+
"lodash": "^4.17.21",
|
|
47
48
|
"npm-package-arg": "^13.0.0",
|
|
48
49
|
"pacote": "^21.0.0",
|
|
49
50
|
"semver": "^7.7.2"
|