@hpcc-js/wasm 1.15.3 → 1.15.4

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/bin/cli.js CHANGED
@@ -3,11 +3,12 @@
3
3
  /* eslint-disable @typescript-eslint/no-var-requires */
4
4
 
5
5
  const fs = require("fs");
6
- const gvMod = require("../dist/graphviz.node.js");
6
+ const { exit } = require("process");
7
+ const gvMod = require("../dist/graphviz.js");
7
8
 
8
9
  const yargs = require("yargs/yargs")(process.argv.slice(2))
9
10
  .usage("Usage: dot-wasm [options] fileOrDot")
10
- .demandCommand(1, 1)
11
+ .demandCommand(0, 1)
11
12
  .example("dot-wasm -K neato -T xdot ./input.dot", "Execute NEATO layout and outputs XDOT format.")
12
13
  .alias("K", "layout")
13
14
  .nargs("K", 1)
@@ -21,6 +22,8 @@ const yargs = require("yargs/yargs")(process.argv.slice(2))
21
22
  .alias("y", "invert-y")
22
23
  .nargs("y", 0)
23
24
  .describe("y", "By default, the coordinate system used in generic output formats, such as attributed dot, extended dot, plain and plain-ext, is the standard cartesian system with the origin in the lower left corner, and with increasing y coordinates as points move from bottom to top. If the -y flag is used, the coordinate system is inverted, so that increasing values of y correspond to movement from top to bottom.")
25
+ .nargs("v", 0)
26
+ .describe("v", "Echo GraphViz library version")
24
27
  .help("h")
25
28
  .alias("h", "help")
26
29
  .epilog("https://github.com/hpcc-systems/hpcc-js-wasm")
@@ -36,24 +39,35 @@ try {
36
39
  dot = argv._[0];
37
40
  }
38
41
 
39
- if (argv.n && argv.layout.trim() !== "neato") {
40
- throw new Error("-n option is only supported with -T neato");
41
- }
42
+ if (argv.v) {
43
+ gvMod.graphvizVersion().then(version => {
44
+ console.log(`GraphViz version: ${version}`);
45
+ }).catch(e => {
46
+ console.error(e.message);
47
+ exit(1);
48
+ })
49
+ } else {
42
50
 
43
- const ext = {
44
- };
45
- if (argv.n) {
46
- ext.nop = parseInt(argv.n);
47
- }
48
- if (argv.y) {
49
- ext.yInvert = true;
50
- }
51
+ if (argv.n && argv.layout.trim() !== "neato") {
52
+ throw new Error("-n option is only supported with -T neato");
53
+ }
54
+
55
+ const ext = {
56
+ };
57
+ if (argv.n) {
58
+ ext.nop = parseInt(argv.n);
59
+ }
60
+ if (argv.y) {
61
+ ext.yInvert = true;
62
+ }
51
63
 
52
- gvMod.graphviz.layout(dot, argv.format?.trim() ?? "svg", argv.layout?.trim() ?? "dot", ext).then(response => {
53
- console.log(response);
54
- }).catch(e => {
55
- console.error(e.message);
56
- });
64
+ gvMod.graphviz.layout(dot, argv.format?.trim() ?? "svg", argv.layout?.trim() ?? "dot", ext).then(response => {
65
+ console.log(response);
66
+ }).catch(e => {
67
+ console.error(e.message);
68
+ exit(1);
69
+ });
70
+ }
57
71
  } catch (e) {
58
72
  console.error(`Error: ${e.message}\n`);
59
73
  yargs.showHelp();
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hpcc-js/wasm",
3
- "version": "1.15.3",
3
+ "version": "1.15.4",
4
4
  "description": "hpcc-js - WASM Libraries",
5
5
  "keywords": [
6
6
  "graphviz",
@@ -15,9 +15,8 @@
15
15
  "patchwork",
16
16
  "xml"
17
17
  ],
18
- "main": "dist/index.node.js",
18
+ "main": "dist/index.js",
19
19
  "module": "dist/index.es6",
20
- "module-node": "dist/index.node.es6",
21
20
  "browser": "dist/index.js",
22
21
  "unpkg": "dist/index.min.js",
23
22
  "jsdelivr": "dist/index.min.js",
@@ -64,9 +63,10 @@
64
63
  "dev-start": "ws",
65
64
  "lint": "eslint src/**/*.ts",
66
65
  "lint-fix": "npm run lint -- --fix",
66
+ "test-cli": "node ./bin/cli.js -v",
67
67
  "test-chrome": "karma start --single-run --browsers ChromeHeadless karma.conf.js",
68
68
  "test-firefox": "karma start --single-run --browsers Firefox karma.conf.js",
69
- "test-node": "mocha ./dist/test.js --reporter spec",
69
+ "test-node": "node ./bin/cli.js -v && mocha ./dist/test.js --reporter spec",
70
70
  "test": "run-p test-chrome test-node",
71
71
  "tag": "run-s standard-version git-push",
72
72
  "purge-jsdelivr": "node ./utils/purge-jsdelivr.js",