@travetto/doc 3.4.1 → 3.4.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 CHANGED
@@ -97,7 +97,7 @@ Usage: doc [options]
97
97
 
98
98
  Options:
99
99
  -i, --input <string> Input File (default: "DOC.tsx")
100
- -o, --outputs <string> Outputs (default: [])
100
+ -o, --outputs <string> Outputs (default: ["README.md"])
101
101
  -w, --watch Watch? (default: false)
102
102
  -h, --help display help for command
103
103
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/doc",
3
- "version": "3.4.1",
3
+ "version": "3.4.2",
4
4
  "description": "Documentation support for the Travetto framework",
5
5
  "keywords": [
6
6
  "docs",
@@ -29,7 +29,7 @@
29
29
  "prismjs": "^1.29.0"
30
30
  },
31
31
  "peerDependencies": {
32
- "@travetto/cli": "^3.4.3"
32
+ "@travetto/cli": "^3.4.6"
33
33
  },
34
34
  "peerDependenciesMeta": {
35
35
  "@travetto/cli": {
@@ -62,7 +62,7 @@ yarn add ${el.props.pkg}
62
62
  Code: async ({ context, el }) => {
63
63
  const name = getComponentName(el.type);
64
64
  const content = await context.resolveCode(el);
65
- let lang = content.language;
65
+ let lang = el.props.language ?? content.language;
66
66
  if (!lang) {
67
67
  if (el.type === c.Terminal) {
68
68
  lang = 'bash';
@@ -1,7 +1,7 @@
1
1
  import fs from 'fs/promises';
2
2
 
3
3
  import { PackageUtil, path, RootIndex } from '@travetto/manifest';
4
- import { ExecUtil, EnvInit, CompilerClient } from '@travetto/base';
4
+ import { ExecUtil, CompilerClient, defineEnv } from '@travetto/base';
5
5
  import { CliCommandShape, CliCommand, CliValidationError, CliUtil } from '@travetto/cli';
6
6
  import { MinLength } from '@travetto/schema';
7
7
 
@@ -21,25 +21,26 @@ export class DocCommand implements CliCommandShape {
21
21
  /** Watch? */
22
22
  watch = false;
23
23
 
24
- envInit(): EnvInit {
24
+ preMain(): void {
25
25
  Object.assign(process.env, {
26
26
  TRV_CLI_IPC: '',
27
27
  TRV_LOG_PLAIN: 'true',
28
28
  TRV_CONSOLE_WIDTH: '140',
29
29
  FORCE_COLOR: '0',
30
30
  });
31
- return { debug: false, };
31
+ defineEnv({ debug: false, });
32
32
  }
33
33
 
34
- finalize(): void {
35
- if (this.outputs.length === 0) {
36
- const workspacePkg = PackageUtil.readPackage(RootIndex.manifest.workspacePath);
37
- this.outputs = workspacePkg.travetto?.docOutputs ?? ['README.md'];
38
- }
39
- this.input = path.resolve(this.input);
34
+ preBind(): void {
35
+ const workspacePkg = PackageUtil.readPackage(RootIndex.manifest.workspacePath);
36
+ this.outputs = workspacePkg.travetto?.docOutputs ?? ['README.md'];
37
+ }
38
+
39
+ preHelp(): void {
40
+ this.preBind();
40
41
  }
41
42
 
42
- async validate(...args: unknown[]): Promise<CliValidationError | undefined> {
43
+ async validate(): Promise<CliValidationError | undefined> {
43
44
  const docFile = path.resolve(this.input);
44
45
  if (!(await fs.stat(docFile).catch(() => false))) {
45
46
  return { message: `input: ${this.input} does not exist`, source: 'flag' };
@@ -84,6 +85,8 @@ export class DocCommand implements CliCommandShape {
84
85
  }
85
86
 
86
87
  main(): Promise<void> {
88
+ this.input = path.resolve(this.input);
89
+
87
90
  return this.watch ? this.runWatch() : this.render();
88
91
  }
89
92
  }