x3d-tidy 1.0.80 → 1.0.81

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/Makefile CHANGED
@@ -1,5 +1,6 @@
1
- test:
2
- npm start -- -i tests/test.x3d -o tests/test.html
1
+ .PHONY: tests
2
+ tests:
3
+ npx . -i tests/test.x3d -o tests/test.html
3
4
 
4
5
  publish:
5
6
  perl build/publish.pl
package/build/publish.pl CHANGED
@@ -14,11 +14,14 @@ if (`git branch --show-current` ne "development\n")
14
14
  system "git", "checkout", "main";
15
15
  system "git", "merge", "development";
16
16
 
17
+ my $name = `node -p "require('./package.json').name"`;
18
+ chomp $name;
19
+
17
20
  my $version = `npm pkg get version | sed 's/"//g'`;
18
21
  chomp $version;
19
22
  say "package.json version $version";
20
23
 
21
- my $online = `npm view x3d-tidy version`;
24
+ my $online = `npm view $name version`;
22
25
  chomp $online;
23
26
  say "NPM version $online";
24
27
 
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "x3d-tidy",
3
- "version": "1.0.80",
3
+ "version": "1.0.81",
4
4
  "description": "X3D Converter, Beautifier and Minimizer",
5
+ "main": "src/main.js",
5
6
  "bin": {
6
7
  "x3d-tidy": "bin/x3d-tidy.js"
7
8
  },
8
- "main": "src/main.js",
9
9
  "scripts": {
10
10
  "start": "electron .",
11
- "test": "echo \"Error: no test specified\" && exit 1"
11
+ "test": "make tests"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
@@ -40,10 +40,17 @@
40
40
  "url": "https://github.com/create3000/x3d-tidy/issues"
41
41
  },
42
42
  "homepage": "https://www.npmjs.com/package/x3d-tidy",
43
+ "contributors": [
44
+ {
45
+ "name": "Holger Seelig",
46
+ "email": "holger.seelig@gmail.com",
47
+ "url": "https://github.com/create3000"
48
+ }
49
+ ],
43
50
  "dependencies": {
44
51
  "colors": "^1.4.0",
45
52
  "electron": "^25.3.0",
46
- "x_ite": "^8.11.4",
53
+ "x_ite": "^8.11.5",
47
54
  "yargs": "^17.7.2"
48
55
  }
49
56
  }
package/src/convert.js CHANGED
@@ -1,17 +1,17 @@
1
1
  "use strict"
2
2
 
3
3
  const
4
- X3D = require ("x_ite"),
5
- infer = require ("./infer"),
6
- pkg = require ("../package.json"),
7
- metadata = require ("./metadata"),
8
- electron = require ("electron"),
9
- yargs = require ("yargs"),
10
- url = require ("url"),
11
- path = require ("path"),
12
- fs = require ("fs"),
13
- zlib = require ("zlib"),
14
- DEBUG = false
4
+ X3D = require ("x_ite"),
5
+ infer = require ("./infer"),
6
+ pkg = require ("../package.json"),
7
+ metadata = require ("./metadata"),
8
+ electron = require ("electron"),
9
+ yargs = require ("yargs"),
10
+ url = require ("url"),
11
+ path = require ("path"),
12
+ fs = require ("fs"),
13
+ zlib = require ("zlib"),
14
+ DEBUG = false
15
15
 
16
16
  // Redirect console messages.
17
17
 
@@ -20,7 +20,7 @@ console .log = (... messages) => electron .ipcRenderer .send ("log", message
20
20
  console .warn = (... messages) => electron .ipcRenderer .send ("warn", messages)
21
21
  console .error = (... messages) => electron .ipcRenderer .send ("error", messages)
22
22
 
23
- electron .ipcRenderer .on ("convert", async (event, argv) => main (argv))
23
+ electron .ipcRenderer .on ("main", async (event, argv) => main (argv))
24
24
 
25
25
  async function main (argv)
26
26
  {
@@ -98,15 +98,18 @@ async function convert (argv)
98
98
  description: "If set, remove metadata nodes.",
99
99
  })
100
100
  .help ()
101
- .alias ("help", "h") .argv;
101
+ .alias ("help", "h") .argv
102
+
103
+ if (args .help)
104
+ return
102
105
 
103
106
  const
104
107
  Browser = X3D .createBrowser () .browser,
105
108
  input = path .resolve (args .cwd, args .input)
106
109
 
107
110
  Browser .endUpdate ()
108
- Browser .setBrowserOption ("PrimitiveQuality", "HIGH");
109
- Browser .setBrowserOption ("TextureQuality", "HIGH");
111
+ Browser .setBrowserOption ("PrimitiveQuality", "HIGH")
112
+ Browser .setBrowserOption ("TextureQuality", "HIGH")
110
113
 
111
114
  await Browser .loadComponents (Browser .getProfile ("Full"))
112
115
  await Browser .loadURL (new X3D .MFString (input))
@@ -145,7 +148,7 @@ async function convert (argv)
145
148
 
146
149
  function getContents ({ scene, type, style, precision, doublePrecision })
147
150
  {
148
- switch (type)
151
+ switch (type .toLowerCase ())
149
152
  {
150
153
  default:
151
154
  case ".x3d":
@@ -161,7 +164,7 @@ function getContents ({ scene, type, style, precision, doublePrecision })
161
164
  case ".x3djz":
162
165
  return zlib .gzipSync (scene .toJSONString ({ style: style || "CLEAN", precision: precision, doublePrecision: doublePrecision }))
163
166
  case ".html":
164
- return getHTML (scene);
167
+ return getHTML (scene)
165
168
  }
166
169
  }
167
170
 
package/src/main.js CHANGED
@@ -49,5 +49,5 @@ electron .app .whenReady () .then (async () =>
49
49
 
50
50
  await window .loadFile (path .join (__dirname, "window.html"))
51
51
 
52
- window .webContents .send ("convert", process .argv)
52
+ window .webContents .send ("main", process .argv)
53
53
  })