Skip to content

Commit 1874798

Browse files
authored
Ensure CLI builds have a non-zero exit code on failure (#10703)
* ensure simple builds have a non-zero exit code on failure This is not used for the watcher. * update changelog
1 parent 0c9b3f9 commit 1874798

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323

2424
- Disallow multiple selectors in arbitrary variants ([#10655](https://github.com/tailwindlabs/tailwindcss/pull/10655))
2525
- Sort class lists deterministically for Prettier plugin ([#10672](https://github.com/tailwindlabs/tailwindcss/pull/10672))
26+
- Ensure CLI builds have a non-zero exit code on failure ([#10703](https://github.com/tailwindlabs/tailwindcss/pull/10703))
2627

2728
### Changed
2829

src/cli/build/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ export async function build(args, configs) {
4444

4545
await processor.watch()
4646
} else {
47-
await processor.build()
47+
await processor.build().catch((e) => {
48+
console.error(e)
49+
process.exit(1)
50+
})
4851
}
4952
}

src/cli/build/plugin.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,11 @@ export async function createProcessor(args, cliConfigPath) {
383383
// The watcher will start watching the imported CSS files and will be
384384
// resilient to future errors.
385385

386-
console.error(err)
386+
if (state.watcher) {
387+
console.error(err)
388+
} else {
389+
return Promise.reject(err)
390+
}
387391
}
388392
)
389393
}

src/oxide/cli/build/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ export async function build(args, configs) {
4242

4343
await processor.watch()
4444
} else {
45-
await processor.build()
45+
await processor.build().catch((e) => {
46+
console.error(e)
47+
process.exit(1)
48+
})
4649
}
4750
}

src/oxide/cli/build/plugin.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,11 @@ export async function createProcessor(args, cliConfigPath) {
380380
// The watcher will start watching the imported CSS files and will be
381381
// resilient to future errors.
382382

383-
console.error(err)
383+
if (state.watcher) {
384+
console.error(err)
385+
} else {
386+
return Promise.reject(err)
387+
}
384388
}
385389
)
386390
}

0 commit comments

Comments
 (0)