x3d-tidy 2.2.0 → 2.2.1

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 (3) hide show
  1. package/README.md +7 -3
  2. package/package.json +1 -1
  3. package/src/main.js +20 -11
package/README.md CHANGED
@@ -33,14 +33,18 @@ This tool is particularly useful for developers, 3D artists, and researchers wor
33
33
 
34
34
  Set double precision, default is 15.
35
35
 
36
- ### -e *extension*
36
+ ### -e *extension(s)* ...
37
37
 
38
- Set output file extension(s), e.g. ".x3dv". The output file will have the same basename as the input file.
38
+ Set output file extension(s), e.g. ".x3dv" or ".tidy.x3d". The output file will have the same basename as the input file. Use either '-e' or '-o'.
39
39
 
40
40
  ### -f *integer*
41
41
 
42
42
  Set float precision, default is 7.
43
43
 
44
+ ### -g
45
+
46
+ Log output filenames to stdout..
47
+
44
48
  ### -h
45
49
 
46
50
  Show help.
@@ -55,7 +59,7 @@ If set, remove metadata nodes.
55
59
 
56
60
  ### -o *file(s)* ...
57
61
 
58
- Set output file(s). To output it to stdout use only the extension, e.g. ".x3dv".
62
+ Set output file(s). To output it to stdout use only the extension, e.g. ".x3dv". Use either '-e' or '-o'.
59
63
 
60
64
  ### -r
61
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x3d-tidy",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "X3D Converter, Beautifier and Minimizer",
5
5
  "main": "src/main.js",
6
6
  "bin": {
package/src/main.js CHANGED
@@ -26,7 +26,7 @@ async function main ()
26
26
  }
27
27
  catch (error)
28
28
  {
29
- console .error (error .message || error);
29
+ console .error (colors .red (error .message || error));
30
30
  process .exit (1);
31
31
  }
32
32
  }
@@ -58,7 +58,7 @@ async function convert ()
58
58
  {
59
59
  type: "string",
60
60
  alias: "e",
61
- description: `Set output file extension(s), e.g. ".x3dv". The output file will have the same basename as the input file.`,
61
+ description: `Set output file extension(s), e.g. ".x3dv" or ".tidy.x3d". The output file will have the same basename as the input file.`,
62
62
  array: true,
63
63
  requiresArg: true,
64
64
  implies: "input",
@@ -73,6 +73,21 @@ async function convert ()
73
73
  default: [7],
74
74
  requiresArg: true,
75
75
  })
76
+ .option ("log",
77
+ {
78
+ type: "boolean",
79
+ alias: "g",
80
+ description: `Log output filenames to stdout.`,
81
+ implies: "input",
82
+ })
83
+ .option ("infer",
84
+ {
85
+ type: "boolean",
86
+ alias: "r",
87
+ description: "If set, infer profile and components from used nodes.",
88
+ array: true,
89
+ default: [false],
90
+ })
76
91
  .option ("input",
77
92
  {
78
93
  type: "string",
@@ -100,14 +115,6 @@ async function convert ()
100
115
  implies: "input",
101
116
  conflicts: "extension",
102
117
  })
103
- .option ("infer",
104
- {
105
- type: "boolean",
106
- alias: "r",
107
- description: "If set, infer profile and components from used nodes.",
108
- array: true,
109
- default: [false],
110
- })
111
118
  .option ("style",
112
119
  {
113
120
  type: "string",
@@ -128,7 +135,6 @@ async function convert ()
128
135
  "Convert an XML encoded file to a VRML encoded file and a JSON encoded file with smallest size possible by removing redundant whitespaces"
129
136
  ],
130
137
  ])
131
- .requiresArg (["extension", "output"])
132
138
  .help ()
133
139
  .alias ("help", "h") .argv;
134
140
 
@@ -200,6 +206,9 @@ async function convert ()
200
206
  output = `${filename .slice (0, -path. extname (filename) .length)}${extension}`;
201
207
  }
202
208
 
209
+ if (args .log)
210
+ console .log (output);
211
+
203
212
  if (path .extname (output))
204
213
  fs .writeFileSync (output, getContents ({ ... options, type: path .extname (output) }));
205
214
  else