Skip to content

Commit

Permalink
feat: modify build warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
swashata committed Apr 28, 2019
1 parent 68544b3 commit 3f3face
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/scripts/src/bin/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function build(options: ProgramOptions | undefined): void {
if (status === 'success') {
spinner.succeed(`${wpackLogoSmall} build successful.`);
} else {
spinner.warn(`${wpackLogoSmall} build warnings.`);
spinner.warn(`${wpackLogoSmall} built with warnings.`);
}
console.log('');
console.log(
Expand Down
29 changes: 17 additions & 12 deletions packages/scripts/src/scripts/Build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,32 @@ export class Build {
compiler.run((err, stats) => {
const raw = stats.toJson('verbose');
const messages = formatWebpackMessages(raw);
const outputLog = stats.toString({
colors: true,
assets: true,
chunks: false,
entrypoints: false,
hash: false,
version: false,
modules: false,
builtAt: false,
timings: false,
});

if (!messages.errors.length && !messages.warnings.length) {
// All good
resolve({
status: 'success',
log: stats.toString({
colors: true,
assets: true,
chunks: false,
entrypoints: false,
hash: false,
version: false,
modules: false,
builtAt: false,
timings: false,
}),
log: outputLog,
});
}
if (messages.errors.length) {
reject(messages.errors.join('\n'));
}
resolve({ status: 'warn', log: messages.warnings.join('\n') });
resolve({
status: 'warn',
log: `${outputLog}\n\n${messages.warnings.join('\n')}`,
});
});
});
}
Expand Down

0 comments on commit 3f3face

Please sign in to comment.