-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
move.ts
25 lines (22 loc) · 854 Bytes
/
move.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { convertNxGenerator, formatFiles, Tree } from '@nrwl/devkit';
import { moveGenerator } from '@nrwl/workspace';
import { updateModuleName } from './lib/update-module-name';
import { Schema } from './schema';
/**
* Moves an Angular lib/app to another folder (and renames it in the process)
*
* @remarks It's important to note that `updateModuleName` is done after the update
* to the workspace, so it can't use the same tricks as the `@nrwl/workspace` rules
* to get the before and after names and paths.
*/
export async function angularMoveGenerator(
tree: Tree,
schema: Schema
): Promise<void> {
await moveGenerator(tree, { ...schema, skipFormat: true });
updateModuleName(tree, schema);
if (!schema.skipFormat) {
await formatFiles(tree);
}
}
export const angularMoveSchematic = convertNxGenerator(angularMoveGenerator);