forked from intershop/intershop-pwa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfactory.ts
26 lines (23 loc) · 830 Bytes
/
factory.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
26
import { strings } from '@angular-devkit/core';
import { Rule, SchematicsException, apply, mergeWith, move, template, url } from '@angular-devkit/schematics';
import { getWorkspace } from '@schematics/angular/utility/workspace';
import { PWAKubernetesDeploymentOptionsSchema as Options } from './schema';
export function createKubernetesDeployment(options: Options): Rule {
return async host => {
if (!options.project) {
throw new SchematicsException('Option (project) is required.');
}
const workspace = await getWorkspace(host);
const project = workspace.projects.get(options.project);
const projectRoot = project.root;
return mergeWith(
apply(url('./files'), [
template({
...strings,
...options,
}),
move(projectRoot),
])
);
};
}