Skip to content

Commit 8b38e62

Browse files
committed
Ensure non-zero exit code on error
1 parent f71e8f5 commit 8b38e62

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

scripts/build.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,18 @@ async function buildWebComponent({ nestedCSS, minify }) {
161161
: outputOptions.file
162162

163163
fs.writeFile(fileName, updatedCode, err => {
164-
if (err) return console.log(err)
164+
if (err) {
165+
console.error(err)
166+
process.exit(1)
167+
}
165168
})
166169

167170
if (minify) {
168171
fs.writeFile(fileName.replace('.js', '.js.map'), map, err => {
169-
if (err) return console.log(err)
172+
if (err) {
173+
console.error(err)
174+
process.exit(1)
175+
}
170176
})
171177
}
172178
}
@@ -183,7 +189,8 @@ async function main() {
183189
// builds minified bundle with sourcemap
184190
await buildWebComponent({ nestedCSS, minify: true })
185191
} catch (ex) {
186-
console.log(ex)
192+
console.error(ex)
193+
process.exit(1)
187194
}
188195
}
189196

0 commit comments

Comments
 (0)