@darkhorseprojects/circuitry 0.3.4 → 0.3.7
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 +10 -15
- package/dist/index.js +6 -1
- package/dist/node.js +6 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -167,7 +167,6 @@ var parseYamlData = (text) => {
|
|
|
167
167
|
${message}`);
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
|
-
var stringifyYamlData = (value) => YAML2.stringify(value);
|
|
171
170
|
var parseCircuitryYaml = (text, standard = {}, options = {}) => {
|
|
172
171
|
const graph = parseYamlData(text);
|
|
173
172
|
if (!graph || typeof graph !== "object" || Array.isArray(graph)) {
|
|
@@ -248,28 +247,24 @@ var loadCircuitryGraphFile = async (filename2 = defaultFilename, standard, stack
|
|
|
248
247
|
// src/cli.ts
|
|
249
248
|
var [, , command, filename] = process.argv;
|
|
250
249
|
var usage = () => {
|
|
251
|
-
console.error("usage: circuitry <check|
|
|
250
|
+
console.error("usage: circuitry <check|parse> <file.yaml>");
|
|
252
251
|
process.exit(2);
|
|
253
252
|
};
|
|
254
253
|
if (!command || !filename) usage();
|
|
255
254
|
try {
|
|
256
255
|
if (command === "parse") {
|
|
257
256
|
const text = await readFile2(filename, "utf8");
|
|
258
|
-
process.stdout.write(
|
|
259
|
-
} else {
|
|
257
|
+
process.stdout.write(JSON.stringify(parseYamlData(text)));
|
|
258
|
+
} else if (command === "check") {
|
|
260
259
|
const loaded = await loadCircuitryGraphFile(filename);
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
process.exit(1);
|
|
266
|
-
}
|
|
267
|
-
console.log(`ok: ${loaded.filename}`);
|
|
268
|
-
} else if (command === "normalize") {
|
|
269
|
-
process.stdout.write(stringifyYamlData({ circuitryBundle: CIRCUITRY_SPEC_VERSION, graph: loaded.graph, origins: loaded.origins }));
|
|
270
|
-
} else {
|
|
271
|
-
usage();
|
|
260
|
+
const result = validateCircuitryExecutionGraphWithStandard(loaded.graph);
|
|
261
|
+
if (!result.ok) {
|
|
262
|
+
console.error(result.errors.map((error) => error.message).join("\n"));
|
|
263
|
+
process.exit(1);
|
|
272
264
|
}
|
|
265
|
+
console.log(`ok: ${loaded.filename}`);
|
|
266
|
+
} else {
|
|
267
|
+
usage();
|
|
273
268
|
}
|
|
274
269
|
} catch (error) {
|
|
275
270
|
console.error(error instanceof Error ? error.message : String(error));
|
package/dist/index.js
CHANGED
|
@@ -199,7 +199,12 @@ var parseYamlData = (text) => {
|
|
|
199
199
|
${message}`);
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
|
-
var stringifyYamlData = (value) => YAML2.stringify(value
|
|
202
|
+
var stringifyYamlData = (value) => YAML2.stringify(value, {
|
|
203
|
+
aliasDuplicateObjects: false,
|
|
204
|
+
defaultKeyType: "PLAIN",
|
|
205
|
+
defaultStringType: "QUOTE_DOUBLE",
|
|
206
|
+
doubleQuotedAsJSON: true
|
|
207
|
+
});
|
|
203
208
|
var parseCircuitryYaml = (text, standard = {}, options = {}) => {
|
|
204
209
|
const graph = parseYamlData(text);
|
|
205
210
|
if (!graph || typeof graph !== "object" || Array.isArray(graph)) {
|
package/dist/node.js
CHANGED
|
@@ -179,7 +179,12 @@ var parseYamlData = (text) => {
|
|
|
179
179
|
${message}`);
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
|
-
var stringifyYamlData = (value) => YAML2.stringify(value
|
|
182
|
+
var stringifyYamlData = (value) => YAML2.stringify(value, {
|
|
183
|
+
aliasDuplicateObjects: false,
|
|
184
|
+
defaultKeyType: "PLAIN",
|
|
185
|
+
defaultStringType: "QUOTE_DOUBLE",
|
|
186
|
+
doubleQuotedAsJSON: true
|
|
187
|
+
});
|
|
183
188
|
var parseCircuitryYaml = (text, standard = {}, options = {}) => {
|
|
184
189
|
const graph = parseYamlData(text);
|
|
185
190
|
if (!graph || typeof graph !== "object" || Array.isArray(graph)) {
|