Skip to content

Commit 5311005

Browse files
OttoAllmendingerllm-git
andcommitted
fix(wasm-utxo): update build paths to include test directory
Adjust paths in build configurations, Makefile targets, and import paths to properly include the test directory in the build process. This ensures consistent directory structure across the package. Issue: BTC-0 Co-authored-by: llm-git <[email protected]>
1 parent 7a2fe0c commit 5311005

File tree

6 files changed

+23
-22
lines changed

6 files changed

+23
-22
lines changed

packages/wasm-utxo/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ endef
3838
js/wasm/:
3939
$(call BUILD,$@,bundler)
4040

41-
.PHONY: dist/esm/wasm/
42-
dist/esm/wasm/:
41+
.PHONY: dist/esm/js/wasm/
42+
dist/esm/js/wasm/:
4343
$(call BUILD,$@,bundler)
4444

45-
.PHONY: dist/cjs/wasm/
46-
dist/cjs/wasm/:
45+
.PHONY: dist/cjs/js/wasm/
46+
dist/cjs/js/wasm/:
4747
$(call BUILD,$@,nodejs)
4848

4949
.PHONY: lint

packages/wasm-utxo/bundler-test/test-cjs-import.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ console.log("Testing CommonJS require() compatibility...\n");
88
// Use standard CommonJS require
99
let wasmUtxo;
1010
try {
11-
wasmUtxo = require("../dist/cjs/index.js");
11+
wasmUtxo = require("../dist/cjs/js/index.js");
1212
} catch (error) {
1313
console.error("✗ require() failed:", error.message);
1414
process.exit(1);

packages/wasm-utxo/bundler-test/test-esm-import.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Run with: node --experimental-wasm-modules bundler-test/test-esm-import.mjs
44
*/
55

6-
import { Descriptor, Psbt, address, fixedScriptWallet } from "../dist/esm/index.js";
6+
import { Descriptor, Psbt, address, fixedScriptWallet } from "../dist/esm/js/index.js";
77

88
console.log("Testing ESM import...\n");
99

packages/wasm-utxo/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,32 @@
1515
"exports": {
1616
".": {
1717
"import": {
18-
"types": "./dist/esm/index.d.ts",
19-
"default": "./dist/esm/index.js"
18+
"types": "./dist/esm/js/index.d.ts",
19+
"default": "./dist/esm/js/index.js"
2020
},
2121
"require": {
22-
"types": "./dist/cjs/index.d.ts",
23-
"default": "./dist/cjs/index.js"
22+
"types": "./dist/cjs/js/index.d.ts",
23+
"default": "./dist/cjs/js/index.js"
2424
}
2525
}
2626
},
27-
"main": "./dist/cjs/index.js",
28-
"module": "./dist/esm/index.js",
29-
"types": "./dist/esm/index.d.ts",
27+
"main": "./dist/cjs/js/index.js",
28+
"module": "./dist/esm/js/index.js",
29+
"types": "./dist/esm/js/index.d.ts",
3030
"sideEffects": [
31-
"./dist/esm/wasm/wasm_utxo.js",
32-
"./dist/cjs/wasm/wasm_utxo.js"
31+
"./dist/esm/js/wasm/wasm_utxo.js",
32+
"./dist/cjs/js/wasm/wasm_utxo.js"
3333
],
3434
"scripts": {
35-
"test": "npm run test:mocha && npm run test:wasm-pack",
35+
"test": "npm run test:mocha && npm run test:wasm-pack && npm run test:imports",
3636
"test:mocha": "mocha --recursive test",
3737
"test:wasm-pack": "npm run test:wasm-pack-node && npm run test:wasm-pack-chrome",
3838
"test:wasm-pack-node": "wasm-pack test --node",
3939
"test:wasm-pack-chrome": "wasm-pack test --headless --chrome",
4040
"test:esm-import": "node --experimental-wasm-modules bundler-test/test-esm-import.mjs",
4141
"test:cjs-import": "node bundler-test/test-cjs-import.cjs",
4242
"test:imports": "npm run test:esm-import && npm run test:cjs-import",
43-
"build:wasm": "make js/wasm/ && make dist/esm/wasm/ && make dist/cjs/wasm/",
43+
"build:wasm": "make js/wasm/ && make dist/esm/js/wasm/ && make dist/cjs/js/wasm/",
4444
"build:ts-esm": "tsc",
4545
"build:ts-cjs": "tsc --project tsconfig.cjs.json",
4646
"build:ts": "npm run build:ts-esm && npm run build:ts-cjs",

packages/wasm-utxo/tsconfig.cjs.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"compilerOptions": {
44
"module": "CommonJS",
55
"moduleResolution": "node",
6-
"rootDir": "./js",
6+
"rootDir": ".",
77
"outDir": "./dist/cjs"
8-
}
8+
},
9+
"exclude": ["test/**/*"]
910
}

packages/wasm-utxo/tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"skipLibCheck": true,
99
"declaration": true,
1010
"composite": true,
11-
"rootDir": "./js",
11+
"rootDir": ".",
1212
"outDir": "./dist/esm"
1313
},
14-
"include": ["./js/**/*.ts"],
15-
"exclude": ["node_modules", "./js/wasm/**/*", "test"]
14+
"include": ["./js/**/*.ts", "test/**/*.ts"],
15+
"exclude": ["node_modules", "./js/wasm/**/*"]
1616
}

0 commit comments

Comments
 (0)