@travetto/cli 3.1.0-rc.5 → 3.1.0-rc.7

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 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.5",
3
+ "version": "3.1.0-rc.7",
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.4",
28
- "@travetto/terminal": "^3.1.0-rc.0"
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, file?: boolean, envVars?: 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, specifier: cfg.file ? 'file' : undefined
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
- type: x.type === Date ? 'date' :
15
- x.type === Boolean ? 'boolean' :
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/scm.ts CHANGED
@@ -47,7 +47,7 @@ export class CliScmUtil {
47
47
  */
48
48
  static async findChangedModulesSince(hash: string): Promise<IndexedModule[]> {
49
49
  const ws = RootIndex.manifest.workspacePath;
50
- const res = await ExecUtil.spawn('git', ['diff', '--name-only', `HEAD..${hash}`], { cwd: ws }).result;
50
+ const res = await ExecUtil.spawn('git', ['diff', '--name-only', `HEAD..${hash}`, ':!**/DOC.tsx', ':!**/DOC.html', ':!**/README.md'], { cwd: ws }).result;
51
51
  const out = new Set<IndexedModule>();
52
52
  for (const line of res.stdout.split(/\n/g)) {
53
53
  const mod = RootIndex.getFromSource(path.resolve(ws, line));
package/src/types.ts CHANGED
@@ -71,6 +71,7 @@ export type CliCommandInput = {
71
71
  name: string;
72
72
  description?: string;
73
73
  type: 'string' | 'file' | 'number' | 'boolean' | 'date' | 'regex';
74
+ fileExtensions?: string[];
74
75
  choices?: unknown[];
75
76
  required?: boolean;
76
77
  array?: boolean;