@needle-tools/gltf-build-pipeline 1.6.0-alpha.4 → 1.6.0-alpha.5
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/CHANGELOG.md +2 -1
- package/dist/package.json +1 -1
- package/dist/src/cli/index.js +14 -3
- package/dist/src/constants.d.ts +5 -0
- package/dist/src/constants.js +5 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/transforms/needle_progressive.js +1 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,9 @@ All notable changes to this package will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
-
## [1.6.0-alpha.
|
|
7
|
+
## [1.6.0-alpha.5] - 2023-05-28
|
|
8
8
|
- fix: determine build pipeline version
|
|
9
|
+
- change: throw error and exit process if packing or transform fails
|
|
9
10
|
|
|
10
11
|
## [1.6.0-alpha.2] - 2023-05-27
|
|
11
12
|
- add: `gltf-build-pipeline` commandline support with `transform` and `compress` (pack-gltf) options.
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
-
"version": "1.6.0-alpha.
|
|
3
|
+
"version": "1.6.0-alpha.5",
|
|
4
4
|
"description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"type": "module",
|
package/dist/src/cli/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { cacheSizeLimit, clearCache } from '../cache/cache.js';
|
|
|
9
9
|
import { existsSync, statSync } from 'fs';
|
|
10
10
|
import { foreachGLTF } from '../utils/fileutils.js';
|
|
11
11
|
import { dirname } from 'path';
|
|
12
|
+
import { ERROR_CODES } from '../constants.js';
|
|
12
13
|
// For testing / dev you can run `npm link` in the package directory
|
|
13
14
|
// For removing the link run `npm rm --global @needle-tools/gltf-build-pipeline`
|
|
14
15
|
program
|
|
@@ -77,7 +78,7 @@ Compress a single glTF file. The input file is compressed and written to the out
|
|
|
77
78
|
const filename = file.replaceAll("\\", "/").split("/").pop();
|
|
78
79
|
outputFile = options.output?.toString() + "/" + filename;
|
|
79
80
|
}
|
|
80
|
-
await packGLTF(file, outputFile, {
|
|
81
|
+
const res = await packGLTF(file, outputFile, {
|
|
81
82
|
config,
|
|
82
83
|
packedFiles: set,
|
|
83
84
|
stats,
|
|
@@ -86,6 +87,9 @@ Compress a single glTF file. The input file is compressed and written to the out
|
|
|
86
87
|
logger: logger,
|
|
87
88
|
file_stats: file_stats,
|
|
88
89
|
});
|
|
90
|
+
if (!res) {
|
|
91
|
+
process.exit(ERROR_CODES.PACKING_FAILED);
|
|
92
|
+
}
|
|
89
93
|
});
|
|
90
94
|
printStats(stats);
|
|
91
95
|
console.log("Stats: ", options);
|
|
@@ -136,6 +140,9 @@ Each version will be compressed and written to the output directory.
|
|
|
136
140
|
config,
|
|
137
141
|
debug: false,
|
|
138
142
|
useCache: true,
|
|
143
|
+
}).catch(err => {
|
|
144
|
+
logger.error(err);
|
|
145
|
+
process.exit(ERROR_CODES.PROGRESSIVE_FAILED);
|
|
139
146
|
});
|
|
140
147
|
const opts = {
|
|
141
148
|
config,
|
|
@@ -148,10 +155,14 @@ Each version will be compressed and written to the output directory.
|
|
|
148
155
|
};
|
|
149
156
|
for (const res of progressive_results) {
|
|
150
157
|
logger.info("> Compress " + res);
|
|
151
|
-
await packGLTF(res, res, opts)
|
|
158
|
+
if (!await packGLTF(res, res, opts)) {
|
|
159
|
+
process.exit(ERROR_CODES.PACKING_FAILED);
|
|
160
|
+
}
|
|
152
161
|
}
|
|
153
162
|
logger.info("> Compress " + file);
|
|
154
|
-
await packGLTF(file, file, opts)
|
|
163
|
+
if (!await packGLTF(file, file, opts)) {
|
|
164
|
+
process.exit(ERROR_CODES.PACKING_FAILED);
|
|
165
|
+
}
|
|
155
166
|
});
|
|
156
167
|
printStats(stats);
|
|
157
168
|
if (options.outputStats) {
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -53,15 +53,7 @@ async function onProcess(file, opts) {
|
|
|
53
53
|
'draco3d.decoder': await draco3d.createDecoderModule(),
|
|
54
54
|
'draco3d.encoder': await draco3d.createEncoderModule(),
|
|
55
55
|
});
|
|
56
|
-
|
|
57
|
-
// Log this message as a warning, it happens when trying to run on a already compressed gltf file (e.g. pre-processed. When logging an error we fail the build which is not desired)
|
|
58
|
-
if (err.message === "Cannot read properties of undefined (reading 'DT_FLOAT32')") {
|
|
59
|
-
console.log("WARN: \"" + err.message + "\" at \"" + file + "\"");
|
|
60
|
-
}
|
|
61
|
-
else
|
|
62
|
-
console.log("ERR: \"" + err.message + "\" at \"" + file + "\"\nStacktrace:\n" + err.stack);
|
|
63
|
-
return;
|
|
64
|
-
});
|
|
56
|
+
let document = await io.read(file);
|
|
65
57
|
if (document) {
|
|
66
58
|
if (opts.debug === true) {
|
|
67
59
|
if (file.includes(".debug.")) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
-
"version": "1.6.0-alpha.
|
|
3
|
+
"version": "1.6.0-alpha.5",
|
|
4
4
|
"description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"type": "module",
|