@darkhorseprojects/circuitry 0.3.7 → 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.
Files changed (2) hide show
  1. package/dist/cli.js +12 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -253,8 +253,18 @@ var usage = () => {
253
253
  if (!command || !filename) usage();
254
254
  try {
255
255
  if (command === "parse") {
256
- const text = await readFile2(filename, "utf8");
257
- process.stdout.write(JSON.stringify(parseYamlData(text)));
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
+ }
258
268
  } else if (command === "check") {
259
269
  const loaded = await loadCircuitryGraphFile(filename);
260
270
  const result = validateCircuitryExecutionGraphWithStandard(loaded.graph);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darkhorseprojects/circuitry",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",