@travetto/cli 3.2.3 → 3.3.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/cli",
3
- "version": "3.2.3",
3
+ "version": "3.3.0",
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.2.2",
28
- "@travetto/terminal": "^3.2.0"
27
+ "@travetto/schema": "^3.3.0",
28
+ "@travetto/terminal": "^3.3.0"
29
29
  },
30
30
  "travetto": {
31
31
  "displayName": "Command Line Interface"
package/src/decorators.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Class, ClassInstance, ConcreteClass, ConsoleManager, defineGlobalEnv } from '@travetto/base';
1
+ import { Class, ClassInstance, ConcreteClass, ConsoleManager, GlobalEnv, defineGlobalEnv } from '@travetto/base';
2
2
  import { RootIndex } from '@travetto/manifest';
3
3
  import { SchemaRegistry } from '@travetto/schema';
4
4
 
@@ -37,9 +37,13 @@ export function CliCommand(cfg: { fields?: ExtraFields[], runTarget?: boolean, h
37
37
  hidden: cfg.hidden,
38
38
  runTarget: cfg.runTarget,
39
39
  preMain: (cmd: CliCommandShape & { env?: string, profile?: string[], module?: string }) => {
40
- if (addEnv) { defineGlobalEnv({ envName: cmd.env }); }
41
- if (addProfile) { defineGlobalEnv({ profiles: cmd.profile }); }
42
- if (addEnv || addProfile) { ConsoleManager.setDebugFromEnv(); }
40
+ if (addEnv || addProfile) {
41
+ defineGlobalEnv({
42
+ ...addEnv ? { envName: cmd.env } : {},
43
+ ...addProfile ? { profiles: cmd.profile } : {}
44
+ });
45
+ ConsoleManager.setDebug(GlobalEnv.debug, GlobalEnv.devMode);
46
+ }
43
47
  if (addModule && cmd.module && cmd.module !== RootIndex.mainModuleName) { // Mono-repo support
44
48
  RootIndex.reinitForModule(cmd.module); // Reinit with specified module
45
49
  }
package/src/execute.ts CHANGED
@@ -2,7 +2,7 @@ import { appendFile, mkdir } from 'fs/promises';
2
2
 
3
3
  import { GlobalTerminal } from '@travetto/terminal';
4
4
  import { path } from '@travetto/manifest';
5
- import { ConsoleManager, defineGlobalEnv, ShutdownManager } from '@travetto/base';
5
+ import { ConsoleManager, defineGlobalEnv, ShutdownManager, GlobalEnv } from '@travetto/base';
6
6
 
7
7
  import { HelpUtil } from './help';
8
8
  import { CliCommandShape, CliValidationResultError } from './types';
@@ -16,11 +16,8 @@ export class ExecutionManager {
16
16
 
17
17
  static async #envInit(cmd: CliCommandShape): Promise<void> {
18
18
  if (cmd.envInit) {
19
- defineGlobalEnv({
20
- debug: process.env.DEBUG || false,
21
- ...await cmd.envInit(),
22
- });
23
- ConsoleManager.setDebugFromEnv();
19
+ defineGlobalEnv(await cmd.envInit());
20
+ ConsoleManager.setDebug(GlobalEnv.debug, GlobalEnv.devMode);
24
21
  }
25
22
  }
26
23
 
package/src/schema.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Class, ConsoleManager } from '@travetto/base';
1
+ import { Class, ConsoleManager, GlobalEnv } from '@travetto/base';
2
2
  import { BindUtil, FieldConfig, SchemaRegistry, SchemaValidator, ValidationResultError } from '@travetto/schema';
3
3
  import { CliCommandRegistry } from './registry';
4
4
 
@@ -57,7 +57,7 @@ export class CliCommandSchemaUtil {
57
57
  }
58
58
  SchemaRegistry.onInstall(cls, { type: 'added', curr: cls });
59
59
  } finally {
60
- ConsoleManager.setDebugFromEnv();
60
+ ConsoleManager.setDebug(GlobalEnv.debug, GlobalEnv.devMode);
61
61
  }
62
62
 
63
63
  const schema = await SchemaRegistry.getViewSchema(cls);