npq 3.9.0 → 3.9.1
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 +4 -1
- package/lib/cli.js +16 -3
- package/package.json +1 -1
package/bin/npq-hero.js
CHANGED
|
@@ -16,7 +16,10 @@ const { promiseThrottleHelper } = require('../lib/helpers/promiseThrottler')
|
|
|
16
16
|
const PACKAGE_MANAGER_TOOL = process.env.NPQ_PKG_MGR
|
|
17
17
|
|
|
18
18
|
const cliArgs = CliParser.parseArgsMinimal()
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
const silentModeNoPackages = !cliArgs || !cliArgs.packages || cliArgs.packages.length === 0
|
|
21
|
+
|
|
22
|
+
const isInteractive = cliSupport.isInteractiveTerminal() && !silentModeNoPackages
|
|
20
23
|
const spinner = isInteractive ? new Spinner({ text: 'Initiating...' }) : null
|
|
21
24
|
|
|
22
25
|
if (spinner) {
|
package/lib/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ class CliParser {
|
|
|
17
17
|
process.exit(errorCode || -1)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
static _extractPackagesFromPositionals(positionals) {
|
|
20
|
+
static _extractPackagesFromPositionals(positionals, earlyExitNoInstall = false) {
|
|
21
21
|
let packages = []
|
|
22
22
|
if (positionals.length > 0) {
|
|
23
23
|
const command = positionals[0]
|
|
@@ -38,6 +38,12 @@ class CliParser {
|
|
|
38
38
|
packages = positionals.slice(1)
|
|
39
39
|
break
|
|
40
40
|
default:
|
|
41
|
+
if (earlyExitNoInstall) {
|
|
42
|
+
// If no install command, exit early
|
|
43
|
+
// needed for npq-hero command which only runs on 'install' use-cases of npm
|
|
44
|
+
break
|
|
45
|
+
}
|
|
46
|
+
|
|
41
47
|
// Treat first positional as package if no explicit command
|
|
42
48
|
packages = positionals
|
|
43
49
|
break
|
|
@@ -113,12 +119,19 @@ curated by Liran Tal at https://github.com/lirantal/npq`)
|
|
|
113
119
|
const config = {
|
|
114
120
|
allowPositionals: true,
|
|
115
121
|
strict: false,
|
|
116
|
-
options: {
|
|
122
|
+
options: {
|
|
123
|
+
install: {
|
|
124
|
+
type: 'string',
|
|
125
|
+
short: 'i',
|
|
126
|
+
default: 'install'
|
|
127
|
+
}
|
|
128
|
+
}
|
|
117
129
|
}
|
|
118
130
|
|
|
119
131
|
const { positionals } = parseArgs(config)
|
|
120
132
|
|
|
121
|
-
const
|
|
133
|
+
const earlyExitNoInstall = true
|
|
134
|
+
const normalizedPackages = this._extractPackagesFromPositionals(positionals, earlyExitNoInstall)
|
|
122
135
|
|
|
123
136
|
return {
|
|
124
137
|
packages: normalizedPackages
|