Skip to content

Commit

Permalink
feat(@angular-devkit/build-angular): add factory methods for WebpackB…
Browse files Browse the repository at this point in the history
…uilder and LoggingFactory
  • Loading branch information
manfredsteyer authored and alexeagle committed Jan 8, 2019
1 parent 554f5d2 commit dcc53d0
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/angular_devkit/build_angular/src/browser/index.ts
Expand Up @@ -43,11 +43,20 @@ export class BrowserBuilder implements Builder<BrowserBuilderSchema> {

constructor(public context: BuilderContext) { }

protected createWebpackBuilder(context: BuilderContext): WebpackBuilder {
return new WebpackBuilder(context);
}

protected createLoggingFactory(): (verbose: boolean) => LoggingCallback {
return getBrowserLoggingCb;
}

run(builderConfig: BuilderConfiguration<BrowserBuilderSchema>): Observable<BuildEvent> {
const root = this.context.workspace.root;
const projectRoot = resolve(root, builderConfig.root);
const host = new virtualFs.AliasHost(this.context.host as virtualFs.Host<fs.Stats>);
const webpackBuilder = new WebpackBuilder({ ...this.context, host });
const webpackBuilder = this.createWebpackBuilder({ ...this.context, host });
const getLoggingCb = this.createLoggingFactory();

const options = normalizeBuilderSchema(
host,
Expand All @@ -67,7 +76,7 @@ export class BrowserBuilder implements Builder<BrowserBuilderSchema> {
return throwError(e);
}

return webpackBuilder.runWebpack(webpackConfig, getBrowserLoggingCb(options.verbose));
return webpackBuilder.runWebpack(webpackConfig, getLoggingCb(options.verbose));
}),
concatMap(buildEvent => {
if (buildEvent.success && !options.watch && options.serviceWorker) {
Expand Down

0 comments on commit dcc53d0

Please sign in to comment.