@shaclmate/cli 4.0.18 → 4.0.19

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 +26 -1
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { AstJsonGenerator, TsGenerator, ZodGenerator, } from "@shaclmate/compiler";
2
+ import fs from "node:fs";
3
+ import { AstJsonGenerator, Cx2Generator, TsGenerator, ZodGenerator, } from "@shaclmate/compiler";
3
4
  import { command, option, restPositionals, run, string, subcommands, } from "cmd-ts";
4
5
  import { ExistingPath } from "cmd-ts/dist/cjs/batteries/fs.js";
5
6
  import { generate } from "./commands/generate.js";
@@ -37,6 +38,30 @@ run(subcommands({
37
38
  })).unsafeCoerce();
38
39
  },
39
40
  }),
41
+ cx2: command({
42
+ name: "cx2",
43
+ description: "generate Cytoscape Exchange Format Specification (Version 2)",
44
+ args: {
45
+ inputPaths,
46
+ outputFilePath,
47
+ visualPropertiesJsonFilePath: option({
48
+ description: "path to a file containing the visualProperties JSON object to include in the CX2 file",
49
+ long: "visual-properties-json-file-path",
50
+ type: ExistingPath,
51
+ }),
52
+ },
53
+ handler: async ({ inputPaths, outputFilePath, visualPropertiesJsonFilePath, }) => {
54
+ let visualProperties;
55
+ if (visualPropertiesJsonFilePath) {
56
+ visualProperties = JSON.parse((await fs.promises.readFile(visualPropertiesJsonFilePath)).toString("utf-8"));
57
+ }
58
+ (await generate({
59
+ generator: new Cx2Generator({ visualProperties }),
60
+ inputPaths,
61
+ outputFilePath,
62
+ })).unsafeCoerce();
63
+ },
64
+ }),
40
65
  ts: command({
41
66
  name: "ts",
42
67
  description: "generate TypeScript for the SHACL shapes graph",
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "shaclmate": "dist/cli.js"
4
4
  },
5
5
  "dependencies": {
6
- "@shaclmate/compiler": "4.0.18",
6
+ "@shaclmate/compiler": "4.0.19",
7
7
  "@rdfjs/data-model": "~2.1.1",
8
8
  "@rdfjs/dataset": "~2.0.2",
9
9
  "@rdfjs/prefix-map": "~0.1.2",
@@ -56,5 +56,5 @@
56
56
  },
57
57
  "type": "module",
58
58
  "types": "./dist/index.d.ts",
59
- "version": "4.0.18"
59
+ "version": "4.0.19"
60
60
  }