Colum Ferry 96293b02cb
cleanup(angular): refactor angular application generator (#6036)
Refactor Angular Application Schematic to Generator using Nx Devkit
2021-06-18 15:39:05 +01:00

34 lines
779 B
TypeScript

import type { Tree } from '@nrwl/devkit';
import type { NormalizedSchema } from './normalized-schema';
import {
moveFilesToNewDirectory,
getWorkspaceLayout,
joinPathFragments,
} from '@nrwl/devkit';
import { wrapAngularDevkitSchematic } from '@nrwl/devkit/ngcli-adapter';
export async function addProtractor(
host: Tree,
options: NormalizedSchema,
e2eProjectRoot: string
) {
const { appsDir } = getWorkspaceLayout(host);
const protractorSchematic = wrapAngularDevkitSchematic(
'@schematics/angular',
'e2e'
);
await protractorSchematic(host, {
relatedAppName: options.name,
rootSelector: `${options.prefix}-root`,
});
moveFilesToNewDirectory(
host,
joinPathFragments(appsDir, e2eProjectRoot),
options.e2eProjectRoot
);
}