npq 3.22.0 → 3.22.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/README.md +1 -0
- package/lib/cli.js +6 -16
- package/lib/helpers/packageManagerArgumentParser.js +39 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -130,6 +130,7 @@ NPQ_PKG_MGR=pnpm npx npq install fastify
|
|
|
130
130
|
|
|
131
131
|
```bash
|
|
132
132
|
alias pnpm="NPQ_PKG_MGR=pnpm npq-hero"
|
|
133
|
+
pnpm --filter workspace... add express
|
|
133
134
|
```
|
|
134
135
|
|
|
135
136
|
Note: `npq` by default will offload all commands and their arguments to the `npm` (or other package manager as specified) after it finished its due-diligence checks for the respective packages.
|
package/lib/cli.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const { parseArgs } = require('node:util')
|
|
4
4
|
const npa = require('npm-package-arg')
|
|
5
5
|
const pkg = require('../package.json')
|
|
6
|
+
const { parsePackageManagerArguments } = require('./helpers/packageManagerArgumentParser')
|
|
6
7
|
|
|
7
8
|
const INSTALL_SUBCOMMANDS = new Set([
|
|
8
9
|
'install',
|
|
@@ -145,22 +146,11 @@ curated by Liran Tal at https://github.com/lirantal/npq`)
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
static parseArgsMinimal() {
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
type: 'string',
|
|
154
|
-
short: 'i',
|
|
155
|
-
default: 'install'
|
|
156
|
-
},
|
|
157
|
-
registry: { type: 'string' },
|
|
158
|
-
userconfig: { type: 'string' },
|
|
159
|
-
globalconfig: { type: 'string' }
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const { values, positionals } = parseArgs(config)
|
|
149
|
+
const packageManager = process.env.NPQ_PKG_MGR || 'npm'
|
|
150
|
+
const { values, positionals } = parsePackageManagerArguments({
|
|
151
|
+
packageManager,
|
|
152
|
+
args: process.argv.slice(2)
|
|
153
|
+
})
|
|
164
154
|
|
|
165
155
|
const earlyExitNoInstall = true
|
|
166
156
|
const normalizedPackages = this._extractPackagesFromPositionals(positionals, earlyExitNoInstall)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { parseArgs } = require('node:util')
|
|
4
|
+
|
|
5
|
+
const BASE_OPTIONS = {
|
|
6
|
+
install: {
|
|
7
|
+
type: 'string',
|
|
8
|
+
short: 'i',
|
|
9
|
+
default: 'install'
|
|
10
|
+
},
|
|
11
|
+
registry: { type: 'string' },
|
|
12
|
+
userconfig: { type: 'string' },
|
|
13
|
+
globalconfig: { type: 'string' }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function parsePackageManagerArguments({ packageManager, args }) {
|
|
17
|
+
const options =
|
|
18
|
+
packageManager === 'pnpm'
|
|
19
|
+
? {
|
|
20
|
+
...BASE_OPTIONS,
|
|
21
|
+
filter: { type: 'string', short: 'F', multiple: true },
|
|
22
|
+
'filter-prod': { type: 'string', multiple: true }
|
|
23
|
+
}
|
|
24
|
+
: BASE_OPTIONS
|
|
25
|
+
|
|
26
|
+
const config = {
|
|
27
|
+
allowPositionals: true,
|
|
28
|
+
strict: false,
|
|
29
|
+
options
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (args !== undefined) {
|
|
33
|
+
config.args = args
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return parseArgs(config)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports.parsePackageManagerArguments = parsePackageManagerArguments
|