|
7 | 7 | */ |
8 | 8 | import { BuilderContext, BuilderOutput, createBuilder } from '@angular-devkit/architect'; |
9 | 9 | import { runWebpack } from '@angular-devkit/build-webpack'; |
10 | | -import { json, virtualFs } from '@angular-devkit/core'; |
11 | | -import { NodeJsSyncHost } from '@angular-devkit/core/node'; |
12 | | -import * as fs from 'fs'; |
| 10 | +import { json } from '@angular-devkit/core'; |
13 | 11 | import * as path from 'path'; |
14 | | -import { Observable, from, of } from 'rxjs'; |
| 12 | +import { Observable, from } from 'rxjs'; |
15 | 13 | import { concatMap, map } from 'rxjs/operators'; |
16 | 14 | import { ScriptTarget } from 'typescript'; |
17 | 15 | import * as webpack from 'webpack'; |
@@ -46,17 +44,16 @@ export function execute( |
46 | 44 | webpackConfiguration?: ExecutionTransformer<webpack.Configuration>; |
47 | 45 | } = {}, |
48 | 46 | ): Observable<ServerBuilderOutput> { |
49 | | - const host = new NodeJsSyncHost(); |
50 | 47 | const root = context.workspaceRoot; |
51 | 48 |
|
52 | 49 | // Check Angular version. |
53 | | - assertCompatibleAngularVersion(context.workspaceRoot, context.logger); |
| 50 | + assertCompatibleAngularVersion(root, context.logger); |
54 | 51 |
|
55 | | - const tsConfig = readTsconfig(options.tsConfig, context.workspaceRoot); |
| 52 | + const tsConfig = readTsconfig(options.tsConfig, root); |
56 | 53 | const target = tsConfig.options.target || ScriptTarget.ES5; |
57 | | - const baseOutputPath = path.resolve(context.workspaceRoot, options.outputPath); |
| 54 | + const baseOutputPath = path.resolve(root, options.outputPath); |
58 | 55 |
|
59 | | - return from(initialize(options, context, host, transforms.webpackConfiguration)).pipe( |
| 56 | + return from(initialize(options, context, transforms.webpackConfiguration)).pipe( |
60 | 57 | concatMap(({ config, i18n }) => { |
61 | 58 | return runWebpack(config, context).pipe( |
62 | 59 | concatMap(async output => { |
@@ -108,7 +105,6 @@ export default createBuilder<json.JsonObject & ServerBuilderOptions, ServerBuild |
108 | 105 | async function initialize( |
109 | 106 | options: ServerBuilderOptions, |
110 | 107 | context: BuilderContext, |
111 | | - host: virtualFs.Host<fs.Stats>, |
112 | 108 | webpackConfigurationTransform?: ExecutionTransformer<webpack.Configuration>, |
113 | 109 | ): Promise<{ |
114 | 110 | config: webpack.Configuration; |
|
0 commit comments