diff --git a/.vscode/settings.json b/.vscode/settings.json index d4043a81..bb3833cb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -62,6 +62,7 @@ "pendulumchain", "phala", "polkadot", + "postbuild", "precompile", "preinstall", "rmrk", diff --git a/package.json b/package.json index fe66ed2d..ce1e4a46 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "scripts": { "preinstall": "npx only-allow pnpm", "build": "turbo run build", + "postbuild": "npx bun scripts/copy-dts.ts", "dev": "turbo run dev", "link": "turbo run link", "lint": "pnpm biome check .", diff --git a/scripts/copy-dts.ts b/scripts/copy-dts.ts new file mode 100644 index 00000000..3b2a0027 --- /dev/null +++ b/scripts/copy-dts.ts @@ -0,0 +1,13 @@ +import { copyFile } from 'node:fs/promises'; +import { glob } from 'glob'; + +async function copyDtsToMts() { + const dtsFiles = await glob('packages/*/build/**/*.d.ts'); + + for (const file of dtsFiles) { + const mtsFile = file.replace('.d.ts', '.d.mts'); + await copyFile(file, mtsFile); + } +} + +copyDtsToMts().catch(console.error);