Skip to content

Commit 0948dd8

Browse files
committed
ci: fail sdk build on dts errors
1 parent fcd5ee9 commit 0948dd8

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

β€Žsdk/scripts/build.tsβ€Ž

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ async function build() {
9191
})
9292

9393
console.log('πŸ“ Generating and bundling TypeScript declarations...')
94+
let dtsBundlingFailed = false
9495
try {
9596
const [bundle] = generateDtsBundle(
9697
[
@@ -110,7 +111,8 @@ async function build() {
110111
await fixDuplicateImports()
111112
console.log(' βœ“ Created bundled type definitions')
112113
} catch (error) {
113-
console.warn('⚠ TypeScript declaration bundling failed:', error.message)
114+
dtsBundlingFailed = true
115+
console.error('❌ TypeScript declaration bundling failed:', error.message)
114116
}
115117

116118
console.log('πŸ“‚ Copying WASM files for tree-sitter...')
@@ -123,6 +125,10 @@ async function build() {
123125
console.log(' πŸ“„ dist/index.mjs (ESM)')
124126
console.log(' πŸ“„ dist/index.cjs (CJS)')
125127
console.log(' πŸ“„ dist/index.d.ts (Types)')
128+
129+
if (dtsBundlingFailed) {
130+
throw new Error('TypeScript declaration bundling failed')
131+
}
126132
}
127133

128134
/**
@@ -203,5 +209,8 @@ async function copyRipgrepVendor() {
203209
}
204210

205211
if (import.meta.main) {
206-
build().catch(console.error)
212+
build().catch((error) => {
213+
console.error(error)
214+
process.exit(1)
215+
})
207216
}

0 commit comments

Comments
Β (0)