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
This commit is contained in:
Robin Malfait 2023-02-28 16:50:06 +01:00 committed by GitHub
parent 0c9b3f9333
commit 1874798bdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 4 deletions

View File

@ -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

View File

@ -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)
})
}
}

View File

@ -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)
}
}
)
}

View File

@ -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)
})
}
}

View File

@ -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)
}
}
)
}