|
9 | 9 | import { Architect, BuilderInfo, BuilderProgressState, Target } from '@angular-devkit/architect';
|
10 | 10 | import { WorkspaceNodeModulesArchitectHost } from '@angular-devkit/architect/node';
|
11 | 11 | import {
|
12 |
| - experimental, |
13 | 12 | json,
|
14 | 13 | logging,
|
15 |
| - normalize, |
16 | 14 | schema,
|
17 | 15 | tags,
|
18 | 16 | terminal,
|
| 17 | + workspaces, |
19 | 18 | } from '@angular-devkit/core';
|
20 | 19 | import { NodeJsSyncHost, createConsoleLogger } from '@angular-devkit/core/node';
|
21 |
| -import { existsSync, readFileSync } from 'fs'; |
| 20 | +import { existsSync } from 'fs'; |
22 | 21 | import * as minimist from 'minimist';
|
23 | 22 | import * as path from 'path';
|
24 | 23 | import { tap } from 'rxjs/operators';
|
@@ -82,7 +81,7 @@ interface BarInfo {
|
82 | 81 |
|
83 | 82 | async function _executeTarget(
|
84 | 83 | parentLogger: logging.Logger,
|
85 |
| - workspace: experimental.workspace.Workspace, |
| 84 | + workspace: workspaces.WorkspaceDefinition, |
86 | 85 | root: string,
|
87 | 86 | argv: minimist.ParsedArgs,
|
88 | 87 | registry: json.schema.SchemaRegistry,
|
@@ -213,16 +212,14 @@ async function main(args: string[]): Promise<number> {
|
213 | 212 | }
|
214 | 213 |
|
215 | 214 | const root = path.dirname(configFilePath);
|
216 |
| - const configContent = readFileSync(configFilePath, 'utf-8'); |
217 |
| - const workspaceJson = JSON.parse(configContent); |
218 | 215 |
|
219 | 216 | const registry = new schema.CoreSchemaRegistry();
|
220 | 217 | registry.addPostTransform(schema.transforms.addUndefinedDefaults);
|
221 | 218 |
|
222 |
| - const host = new NodeJsSyncHost(); |
223 |
| - const workspace = new experimental.workspace.Workspace(normalize(root), host); |
224 |
| - |
225 |
| - await workspace.loadWorkspaceFromJson(workspaceJson).toPromise(); |
| 219 | + const { workspace } = await workspaces.readWorkspace( |
| 220 | + configFilePath, |
| 221 | + workspaces.createWorkspaceHost(new NodeJsSyncHost()), |
| 222 | + ); |
226 | 223 |
|
227 | 224 | // Clear the console.
|
228 | 225 | process.stdout.write('\u001Bc');
|
|
0 commit comments