@travetto/doc 3.3.4 → 3.4.0-rc.1
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 +5 -5
- package/src/util/run.ts +7 -2
- package/support/cli.doc.ts +9 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/doc",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0-rc.1",
|
|
4
4
|
"description": "Documentation support for the Travetto framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"directory": "module/doc"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@travetto/base": "^3.
|
|
28
|
-
"@types/prismjs": "^1.26.
|
|
27
|
+
"@travetto/base": "^3.4.0-rc.1",
|
|
28
|
+
"@types/prismjs": "^1.26.2",
|
|
29
29
|
"prismjs": "^1.29.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@travetto/cli": "^3.
|
|
32
|
+
"@travetto/cli": "^3.4.0-rc.2"
|
|
33
33
|
},
|
|
34
34
|
"peerDependenciesMeta": {
|
|
35
35
|
"@travetto/cli": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"travetto": {
|
|
40
|
-
"
|
|
40
|
+
"roles": [
|
|
41
41
|
"doc"
|
|
42
42
|
],
|
|
43
43
|
"displayName": "Documentation"
|
package/src/util/run.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
|
|
1
3
|
import { path, RootIndex } from '@travetto/manifest';
|
|
2
4
|
import { ExecUtil, ExecutionOptions, ExecutionState } from '@travetto/base';
|
|
3
5
|
import { stripAnsiCodes } from '@travetto/terminal';
|
|
@@ -9,7 +11,7 @@ export type RunConfig = {
|
|
|
9
11
|
rewrite?: (text: string) => string;
|
|
10
12
|
module?: string;
|
|
11
13
|
env?: Record<string, string>;
|
|
12
|
-
|
|
14
|
+
envName?: string;
|
|
13
15
|
cwd?: string;
|
|
14
16
|
};
|
|
15
17
|
|
|
@@ -60,10 +62,12 @@ export class DocRunUtil {
|
|
|
60
62
|
env: {
|
|
61
63
|
...process.env,
|
|
62
64
|
DEBUG: '0',
|
|
65
|
+
TRV_CAN_RESTART: '0',
|
|
66
|
+
TRV_CLI_IPC: '',
|
|
63
67
|
TRV_MANIFEST: '',
|
|
64
68
|
TRV_BUILD: 'none',
|
|
65
69
|
TRV_MODULE: config.module ?? '',
|
|
66
|
-
...(config.
|
|
70
|
+
...(config.envName ? { TRV_ENV: config.envName } : {}),
|
|
67
71
|
...(config.env ?? {})
|
|
68
72
|
}
|
|
69
73
|
}
|
|
@@ -77,6 +81,7 @@ export class DocRunUtil {
|
|
|
77
81
|
const cwd = path.toPosix((cfg.module ? RootIndex.getModule(cfg.module)! : RootIndex.mainModule).sourcePath);
|
|
78
82
|
text = stripAnsiCodes(text.trim())
|
|
79
83
|
.replaceAll(cwd, '.')
|
|
84
|
+
.replaceAll(os.tmpdir(), '/tmp')
|
|
80
85
|
.replaceAll(RootIndex.manifest.workspacePath, '<workspace-root>')
|
|
81
86
|
.replace(/[/]tmp[/][a-z_A-Z0-9\/\-]+/g, '/tmp/<temp-folder>')
|
|
82
87
|
.replace(/^(\s*framework:\s*')(\d+[.]\d+)[^']*('[,]?\s*)$/gm, (_, pre, ver, post) => `${pre}${ver}.x${post}`)
|
package/support/cli.doc.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
|
|
3
|
-
import { PackageUtil, path, RootIndex
|
|
4
|
-
import { ExecUtil, GlobalEnvConfig } from '@travetto/base';
|
|
5
|
-
import { CliCommandShape, CliCommand, CliValidationError } from '@travetto/cli';
|
|
3
|
+
import { PackageUtil, path, RootIndex } from '@travetto/manifest';
|
|
4
|
+
import { ExecUtil, GlobalEnvConfig, CompilerClient } from '@travetto/base';
|
|
5
|
+
import { CliCommandShape, CliCommand, CliValidationError, CliUtil } from '@travetto/cli';
|
|
6
6
|
import { MinLength } from '@travetto/schema';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -49,9 +49,12 @@ export class DocCommand implements CliCommandShape {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
async runWatch(): Promise<void> {
|
|
52
|
+
if (await CliUtil.runWithRestart(this)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
52
56
|
const args = process.argv.slice(2).filter(x => !/(-w|--watch)/.test(x));
|
|
53
|
-
|
|
54
|
-
for await (const { action, file } of stream) {
|
|
57
|
+
await new CompilerClient().onFileChange(async ({ action, file }) => {
|
|
55
58
|
if (action === 'update' && file === this.input) {
|
|
56
59
|
await ExecUtil.spawn('npx', ['trv', ...args], {
|
|
57
60
|
cwd: RootIndex.mainModule.sourcePath,
|
|
@@ -59,7 +62,7 @@ export class DocCommand implements CliCommandShape {
|
|
|
59
62
|
stdio: 'inherit', catchAsResult: true
|
|
60
63
|
});
|
|
61
64
|
}
|
|
62
|
-
}
|
|
65
|
+
}, true);
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
async render(): Promise<void> {
|