Skip to content

Commit 9eb9dea

Browse files
committed
fix: build types from source instead of generated files
This module copies everything into the `dist` folder then builds types from there. `multiformats` builds types from the source, then copies moves the `types` folder into `dist`. The latter seems more predictable and means things like mikeal/ipjs#14 don't trip it up. Also, doing `cp -a ... test/ dist/` instead of `cp -a ... test dist/` meant that the contents of the test folder was copied into `dist` rather than the test folder itself, which I guess was not intentional? Removing the trailing slash means you don't need the extra `cp` command to copy the examples folder afterwards.
1 parent 5828444 commit 9eb9dea

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"scripts": {
1212
"build": "npm run build:js && npm run build:types",
1313
"build:js": "ipjs build --tests --main && npm run build:copy",
14-
"build:copy": "mkdir -p dist/examples/ && cp -a tsconfig.json *.js *.ts lib/ test/ dist/ && cp examples/*.* dist/examples/",
15-
"build:types": "npm run build:copy && cd dist && tsc --build",
14+
"build:copy": "mkdir -p dist/examples/ && cp -a tsconfig.json *.js *.ts lib test examples dist/",
15+
"build:types": "npm run build:copy && tsc --build && mv types/ dist/",
1616
"prepublishOnly": "npm run build",
1717
"publish": "ipjs publish",
1818
"lint": "standard",

tsconfig.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@
3838
},
3939
"exclude": [
4040
"node_modules",
41-
"esm",
42-
"cjs",
43-
"examples",
44-
"index.js"
41+
"dist",
42+
"examples"
4543
],
4644
"compileOnSave": false
4745
}

0 commit comments

Comments
 (0)