Skip to content

Commit 61114ca

Browse files
authored
feat: bundle types (#177)
* feat: bundle types * fix: move deps * fix: update deps
1 parent d5364b2 commit 61114ca

File tree

3 files changed

+428
-506
lines changed

3 files changed

+428
-506
lines changed

bin/build.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@ build_types() {
3030
{
3131
"name": "@govtechsg/document-store",
3232
"version": "1.0.0",
33-
"main": "index.ts",
33+
"main": "index.js",
34+
"module": "index.mjs",
35+
"types": "./types/index.d.ts",
36+
"exports": {
37+
"types": "./types/index.d.ts",
38+
"require": "./index.js",
39+
"default": "./index.mjs"
40+
},
3441
"repository": "git+https://github.com/Open-Attestation/document-store.git",
3542
"license": "Apache-2.0",
3643
"publishConfig": {
@@ -47,9 +54,23 @@ EOF
4754

4855
npm install "@typechain/$target" --save-dev --no-fund --no-audit
4956

50-
npx typechain --target $target --out-dir . '../../artifacts/src/**/*[^dbg].json'
57+
npx --yes typechain --target $target --out-dir ./output '../../artifacts/src/**/*[^dbg].json'
5158

52-
echo "✅ Completed building types for $target!"
59+
echo "Typechain build completed."
60+
61+
npm install --no-save rollup-plugin-typescript2 @rollup/plugin-commonjs @rollup/plugin-node-resolve
62+
63+
cp ../../rollup.config.mjs .
64+
65+
npx --yes rollup -c
66+
67+
mkdir -p types && mv .build/types-$target/output/* types/
68+
69+
rm -rf .build output rollup.config.mjs
70+
71+
echo "Bundling completed."
72+
73+
echo "✅ Completed building for $target!"
5374
}
5475

5576
publish_types() {

0 commit comments

Comments
 (0)