@diagc/cli 1.7.0 → 1.9.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/README.md +1 -1
- package/assets/guide/compose.md +84 -0
- package/assets/guide/git-graph.md +3 -0
- package/assets/guide/index.md +11 -3
- package/assets/skill/SKILL.md +2 -1
- package/assets/studio/assets/{index-DzVDK5uD.css → index-CAVbaTgv.css} +1 -1
- package/assets/studio/assets/index-Cgkqoymm.js +112 -0
- package/assets/studio/index.html +2 -2
- package/assets/viewer/index.html +23 -23
- package/assets/viewer/shared/caveat-cyrillic-500-normal.woff +0 -0
- package/assets/viewer/shared/caveat-cyrillic-500-normal.woff2 +0 -0
- package/assets/viewer/shared/caveat-cyrillic-700-normal.woff +0 -0
- package/assets/viewer/shared/caveat-cyrillic-700-normal.woff2 +0 -0
- package/assets/viewer/shared/caveat-cyrillic-ext-500-normal.woff +0 -0
- package/assets/viewer/shared/caveat-cyrillic-ext-500-normal.woff2 +0 -0
- package/assets/viewer/shared/caveat-cyrillic-ext-700-normal.woff +0 -0
- package/assets/viewer/shared/caveat-cyrillic-ext-700-normal.woff2 +0 -0
- package/assets/viewer/shared/caveat-latin-500-normal.woff +0 -0
- package/assets/viewer/shared/caveat-latin-500-normal.woff2 +0 -0
- package/assets/viewer/shared/caveat-latin-700-normal.woff +0 -0
- package/assets/viewer/shared/caveat-latin-700-normal.woff2 +0 -0
- package/assets/viewer/shared/caveat-latin-ext-500-normal.woff +0 -0
- package/assets/viewer/shared/caveat-latin-ext-500-normal.woff2 +0 -0
- package/assets/viewer/shared/caveat-latin-ext-700-normal.woff +0 -0
- package/assets/viewer/shared/caveat-latin-ext-700-normal.woff2 +0 -0
- package/assets/viewer/shared/chakra-petch-latin-500-normal.woff2 +0 -0
- package/assets/viewer/shared/chakra-petch-latin-600-normal.woff2 +0 -0
- package/assets/viewer/shared/inter-latin-400-normal.woff2 +0 -0
- package/assets/viewer/shared/inter-latin-600-normal.woff2 +0 -0
- package/assets/viewer/shared/jetbrains-mono-latin-400-normal.woff2 +0 -0
- package/assets/viewer/shared/jetbrains-mono-latin-600-normal.woff2 +0 -0
- package/assets/viewer/shared/kalam-devanagari-400-normal.woff +0 -0
- package/assets/viewer/shared/kalam-devanagari-400-normal.woff2 +0 -0
- package/assets/viewer/shared/kalam-devanagari-700-normal.woff +0 -0
- package/assets/viewer/shared/kalam-devanagari-700-normal.woff2 +0 -0
- package/assets/viewer/shared/kalam-latin-400-normal.woff +0 -0
- package/assets/viewer/shared/kalam-latin-400-normal.woff2 +0 -0
- package/assets/viewer/shared/kalam-latin-700-normal.woff +0 -0
- package/assets/viewer/shared/kalam-latin-700-normal.woff2 +0 -0
- package/assets/viewer/shared/kalam-latin-ext-400-normal.woff +0 -0
- package/assets/viewer/shared/kalam-latin-ext-400-normal.woff2 +0 -0
- package/assets/viewer/shared/kalam-latin-ext-700-normal.woff +0 -0
- package/assets/viewer/shared/kalam-latin-ext-700-normal.woff2 +0 -0
- package/assets/viewer/shared/viewer.css +2 -0
- package/assets/viewer/shared/viewer.js +46 -0
- package/dist/api/diagrams.d.ts +20 -0
- package/dist/api/diagrams.js +69 -3
- package/dist/api/handlers.d.ts +1 -1
- package/dist/api/handlers.js +1 -1
- package/dist/api/routes.js +13 -0
- package/dist/cli/parse.d.ts +9 -1
- package/dist/cli/parse.js +14 -1
- package/dist/cli/run.js +6 -2
- package/dist/cli.js +7 -1
- package/dist/commands/compile.d.ts +1 -1
- package/dist/commands/compile.js +5 -6
- package/dist/commands/lint.js +4 -5
- package/dist/commands/publish.d.ts +1 -1
- package/dist/commands/publish.js +15 -7
- package/dist/commands/shared.d.ts +9 -0
- package/dist/commands/shared.js +30 -1
- package/dist/commands/show.d.ts +1 -1
- package/dist/commands/show.js +12 -2
- package/dist/compile.d.ts +11 -1
- package/dist/compile.js +25 -6
- package/dist/guide.js +22 -10
- package/dist/home.d.ts +5 -1
- package/dist/home.js +2 -0
- package/dist/init.d.ts +1 -1
- package/dist/init.js +1 -1
- package/dist/lint.js +2 -1
- package/dist/loadHints.d.ts +8 -0
- package/dist/loadHints.js +36 -0
- package/dist/names.js +1 -1
- package/dist/publish/html.d.ts +13 -0
- package/dist/publish/html.js +54 -2
- package/dist/publish/publish.d.ts +10 -0
- package/dist/publish/publish.js +45 -23
- package/dist/publish/snapshot.d.ts +21 -2
- package/dist/publish/snapshot.js +95 -18
- package/dist/text/git.d.ts +52 -0
- package/dist/text/git.js +274 -0
- package/dist/text/layout.d.ts +29 -0
- package/dist/text/paint.js +95 -0
- package/dist/text/scene.d.ts +3 -0
- package/dist/text/scene.js +7 -3
- package/dist/tui/actions.js +14 -2
- package/dist/tui/screen.js +1 -0
- package/dist/tui/state.d.ts +2 -0
- package/dist/tui/state.js +1 -0
- package/dist/watch.js +23 -7
- package/package.json +2 -2
- package/assets/studio/assets/index-DRsUukzt.js +0 -112
package/dist/api/diagrams.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ export interface DiagramEntry {
|
|
|
7
7
|
message: string;
|
|
8
8
|
}[];
|
|
9
9
|
editable: boolean;
|
|
10
|
+
/** the `.diagram.ts` a compiled diagram comes from, relative to the sources dir
|
|
11
|
+
* (`team/arch.diagram.ts`), when it is there: what the studio names on its
|
|
12
|
+
* read-only chip and opens on request */
|
|
13
|
+
source?: string;
|
|
10
14
|
}
|
|
11
15
|
/** Render-ready models for the studio boot: JSON sources (editable) served from
|
|
12
16
|
* `diagramsDir`, compiled TS artifacts from `artifactsDir`. A source shadows its
|
|
@@ -17,6 +21,13 @@ export declare function listDiagramModels(diagramsDir: string, artifactsDir: str
|
|
|
17
21
|
* spelling, is what keeps it inside the two directories: a compiled diagram's name
|
|
18
22
|
* comes from its `.diagram.ts` file and need not pass `isSafeName`. */
|
|
19
23
|
export declare function diagramAsShown(diagramsDir: string, artifactsDir: string, name: string): Promise<DiagramEntry | undefined>;
|
|
24
|
+
/** The TypeScript a compiled diagram comes from, as plain text: what the studio's
|
|
25
|
+
* read-only chip opens. Only `.diagram.ts` is served — a JSON source is the
|
|
26
|
+
* studio's own, read through `readDiagram`. */
|
|
27
|
+
export declare function readDiagramSource(diagramsDir: string, name: string): Promise<HandlerResult & {
|
|
28
|
+
bytes?: Buffer;
|
|
29
|
+
contentType?: string;
|
|
30
|
+
}>;
|
|
20
31
|
/** the JSON source (+ sibling layout and drawings) of a designer-owned diagram — the studio
|
|
21
32
|
* reads these directly so it never depends on a compile watcher for its own files */
|
|
22
33
|
export declare function readDiagram(diagramsDir: string, name: string): Promise<HandlerResult>;
|
|
@@ -27,6 +38,15 @@ export declare function saveDiagram(diagramsDir: string, name: string, payload:
|
|
|
27
38
|
/** Move a designer-owned diagram (and its sibling layout, if any) to a new name,
|
|
28
39
|
* rewriting the model's id to match so the file stays self-consistent. */
|
|
29
40
|
export declare function renameDiagram(diagramsDir: string, from: string, to: string): Promise<HandlerResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Remove a studio-owned diagram: its JSON source, its layout and drawings sidecars,
|
|
43
|
+
* and its compiled artifact — the watcher's copy, which would otherwise list the
|
|
44
|
+
* diagram again, read-only, the next time the studio starts without a watcher
|
|
45
|
+
* having seen the deletion. A diagram with a `.diagram.ts` is TypeScript's: the
|
|
46
|
+
* studio never offers to delete it, and the route refuses too (409). Published
|
|
47
|
+
* pages and PNGs are left where they are; `diagc publish` regenerates them.
|
|
48
|
+
*/
|
|
49
|
+
export declare function deleteDiagram(diagramsDir: string, artifactsDir: string, name: string): Promise<HandlerResult>;
|
|
30
50
|
/** Promote a JSON-owned diagram to a generated `.diagram.ts`. See `ejectDiagram`
|
|
31
51
|
* for the round-trip guarantee; this just maps its failure codes to statuses. */
|
|
32
52
|
export declare function ejectDiagramSource(diagramsDir: string, artifactsDir: string, name: string): Promise<HandlerResult>;
|
package/dist/api/diagrams.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { access, mkdir, readFile, rename, unlink } from 'node:fs/promises';
|
|
1
|
+
import { access, mkdir, readFile, rename, rm, unlink } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { composeIncludes, errMessage, validate } from '@diagc/core/internal';
|
|
4
4
|
import { writeFileAtomic } from '../atomic-write.js';
|
|
@@ -42,9 +42,12 @@ async function loadEntry(diagramsDir, artifactsDir, name, isSource) {
|
|
|
42
42
|
const issues = [];
|
|
43
43
|
if (isSource && !editable) {
|
|
44
44
|
issues.push({
|
|
45
|
-
message: `'${name}' is read-only here: the studio saves names of lowercase letters, digits, '-' and '/', none ending in /rename, /eject or /
|
|
45
|
+
message: `'${name}' is read-only here: the studio saves names of lowercase letters, digits, '-' and '/', none ending in /rename, /eject, /composed or /source. Rename the file to edit it.`,
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
+
// A compiled diagram names the TypeScript it comes from, when it is beside the
|
|
49
|
+
// sources: an artifact with no source here (a build output copied in) names none.
|
|
50
|
+
const source = isSource ? undefined : await tsSourceOf(diagramsDir, name);
|
|
48
51
|
try {
|
|
49
52
|
model = JSON.parse(await readFile(file, 'utf8'));
|
|
50
53
|
}
|
|
@@ -53,7 +56,32 @@ async function loadEntry(diagramsDir, artifactsDir, name, isSource) {
|
|
|
53
56
|
}
|
|
54
57
|
if (isSource && hasIncludes(model))
|
|
55
58
|
model = await composedForList(model, file, diagramsDir, issues);
|
|
56
|
-
return { name, model, issues, editable };
|
|
59
|
+
return { name, model, issues, editable, ...(source !== undefined ? { source } : {}) };
|
|
60
|
+
}
|
|
61
|
+
/** `<name>.diagram.ts` relative to `diagramsDir` when that file exists, else undefined. */
|
|
62
|
+
async function tsSourceOf(diagramsDir, name) {
|
|
63
|
+
const rel = `${name}.diagram.ts`;
|
|
64
|
+
try {
|
|
65
|
+
await access(path.join(diagramsDir, rel));
|
|
66
|
+
return rel;
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** The TypeScript a compiled diagram comes from, as plain text: what the studio's
|
|
73
|
+
* read-only chip opens. Only `.diagram.ts` is served — a JSON source is the
|
|
74
|
+
* studio's own, read through `readDiagram`. */
|
|
75
|
+
export async function readDiagramSource(diagramsDir, name) {
|
|
76
|
+
if (!isSafeName(name))
|
|
77
|
+
return refuse(400, `Unsafe name '${name}'`);
|
|
78
|
+
try {
|
|
79
|
+
const bytes = await readFile(path.join(diagramsDir, `${name}.diagram.ts`));
|
|
80
|
+
return { status: 200, body: undefined, bytes, contentType: 'text/plain; charset=utf-8' };
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return refuse(404, `No TypeScript source '${name}'`);
|
|
84
|
+
}
|
|
57
85
|
}
|
|
58
86
|
/** `model` with its includes expanded for the list, or `model` itself when they
|
|
59
87
|
* cannot be, with what went wrong added to `issues`. */
|
|
@@ -263,6 +291,44 @@ async function moveIfPresent(src, dst) {
|
|
|
263
291
|
throw e;
|
|
264
292
|
}
|
|
265
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Remove a studio-owned diagram: its JSON source, its layout and drawings sidecars,
|
|
296
|
+
* and its compiled artifact — the watcher's copy, which would otherwise list the
|
|
297
|
+
* diagram again, read-only, the next time the studio starts without a watcher
|
|
298
|
+
* having seen the deletion. A diagram with a `.diagram.ts` is TypeScript's: the
|
|
299
|
+
* studio never offers to delete it, and the route refuses too (409). Published
|
|
300
|
+
* pages and PNGs are left where they are; `diagc publish` regenerates them.
|
|
301
|
+
*/
|
|
302
|
+
export async function deleteDiagram(diagramsDir, artifactsDir, name) {
|
|
303
|
+
if (!isSafeName(name))
|
|
304
|
+
return refuse(400, `Unsafe name '${name}'`);
|
|
305
|
+
const tsPath = path.join(diagramsDir, `${name}.diagram.ts`);
|
|
306
|
+
try {
|
|
307
|
+
await access(tsPath);
|
|
308
|
+
return refuse(409, `'${name}' is TypeScript-owned (${tsPath}) — delete its source`);
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
/* no TypeScript source — the studio's to delete */
|
|
312
|
+
}
|
|
313
|
+
const source = path.join(diagramsDir, `${name}.diagram.json`);
|
|
314
|
+
try {
|
|
315
|
+
await access(source);
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
return refuse(404, `No diagram source '${name}'`);
|
|
319
|
+
}
|
|
320
|
+
// The sidecars and the artifact first, the source last: a failure part-way
|
|
321
|
+
// leaves a diagram the studio still lists and can retry on.
|
|
322
|
+
for (const file of [
|
|
323
|
+
path.join(diagramsDir, `${name}.layout.json`),
|
|
324
|
+
path.join(diagramsDir, `${name}.drawings.json`),
|
|
325
|
+
path.join(artifactsDir, `${name}.diagram.json`),
|
|
326
|
+
]) {
|
|
327
|
+
await rm(file, { force: true });
|
|
328
|
+
}
|
|
329
|
+
await unlink(source);
|
|
330
|
+
return { status: 200, body: { ok: true } };
|
|
331
|
+
}
|
|
266
332
|
/** Promote a JSON-owned diagram to a generated `.diagram.ts`. See `ejectDiagram`
|
|
267
333
|
* for the round-trip guarantee; this just maps its failure codes to statuses. */
|
|
268
334
|
export async function ejectDiagramSource(diagramsDir, artifactsDir, name) {
|
package/dist/api/handlers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { MAX_ASSET_BYTES, readAsset, saveAsset } from './assets.js';
|
|
2
|
-
export { ejectDiagramSource, listDiagramModels, readComposedDiagram, readDiagram, renameDiagram, saveDiagram, type DiagramEntry, } from './diagrams.js';
|
|
2
|
+
export { deleteDiagram, ejectDiagramSource, listDiagramModels, readComposedDiagram, readDiagram, readDiagramSource, renameDiagram, saveDiagram, type DiagramEntry, } from './diagrams.js';
|
|
3
3
|
export { walkDiagramJson, walkFiles } from './files.js';
|
|
4
4
|
export { readLibrary, saveLibrary } from './library.js';
|
|
5
5
|
export { exportPage } from './pages.js';
|
package/dist/api/handlers.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// the Obsidian vault host imports the file by path. So each export is named, and a
|
|
4
4
|
// helper one subject module exports to another does not become part of that type.
|
|
5
5
|
export { MAX_ASSET_BYTES, readAsset, saveAsset } from './assets.js';
|
|
6
|
-
export { ejectDiagramSource, listDiagramModels, readComposedDiagram, readDiagram, renameDiagram, saveDiagram, } from './diagrams.js';
|
|
6
|
+
export { deleteDiagram, ejectDiagramSource, listDiagramModels, readComposedDiagram, readDiagram, readDiagramSource, renameDiagram, saveDiagram, } from './diagrams.js';
|
|
7
7
|
export { walkDiagramJson, walkFiles } from './files.js';
|
|
8
8
|
export { readLibrary, saveLibrary } from './library.js';
|
|
9
9
|
export { exportPage } from './pages.js';
|
package/dist/api/routes.js
CHANGED
|
@@ -36,11 +36,24 @@ export const ROUTES = [
|
|
|
36
36
|
pattern: /^\/api\/diagrams\/(.+)\/composed$/,
|
|
37
37
|
handler: (h, c) => h.readComposedDiagram(c.diagramsDir, decodeURIComponent(c.match[1] ?? '')),
|
|
38
38
|
},
|
|
39
|
+
// The TypeScript a compiled diagram comes from, as text. Before the generic read
|
|
40
|
+
// for the same reason as the composed one.
|
|
41
|
+
{
|
|
42
|
+
method: 'GET',
|
|
43
|
+
pattern: /^\/api\/diagrams\/(.+)\/source$/,
|
|
44
|
+
handler: (h, c) => h.readDiagramSource(c.diagramsDir, decodeURIComponent(c.match[1] ?? '')),
|
|
45
|
+
},
|
|
39
46
|
{
|
|
40
47
|
method: 'GET',
|
|
41
48
|
pattern: /^\/api\/diagrams\/(.+)$/,
|
|
42
49
|
handler: (h, c) => h.readDiagram(c.diagramsDir, decodeURIComponent(c.match[1] ?? '')),
|
|
43
50
|
},
|
|
51
|
+
// A diagram the studio owns, with its sidecars and its compiled artifact.
|
|
52
|
+
{
|
|
53
|
+
method: 'DELETE',
|
|
54
|
+
pattern: /^\/api\/diagrams\/(.+)$/,
|
|
55
|
+
handler: (h, c) => h.deleteDiagram(c.diagramsDir, c.artifactsDir, decodeURIComponent(c.match[1] ?? '')),
|
|
56
|
+
},
|
|
44
57
|
// Rename must be checked before the generic save route, whose `(.+)`
|
|
45
58
|
// would otherwise swallow `<from>/rename` as a filename.
|
|
46
59
|
{
|
package/dist/cli/parse.d.ts
CHANGED
|
@@ -15,9 +15,11 @@ export interface FlagValues {
|
|
|
15
15
|
'--layers': string[];
|
|
16
16
|
'--depth': number;
|
|
17
17
|
'--root': string;
|
|
18
|
+
'--horizontal': true;
|
|
18
19
|
'--ascii': true;
|
|
19
20
|
'--color': true;
|
|
20
21
|
'--no-color': true;
|
|
22
|
+
'--single-file': true;
|
|
21
23
|
}
|
|
22
24
|
export type Flag = keyof FlagValues;
|
|
23
25
|
/** What a command takes, as the parser checks it before the command runs. */
|
|
@@ -46,13 +48,19 @@ export declare class UsageError extends Error {
|
|
|
46
48
|
readonly exitCode: number;
|
|
47
49
|
constructor(message: string, exitCode: number);
|
|
48
50
|
}
|
|
51
|
+
/** `--version`: the run prints the version, whatever else argv says after it, and ends
|
|
52
|
+
* with exit 0. */
|
|
53
|
+
export declare class VersionRequest extends Error {
|
|
54
|
+
constructor();
|
|
55
|
+
}
|
|
49
56
|
/** The style presets `--style` takes: the renderer's, by id and in its order. The CLI
|
|
50
57
|
* cannot import the renderer (it only couples to the viewer as a built artifact), so
|
|
51
58
|
* the list is written out and styleIds.test.ts pins it to the renderer's. */
|
|
52
59
|
export declare const STYLE_IDS: string[];
|
|
53
60
|
/** Read argv against every flag there is, whichever command it names: which arguments
|
|
54
61
|
* are values depends on the flags alone, and the command may come after its flags. The
|
|
55
|
-
* first mistake in argv's order is thrown as a {@link UsageError}
|
|
62
|
+
* first mistake in argv's order is thrown as a {@link UsageError}, and so is `--help`;
|
|
63
|
+
* `--version` is a {@link VersionRequest}. An unknown flag is an
|
|
56
64
|
* error rather than a file path, so a typo surfaces loudly instead of quietly skewing
|
|
57
65
|
* the file set. */
|
|
58
66
|
export declare function parseArgv(argv: readonly string[]): ParsedArgv;
|
package/dist/cli/parse.js
CHANGED
|
@@ -10,6 +10,14 @@ export class UsageError extends Error {
|
|
|
10
10
|
this.name = 'UsageError';
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
+
/** `--version`: the run prints the version, whatever else argv says after it, and ends
|
|
14
|
+
* with exit 0. */
|
|
15
|
+
export class VersionRequest extends Error {
|
|
16
|
+
constructor() {
|
|
17
|
+
super('version requested');
|
|
18
|
+
this.name = 'VersionRequest';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
13
21
|
const badValue = (flag, why) => new UsageError(`${flag}: ${why}`, 1);
|
|
14
22
|
/** The style presets `--style` takes: the renderer's, by id and in its order. The CLI
|
|
15
23
|
* cannot import the renderer (it only couples to the viewer as a built artifact), so
|
|
@@ -109,14 +117,17 @@ const FLAGS = {
|
|
|
109
117
|
return Number(next);
|
|
110
118
|
},
|
|
111
119
|
'--root': required('--root', 'needs a node id, e.g. --root checkout'),
|
|
120
|
+
'--horizontal': null,
|
|
112
121
|
'--ascii': null,
|
|
113
122
|
'--color': null,
|
|
114
123
|
'--no-color': null,
|
|
124
|
+
'--single-file': null,
|
|
115
125
|
};
|
|
116
126
|
const isFlag = (arg) => Object.hasOwn(FLAGS, arg);
|
|
117
127
|
/** Read argv against every flag there is, whichever command it names: which arguments
|
|
118
128
|
* are values depends on the flags alone, and the command may come after its flags. The
|
|
119
|
-
* first mistake in argv's order is thrown as a {@link UsageError}
|
|
129
|
+
* first mistake in argv's order is thrown as a {@link UsageError}, and so is `--help`;
|
|
130
|
+
* `--version` is a {@link VersionRequest}. An unknown flag is an
|
|
120
131
|
* error rather than a file path, so a typo surfaces loudly instead of quietly skewing
|
|
121
132
|
* the file set. */
|
|
122
133
|
export function parseArgv(argv) {
|
|
@@ -132,6 +143,8 @@ export function parseArgv(argv) {
|
|
|
132
143
|
}
|
|
133
144
|
if (arg === '--help' || arg === '-h')
|
|
134
145
|
throw new UsageError('help requested', 0);
|
|
146
|
+
if (arg === '--version')
|
|
147
|
+
throw new VersionRequest();
|
|
135
148
|
if (arg.startsWith('--'))
|
|
136
149
|
throw new UsageError(`Unknown flag '${arg}'`, 1);
|
|
137
150
|
// The first argument that is not a flag names the command; anything after it is
|
package/dist/cli/run.js
CHANGED
|
@@ -11,11 +11,11 @@ import { show } from '../commands/show.js';
|
|
|
11
11
|
import { studio } from '../commands/studio.js';
|
|
12
12
|
import { tui } from '../commands/tui.js';
|
|
13
13
|
import { watch } from '../commands/watch.js';
|
|
14
|
-
import { findHome, homePaths } from '../home.js';
|
|
14
|
+
import { cliVersion, findHome, homePaths } from '../home.js';
|
|
15
15
|
import { resolveInclude } from '../includes.js';
|
|
16
16
|
import { RELATIVE_PATHS } from '../paths.js';
|
|
17
17
|
import { snapshotSession } from '../snapshots.js';
|
|
18
|
-
import { checkTaken, parseArgv, UsageError } from './parse.js';
|
|
18
|
+
import { checkTaken, parseArgv, UsageError, VersionRequest } from './parse.js';
|
|
19
19
|
/** Every command by name, in the order the refusal of a flag names the commands that
|
|
20
20
|
* take it. */
|
|
21
21
|
export const COMMANDS = {
|
|
@@ -56,6 +56,10 @@ export async function run(argv, io, usage) {
|
|
|
56
56
|
return await dispatch(parsed, io, usage);
|
|
57
57
|
}
|
|
58
58
|
catch (e) {
|
|
59
|
+
if (e instanceof VersionRequest) {
|
|
60
|
+
io.out(cliVersion(homePaths(findHome(fileURLToPath(import.meta.url))).root));
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
59
63
|
if (!(e instanceof UsageError)) {
|
|
60
64
|
io.err(errMessage(e));
|
|
61
65
|
return 1;
|
package/dist/cli.js
CHANGED
|
@@ -31,7 +31,8 @@ Commands:
|
|
|
31
31
|
compile Compile *.diagram.{ts,json} sources into overlay artifacts once
|
|
32
32
|
lint Report suspicious diagrams (typos, duplicates, unused or undrawn parts); exit 1 on any
|
|
33
33
|
watch Recompile — and live-recompile — a directory of sources
|
|
34
|
-
publish
|
|
34
|
+
publish publish [names...]: compile, then write an HTML page and PNGs under
|
|
35
|
+
.diagrams/ for each diagram named, or for every diagram with none
|
|
35
36
|
show show <name>: print the diagram as text — boxes, lines and labels in the
|
|
36
37
|
terminal or a pipe, every container open (--depth folds deeper levels)
|
|
37
38
|
studio Run the visual studio against the current directory
|
|
@@ -47,6 +48,8 @@ Options:
|
|
|
47
48
|
--out dir Artifact output directory (default .diagrams/.artifacts;
|
|
48
49
|
diff: .diagrams/diff/<from>..<to>)
|
|
49
50
|
--no-images Publish (or diff) HTML without rendering PNG images
|
|
51
|
+
--single-file Publish every page whole, the viewer inside it, as a file to send
|
|
52
|
+
on its own (default: the pages share one diagc-viewer/ folder)
|
|
50
53
|
--link url Publish with a link to url in the index header
|
|
51
54
|
--style id Publish: take the PNGs in this style preset (clean, sketch, …) in
|
|
52
55
|
place of each diagram's own; tui: draw every diagram in dos or clean
|
|
@@ -55,6 +58,8 @@ Options:
|
|
|
55
58
|
--layers a,b show: draw these layers in place of the plane's own ('' for none)
|
|
56
59
|
--depth n show: open only the top n levels of containers
|
|
57
60
|
--root id show: draw this container's inside only
|
|
61
|
+
--horizontal show: a git graph across the screen, its lanes as rows, as the page
|
|
62
|
+
draws it (default: down the screen, its lanes as columns)
|
|
58
63
|
--ascii show: plain ASCII in place of box-drawing characters
|
|
59
64
|
--color, --no-color show: colour or not, whatever stdout is (default: a terminal is)
|
|
60
65
|
--json lint: print the findings as a JSON array; diff: the changes as JSON
|
|
@@ -65,6 +70,7 @@ Options:
|
|
|
65
70
|
--agents init: write the coding-agent block into AGENTS.md / CLAUDE.md, and
|
|
66
71
|
the skill into .claude/skills/diagc/ where Claude Code is in use
|
|
67
72
|
--help, -h Show this help and exit
|
|
73
|
+
--version Print diagc's version and exit
|
|
68
74
|
`;
|
|
69
75
|
/** End the process once stdout and stderr have taken everything written to them:
|
|
70
76
|
* `process.exit` straight after a write drops what a pipe has not accepted yet. A
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Command } from '../cli/command.js';
|
|
2
|
-
/** `diagc compile [files...]`: the files named, or every source, into artifacts. */
|
|
2
|
+
/** `diagc compile [files...]`: the files or diagrams named, or every source, into artifacts. */
|
|
3
3
|
export declare const compile: Command<'--out' | '--update-includes'>;
|
package/dist/commands/compile.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { errMessage } from '@diagc/core/internal';
|
|
2
2
|
import { compileFile } from '../compile.js';
|
|
3
|
-
import { globSorted } from '../glob.js';
|
|
4
3
|
import { RELATIVE_PATHS } from '../paths.js';
|
|
5
4
|
import { formatCompileEvent } from '../watch.js';
|
|
6
|
-
import {
|
|
7
|
-
/** `diagc compile [files...]`: the files named, or every source, into artifacts. */
|
|
5
|
+
import { resolveSources } from './shared.js';
|
|
6
|
+
/** `diagc compile [files...]`: the files or diagrams named, or every source, into artifacts. */
|
|
8
7
|
export const compile = {
|
|
9
8
|
flags: ['--out', '--update-includes'],
|
|
10
9
|
async run({ positionals, flags }, { io, home, snapshots }) {
|
|
11
|
-
const files =
|
|
12
|
-
if (
|
|
13
|
-
|
|
10
|
+
const files = await resolveSources(io, positionals);
|
|
11
|
+
if (files === undefined)
|
|
12
|
+
return 1;
|
|
14
13
|
let failed = false;
|
|
15
14
|
for (const file of files) {
|
|
16
15
|
try {
|
package/dist/commands/lint.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { formatLintReport, lintFile } from '../lint.js';
|
|
2
|
-
import { globSorted } from '../glob.js';
|
|
3
2
|
import { RELATIVE_PATHS } from '../paths.js';
|
|
4
|
-
import {
|
|
3
|
+
import { resolveSources } from './shared.js';
|
|
5
4
|
/** `diagc lint [files...] [--json]`: every finding, and exit 1 on any. */
|
|
6
5
|
export const lint = {
|
|
7
6
|
flags: ['--json'],
|
|
8
7
|
async run({ positionals, flags }, { io, home, snapshots }) {
|
|
9
|
-
const files =
|
|
10
|
-
if (
|
|
11
|
-
|
|
8
|
+
const files = await resolveSources(io, positionals);
|
|
9
|
+
if (files === undefined)
|
|
10
|
+
return 1;
|
|
12
11
|
const reports = [];
|
|
13
12
|
for (const file of files) {
|
|
14
13
|
reports.push(...(await lintFile(file, {
|
|
@@ -7,5 +7,5 @@ type PublishDirs = Pick<PublishOptions, 'srcDir' | 'artifactsDir' | 'htmlDir' |
|
|
|
7
7
|
* that embed them expect to find them. */
|
|
8
8
|
export declare function publishDirs(out: string): PublishDirs;
|
|
9
9
|
/** `diagc publish [names...]`: compile, then a page per diagram, the gallery, and PNGs. */
|
|
10
|
-
export declare const publish: Command<'--out' | '--no-images' | '--link' | '--update-includes' | '--style' | '--theme'>;
|
|
10
|
+
export declare const publish: Command<'--out' | '--no-images' | '--link' | '--update-includes' | '--style' | '--theme' | '--single-file'>;
|
|
11
11
|
export {};
|
package/dist/commands/publish.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
2
3
|
import { errMessage } from '@diagc/core/internal';
|
|
3
4
|
import { compileFile } from '../compile.js';
|
|
4
5
|
import { globSorted } from '../glob.js';
|
|
@@ -40,16 +41,19 @@ async function compileSources(dirs, { io, home, snapshots }) {
|
|
|
40
41
|
}
|
|
41
42
|
/** `diagc publish [names...]`: compile, then a page per diagram, the gallery, and PNGs. */
|
|
42
43
|
export const publish = {
|
|
43
|
-
flags: ['--out', '--no-images', '--link', '--update-includes', '--style', '--theme'],
|
|
44
|
+
flags: ['--out', '--no-images', '--link', '--update-includes', '--style', '--theme', '--single-file'],
|
|
44
45
|
async run({ positionals, flags }, ctx) {
|
|
45
46
|
const { io, home, snapshots } = ctx;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
const singleFile = flags['--single-file'] === true;
|
|
48
|
+
// The shell for whole pages, the folder for pages that share the viewer: one
|
|
49
|
+
// build makes both. Only a checkout can be missing them; an installed package
|
|
50
|
+
// ships both, so there the message would send the reader off to build a repo
|
|
51
|
+
// they do not have.
|
|
52
|
+
const needed = singleFile ? home.viewerShell : path.join(home.viewerDir, 'viewer.js');
|
|
53
|
+
if (!existsSync(needed)) {
|
|
50
54
|
io.err(home.layout === 'monorepo'
|
|
51
|
-
? 'viewer
|
|
52
|
-
: `viewer
|
|
55
|
+
? 'viewer not built — run `pnpm --filter @diagc/viewer build` in the monorepo.'
|
|
56
|
+
: `viewer missing from this install (${needed}) — reinstall diagc.`);
|
|
53
57
|
return 1;
|
|
54
58
|
}
|
|
55
59
|
const dirs = publishDirs(flags['--out'] ?? RELATIVE_PATHS.artifactsDir);
|
|
@@ -67,6 +71,8 @@ export const publish = {
|
|
|
67
71
|
const res = await publishDiagrams({
|
|
68
72
|
...dirs,
|
|
69
73
|
shellPath: home.viewerShell,
|
|
74
|
+
viewerDir: home.viewerDir,
|
|
75
|
+
singleFile,
|
|
70
76
|
libraryDir: home.libraryDir,
|
|
71
77
|
images: renderPng !== undefined,
|
|
72
78
|
names,
|
|
@@ -80,6 +86,8 @@ export const publish = {
|
|
|
80
86
|
warn: io.err,
|
|
81
87
|
});
|
|
82
88
|
io.out(`✓ ${res.pages.length} page(s) -> ${dirs.htmlDir}`);
|
|
89
|
+
if (res.viewer !== undefined)
|
|
90
|
+
io.out(`✓ viewer -> ${res.viewer}`);
|
|
83
91
|
if (res.images.length > 0)
|
|
84
92
|
io.out(`✓ ${res.images.length} image(s) -> ${dirs.staticDir}`);
|
|
85
93
|
io.out(`✓ gallery -> ${res.gallery}`);
|
|
@@ -17,6 +17,15 @@ export declare function diagramNames(io: CliIo, files: readonly string[], known:
|
|
|
17
17
|
* says so on stderr, and the pages go out as HTML only. Playwright loads only when a
|
|
18
18
|
* picture is wanted. */
|
|
19
19
|
export declare function pngRenderer(io: CliIo, images: boolean): Promise<NonNullable<PublishOptions['renderPng']> | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* The sources `compile` and `lint` read for `files...`: a path as given, or a
|
|
22
|
+
* diagram name read as `publish` reads one (`shop` is `.diagrams/src/shop.diagram.ts`,
|
|
23
|
+
* else its `.diagram.json`). None given means every source, in path order, with
|
|
24
|
+
* the no-sources warning when there is none. An argument that is neither a file
|
|
25
|
+
* nor a diagram is one line on stderr each, and the result is then undefined: an
|
|
26
|
+
* empty selection would look like nothing to do.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveSources(io: CliIo, args: readonly string[]): Promise<string[] | undefined>;
|
|
20
29
|
/** The source a diagram name reads from: its `.diagram.ts`, else its `.diagram.json`;
|
|
21
30
|
* undefined when it has neither. TypeScript first, as the hand-written one of the two
|
|
22
31
|
* (a `.diagram.json` beside it is the studio's, or a leftover from an eject). */
|
package/dist/commands/shared.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
import { globSorted } from '../glob.js';
|
|
3
4
|
import { diagramName } from '../names.js';
|
|
4
5
|
import { RELATIVE_PATHS } from '../paths.js';
|
|
5
6
|
/** The sources compile and lint read when they are named none. */
|
|
@@ -29,11 +30,39 @@ export async function pngRenderer(io, images) {
|
|
|
29
30
|
return undefined;
|
|
30
31
|
const snapshot = await import('../publish/snapshot.js');
|
|
31
32
|
if (snapshot.findChrome() === undefined) {
|
|
32
|
-
io.err(
|
|
33
|
+
io.err(snapshot.NO_CHROME_MESSAGE);
|
|
33
34
|
return undefined;
|
|
34
35
|
}
|
|
35
36
|
return snapshot.renderPng;
|
|
36
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* The sources `compile` and `lint` read for `files...`: a path as given, or a
|
|
40
|
+
* diagram name read as `publish` reads one (`shop` is `.diagrams/src/shop.diagram.ts`,
|
|
41
|
+
* else its `.diagram.json`). None given means every source, in path order, with
|
|
42
|
+
* the no-sources warning when there is none. An argument that is neither a file
|
|
43
|
+
* nor a diagram is one line on stderr each, and the result is then undefined: an
|
|
44
|
+
* empty selection would look like nothing to do.
|
|
45
|
+
*/
|
|
46
|
+
export async function resolveSources(io, args) {
|
|
47
|
+
if (args.length === 0) {
|
|
48
|
+
const files = await globSorted(SOURCES);
|
|
49
|
+
if (files.length === 0)
|
|
50
|
+
warnNoSources(io);
|
|
51
|
+
return files;
|
|
52
|
+
}
|
|
53
|
+
const files = [];
|
|
54
|
+
let unknown = false;
|
|
55
|
+
for (const arg of args) {
|
|
56
|
+
const file = existsSync(arg) ? arg : sourceOf(diagramName(arg));
|
|
57
|
+
if (file === undefined) {
|
|
58
|
+
unknown = true;
|
|
59
|
+
io.err(`diagc: no diagram '${arg}' — not a file, and nothing under ${RELATIVE_PATHS.srcDir} is named that`);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
files.push(file);
|
|
63
|
+
}
|
|
64
|
+
return unknown ? undefined : files;
|
|
65
|
+
}
|
|
37
66
|
/** The source a diagram name reads from: its `.diagram.ts`, else its `.diagram.json`;
|
|
38
67
|
* undefined when it has neither. TypeScript first, as the hand-written one of the two
|
|
39
68
|
* (a `.diagram.json` beside it is the studio's, or a leftover from an eject). */
|
package/dist/commands/show.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Command } from '../cli/command.js';
|
|
2
|
-
type ShowFlag = '--plane' | '--layers' | '--depth' | '--root' | '--ascii' | '--color' | '--no-color';
|
|
2
|
+
type ShowFlag = '--plane' | '--layers' | '--depth' | '--root' | '--horizontal' | '--ascii' | '--color' | '--no-color';
|
|
3
3
|
/** `diagc show <name>`: the diagram as text on stdout. */
|
|
4
4
|
export declare const show: Command<ShowFlag>;
|
|
5
5
|
export {};
|
package/dist/commands/show.js
CHANGED
|
@@ -64,7 +64,7 @@ function widthHint(io, lines, name) {
|
|
|
64
64
|
}
|
|
65
65
|
/** `diagc show <name>`: the diagram as text on stdout. */
|
|
66
66
|
export const show = {
|
|
67
|
-
flags: ['--plane', '--layers', '--depth', '--root', '--ascii', '--color', '--no-color'],
|
|
67
|
+
flags: ['--plane', '--layers', '--depth', '--root', '--horizontal', '--ascii', '--color', '--no-color'],
|
|
68
68
|
positionals: { max: 1, what: 'one diagram name' },
|
|
69
69
|
whyNot: LOCKED,
|
|
70
70
|
async run({ positionals, flags }, { io, usage, home, snapshots }) {
|
|
@@ -103,7 +103,17 @@ export const show = {
|
|
|
103
103
|
const plane = flags['--plane'];
|
|
104
104
|
// A printed picture folds as the PNG does; --depth trades that for the top levels.
|
|
105
105
|
const pins = flags['--depth'] !== undefined ? depthPins(model, plane, flags['--depth']) : exportPins(model, overlay);
|
|
106
|
-
const lines = await renderToLines({
|
|
106
|
+
const lines = await renderToLines({
|
|
107
|
+
model,
|
|
108
|
+
pins,
|
|
109
|
+
...defined({
|
|
110
|
+
overlay,
|
|
111
|
+
plane,
|
|
112
|
+
layers: flags['--layers'],
|
|
113
|
+
root: flags['--root'],
|
|
114
|
+
horizontal: flags['--horizontal'],
|
|
115
|
+
}),
|
|
116
|
+
}, { ascii: flags['--ascii'] === true, color: colorModeFor(process.env, io.tty !== undefined, colorFlag(flags)) });
|
|
107
117
|
if (lines.length === 0) {
|
|
108
118
|
io.err(`diagc: nothing to draw in ${name}`);
|
|
109
119
|
return 0;
|
package/dist/compile.d.ts
CHANGED
|
@@ -10,12 +10,18 @@ import { type DiagramModel, type IncludeResolver } from '@diagc/core/internal';
|
|
|
10
10
|
export declare class LoadError extends Error {
|
|
11
11
|
readonly file: string;
|
|
12
12
|
readonly reason: string;
|
|
13
|
+
/** the rule a builder refusal names (`missing-kind`); undefined for a source
|
|
14
|
+
* that simply threw, which lint reports as `load` */
|
|
15
|
+
readonly code?: string | undefined;
|
|
13
16
|
readonly line: number | undefined;
|
|
14
17
|
readonly column: number | undefined;
|
|
15
18
|
constructor(file: string, reason: string, position?: {
|
|
16
19
|
line: number;
|
|
17
20
|
column: number;
|
|
18
|
-
}
|
|
21
|
+
},
|
|
22
|
+
/** the rule a builder refusal names (`missing-kind`); undefined for a source
|
|
23
|
+
* that simply threw, which lint reports as `load` */
|
|
24
|
+
code?: string | undefined);
|
|
19
25
|
}
|
|
20
26
|
/** The line and column of the first `at` frame inside `file`. Matched on the
|
|
21
27
|
* basename after a path separator: a frame spells the path as it was imported,
|
|
@@ -46,4 +52,8 @@ export interface LoadOptions {
|
|
|
46
52
|
* model `compile` writes and `lint` inspects. Throws on anything invalid.
|
|
47
53
|
*/
|
|
48
54
|
export declare function loadModel(file: string, opts?: LoadOptions): Promise<DiagramModel>;
|
|
55
|
+
/** Where `file` compiles to under `outDir`: its name as `.diagram.json`, in the
|
|
56
|
+
* subdirectory it has under `rootDir`. The watcher removes the same path when the
|
|
57
|
+
* source goes. */
|
|
58
|
+
export declare function artifactPathFor(file: string, outDir: string, rootDir?: string): string;
|
|
49
59
|
export declare function compileFile(file: string, outDir: string, opts?: LoadOptions): Promise<string>;
|
package/dist/compile.js
CHANGED
|
@@ -4,6 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import { createJiti } from 'jiti';
|
|
5
5
|
import { composeIncludes, DiagramValidationError, diagramWarnings, errMessage, validate, } from '@diagc/core/internal';
|
|
6
6
|
import { resolveInclude } from './includes.js';
|
|
7
|
+
import { loadHint } from './loadHints.js';
|
|
7
8
|
import { lockedResolverFor } from './snapshots.js';
|
|
8
9
|
/**
|
|
9
10
|
* Shape guard: with `{ default: true }` jiti returns the module NAMESPACE when
|
|
@@ -29,17 +30,30 @@ function assertDiagramShape(model, file) {
|
|
|
29
30
|
export class LoadError extends Error {
|
|
30
31
|
file;
|
|
31
32
|
reason;
|
|
33
|
+
code;
|
|
32
34
|
line;
|
|
33
35
|
column;
|
|
34
|
-
constructor(file, reason, position
|
|
36
|
+
constructor(file, reason, position,
|
|
37
|
+
/** the rule a builder refusal names (`missing-kind`); undefined for a source
|
|
38
|
+
* that simply threw, which lint reports as `load` */
|
|
39
|
+
code) {
|
|
35
40
|
super(position !== undefined ? `${file}:${position.line}:${position.column}: ${reason}` : reason);
|
|
36
41
|
this.file = file;
|
|
37
42
|
this.reason = reason;
|
|
43
|
+
this.code = code;
|
|
38
44
|
this.name = 'LoadError';
|
|
39
45
|
this.line = position?.line;
|
|
40
46
|
this.column = position?.column;
|
|
41
47
|
}
|
|
42
48
|
}
|
|
49
|
+
/** The code a builder refusal carries, or undefined for any other error. By name,
|
|
50
|
+
* not instanceof: the diagram ran in jiti's own copy of core. */
|
|
51
|
+
function builderCode(e) {
|
|
52
|
+
if (!(e instanceof Error) || e.name !== 'BuilderError')
|
|
53
|
+
return undefined;
|
|
54
|
+
const code = e.code;
|
|
55
|
+
return typeof code === 'string' ? code : undefined;
|
|
56
|
+
}
|
|
43
57
|
/** The line and column of the first `at` frame inside `file`. Matched on the
|
|
44
58
|
* basename after a path separator: a frame spells the path as it was imported,
|
|
45
59
|
* which a symlinked temp dir would not equal; the message line is skipped because
|
|
@@ -80,7 +94,7 @@ export async function executeDiagramTs(file, coreEntry) {
|
|
|
80
94
|
// `issues` by name. Everything else is the source failing to run.
|
|
81
95
|
if (e instanceof Error && e.name === 'DiagramValidationError')
|
|
82
96
|
throw e;
|
|
83
|
-
throw new LoadError(file, errMessage(e), positionIn(e instanceof Error ? e.stack : undefined, file));
|
|
97
|
+
throw new LoadError(file, loadHint(errMessage(e)), positionIn(e instanceof Error ? e.stack : undefined, file), builderCode(e));
|
|
84
98
|
}
|
|
85
99
|
const hasToJSON = typeof def?.toJSON === 'function';
|
|
86
100
|
const model = (hasToJSON ? def.toJSON() : def);
|
|
@@ -150,6 +164,13 @@ export async function loadModel(file, opts) {
|
|
|
150
164
|
}
|
|
151
165
|
return model;
|
|
152
166
|
}
|
|
167
|
+
/** Where `file` compiles to under `outDir`: its name as `.diagram.json`, in the
|
|
168
|
+
* subdirectory it has under `rootDir`. The watcher removes the same path when the
|
|
169
|
+
* source goes. */
|
|
170
|
+
export function artifactPathFor(file, outDir, rootDir) {
|
|
171
|
+
const base = path.basename(file).replace(/\.diagram\.(ts|json)$/, '');
|
|
172
|
+
return path.join(outDir, relativeSubdir(file, rootDir), `${base}.diagram.json`);
|
|
173
|
+
}
|
|
153
174
|
export async function compileFile(file, outDir, opts) {
|
|
154
175
|
const model = await loadModel(file, opts);
|
|
155
176
|
// Sound but probably not what was meant (a fishbone cause on no bone, a typo'd
|
|
@@ -157,10 +178,8 @@ export async function compileFile(file, outDir, opts) {
|
|
|
157
178
|
// complaint. `diagc lint` is the strict reading of the same list.
|
|
158
179
|
for (const w of diagramWarnings(model))
|
|
159
180
|
(opts?.warn ?? console.warn)(`${file}: ${w.message}`);
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
await mkdir(artifactDir, { recursive: true });
|
|
163
|
-
const artifact = path.join(artifactDir, `${base}.diagram.json`);
|
|
181
|
+
const artifact = artifactPathFor(file, outDir, opts?.rootDir);
|
|
182
|
+
await mkdir(path.dirname(artifact), { recursive: true });
|
|
164
183
|
await writeFile(artifact, `${JSON.stringify(model, null, 2)}\n`);
|
|
165
184
|
return artifact;
|
|
166
185
|
}
|