mirror of
https://github.com/primer/css.git
synced 2024-12-23 06:01:54 +03:00
Fail dist build when for postcss warnings (#2180)
* Fail dist build when for postcss warnings * Create rotten-phones-ring.md Co-authored-by: Jon Rohan <yes@jonrohan.codes>
This commit is contained in:
parent
370c8a286d
commit
c71e7df03b
5
.changeset/rotten-phones-ring.md
Normal file
5
.changeset/rotten-phones-ring.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@primer/css": patch
|
||||
---
|
||||
|
||||
Fail dist build when for postcss warnings
|
@ -51,6 +51,15 @@ async function dist() {
|
||||
const scss = await readFile(from, encoding)
|
||||
meta.imports = getExternalImports(scss, path).map(getPathName)
|
||||
const result = await compiler(scss, {from, to})
|
||||
const warnings = result.warnings()
|
||||
|
||||
// We don't want to release changes that cause warnings with postcss. Fail the dist build if any warnings are detected.
|
||||
if (warnings.length) {
|
||||
for (const warning of warnings) {
|
||||
console.warn(warning.toString())
|
||||
}
|
||||
throw new Error(`Warnings while compiling ${from}. See output above.`)
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
writeFile(to, result.css, encoding),
|
||||
|
Loading…
Reference in New Issue
Block a user