Skip to content

Commit

Permalink
fix: build types from source instead of generated files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
achingbrain committed Jul 16, 2021
1 parent 5828444 commit 9eb9dea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"scripts": {
"build": "npm run build:js && npm run build:types",
"build:js": "ipjs build --tests --main && npm run build:copy",
"build:copy": "mkdir -p dist/examples/ && cp -a tsconfig.json *.js *.ts lib/ test/ dist/ && cp examples/*.* dist/examples/",
"build:types": "npm run build:copy && cd dist && tsc --build",
"build:copy": "mkdir -p dist/examples/ && cp -a tsconfig.json *.js *.ts lib test examples dist/",
"build:types": "npm run build:copy && tsc --build && mv types/ dist/",
"prepublishOnly": "npm run build",
"publish": "ipjs publish",
"lint": "standard",
Expand Down
6 changes: 2 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@
},
"exclude": [
"node_modules",
"esm",
"cjs",
"examples",
"index.js"
"dist",
"examples"
],
"compileOnSave": false
}

0 comments on commit 9eb9dea

Please sign in to comment.