mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 12:09:26 +00:00
properly report build failures
This commit is contained in:
@@ -74,6 +74,10 @@ function generateManifest() {
|
||||
execSync('cem analyze --config "custom-elements-manifest.js"');
|
||||
} catch (error) {
|
||||
console.error(`\n\n${error.message}`);
|
||||
|
||||
if (!isDeveloping) {
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
spinner.succeed();
|
||||
@@ -91,6 +95,10 @@ function generateReactWrappers() {
|
||||
execSync(`node scripts/make-react.js --outdir "${cdnDir}"`, { stdio: 'inherit' });
|
||||
} catch (error) {
|
||||
console.error(`\n\n${error.message}`);
|
||||
|
||||
if (!isDeveloping) {
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
spinner.succeed();
|
||||
|
||||
@@ -147,6 +155,9 @@ async function generateTypes() {
|
||||
try {
|
||||
execSync(`tsc --project ./tsconfig.prod.json --outdir "${cdnDir}"`);
|
||||
} catch (error) {
|
||||
if (!isDeveloping) {
|
||||
process.exit(1)
|
||||
}
|
||||
return Promise.reject(error.stdout);
|
||||
}
|
||||
|
||||
@@ -219,6 +230,9 @@ async function generateBundle() {
|
||||
} catch (error) {
|
||||
spinner.fail();
|
||||
console.log(chalk.red(`\n${error}`));
|
||||
if (!isDeveloping) {
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
spinner.succeed();
|
||||
@@ -235,6 +249,10 @@ async function regenerateBundle() {
|
||||
} catch (error) {
|
||||
spinner.fail();
|
||||
console.log(chalk.red(`\n${error}`));
|
||||
|
||||
if (!isDeveloping) {
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
spinner.succeed();
|
||||
@@ -250,18 +268,27 @@ async function generateDocs() {
|
||||
if (isAlpha) args.push('--alpha');
|
||||
if (isDeveloping) args.push('--develop');
|
||||
|
||||
// 11ty
|
||||
const output = (await runScript(join(__dirname, 'docs.js'), args))
|
||||
// Cleanup the output
|
||||
.replace('[11ty]', '')
|
||||
.replace(' seconds', 's')
|
||||
.replace(/\(.*?\)/, '')
|
||||
.toLowerCase()
|
||||
.trim();
|
||||
let output
|
||||
try {
|
||||
// 11ty
|
||||
output = (await runScript(join(__dirname, 'docs.js'), args))
|
||||
// Cleanup the output
|
||||
.replace('[11ty]', '')
|
||||
.replace(' seconds', 's')
|
||||
.replace(/\(.*?\)/, '')
|
||||
.toLowerCase()
|
||||
.trim();
|
||||
|
||||
// Copy dist (production only)
|
||||
if (!isDeveloping) {
|
||||
await copy(cdnDir, join(siteDir, 'dist'));
|
||||
// Copy dist (production only)
|
||||
if (!isDeveloping) {
|
||||
await copy(cdnDir, join(siteDir, 'dist'));
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error("\n\n" + chalk.red(error) + "\n")
|
||||
|
||||
spinner.fail(chalk.red(`Error while writing the docs.`));
|
||||
if (!isDeveloping) { process.exit(1) }
|
||||
}
|
||||
|
||||
spinner.succeed(`Writing the docs ${chalk.gray(`(${output}`)})`);
|
||||
@@ -365,6 +392,10 @@ if (isDeveloping) {
|
||||
reload();
|
||||
} catch (err) {
|
||||
console.error(chalk.red(err));
|
||||
|
||||
if (!isDeveloping) {
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -392,3 +423,4 @@ function terminate() {
|
||||
|
||||
process.on('SIGINT', terminate);
|
||||
process.on('SIGTERM', terminate);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user