Skip to content

Commit 2f065f5

Browse files
committed
New btr logging approach, pass in spinner
1 parent 6863c68 commit 2f065f5

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/dist.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Copyright [JS Foundation](https://js.foundation/) & contributors
3232
All rights reserved
3333
`;
3434

35-
function webpackConfig(args: any): webpack.Configuration {
35+
function webpackConfig(args: any, spinner?: any): webpack.Configuration {
3636
const basePath = process.cwd();
3737
const base = args.base || '/';
3838
const config = baseConfigFactory(args);
@@ -154,7 +154,8 @@ function webpackConfig(args: any): webpack.Configuration {
154154
basePath,
155155
baseUrl: base,
156156
scope: libraryName,
157-
onDemand: Boolean(args.serve && args.watch)
157+
onDemand: Boolean(args.serve && args.watch),
158+
spinner
158159
})
159160
);
160161
}

src/main.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ function serveStatic(
8383
}
8484
}
8585

86-
function build(config: webpack.Configuration, args: any) {
86+
function build(config: webpack.Configuration, args: any, spinner?: any) {
8787
const compiler = createCompiler(config);
88-
const spinner = ora('building').start();
88+
spinner = spinner || ora();
89+
spinner.start('building');
8990
return new Promise<webpack.Compiler>((resolve, reject) => {
9091
compiler.run((err, stats) => {
9192
spinner.stop();
@@ -360,14 +361,15 @@ const command: Command = {
360361
let config: webpack.Configuration;
361362
args.experimental = args.experimental || {};
362363

364+
const spinner = ora();
363365
if (args.mode === 'dev') {
364366
config = devConfigFactory(args);
365367
} else if (args.mode === 'unit' || args.mode === 'test') {
366368
config = unitConfigFactory(args);
367369
} else if (args.mode === 'functional') {
368370
config = functionalConfigFactory(args);
369371
} else {
370-
config = distConfigFactory(args);
372+
config = distConfigFactory(args, spinner);
371373
}
372374

373375
if (args.serve) {
@@ -381,7 +383,8 @@ const command: Command = {
381383
return fileWatch(config, args);
382384
}
383385

384-
return build(config, args);
386+
spinner.text = 'building';
387+
return build(config, args, spinner);
385388
},
386389
eject(helper: Helper): EjectOutput {
387390
return {

0 commit comments

Comments
 (0)