@darkhorseprojects/circuitry 0.3.8 → 0.3.9
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 +12 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -253,13 +253,18 @@ var usage = () => {
|
|
|
253
253
|
if (!command || !filename) usage();
|
|
254
254
|
try {
|
|
255
255
|
if (command === "parse") {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
process.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
256
|
+
if (filename.endsWith(".circuitry.yaml") || filename.endsWith(".circuitry.yml")) {
|
|
257
|
+
const loaded = await loadCircuitryGraphFile(filename);
|
|
258
|
+
process.stdout.write(JSON.stringify({ graph: loaded.graph, origins: loaded.origins }));
|
|
259
|
+
} else {
|
|
260
|
+
const text = filename === "--stdin" ? await new Promise((resolve, reject) => {
|
|
261
|
+
let data = "";
|
|
262
|
+
process.stdin.on("data", (chunk) => data += chunk);
|
|
263
|
+
process.stdin.on("end", () => resolve(data));
|
|
264
|
+
process.stdin.on("error", reject);
|
|
265
|
+
}) : await readFile2(filename, "utf8");
|
|
266
|
+
process.stdout.write(JSON.stringify(parseYamlData(text)));
|
|
267
|
+
}
|
|
263
268
|
} else if (command === "check") {
|
|
264
269
|
const loaded = await loadCircuitryGraphFile(filename);
|
|
265
270
|
const result = validateCircuitryExecutionGraphWithStandard(loaded.graph);
|