@darkhorseprojects/circuitry 0.3.5 → 0.3.8

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 +16 -21
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -167,12 +167,6 @@ var parseYamlData = (text) => {
167
167
  ${message}`);
168
168
  }
169
169
  };
170
- var stringifyYamlData = (value) => YAML2.stringify(value, {
171
- aliasDuplicateObjects: false,
172
- defaultKeyType: "PLAIN",
173
- defaultStringType: "QUOTE_DOUBLE",
174
- doubleQuotedAsJSON: true
175
- });
176
170
  var parseCircuitryYaml = (text, standard = {}, options = {}) => {
177
171
  const graph = parseYamlData(text);
178
172
  if (!graph || typeof graph !== "object" || Array.isArray(graph)) {
@@ -253,28 +247,29 @@ var loadCircuitryGraphFile = async (filename2 = defaultFilename, standard, stack
253
247
  // src/cli.ts
254
248
  var [, , command, filename] = process.argv;
255
249
  var usage = () => {
256
- console.error("usage: circuitry <check|normalize|parse> <file.yaml>");
250
+ console.error("usage: circuitry <check|parse> <file.yaml>");
257
251
  process.exit(2);
258
252
  };
259
253
  if (!command || !filename) usage();
260
254
  try {
261
255
  if (command === "parse") {
262
- const text = await readFile2(filename, "utf8");
263
- process.stdout.write(stringifyYamlData(parseYamlData(text)));
264
- } else {
256
+ const text = filename === "--stdin" ? await new Promise((resolve, reject) => {
257
+ let data = "";
258
+ process.stdin.on("data", (chunk) => data += chunk);
259
+ process.stdin.on("end", () => resolve(data));
260
+ process.stdin.on("error", reject);
261
+ }) : await readFile2(filename, "utf8");
262
+ process.stdout.write(JSON.stringify(parseYamlData(text)));
263
+ } else if (command === "check") {
265
264
  const loaded = await loadCircuitryGraphFile(filename);
266
- if (command === "check") {
267
- const result = validateCircuitryExecutionGraphWithStandard(loaded.graph);
268
- if (!result.ok) {
269
- console.error(result.errors.map((error) => error.message).join("\n"));
270
- process.exit(1);
271
- }
272
- console.log(`ok: ${loaded.filename}`);
273
- } else if (command === "normalize") {
274
- process.stdout.write(stringifyYamlData({ circuitryBundle: CIRCUITRY_SPEC_VERSION, graph: loaded.graph, origins: loaded.origins }));
275
- } else {
276
- usage();
265
+ const result = validateCircuitryExecutionGraphWithStandard(loaded.graph);
266
+ if (!result.ok) {
267
+ console.error(result.errors.map((error) => error.message).join("\n"));
268
+ process.exit(1);
277
269
  }
270
+ console.log(`ok: ${loaded.filename}`);
271
+ } else {
272
+ usage();
278
273
  }
279
274
  } catch (error) {
280
275
  console.error(error instanceof Error ? error.message : String(error));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darkhorseprojects/circuitry",
3
- "version": "0.3.5",
3
+ "version": "0.3.8",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",