Skip to content

Commit 652a953

Browse files
authored
Fix more npm package issues. (#1427)
* Pack all the things. * Isolated smoke tests
1 parent a06d450 commit 652a953

File tree

4 files changed

+28
-36
lines changed

4 files changed

+28
-36
lines changed

.github/workflows/manifold.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,30 @@ jobs:
133133
run: |
134134
cd build/test
135135
node ./manifold_test.js
136-
- name: Test package
136+
- name: Run unit tests
137137
if: matrix.parallelization == 'OFF'
138138
run: |
139139
cd bindings/wasm
140140
npm ci
141141
npm run build
142142
npm test
143+
- name: Isolated npm smoke test
144+
if: matrix.parallelization == 'OFF'
145+
run: |
146+
set -ev -o pipefail
147+
cd bindings/wasm
148+
wasmpath=$(pwd)
149+
npmtestpath=../npmtest
150+
# Create an npm package.
151+
npm ci && npm pack
152+
# Install it in an empty directory.
153+
mkdir -p ${npmtestpath} && cd ${npmtestpath}
154+
npm install ${wasmpath}/manifold-3d*.tgz
155+
cp ${wasmpath}/test/fixtures/npm/* .
156+
# Positive case smoke test.
157+
npx manifold-cad ./unitSphere.mjs ./unitSphere.glb && echo "Positive smoke test succeeded"
158+
# Negative case smoke test.
159+
npx manifold-cad ./unitSphereNoManifoldImport.mjs ./unitSphereNoManifoldImport.glb || echo "Negative smoke test failed as expected"
143160
- name: Build examples
144161
if: matrix.parallelization == 'OFF'
145162
run: |

bindings/wasm/package.json

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,41 +25,10 @@
2525
"manifold-encapsulated-types.d.ts",
2626
"manifold-global-types.d.ts",
2727
"bin/manifold-cad",
28-
"lib/animation.d.ts",
29-
"lib/animation.js",
30-
"lib/bundler.js",
31-
"lib/bundler.d.ts",
32-
"lib/debug.d.ts",
33-
"lib/debug.js",
34-
"lib/math.js",
35-
"lib/math.d.ts",
36-
"lib/error.d.ts",
37-
"lib/error.js",
38-
"lib/scene-builder.d.ts",
39-
"lib/scene-builder.js",
40-
"lib/gltf-io.d.ts",
41-
"lib/gltf-io.js",
42-
"lib/3mf-export.d.ts",
43-
"lib/export-3mf.d.ts",
44-
"lib/export-3mf.js",
45-
"lib/export-gltf.d.ts",
46-
"lib/export-gltf.js",
47-
"lib/garbage-collector.js",
48-
"lib/garbage-collector.d.ts",
49-
"lib/manifold-gltf.d.ts",
50-
"lib/manifold-gltf.js",
51-
"lib/material.d.ts",
52-
"lib/material.js",
53-
"lib/util.js",
54-
"lib/util.d.ts",
55-
"lib/wasm.js",
56-
"lib/wasm.d.ts",
57-
"lib/worker.js",
58-
"lib/worker.d.ts",
59-
"lib/manifoldCAD.js",
60-
"lib/manifoldCAD.d.ts",
28+
"lib/*.d.ts",
29+
"lib/*.js",
6130
"types/manifoldCAD.d.ts",
62-
"types/globalDefaults.d.ts",
31+
"types/manifoldCADGlobals.d.ts",
6332
"dist/manifoldCAD.d.ts",
6433
"dist/manifoldCADGlobals.d.ts",
6534
"dist/worker.bundled.js"
@@ -72,7 +41,7 @@
7241
"./manifoldCAD.d.ts": "./dist/manifoldCAD.d.ts",
7342
"./lib/worker.bundled.js": {
7443
"import": "./dist/worker.bundled.js",
75-
"types": "./lib/worker.js"
44+
"types": "./lib/worker.d.ts"
7645
},
7746
"./lib/*": "./lib/*",
7847
"./manifold.wasm": "./manifold.wasm",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import {Manifold} from 'manifold-3d/manifoldCAD';
2+
3+
const result = Manifold.sphere(1.0);
4+
export default result;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const result = Manifold.sphere(1.0);
2+
export default result;

0 commit comments

Comments
 (0)