1
1
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:
Dusty Greif 2022-07-29 13:26:30 -07:00 committed by GitHub
parent 370c8a286d
commit c71e7df03b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
"@primer/css": patch
---
Fail dist build when for postcss warnings

View File

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