Skip to content

Commit

Permalink
Ensure CLI builds have a non-zero exit code on failure (#10703)
Browse files Browse the repository at this point in the history
* ensure simple builds have a non-zero exit code on failure

This is not used for the watcher.

* update changelog
  • Loading branch information
RobinMalfait authored Feb 28, 2023
1 parent 0c9b3f9 commit 1874798
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

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

### Changed

Expand Down
5 changes: 4 additions & 1 deletion src/cli/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export async function build(args, configs) {

await processor.watch()
} else {
await processor.build()
await processor.build().catch((e) => {
console.error(e)
process.exit(1)
})
}
}
6 changes: 5 additions & 1 deletion src/cli/build/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,11 @@ export async function createProcessor(args, cliConfigPath) {
// The watcher will start watching the imported CSS files and will be
// resilient to future errors.

console.error(err)
if (state.watcher) {
console.error(err)
} else {
return Promise.reject(err)
}
}
)
}
Expand Down
5 changes: 4 additions & 1 deletion src/oxide/cli/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export async function build(args, configs) {

await processor.watch()
} else {
await processor.build()
await processor.build().catch((e) => {
console.error(e)
process.exit(1)
})
}
}
6 changes: 5 additions & 1 deletion src/oxide/cli/build/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,11 @@ export async function createProcessor(args, cliConfigPath) {
// The watcher will start watching the imported CSS files and will be
// resilient to future errors.

console.error(err)
if (state.watcher) {
console.error(err)
} else {
return Promise.reject(err)
}
}
)
}
Expand Down

0 comments on commit 1874798

Please sign in to comment.