1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | const schematics_1 = require("@angular-devkit/schematics");
|
11 | const tasks_1 = require("@angular-devkit/schematics/tasks");
|
12 | function default_1(options) {
|
13 | if (!options.directory) {
|
14 |
|
15 | options.directory = options.name.startsWith('@') ? options.name.slice(1) : options.name;
|
16 | }
|
17 | const workspaceOptions = {
|
18 | name: options.name,
|
19 | version: options.version,
|
20 | newProjectRoot: options.newProjectRoot,
|
21 | minimal: options.minimal,
|
22 | strict: options.strict,
|
23 | packageManager: options.packageManager,
|
24 | };
|
25 | const applicationOptions = {
|
26 | projectRoot: '',
|
27 | name: options.name,
|
28 | inlineStyle: options.inlineStyle,
|
29 | inlineTemplate: options.inlineTemplate,
|
30 | prefix: options.prefix,
|
31 | viewEncapsulation: options.viewEncapsulation,
|
32 | routing: options.routing,
|
33 | style: options.style,
|
34 | skipTests: options.skipTests,
|
35 | skipPackageJson: false,
|
36 |
|
37 | skipInstall: true,
|
38 | strict: options.strict,
|
39 | minimal: options.minimal,
|
40 | standalone: options.standalone,
|
41 | ssr: options.ssr,
|
42 | };
|
43 | return (0, schematics_1.chain)([
|
44 | (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.empty)(), [
|
45 | (0, schematics_1.schematic)('workspace', workspaceOptions),
|
46 | options.createApplication ? (0, schematics_1.schematic)('application', applicationOptions) : schematics_1.noop,
|
47 | (0, schematics_1.move)(options.directory),
|
48 | ])),
|
49 | (_host, context) => {
|
50 | let packageTask;
|
51 | if (!options.skipInstall) {
|
52 | packageTask = context.addTask(new tasks_1.NodePackageInstallTask({
|
53 | workingDirectory: options.directory,
|
54 | packageManager: options.packageManager,
|
55 | }));
|
56 | if (options.linkCli) {
|
57 | packageTask = context.addTask(new tasks_1.NodePackageLinkTask('@angular/cli', options.directory), [packageTask]);
|
58 | }
|
59 | }
|
60 | if (!options.skipGit) {
|
61 | const commit = typeof options.commit == 'object' ? options.commit : options.commit ? {} : false;
|
62 | context.addTask(new tasks_1.RepositoryInitializerTask(options.directory, commit), packageTask ? [packageTask] : []);
|
63 | }
|
64 | },
|
65 | ]);
|
66 | }
|
67 | exports.default = default_1;
|