Skip to content

Commit a8d1c71

Browse files
author
Marcus Pousette
committed
fix: add wasm verification
1 parent 71a63f1 commit a8d1c71

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"start:node": "npm run build && node demo/node.mjs",
7272
"start:node:native": "npm run build && node demo/node-native.mjs",
7373
"fix": "npx prettier . --write",
74-
"prepublishOnly": "npm run build && npm run fix && npm run publint && npm run check-types",
74+
"prepublishOnly": "npm run build && node scripts/verify-wasm.cjs && npm run fix && npm run publint && npm run check-types",
7575
"deploy": "npm run prepublishOnly && git add . && git commit -am 'New release' && git push && npm publish --access public"
7676
},
7777
"postinstall": "node scripts/postinstall.cjs || true",

scripts/verify-wasm.cjs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env node
2+
const fs = require('fs');
3+
const path = require('path');
4+
5+
const root = process.cwd();
6+
const dir = path.join(root, 'sqlite-wasm', 'jswasm');
7+
const required = [
8+
'sqlite3.wasm',
9+
'sqlite3.mjs',
10+
'sqlite3-bundler-friendly.mjs',
11+
'sqlite3-worker1-promiser.mjs',
12+
];
13+
14+
const missing = required.filter((f) => !fs.existsSync(path.join(dir, f)));
15+
if (missing.length) {
16+
console.error('[verify-wasm] Missing required payload files in', dir);
17+
for (const f of missing) console.error(' -', f);
18+
console.error('\nFix: run `npm run build` (or ensure prebuilts are checked in).');
19+
process.exit(1);
20+
} else {
21+
console.log('[verify-wasm] Payload OK in', dir);
22+
}
23+

0 commit comments

Comments
 (0)