From 1bc4f3ea6b1fc5210a97594e3ff933c4bed076bd Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 16 Jul 2021 07:38:06 +0100 Subject: [PATCH 1/2] 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 https://github.com/mikeal/ipjs/pull/14 don't trip it up. --- .gitignore | 1 + package.json | 4 ++-- tsconfig.json | 6 ++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index d3f2322..f6504de 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ node_modules/ coverage/ build/ dist/ +types/ \ No newline at end of file diff --git a/package.json b/package.json index 884db8f..7f94cd7 100644 --- a/package.json +++ b/package.json @@ -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": "tsc --build && mv types dist", "prepublishOnly": "npm run build", "publish": "ipjs publish", "lint": "standard", diff --git a/tsconfig.json b/tsconfig.json index 58f91b0..873f74e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -38,10 +38,8 @@ }, "exclude": [ "node_modules", - "esm", - "cjs", - "examples", - "index.js" + "dist", + "examples" ], "compileOnSave": false } From 95a1d233a079cb75455f2897f6a916727f11889e Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 16 Jul 2021 08:26:32 +0100 Subject: [PATCH 2/2] chore: copy examples separately --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7f94cd7..bebab58 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "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 examples dist/", + "build:copy": "mkdir -p dist/examples/ && cp -a tsconfig.json *.js *.ts lib test dist/ && cp examples/*.* dist/examples/", "build:types": "tsc --build && mv types dist", "prepublishOnly": "npm run build", "publish": "ipjs publish",