Skip to content

Commit 53e8dab

Browse files
committed
fix(cli-with-sentry): write esbuild output and add gitignore
The Sentry CLI esbuild config extends the base config which has write: false. Add file writing logic and gitignore dist/ folder. Changes: - Import mkdirSync and writeFileSync from node:fs - Add output file writing in build().then() handler - Create dist/ directory if it doesn't exist - Add .gitignore to exclude dist/ from version control
1 parent 281ce8b commit 53e8dab

4 files changed

Lines changed: 51 additions & 26 deletions

File tree

packages/bootstrap/dist/bootstrap-npm.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/bootstrap/dist/bootstrap-smol.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli-with-sentry/.config/esbuild.cli-sentry.build.mjs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import { build } from 'esbuild'
7+
import { mkdirSync, writeFileSync } from 'node:fs'
78
import path from 'node:path'
89
import { fileURLToPath } from 'node:url'
910

@@ -34,10 +35,20 @@ const config = {
3435

3536
// Run build if invoked directly.
3637
if (import.meta.url === `file://${process.argv[1]}`) {
37-
build(config).catch(error => {
38-
console.error('Build failed:', error)
39-
process.exitCode = 1
40-
})
38+
build(config)
39+
.then(result => {
40+
// Write the transformed output (build had write: false).
41+
if (result.outputFiles && result.outputFiles.length > 0) {
42+
mkdirSync(path.dirname(config.outfile), { recursive: true })
43+
for (const output of result.outputFiles) {
44+
writeFileSync(output.path, output.contents)
45+
}
46+
}
47+
})
48+
.catch(error => {
49+
console.error('Build failed:', error)
50+
process.exitCode = 1
51+
})
4152
}
4253

4354
export default config
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Build output
2+
dist/
3+
4+
# Node modules
5+
node_modules/
6+
7+
# Test coverage
8+
coverage/
9+
10+
# Cache
11+
.cache/
12+
13+
# macOS
14+
.DS_Store

0 commit comments

Comments
 (0)