@cabloy/cli 3.0.56 → 3.0.59
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/dist/lib/cli.d.ts +1 -0
- package/dist/lib/cli.js +18 -4
- package/dist/registry.js +1 -1
- package/package.json +2 -2
package/dist/lib/cli.d.ts
CHANGED
package/dist/lib/cli.js
CHANGED
|
@@ -12,9 +12,9 @@ export class CliCommand extends BaseCommand {
|
|
|
12
12
|
__argv;
|
|
13
13
|
constructor(rawArgv, { meta, argv }) {
|
|
14
14
|
super(rawArgv);
|
|
15
|
-
this.usage = meta.info.usage;
|
|
15
|
+
// this.usage = meta.info.usage; // readonly
|
|
16
|
+
// this.options = meta.options; // readonly
|
|
16
17
|
this.version = meta.info.version;
|
|
17
|
-
this.options = meta.options;
|
|
18
18
|
this.__meta = meta;
|
|
19
19
|
this.__groups = meta.groups;
|
|
20
20
|
this.__argv = argv;
|
|
@@ -22,8 +22,7 @@ export class CliCommand extends BaseCommand {
|
|
|
22
22
|
async run(options) {
|
|
23
23
|
let { argv, cwd, env, rawArgv } = options;
|
|
24
24
|
// argv
|
|
25
|
-
argv =
|
|
26
|
-
delete argv.$0;
|
|
25
|
+
argv = this._prepareArgv(argv);
|
|
27
26
|
// context
|
|
28
27
|
const context = {
|
|
29
28
|
brandName: process.env.CabloyCliBrandName,
|
|
@@ -200,4 +199,19 @@ export class CliCommand extends BaseCommand {
|
|
|
200
199
|
return true;
|
|
201
200
|
return evaluate(expression, { group, context });
|
|
202
201
|
}
|
|
202
|
+
_prepareArgv(argv) {
|
|
203
|
+
argv = Object.assign({}, argv, this.__argv);
|
|
204
|
+
delete argv.$0;
|
|
205
|
+
// alias
|
|
206
|
+
const options = this.__meta.options;
|
|
207
|
+
if (options) {
|
|
208
|
+
for (const key in options) {
|
|
209
|
+
const option = options[key];
|
|
210
|
+
if (option.alias && argv[key] === undefined) {
|
|
211
|
+
argv[key] = argv[option.alias];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return argv;
|
|
216
|
+
}
|
|
203
217
|
}
|
package/dist/registry.js
CHANGED
|
@@ -6,7 +6,7 @@ export async function getRegistry() {
|
|
|
6
6
|
const npmConfig = new NPMConfig(Object.assign({ npmPath: '' }, npmDefinitions));
|
|
7
7
|
await npmConfig.load();
|
|
8
8
|
__registry = npmConfig.get('registry') || 'https://registry.npmjs.org/';
|
|
9
|
-
if (__registry.
|
|
9
|
+
if (!__registry.endsWith('/')) {
|
|
10
10
|
__registry = `${__registry}/`;
|
|
11
11
|
}
|
|
12
12
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cabloy/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.59",
|
|
5
5
|
"description": "@cabloy/cli",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@cabloy/process-helper": "^2.0.21",
|
|
33
33
|
"@cabloy/utils": "^1.0.47",
|
|
34
34
|
"@cabloy/word-utils": "^2.0.1",
|
|
35
|
-
"@npmcli/config": "^
|
|
35
|
+
"@npmcli/config": "^10.4.2",
|
|
36
36
|
"@zhennann/common-bin": "^4.0.0",
|
|
37
37
|
"@zhennann/ejs": "^3.0.1",
|
|
38
38
|
"boxen": "^4.2.0",
|