/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { Architect } from '@angular-devkit/architect'; import { WorkspaceNodeModulesArchitectHost } from '@angular-devkit/architect/node'; import { TestProjectHost, TestingArchitectHost } from '@angular-devkit/architect/testing'; import { Path, getSystemPath, normalize, schema, workspaces, join } from '@angular-devkit/core'; export const workspaceRoot = join(normalize(__dirname), './hello-world-app/'); export const host = new TestProjectHost(workspaceRoot); export const outputPathBrowser = normalize('dist/app/browser'); export const outputPathServer = normalize('dist/app/server'); export async function createArchitect(root: Path) { const workspaceSysPath = getSystemPath(root); const { workspace } = await workspaces.readWorkspace( workspaceSysPath, workspaces.createWorkspaceHost(host), ); const architectHost = new TestingArchitectHost( workspaceSysPath, workspaceSysPath, new WorkspaceNodeModulesArchitectHost(workspace, workspaceSysPath), ); const registry = new schema.CoreSchemaRegistry(); registry.addPostTransform(schema.transforms.addUndefinedDefaults); const architect = new Architect(architectHost, registry); return { workspace, architectHost, architect, }; }