@travetto/cli 3.1.0-rc.5 → 3.1.0-rc.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/README.md +0 -3
- package/package.json +3 -3
- package/src/decorators.ts +3 -2
- package/src/schema.ts +7 -5
- package/src/types.ts +1 -0
package/README.md
CHANGED
|
@@ -27,10 +27,8 @@ Commands:
|
|
|
27
27
|
doc:mapping Generate module mapping for @travetto/doc
|
|
28
28
|
email:compile CLI Entry point for running the email server
|
|
29
29
|
email:editor The email editor compilation service and output serving
|
|
30
|
-
exec Repo execution
|
|
31
30
|
lint Command line support for linting
|
|
32
31
|
lint:register Writes the lint configuration file
|
|
33
|
-
list Allows for listing of modules
|
|
34
32
|
model:export Exports model schemas
|
|
35
33
|
model:install Installing models
|
|
36
34
|
openapi:client CLI for generating the cli client
|
|
@@ -50,7 +48,6 @@ Commands:
|
|
|
50
48
|
service Allows for running services
|
|
51
49
|
test Launch test framework and execute tests
|
|
52
50
|
test:watch Invoke the test watcher
|
|
53
|
-
version-sync Enforces all packages to write out their versions and dependencies
|
|
54
51
|
```
|
|
55
52
|
|
|
56
53
|
This listing is from the [Travetto](https://travetto.dev) monorepo, and represents the majority of tools that can be invoked from the command line.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/cli",
|
|
3
|
-
"version": "3.1.0-rc.
|
|
3
|
+
"version": "3.1.0-rc.6",
|
|
4
4
|
"description": "CLI infrastructure for Travetto framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"directory": "module/cli"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@travetto/schema": "^3.1.0-rc.
|
|
28
|
-
"@travetto/terminal": "^3.1.0-rc.
|
|
27
|
+
"@travetto/schema": "^3.1.0-rc.5",
|
|
28
|
+
"@travetto/terminal": "^3.1.0-rc.1"
|
|
29
29
|
},
|
|
30
30
|
"travetto": {
|
|
31
31
|
"displayName": "Command Line Interface"
|
package/src/decorators.ts
CHANGED
|
@@ -84,7 +84,7 @@ export function CliCommand(cfg: { fields?: ExtraFields[], runTarget?: boolean, h
|
|
|
84
84
|
/**
|
|
85
85
|
* Decorator to register a CLI command flag
|
|
86
86
|
*/
|
|
87
|
-
export function CliFlag(cfg: { name?: string, short?: string, desc?: string,
|
|
87
|
+
export function CliFlag(cfg: { name?: string, short?: string, desc?: string, fileExtensions?: string[], envVars?: string[] }) {
|
|
88
88
|
return function (target: ClassInstance, prop: string | symbol): void {
|
|
89
89
|
const aliases: string[] = [];
|
|
90
90
|
if (cfg.name) {
|
|
@@ -98,7 +98,8 @@ export function CliFlag(cfg: { name?: string, short?: string, desc?: string, fil
|
|
|
98
98
|
}
|
|
99
99
|
if (typeof prop === 'string') {
|
|
100
100
|
SchemaRegistry.registerPendingFieldFacet(target.constructor, prop, {
|
|
101
|
-
aliases, description: cfg.desc,
|
|
101
|
+
aliases, description: cfg.desc,
|
|
102
|
+
specifiers: cfg.fileExtensions?.length ? ['file', ...cfg.fileExtensions.map(x => `ext:${x.replace(/[*.]/g, '')}`)] : undefined
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
105
|
};
|
package/src/schema.ts
CHANGED
|
@@ -5,17 +5,19 @@ import { CliCommandRegistry } from './registry';
|
|
|
5
5
|
import { CliCommandInput, CliCommandSchema, CliCommandShape, CliValidationResultError } from './types';
|
|
6
6
|
|
|
7
7
|
function fieldToInput(x: FieldConfig): CliCommandInput {
|
|
8
|
+
const type = x.type === Date ? 'date' :
|
|
9
|
+
x.type === Boolean ? 'boolean' :
|
|
10
|
+
x.type === String ? (x.specifiers?.includes('file') ? 'file' : 'string') :
|
|
11
|
+
x.type === Number ? 'number' :
|
|
12
|
+
x.type === RegExp ? 'regex' : 'string';
|
|
8
13
|
return ({
|
|
9
14
|
name: x.name,
|
|
10
15
|
description: x.description,
|
|
11
16
|
array: x.array,
|
|
12
17
|
required: x.required?.active,
|
|
13
18
|
choices: x.enum?.values,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
x.type === String ? (x.specifier === 'file' ? 'file' : 'string') :
|
|
17
|
-
x.type === Number ? 'number' :
|
|
18
|
-
x.type === RegExp ? 'regex' : 'string',
|
|
19
|
+
fileExtensions: type === 'file' ? x.specifiers?.filter(s => s.startsWith('ext:')).map(s => s.split('ext:')[1]) : undefined,
|
|
20
|
+
type,
|
|
19
21
|
default: x.default,
|
|
20
22
|
flagNames: (x.aliases ?? []).slice(0).filter(v => !v.startsWith('env.')),
|
|
21
23
|
envVars: (x.aliases ?? []).slice(0).filter(v => v.startsWith('env.')).map(v => v.replace('env.', ''))
|
package/src/types.ts
CHANGED