@travetto/cli 3.4.6 → 3.4.8
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/package.json +2 -2
- package/src/decorators.ts +1 -1
- package/src/execute.ts +7 -7
- package/src/parse.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/cli",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.8",
|
|
4
4
|
"description": "CLI infrastructure for Travetto framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"directory": "module/cli"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@travetto/schema": "^3.4.
|
|
32
|
+
"@travetto/schema": "^3.4.4",
|
|
33
33
|
"@travetto/terminal": "^3.4.0"
|
|
34
34
|
},
|
|
35
35
|
"travetto": {
|
package/src/decorators.ts
CHANGED
|
@@ -36,7 +36,7 @@ export function CliCommand(cfg: CliCommandConfigOptions = {}) {
|
|
|
36
36
|
|
|
37
37
|
if (addEnv) {
|
|
38
38
|
SchemaRegistry.registerPendingFieldConfig(target, 'env', String, {
|
|
39
|
-
aliases: ['e'],
|
|
39
|
+
aliases: ['e', CliParseUtil.toEnvField('TRV_ENV')],
|
|
40
40
|
description: 'Application environment',
|
|
41
41
|
default: 'dev',
|
|
42
42
|
required: { active: false }
|
package/src/execute.ts
CHANGED
|
@@ -73,15 +73,15 @@ export class ExecutionManager {
|
|
|
73
73
|
static async run(argv: string[]): Promise<void> {
|
|
74
74
|
await GlobalTerminal.init();
|
|
75
75
|
|
|
76
|
-
const { cmd, args, help } = await CliParseUtil.getArgs(argv);
|
|
77
|
-
|
|
78
|
-
if (!cmd) {
|
|
79
|
-
console.info!(await HelpUtil.renderAllHelp());
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
76
|
let command: CliCommandShape | undefined;
|
|
84
77
|
try {
|
|
78
|
+
const { cmd, args, help } = await CliParseUtil.getArgs(argv);
|
|
79
|
+
|
|
80
|
+
if (!cmd) {
|
|
81
|
+
console.info!(await HelpUtil.renderAllHelp());
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
85
|
// Load a single command
|
|
86
86
|
command = await CliCommandRegistry.getInstance(cmd, true);
|
|
87
87
|
if (help) {
|
package/src/parse.ts
CHANGED
|
@@ -90,9 +90,9 @@ export class CliParseUtil {
|
|
|
90
90
|
/**
|
|
91
91
|
* Read configuration file given flag
|
|
92
92
|
*/
|
|
93
|
-
static async readFlagFile(flag: string
|
|
93
|
+
static async readFlagFile(flag: string): Promise<string[]> {
|
|
94
94
|
const key = flag.replace(CONFIG_PRE, '');
|
|
95
|
-
const mod =
|
|
95
|
+
const mod = RootIndex.mainModuleName;
|
|
96
96
|
|
|
97
97
|
// We have a file
|
|
98
98
|
const rel = (key.includes('/') ? key : `@/support/pack.${key}.flags`)
|
|
@@ -101,7 +101,7 @@ export class CliParseUtil {
|
|
|
101
101
|
.replace(/^(@[^\/]+\/[^\/]+)/, (_, imp) => {
|
|
102
102
|
const val = RootIndex.getModule(imp);
|
|
103
103
|
if (!val) {
|
|
104
|
-
throw new Error(`Unknown module file: ${
|
|
104
|
+
throw new Error(`Unknown module file: ${key}, unable to proceed`);
|
|
105
105
|
}
|
|
106
106
|
return val.sourcePath;
|
|
107
107
|
});
|
|
@@ -109,7 +109,7 @@ export class CliParseUtil {
|
|
|
109
109
|
const file = path.resolve(rel);
|
|
110
110
|
|
|
111
111
|
if (!await fs.stat(file).catch(() => false)) {
|
|
112
|
-
throw new Error(`Missing flag file: ${
|
|
112
|
+
throw new Error(`Missing flag file: ${key}, unable to proceed`);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
const data = await fs.readFile(file, 'utf8');
|