Skip to content

Commit e03cc86

Browse files
fix: build.ts
1 parent 7168432 commit e03cc86

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ lib-cov
99
logs
1010
node_modules
1111
temp
12+
examples
1213
docs/.vitepress/cache

build.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { execSync } from 'node:child_process'
2-
import { existsSync, rmSync } from 'node:fs'
2+
import fs, { existsSync, rmSync } from 'node:fs'
3+
import path from 'node:path'
34
import process from 'node:process'
45

56
// Clean dist directory
@@ -32,6 +33,20 @@ try {
3233
stdio: 'inherit',
3334
cwd: process.cwd(),
3435
})
36+
37+
const srcIndexDts = path.join(process.cwd(), 'dist', 'src', 'index.d.ts')
38+
const distIndexDts = path.join(process.cwd(), 'dist', 'index.d.ts')
39+
40+
if (fs.existsSync(srcIndexDts)) {
41+
let content = fs.readFileSync(srcIndexDts, 'utf8')
42+
43+
// Fix relative paths to point to src/ subdirectory
44+
content = content.replace(/from '\.\//g, 'from \'./src/')
45+
46+
fs.writeFileSync(distIndexDts, content)
47+
console.log('✅ Copied and fixed main declaration file to dist root')
48+
}
49+
3550
console.log('✅ Build completed successfully!')
3651
}
3752
catch (error) {

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"exclude": [
3434
"buddy-bot.config.ts",
3535
"node_modules",
36+
"examples",
3637
"dist",
3738
"test"
3839
]

0 commit comments

Comments
 (0)