dotdog 0.2.4 → 0.2.5
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/dist/cli.js +29 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3201,18 +3201,35 @@ program2.command("compile [dir]").option("-o, --output <file>").action((d = ".",
|
|
|
3201
3201
|
if (!existsSync2(pd))
|
|
3202
3202
|
continue;
|
|
3203
3203
|
const files = readdirSync2(pd).filter((f) => f.endsWith(".dog"));
|
|
3204
|
-
const dag = { version: "1.
|
|
3204
|
+
const dag = { version: "1.1", project: p, compiled_at: new Date().toISOString(), nodes: [], edges: [], files: files.length };
|
|
3205
3205
|
for (const f of files) {
|
|
3206
|
-
const
|
|
3207
|
-
const
|
|
3208
|
-
for (const
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3206
|
+
const content = readFileSync2(join2(pd, f), "utf-8");
|
|
3207
|
+
const ast = parse(content);
|
|
3208
|
+
for (const section of ast.sections) {
|
|
3209
|
+
for (const block of section.blocks) {
|
|
3210
|
+
if (block.kind === "entity") {
|
|
3211
|
+
dag.nodes.push({
|
|
3212
|
+
id: block.name,
|
|
3213
|
+
type: block.type,
|
|
3214
|
+
description: block.description || "",
|
|
3215
|
+
file: f,
|
|
3216
|
+
properties: block.properties,
|
|
3217
|
+
states: block.states || [],
|
|
3218
|
+
lifecycle: block.lifecycle || [],
|
|
3219
|
+
chars: section.content?.length || 0
|
|
3220
|
+
});
|
|
3221
|
+
}
|
|
3222
|
+
if (block.kind === "relationship") {
|
|
3223
|
+
dag.edges.push({
|
|
3224
|
+
source: block.source,
|
|
3225
|
+
target: block.target,
|
|
3226
|
+
verb: block.verb,
|
|
3227
|
+
cardinality: block.cardinality,
|
|
3228
|
+
required: block.required,
|
|
3229
|
+
cascade: block.cascade,
|
|
3230
|
+
file: f,
|
|
3231
|
+
section: section.heading
|
|
3232
|
+
});
|
|
3216
3233
|
}
|
|
3217
3234
|
}
|
|
3218
3235
|
}
|
|
@@ -3221,7 +3238,7 @@ program2.command("compile [dir]").option("-o, --output <file>").action((d = ".",
|
|
|
3221
3238
|
const out = opts.output || join2(pd, "..", `${p}.dag`);
|
|
3222
3239
|
writeFileSync(out, JSON.stringify(dag, null, 2));
|
|
3223
3240
|
console.log(source_default.green(` ✓ ${out}`));
|
|
3224
|
-
console.log(source_default.gray(` ${dag.nodes.length} nodes, ${dag.edges.length} edges, ${dag.
|
|
3241
|
+
console.log(source_default.gray(` ${dag.nodes.length} nodes, ${dag.edges.length} edges, ${dag.files} files`));
|
|
3225
3242
|
}
|
|
3226
3243
|
}
|
|
3227
3244
|
if (!found)
|