Skip to content

Commit c71e7df

Browse files
dgreifjonrohan
andauthored
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>
1 parent 370c8a2 commit c71e7df

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.changeset/rotten-phones-ring.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/css": patch
3+
---
4+
5+
Fail dist build when for postcss warnings

script/dist.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ async function dist() {
5151
const scss = await readFile(from, encoding)
5252
meta.imports = getExternalImports(scss, path).map(getPathName)
5353
const result = await compiler(scss, {from, to})
54+
const warnings = result.warnings()
55+
56+
// We don't want to release changes that cause warnings with postcss. Fail the dist build if any warnings are detected.
57+
if (warnings.length) {
58+
for (const warning of warnings) {
59+
console.warn(warning.toString())
60+
}
61+
throw new Error(`Warnings while compiling ${from}. See output above.`)
62+
}
5463

5564
await Promise.all([
5665
writeFile(to, result.css, encoding),

0 commit comments

Comments
 (0)