@travetto/cli 3.1.0-rc.1 → 3.1.0-rc.2
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 +5 -7
- package/package.json +2 -2
- package/src/decorators.ts +0 -1
package/README.md
CHANGED
|
@@ -130,9 +130,9 @@ HELLO
|
|
|
130
130
|
|
|
131
131
|
The [@CliCommand](https://github.com/travetto/travetto/tree/main/module/cli/src/decorators.ts#L20) supports the following data types for flags:
|
|
132
132
|
* Boolean values
|
|
133
|
-
* Number values. The [@Integer](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#
|
|
134
|
-
* String values. [@MinLength](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#
|
|
135
|
-
* Date values. The [@Min](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#
|
|
133
|
+
* Number values. The [@Integer](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L172), [@Float](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L178), [@Precision](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L166), [@Min](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L107) and [@Max](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L117) decorators help provide additional validation.
|
|
134
|
+
* String values. [@MinLength](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L107), [@MaxLength](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L117), [@Match](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L99) and [@Enum](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L78) provide additional constraints
|
|
135
|
+
* Date values. The [@Min](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L107) and [@Max](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L117) decorators help provide additional validation.
|
|
136
136
|
* String lists. Same as String, but allowing multiple values.
|
|
137
137
|
* Numeric lists. Same as Number, but allowing multiple values.
|
|
138
138
|
|
|
@@ -358,7 +358,7 @@ CuStOm
|
|
|
358
358
|
```
|
|
359
359
|
|
|
360
360
|
## VSCode Integration
|
|
361
|
-
By default, cli commands do not expose themselves to the VSCode extension, as the majority of them are not intended for that sort of operation. [RESTful API](https://github.com/travetto/travetto/tree/main/module/rest#readme "Declarative api for RESTful APIs with support for the dependency injection module.") does expose a cli target `run:rest` that will show up, to help run/debug a rest application. Any command can mark itself as being a run target, and will be eligible for running from within the [VSCode plugin](https://marketplace.visualstudio.com/items?itemName=arcsine.travetto-plugin).
|
|
361
|
+
By default, cli commands do not expose themselves to the VSCode extension, as the majority of them are not intended for that sort of operation. [RESTful API](https://github.com/travetto/travetto/tree/main/module/rest#readme "Declarative api for RESTful APIs with support for the dependency injection module.") does expose a cli target `run:rest` that will show up, to help run/debug a rest application. Any command can mark itself as being a run target, and will be eligible for running from within the [VSCode plugin](https://marketplace.visualstudio.com/items?itemName=arcsine.travetto-plugin). This is achieved by setting the `runTarget` field on the [@CliCommand](https://github.com/travetto/travetto/tree/main/module/cli/src/decorators.ts#L20) decorator. This means the target will be visible within the editor tooling.
|
|
362
362
|
|
|
363
363
|
**Code: Simple Run Target**
|
|
364
364
|
```typescript
|
|
@@ -376,8 +376,6 @@ export class RunCommand {
|
|
|
376
376
|
}
|
|
377
377
|
```
|
|
378
378
|
|
|
379
|
-
Also, any command name that starts with `run:` (i.e. `support/cli.run_*.ts`), will be opted-in to the run behavior unless explicitly disabled.
|
|
380
|
-
|
|
381
379
|
## Advanced Usage
|
|
382
380
|
|
|
383
381
|
**Code: Anatomy of a Command**
|
|
@@ -426,7 +424,7 @@ import { ServerHandle } from '../src/types';
|
|
|
426
424
|
/**
|
|
427
425
|
* Run a rest server as an application
|
|
428
426
|
*/
|
|
429
|
-
@CliCommand({ fields: ['module', 'env', 'profile'] })
|
|
427
|
+
@CliCommand({ runTarget: true, fields: ['module', 'env', 'profile'] })
|
|
430
428
|
export class RunRestCommand {
|
|
431
429
|
|
|
432
430
|
/** Port to run on */
|
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.2",
|
|
4
4
|
"description": "CLI infrastructure for Travetto framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"directory": "module/cli"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@travetto/schema": "^3.1.0-rc.
|
|
27
|
+
"@travetto/schema": "^3.1.0-rc.2",
|
|
28
28
|
"@travetto/terminal": "^3.1.0-rc.0",
|
|
29
29
|
"@travetto/worker": "^3.1.0-rc.0"
|
|
30
30
|
},
|
package/src/decorators.ts
CHANGED
|
@@ -35,7 +35,6 @@ export function CliCommand(cfg: { fields?: ExtraFields[], runTarget?: boolean, h
|
|
|
35
35
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
36
36
|
cls: target as ConcreteClass<T>,
|
|
37
37
|
hidden: cfg.hidden,
|
|
38
|
-
runTarget: cfg.runTarget ?? name.startsWith('run:'),
|
|
39
38
|
preMain: (cmd: CliCommandShape & { env?: string, profile?: string[], module?: string }) => {
|
|
40
39
|
if (addEnv) { defineGlobalEnv({ envName: cmd.env }); }
|
|
41
40
|
if (addProfile) { defineGlobalEnv({ profiles: cmd.profile }); }
|