@abp/ng.schematics 10.5.0-rc.4 → 10.6.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/ai-config/index.d.ts +3 -3
- package/commands/ai-config/index.js +88 -88
- package/commands/ai-config/index.js.map +1 -1
- package/commands/ai-config/model.d.ts +10 -10
- package/commands/ai-config/model.js +2 -2
- package/commands/api/files-service/proxy/__namespace@dir__/__name@kebab__.service.ts.template +6 -4
- package/commands/api/index.d.ts +2 -2
- package/commands/api/index.js +139 -138
- package/commands/api/index.js.map +1 -1
- package/commands/change-theme/index.d.ts +28 -28
- package/commands/change-theme/index.js +474 -473
- package/commands/change-theme/index.js.map +1 -1
- package/commands/change-theme/model.d.ts +5 -5
- package/commands/change-theme/model.js +2 -2
- package/commands/change-theme/style-map.d.ts +16 -16
- package/commands/change-theme/style-map.js +424 -424
- package/commands/change-theme/theme-options.enum.d.ts +6 -6
- package/commands/change-theme/theme-options.enum.js +11 -11
- package/commands/change-theme/theme-options.enum.js.map +1 -1
- package/commands/create-lib/index.d.ts +13 -13
- package/commands/create-lib/index.js +298 -298
- package/commands/create-lib/index.js.map +1 -1
- package/commands/create-lib/models/generate-lib-schema.d.ts +20 -20
- package/commands/create-lib/models/generate-lib-schema.js +8 -8
- package/commands/create-lib/models/generate-lib-schema.js.map +1 -1
- package/commands/create-lib/models/index.d.ts +1 -1
- package/commands/create-lib/models/index.js +4 -17
- package/commands/create-lib/models/index.js.map +1 -1
- package/commands/proxy-add/index.d.ts +2 -2
- package/commands/proxy-add/index.js +41 -41
- package/commands/proxy-add/index.js.map +1 -1
- package/commands/proxy-index/index.d.ts +5 -5
- package/commands/proxy-index/index.js +14 -14
- package/commands/proxy-index/index.js.map +1 -1
- package/commands/proxy-refresh/index.d.ts +3 -3
- package/commands/proxy-refresh/index.js +27 -27
- package/commands/proxy-refresh/index.js.map +1 -1
- package/commands/proxy-remove/index.d.ts +3 -3
- package/commands/proxy-remove/index.js +33 -33
- package/commands/proxy-remove/index.js.map +1 -1
- package/commands/ssr-add/index.d.ts +11 -11
- package/commands/ssr-add/index.js +360 -361
- package/commands/ssr-add/index.js.map +1 -1
- package/commands/ssr-add/server/index.d.ts +10 -10
- package/commands/ssr-add/server/index.js +209 -205
- package/commands/ssr-add/server/index.js.map +1 -1
- package/commands/ssr-add/server/index.ts +6 -2
- package/constants/api.d.ts +1 -1
- package/constants/api.js +4 -4
- package/constants/index.d.ts +4 -4
- package/constants/index.js +7 -20
- package/constants/index.js.map +1 -1
- package/constants/proxy.d.ts +4 -4
- package/constants/proxy.js +7 -7
- package/constants/symbols.d.ts +1 -1
- package/constants/symbols.js +4 -4
- package/constants/system-types.d.ts +1 -1
- package/constants/system-types.js +29 -29
- package/constants/volo.d.ts +5 -5
- package/constants/volo.js +34 -34
- package/enums/binding-source-id.d.ts +8 -7
- package/enums/binding-source-id.js +12 -11
- package/enums/binding-source-id.js.map +1 -1
- package/enums/exception.d.ts +17 -17
- package/enums/exception.js +2 -2
- package/enums/import-keyword.d.ts +4 -4
- package/enums/import-keyword.js +8 -8
- package/enums/import-keyword.js.map +1 -1
- package/enums/index.d.ts +5 -5
- package/enums/index.js +8 -21
- package/enums/index.js.map +1 -1
- package/enums/method-modifier.d.ts +6 -6
- package/enums/method-modifier.js +10 -10
- package/enums/method-modifier.js.map +1 -1
- package/enums/service-types.d.ts +6 -6
- package/enums/service-types.js +10 -10
- package/enums/service-types.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +6 -19
- package/index.js.map +1 -1
- package/models/api-definition.d.ts +97 -93
- package/models/api-definition.js +2 -2
- package/models/generate-proxy-schema.d.ts +28 -28
- package/models/generate-proxy-schema.js +2 -2
- package/models/import.d.ts +11 -11
- package/models/import.js +13 -13
- package/models/index.d.ts +11 -11
- package/models/index.js +14 -27
- package/models/index.js.map +1 -1
- package/models/method.d.ts +36 -34
- package/models/method.js +73 -70
- package/models/method.js.map +1 -1
- package/models/model.d.ts +48 -48
- package/models/model.js +76 -76
- package/models/model.js.map +1 -1
- package/models/project.d.ts +5 -5
- package/models/project.js +2 -2
- package/models/proxy-config.d.ts +4 -4
- package/models/proxy-config.js +2 -2
- package/models/rule.d.ts +2 -2
- package/models/rule.js +2 -2
- package/models/service.d.ts +21 -21
- package/models/service.js +11 -11
- package/models/tree.d.ts +1 -1
- package/models/tree.js +2 -2
- package/models/util.d.ts +7 -7
- package/models/util.js +2 -2
- package/package.json +6 -6
- package/utils/angular/add-declaration-to-ng-module.d.ts +20 -20
- package/utils/angular/add-declaration-to-ng-module.js +45 -45
- package/utils/angular/add-declaration-to-ng-module.js.map +1 -1
- package/utils/angular/ast-utils.d.ts +106 -106
- package/utils/angular/ast-utils.js +518 -518
- package/utils/angular/ast-utils.js.map +1 -1
- package/utils/angular/change.d.ts +68 -68
- package/utils/angular/change.js +121 -121
- package/utils/angular/change.js.map +1 -1
- package/utils/angular/dependencies.d.ts +23 -23
- package/utils/angular/dependencies.js +56 -56
- package/utils/angular/dependencies.js.map +1 -1
- package/utils/angular/dependency.d.ts +96 -96
- package/utils/angular/dependency.js +123 -122
- package/utils/angular/dependency.js.map +1 -1
- package/utils/angular/eol.d.ts +8 -8
- package/utils/angular/eol.js +22 -23
- package/utils/angular/eol.js.map +1 -1
- package/utils/angular/find-module.d.ts +33 -33
- package/utils/angular/find-module.js +105 -105
- package/utils/angular/find-module.js.map +1 -1
- package/utils/angular/generate-from-files.d.ts +19 -19
- package/utils/angular/generate-from-files.js +48 -49
- package/utils/angular/generate-from-files.js.map +1 -1
- package/utils/angular/index.d.ts +15 -15
- package/utils/angular/index.js +18 -31
- package/utils/angular/index.js.map +1 -1
- package/utils/angular/json-file.d.ts +24 -24
- package/utils/angular/json-file.js +71 -71
- package/utils/angular/json-file.js.map +1 -1
- package/utils/angular/latest-versions/index.d.ts +28 -28
- package/utils/angular/latest-versions/index.js +31 -31
- package/utils/angular/ng-ast-utils.d.ts +12 -12
- package/utils/angular/ng-ast-utils.js +79 -79
- package/utils/angular/ng-ast-utils.js.map +1 -1
- package/utils/angular/parse-name.d.ts +13 -13
- package/utils/angular/parse-name.js +19 -20
- package/utils/angular/parse-name.js.map +1 -1
- package/utils/angular/paths.d.ts +8 -8
- package/utils/angular/paths.js +17 -18
- package/utils/angular/paths.js.map +1 -1
- package/utils/angular/project-targets.d.ts +11 -11
- package/utils/angular/project-targets.js +21 -22
- package/utils/angular/project-targets.js.map +1 -1
- package/utils/angular/standalone/app_component.d.ts +29 -29
- package/utils/angular/standalone/app_component.js +107 -107
- package/utils/angular/standalone/app_component.js.map +1 -1
- package/utils/angular/standalone/app_config.d.ts +23 -23
- package/utils/angular/standalone/app_config.js +89 -89
- package/utils/angular/standalone/app_config.js.map +1 -1
- package/utils/angular/standalone/code_block.d.ts +53 -53
- package/utils/angular/standalone/code_block.js +80 -79
- package/utils/angular/standalone/code_block.js.map +1 -1
- package/utils/angular/standalone/index.d.ts +9 -9
- package/utils/angular/standalone/index.js +13 -13
- package/utils/angular/standalone/rules.d.ts +45 -45
- package/utils/angular/standalone/rules.js +187 -188
- package/utils/angular/standalone/rules.js.map +1 -1
- package/utils/angular/standalone/util.d.ts +35 -35
- package/utils/angular/standalone/util.js +135 -135
- package/utils/angular/standalone/util.js.map +1 -1
- package/utils/angular/test/create-app-module.d.ts +9 -9
- package/utils/angular/test/create-app-module.js +14 -15
- package/utils/angular/test/create-app-module.js.map +1 -1
- package/utils/angular/test/get-file-content.d.ts +9 -9
- package/utils/angular/test/get-file-content.js +17 -18
- package/utils/angular/test/get-file-content.js.map +1 -1
- package/utils/angular/test/index.d.ts +9 -9
- package/utils/angular/test/index.js +12 -25
- package/utils/angular/test/index.js.map +1 -1
- package/utils/angular/validation.d.ts +10 -10
- package/utils/angular/validation.js +28 -28
- package/utils/angular/validation.js.map +1 -1
- package/utils/angular/workspace-models.d.ts +167 -167
- package/utils/angular/workspace-models.js +43 -43
- package/utils/angular/workspace-models.js.map +1 -1
- package/utils/angular/workspace.d.ts +65 -65
- package/utils/angular/workspace.js +135 -135
- package/utils/angular/workspace.js.map +1 -1
- package/utils/angular-schematic/generate-lib.d.ts +3 -3
- package/utils/angular-schematic/generate-lib.js +52 -53
- package/utils/angular-schematic/generate-lib.js.map +1 -1
- package/utils/angular-schematic/index.d.ts +1 -1
- package/utils/angular-schematic/index.js +4 -17
- package/utils/angular-schematic/index.js.map +1 -1
- package/utils/api.d.ts +2 -2
- package/utils/api.js +7 -8
- package/utils/api.js.map +1 -1
- package/utils/ast.d.ts +5 -5
- package/utils/ast.js +28 -28
- package/utils/ast.js.map +1 -1
- package/utils/barrel.d.ts +4 -4
- package/utils/barrel.js +86 -87
- package/utils/barrel.js.map +1 -1
- package/utils/common.d.ts +11 -11
- package/utils/common.js +78 -78
- package/utils/common.js.map +1 -1
- package/utils/enum.d.ts +18 -18
- package/utils/enum.js +39 -40
- package/utils/enum.js.map +1 -1
- package/utils/file.d.ts +2 -2
- package/utils/file.js +8 -9
- package/utils/file.js.map +1 -1
- package/utils/generics.d.ts +26 -26
- package/utils/generics.js +89 -89
- package/utils/generics.js.map +1 -1
- package/utils/import.d.ts +3 -3
- package/utils/import.js +10 -11
- package/utils/import.js.map +1 -1
- package/utils/index.d.ts +22 -22
- package/utils/index.js +25 -38
- package/utils/index.js.map +1 -1
- package/utils/methods.d.ts +4 -4
- package/utils/methods.js +31 -29
- package/utils/methods.js.map +1 -1
- package/utils/model.d.ts +14 -14
- package/utils/model.js +217 -211
- package/utils/model.js.map +1 -1
- package/utils/namespace.d.ts +1 -1
- package/utils/namespace.js +17 -18
- package/utils/namespace.js.map +1 -1
- package/utils/ng-module.d.ts +46 -46
- package/utils/ng-module.js +126 -125
- package/utils/ng-module.js.map +1 -1
- package/utils/path.d.ts +2 -2
- package/utils/path.js +35 -36
- package/utils/path.js.map +1 -1
- package/utils/rule.d.ts +4 -4
- package/utils/rule.js +32 -33
- package/utils/rule.js.map +1 -1
- package/utils/service.d.ts +8 -8
- package/utils/service.js +280 -171
- package/utils/service.js.map +1 -1
- package/utils/source.d.ts +13 -13
- package/utils/source.js +165 -165
- package/utils/source.js.map +1 -1
- package/utils/standalone.d.ts +59 -59
- package/utils/standalone.js +146 -145
- package/utils/standalone.js.map +1 -1
- package/utils/text.d.ts +10 -10
- package/utils/text.js +59 -59
- package/utils/text.js.map +1 -1
- package/utils/tree.d.ts +14 -14
- package/utils/tree.js +83 -83
- package/utils/tree.js.map +1 -1
- package/utils/type.d.ts +13 -13
- package/utils/type.js +112 -113
- package/utils/type.js.map +1 -1
- package/utils/workspace.d.ts +20 -20
- package/utils/workspace.js +113 -114
- package/utils/workspace.js.map +1 -1
|
@@ -1,363 +1,362 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5
|
-
*
|
|
6
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.updateIndexHtml =
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
pkg.scripts
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
'
|
|
89
|
-
'
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
files.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function updateApplicationBuilderWorkspaceConfigRule(projectSourceRoot, options, { logger }) {
|
|
174
|
-
return (0, angular_1.updateWorkspace)(workspace => {
|
|
175
|
-
const buildTarget = workspace.projects.get(options.project)?.targets.get('build');
|
|
176
|
-
if (!buildTarget) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
let outputPath = buildTarget.options?.outputPath;
|
|
180
|
-
if (outputPath && (0, core_1.isJsonObject)(outputPath)) {
|
|
181
|
-
if (outputPath.browser === '') {
|
|
182
|
-
const base = outputPath.base;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.updateIndexHtml = updateIndexHtml;
|
|
11
|
+
exports.default = default_1;
|
|
12
|
+
const core_1 = require("@angular-devkit/core");
|
|
13
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
+
const node_path_1 = require("node:path");
|
|
15
|
+
const angular_1 = require("../../utils/angular");
|
|
16
|
+
const json_file_1 = require("../../utils/angular/json-file");
|
|
17
|
+
const latest_versions_1 = require("../../utils/angular/latest-versions");
|
|
18
|
+
const ng_ast_utils_1 = require("../../utils/angular/ng-ast-utils");
|
|
19
|
+
const project_targets_1 = require("../../utils/angular/project-targets");
|
|
20
|
+
const util_1 = require("../../utils/angular/standalone/util");
|
|
21
|
+
const workspace_1 = require("../../utils/angular/workspace");
|
|
22
|
+
const SERVE_SSR_TARGET_NAME = 'serve-ssr';
|
|
23
|
+
const PRERENDER_TARGET_NAME = 'prerender';
|
|
24
|
+
const DEFAULT_BROWSER_DIR = 'browser';
|
|
25
|
+
const DEFAULT_MEDIA_DIR = 'media';
|
|
26
|
+
const DEFAULT_SERVER_DIR = 'server';
|
|
27
|
+
async function getLegacyOutputPaths(host, projectName, target) {
|
|
28
|
+
// Generate new output paths
|
|
29
|
+
const workspace = await (0, angular_1.readWorkspace)(host);
|
|
30
|
+
const project = workspace.projects.get(projectName);
|
|
31
|
+
const architectTarget = project?.targets.get(target);
|
|
32
|
+
if (!architectTarget?.options) {
|
|
33
|
+
throw new schematics_1.SchematicsException(`Cannot find 'options' for ${projectName} ${target} target.`);
|
|
34
|
+
}
|
|
35
|
+
const { outputPath } = architectTarget.options;
|
|
36
|
+
if (typeof outputPath !== 'string') {
|
|
37
|
+
throw new schematics_1.SchematicsException(`outputPath for ${projectName} ${target} target is not a string.`);
|
|
38
|
+
}
|
|
39
|
+
return outputPath;
|
|
40
|
+
}
|
|
41
|
+
async function getApplicationBuilderOutputPaths(host, projectName) {
|
|
42
|
+
// Generate new output paths
|
|
43
|
+
const target = 'build';
|
|
44
|
+
const workspace = await (0, angular_1.readWorkspace)(host);
|
|
45
|
+
const project = workspace.projects.get(projectName);
|
|
46
|
+
const architectTarget = project?.targets.get(target);
|
|
47
|
+
if (!architectTarget?.options) {
|
|
48
|
+
throw new schematics_1.SchematicsException(`Cannot find 'options' for ${projectName} ${target} target.`);
|
|
49
|
+
}
|
|
50
|
+
let { outputPath } = architectTarget.options;
|
|
51
|
+
// Use default if not explicitly specified
|
|
52
|
+
outputPath ?? (outputPath = node_path_1.posix.join('dist', projectName));
|
|
53
|
+
const defaultDirs = {
|
|
54
|
+
server: DEFAULT_SERVER_DIR,
|
|
55
|
+
browser: DEFAULT_BROWSER_DIR,
|
|
56
|
+
};
|
|
57
|
+
if (outputPath && (0, core_1.isJsonObject)(outputPath)) {
|
|
58
|
+
return {
|
|
59
|
+
...defaultDirs,
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
|
+
...outputPath,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (typeof outputPath !== 'string') {
|
|
65
|
+
throw new schematics_1.SchematicsException(`outputPath for ${projectName} ${target} target is not a string.`);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
base: outputPath,
|
|
69
|
+
...defaultDirs,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function addScriptsRule({ project }, isUsingApplicationBuilder) {
|
|
73
|
+
return async (host) => {
|
|
74
|
+
const pkgPath = '/package.json';
|
|
75
|
+
const pkg = host.readJson(pkgPath);
|
|
76
|
+
if (pkg === null) {
|
|
77
|
+
throw new schematics_1.SchematicsException('Could not find package.json');
|
|
78
|
+
}
|
|
79
|
+
if (isUsingApplicationBuilder) {
|
|
80
|
+
const { base, server } = await getApplicationBuilderOutputPaths(host, project);
|
|
81
|
+
pkg.scripts ?? (pkg.scripts = {});
|
|
82
|
+
pkg.scripts[`serve:ssr:${project}`] = `node ${node_path_1.posix.join(base, server)}/server.mjs`;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
const serverDist = await getLegacyOutputPaths(host, project, 'server');
|
|
86
|
+
pkg.scripts = {
|
|
87
|
+
...pkg.scripts,
|
|
88
|
+
'dev:ssr': `ng run ${project}:${SERVE_SSR_TARGET_NAME}`,
|
|
89
|
+
'serve:ssr': `node ${serverDist}/main.js`,
|
|
90
|
+
'build:ssr': `ng build && ng run ${project}:server`,
|
|
91
|
+
prerender: `ng run ${project}:${PRERENDER_TARGET_NAME}`,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
host.overwrite(pkgPath, JSON.stringify(pkg, null, 2));
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function updateApplicationBuilderTsConfigRule(options) {
|
|
98
|
+
return async (host) => {
|
|
99
|
+
const workspace = await (0, angular_1.readWorkspace)(host);
|
|
100
|
+
const project = workspace.projects.get(options.project);
|
|
101
|
+
const buildTarget = project?.targets.get('build');
|
|
102
|
+
if (!buildTarget || !buildTarget.options) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const tsConfigPath = buildTarget.options.tsConfig;
|
|
106
|
+
if (!tsConfigPath || typeof tsConfigPath !== 'string') {
|
|
107
|
+
// No tsconfig path
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const json = new json_file_1.JSONFile(host, tsConfigPath);
|
|
111
|
+
const include = json.get(['include']);
|
|
112
|
+
if (Array.isArray(include) && include.includes('src/**/*.ts')) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const filesPath = ['files'];
|
|
116
|
+
const files = new Set(json.get(filesPath) ?? []);
|
|
117
|
+
files.add('src/server.ts');
|
|
118
|
+
json.modify(filesPath, [...files]);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function updateRootTsConfigRule(options) {
|
|
122
|
+
return async (host) => {
|
|
123
|
+
const workspace = await (0, angular_1.readWorkspace)(host);
|
|
124
|
+
const project = workspace.projects.get(options.project);
|
|
125
|
+
let tsConfigPath = options.tsconfigPath;
|
|
126
|
+
if (!tsConfigPath && project) {
|
|
127
|
+
const projRoot = (0, core_1.normalize)(project.root || '');
|
|
128
|
+
const candidate = projRoot ? (0, core_1.join)(projRoot, 'tsconfig.json') : 'tsconfig.json';
|
|
129
|
+
if (host.exists(candidate)) {
|
|
130
|
+
tsConfigPath = candidate;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (!tsConfigPath && host.exists('tsconfig.json')) {
|
|
134
|
+
tsConfigPath = 'tsconfig.json';
|
|
135
|
+
}
|
|
136
|
+
if (!tsConfigPath || !host.exists(tsConfigPath)) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const json = new json_file_1.JSONFile(host, tsConfigPath);
|
|
140
|
+
const moduleResolutionPath = ['compilerOptions', 'moduleResolution'];
|
|
141
|
+
const modulePath = ['compilerOptions', 'module'];
|
|
142
|
+
const currentModuleResolution = json.get(moduleResolutionPath);
|
|
143
|
+
if (currentModuleResolution !== 'bundler') {
|
|
144
|
+
json.modify(moduleResolutionPath, 'bundler');
|
|
145
|
+
}
|
|
146
|
+
const currentModule = json.get(modulePath);
|
|
147
|
+
if (currentModule !== 'preserve') {
|
|
148
|
+
json.modify(modulePath, 'preserve');
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function updateIndexHtml(options) {
|
|
153
|
+
return async (host) => {
|
|
154
|
+
const workspace = await (0, workspace_1.getWorkspace)(host);
|
|
155
|
+
const project = workspace.projects.get(options.project);
|
|
156
|
+
if (!project) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const buildOptions = project.targets.get('build')?.options;
|
|
160
|
+
const indexPath = buildOptions?.index;
|
|
161
|
+
if (!indexPath || !host.exists(indexPath)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const buffer = host.read(indexPath);
|
|
165
|
+
if (!buffer)
|
|
166
|
+
return;
|
|
167
|
+
const content = buffer.toString('utf-8');
|
|
168
|
+
const loaderDiv = `<div id="lp-page-loader"></div>`;
|
|
169
|
+
let updatedContent = content.replace(loaderDiv, '');
|
|
170
|
+
host.overwrite(indexPath, updatedContent);
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function updateApplicationBuilderWorkspaceConfigRule(projectSourceRoot, options, { logger }) {
|
|
174
|
+
return (0, angular_1.updateWorkspace)(workspace => {
|
|
175
|
+
const buildTarget = workspace.projects.get(options.project)?.targets.get('build');
|
|
176
|
+
if (!buildTarget) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
let outputPath = buildTarget.options?.outputPath;
|
|
180
|
+
if (outputPath && (0, core_1.isJsonObject)(outputPath)) {
|
|
181
|
+
if (outputPath.browser === '') {
|
|
182
|
+
const base = outputPath.base;
|
|
183
183
|
logger.warn(`The output location of the browser build has been updated from "${base}" to "${node_path_1.posix.join(base, DEFAULT_BROWSER_DIR)}".
|
|
184
|
-
You might need to adjust your deployment pipeline.`);
|
|
185
|
-
if ((outputPath.media && outputPath.media !== DEFAULT_MEDIA_DIR) ||
|
|
186
|
-
(outputPath.server && outputPath.server !== DEFAULT_SERVER_DIR)) {
|
|
187
|
-
delete outputPath.browser;
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
outputPath = outputPath.base;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
buildTarget.options = {
|
|
195
|
-
...buildTarget.options,
|
|
196
|
-
outputPath,
|
|
197
|
-
outputMode: 'server',
|
|
198
|
-
ssr: {
|
|
199
|
-
entry: (0, core_1.join)((0, core_1.normalize)(projectSourceRoot), 'server.ts'),
|
|
200
|
-
},
|
|
201
|
-
};
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
function updateWebpackBuilderWorkspaceConfigRule(projectSourceRoot, options) {
|
|
205
|
-
return (0, angular_1.updateWorkspace)(workspace => {
|
|
206
|
-
const projectName = options.project;
|
|
207
|
-
const project = workspace.projects.get(projectName);
|
|
208
|
-
if (!project) {
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
212
|
-
const serverTarget = project.targets.get('server');
|
|
213
|
-
(serverTarget.options ?? (serverTarget.options = {})).main = node_path_1.posix.join(projectSourceRoot, 'server.ts');
|
|
214
|
-
const serveSSRTarget = project.targets.get(SERVE_SSR_TARGET_NAME);
|
|
215
|
-
if (serveSSRTarget) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
project.targets.add({
|
|
219
|
-
name: SERVE_SSR_TARGET_NAME,
|
|
220
|
-
builder: '@angular-devkit/build-angular:ssr-dev-server',
|
|
221
|
-
defaultConfiguration: 'development',
|
|
222
|
-
options: {},
|
|
223
|
-
configurations: {
|
|
224
|
-
development: {
|
|
225
|
-
browserTarget: `${projectName}:build:development`,
|
|
226
|
-
serverTarget: `${projectName}:server:development`,
|
|
227
|
-
},
|
|
228
|
-
production: {
|
|
229
|
-
browserTarget: `${projectName}:build:production`,
|
|
230
|
-
serverTarget: `${projectName}:server:production`,
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
});
|
|
234
|
-
const prerenderTarget = project.targets.get(PRERENDER_TARGET_NAME);
|
|
235
|
-
if (prerenderTarget) {
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
project.targets.add({
|
|
239
|
-
name: PRERENDER_TARGET_NAME,
|
|
240
|
-
builder: '@angular-devkit/build-angular:prerender',
|
|
241
|
-
defaultConfiguration: 'production',
|
|
242
|
-
options: {
|
|
243
|
-
routes: ['/'],
|
|
244
|
-
},
|
|
245
|
-
configurations: {
|
|
246
|
-
production: {
|
|
247
|
-
browserTarget: `${projectName}:build:production`,
|
|
248
|
-
serverTarget: `${projectName}:server:production`,
|
|
249
|
-
},
|
|
250
|
-
development: {
|
|
251
|
-
browserTarget: `${projectName}:build:development`,
|
|
252
|
-
serverTarget: `${projectName}:server:development`,
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
function updateWebpackBuilderServerTsConfigRule(options) {
|
|
259
|
-
return async (host) => {
|
|
260
|
-
const workspace = await (0, angular_1.readWorkspace)(host);
|
|
261
|
-
const project = workspace.projects.get(options.project);
|
|
262
|
-
const serverTarget = project?.targets.get('server');
|
|
263
|
-
if (!serverTarget || !serverTarget.options) {
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
const tsConfigPath = serverTarget.options.tsConfig;
|
|
267
|
-
if (!tsConfigPath || typeof tsConfigPath !== 'string') {
|
|
268
|
-
// No tsconfig path
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
const tsConfig = new json_file_1.JSONFile(host, tsConfigPath);
|
|
272
|
-
const filesAstNode = tsConfig.get(['files']);
|
|
273
|
-
const serverFilePath = 'src/server.ts';
|
|
274
|
-
if (Array.isArray(filesAstNode) && !filesAstNode.some(({ text }) => text === serverFilePath)) {
|
|
275
|
-
tsConfig.modify(['files'], [...filesAstNode, serverFilePath]);
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
function addDependencies({ skipInstall }, isUsingApplicationBuilder) {
|
|
280
|
-
const install = skipInstall ? angular_1.InstallBehavior.None : angular_1.InstallBehavior.Auto;
|
|
281
|
-
const rules = [
|
|
282
|
-
(0, angular_1.addDependency)('express', latest_versions_1.latestVersions.dependencies.express, {
|
|
283
|
-
type: angular_1.DependencyType.Default,
|
|
284
|
-
install,
|
|
285
|
-
existing: angular_1.ExistingBehavior.Replace,
|
|
286
|
-
}),
|
|
287
|
-
(0, angular_1.addDependency)('@types/express', latest_versions_1.latestVersions.dependencies['@types/express'], {
|
|
288
|
-
type: angular_1.DependencyType.Dev,
|
|
289
|
-
install,
|
|
290
|
-
existing: angular_1.ExistingBehavior.Replace,
|
|
291
|
-
}),
|
|
292
|
-
(0, angular_1.addDependency)('openid-client', latest_versions_1.latestVersions.dependencies['openid-client'], {
|
|
293
|
-
type: angular_1.DependencyType.Default,
|
|
294
|
-
install,
|
|
295
|
-
existing: angular_1.ExistingBehavior.Skip,
|
|
296
|
-
}),
|
|
297
|
-
];
|
|
298
|
-
if (!isUsingApplicationBuilder) {
|
|
299
|
-
rules.push((0, angular_1.addDependency)('browser-sync', latest_versions_1.latestVersions.dependencies['browser-sync'], {
|
|
300
|
-
type: angular_1.DependencyType.Dev,
|
|
301
|
-
install,
|
|
302
|
-
}));
|
|
303
|
-
}
|
|
304
|
-
return (0, schematics_1.chain)(rules);
|
|
305
|
-
}
|
|
306
|
-
function addServerFile(projectSourceRoot, options, isStandalone) {
|
|
307
|
-
return async (host) => {
|
|
308
|
-
const projectName = options.project;
|
|
309
|
-
const workspace = await (0, angular_1.readWorkspace)(host);
|
|
310
|
-
const project = workspace.projects.get(projectName);
|
|
311
|
-
if (!project) {
|
|
312
|
-
throw new schematics_1.SchematicsException(`Invalid project name (${projectName})`);
|
|
313
|
-
}
|
|
314
|
-
const usingApplicationBuilder = (0, project_targets_1.isUsingApplicationBuilder)(project);
|
|
315
|
-
const browserDistDirectory = usingApplicationBuilder
|
|
316
|
-
? (await getApplicationBuilderOutputPaths(host, projectName)).browser
|
|
317
|
-
: await getLegacyOutputPaths(host, projectName, 'build');
|
|
318
|
-
return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(`./files/${usingApplicationBuilder ? 'application-builder' : 'server-builder'}`), [
|
|
319
|
-
(0, schematics_1.applyTemplates)({
|
|
320
|
-
...core_1.strings,
|
|
321
|
-
...options,
|
|
322
|
-
browserDistDirectory,
|
|
323
|
-
isStandalone,
|
|
324
|
-
}),
|
|
325
|
-
(0, schematics_1.move)(projectSourceRoot),
|
|
326
|
-
]));
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
function default_1(options) {
|
|
330
|
-
return async (host, context) => {
|
|
331
|
-
const browserEntryPoint = await (0, util_1.getMainFilePath)(host, options.project);
|
|
332
|
-
const isStandalone = (0, ng_ast_utils_1.isStandaloneApp)(host, browserEntryPoint);
|
|
333
|
-
const workspace = await (0, workspace_1.getWorkspace)(host);
|
|
334
|
-
const clientProject = workspace.projects.get(options.project);
|
|
335
|
-
if (!clientProject) {
|
|
336
|
-
throw (0, project_targets_1.targetBuildNotFoundError)();
|
|
337
|
-
}
|
|
338
|
-
const usingApplicationBuilder = (0, project_targets_1.isUsingApplicationBuilder)(clientProject);
|
|
339
|
-
const sourceRoot = clientProject.sourceRoot ?? node_path_1.posix.join(clientProject.root, 'src');
|
|
340
|
-
return (0, schematics_1.chain)([
|
|
341
|
-
(0, schematics_1.schematic)('server', {
|
|
342
|
-
...options,
|
|
343
|
-
skipInstall: true,
|
|
344
|
-
}),
|
|
345
|
-
...(usingApplicationBuilder
|
|
346
|
-
? [
|
|
347
|
-
updateApplicationBuilderWorkspaceConfigRule(sourceRoot, options, context),
|
|
348
|
-
updateApplicationBuilderTsConfigRule(options),
|
|
349
|
-
updateRootTsConfigRule(options)
|
|
350
|
-
]
|
|
351
|
-
: [
|
|
352
|
-
updateWebpackBuilderServerTsConfigRule(options),
|
|
353
|
-
updateWebpackBuilderWorkspaceConfigRule(sourceRoot, options),
|
|
354
|
-
]),
|
|
355
|
-
addServerFile(sourceRoot, options, isStandalone),
|
|
356
|
-
addScriptsRule(options, usingApplicationBuilder),
|
|
357
|
-
addDependencies(options, usingApplicationBuilder),
|
|
358
|
-
updateIndexHtml(options),
|
|
359
|
-
]);
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
exports.default = default_1;
|
|
184
|
+
You might need to adjust your deployment pipeline.`);
|
|
185
|
+
if ((outputPath.media && outputPath.media !== DEFAULT_MEDIA_DIR) ||
|
|
186
|
+
(outputPath.server && outputPath.server !== DEFAULT_SERVER_DIR)) {
|
|
187
|
+
delete outputPath.browser;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
outputPath = outputPath.base;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
buildTarget.options = {
|
|
195
|
+
...buildTarget.options,
|
|
196
|
+
outputPath,
|
|
197
|
+
outputMode: 'server',
|
|
198
|
+
ssr: {
|
|
199
|
+
entry: (0, core_1.join)((0, core_1.normalize)(projectSourceRoot), 'server.ts'),
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function updateWebpackBuilderWorkspaceConfigRule(projectSourceRoot, options) {
|
|
205
|
+
return (0, angular_1.updateWorkspace)(workspace => {
|
|
206
|
+
const projectName = options.project;
|
|
207
|
+
const project = workspace.projects.get(projectName);
|
|
208
|
+
if (!project) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
212
|
+
const serverTarget = project.targets.get('server');
|
|
213
|
+
(serverTarget.options ?? (serverTarget.options = {})).main = node_path_1.posix.join(projectSourceRoot, 'server.ts');
|
|
214
|
+
const serveSSRTarget = project.targets.get(SERVE_SSR_TARGET_NAME);
|
|
215
|
+
if (serveSSRTarget) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
project.targets.add({
|
|
219
|
+
name: SERVE_SSR_TARGET_NAME,
|
|
220
|
+
builder: '@angular-devkit/build-angular:ssr-dev-server',
|
|
221
|
+
defaultConfiguration: 'development',
|
|
222
|
+
options: {},
|
|
223
|
+
configurations: {
|
|
224
|
+
development: {
|
|
225
|
+
browserTarget: `${projectName}:build:development`,
|
|
226
|
+
serverTarget: `${projectName}:server:development`,
|
|
227
|
+
},
|
|
228
|
+
production: {
|
|
229
|
+
browserTarget: `${projectName}:build:production`,
|
|
230
|
+
serverTarget: `${projectName}:server:production`,
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
});
|
|
234
|
+
const prerenderTarget = project.targets.get(PRERENDER_TARGET_NAME);
|
|
235
|
+
if (prerenderTarget) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
project.targets.add({
|
|
239
|
+
name: PRERENDER_TARGET_NAME,
|
|
240
|
+
builder: '@angular-devkit/build-angular:prerender',
|
|
241
|
+
defaultConfiguration: 'production',
|
|
242
|
+
options: {
|
|
243
|
+
routes: ['/'],
|
|
244
|
+
},
|
|
245
|
+
configurations: {
|
|
246
|
+
production: {
|
|
247
|
+
browserTarget: `${projectName}:build:production`,
|
|
248
|
+
serverTarget: `${projectName}:server:production`,
|
|
249
|
+
},
|
|
250
|
+
development: {
|
|
251
|
+
browserTarget: `${projectName}:build:development`,
|
|
252
|
+
serverTarget: `${projectName}:server:development`,
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function updateWebpackBuilderServerTsConfigRule(options) {
|
|
259
|
+
return async (host) => {
|
|
260
|
+
const workspace = await (0, angular_1.readWorkspace)(host);
|
|
261
|
+
const project = workspace.projects.get(options.project);
|
|
262
|
+
const serverTarget = project?.targets.get('server');
|
|
263
|
+
if (!serverTarget || !serverTarget.options) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
const tsConfigPath = serverTarget.options.tsConfig;
|
|
267
|
+
if (!tsConfigPath || typeof tsConfigPath !== 'string') {
|
|
268
|
+
// No tsconfig path
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
const tsConfig = new json_file_1.JSONFile(host, tsConfigPath);
|
|
272
|
+
const filesAstNode = tsConfig.get(['files']);
|
|
273
|
+
const serverFilePath = 'src/server.ts';
|
|
274
|
+
if (Array.isArray(filesAstNode) && !filesAstNode.some(({ text }) => text === serverFilePath)) {
|
|
275
|
+
tsConfig.modify(['files'], [...filesAstNode, serverFilePath]);
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function addDependencies({ skipInstall }, isUsingApplicationBuilder) {
|
|
280
|
+
const install = skipInstall ? angular_1.InstallBehavior.None : angular_1.InstallBehavior.Auto;
|
|
281
|
+
const rules = [
|
|
282
|
+
(0, angular_1.addDependency)('express', latest_versions_1.latestVersions.dependencies.express, {
|
|
283
|
+
type: angular_1.DependencyType.Default,
|
|
284
|
+
install,
|
|
285
|
+
existing: angular_1.ExistingBehavior.Replace,
|
|
286
|
+
}),
|
|
287
|
+
(0, angular_1.addDependency)('@types/express', latest_versions_1.latestVersions.dependencies['@types/express'], {
|
|
288
|
+
type: angular_1.DependencyType.Dev,
|
|
289
|
+
install,
|
|
290
|
+
existing: angular_1.ExistingBehavior.Replace,
|
|
291
|
+
}),
|
|
292
|
+
(0, angular_1.addDependency)('openid-client', latest_versions_1.latestVersions.dependencies['openid-client'], {
|
|
293
|
+
type: angular_1.DependencyType.Default,
|
|
294
|
+
install,
|
|
295
|
+
existing: angular_1.ExistingBehavior.Skip,
|
|
296
|
+
}),
|
|
297
|
+
];
|
|
298
|
+
if (!isUsingApplicationBuilder) {
|
|
299
|
+
rules.push((0, angular_1.addDependency)('browser-sync', latest_versions_1.latestVersions.dependencies['browser-sync'], {
|
|
300
|
+
type: angular_1.DependencyType.Dev,
|
|
301
|
+
install,
|
|
302
|
+
}));
|
|
303
|
+
}
|
|
304
|
+
return (0, schematics_1.chain)(rules);
|
|
305
|
+
}
|
|
306
|
+
function addServerFile(projectSourceRoot, options, isStandalone) {
|
|
307
|
+
return async (host) => {
|
|
308
|
+
const projectName = options.project;
|
|
309
|
+
const workspace = await (0, angular_1.readWorkspace)(host);
|
|
310
|
+
const project = workspace.projects.get(projectName);
|
|
311
|
+
if (!project) {
|
|
312
|
+
throw new schematics_1.SchematicsException(`Invalid project name (${projectName})`);
|
|
313
|
+
}
|
|
314
|
+
const usingApplicationBuilder = (0, project_targets_1.isUsingApplicationBuilder)(project);
|
|
315
|
+
const browserDistDirectory = usingApplicationBuilder
|
|
316
|
+
? (await getApplicationBuilderOutputPaths(host, projectName)).browser
|
|
317
|
+
: await getLegacyOutputPaths(host, projectName, 'build');
|
|
318
|
+
return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(`./files/${usingApplicationBuilder ? 'application-builder' : 'server-builder'}`), [
|
|
319
|
+
(0, schematics_1.applyTemplates)({
|
|
320
|
+
...core_1.strings,
|
|
321
|
+
...options,
|
|
322
|
+
browserDistDirectory,
|
|
323
|
+
isStandalone,
|
|
324
|
+
}),
|
|
325
|
+
(0, schematics_1.move)(projectSourceRoot),
|
|
326
|
+
]));
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
function default_1(options) {
|
|
330
|
+
return async (host, context) => {
|
|
331
|
+
const browserEntryPoint = await (0, util_1.getMainFilePath)(host, options.project);
|
|
332
|
+
const isStandalone = (0, ng_ast_utils_1.isStandaloneApp)(host, browserEntryPoint);
|
|
333
|
+
const workspace = await (0, workspace_1.getWorkspace)(host);
|
|
334
|
+
const clientProject = workspace.projects.get(options.project);
|
|
335
|
+
if (!clientProject) {
|
|
336
|
+
throw (0, project_targets_1.targetBuildNotFoundError)();
|
|
337
|
+
}
|
|
338
|
+
const usingApplicationBuilder = (0, project_targets_1.isUsingApplicationBuilder)(clientProject);
|
|
339
|
+
const sourceRoot = clientProject.sourceRoot ?? node_path_1.posix.join(clientProject.root, 'src');
|
|
340
|
+
return (0, schematics_1.chain)([
|
|
341
|
+
(0, schematics_1.schematic)('server', {
|
|
342
|
+
...options,
|
|
343
|
+
skipInstall: true,
|
|
344
|
+
}),
|
|
345
|
+
...(usingApplicationBuilder
|
|
346
|
+
? [
|
|
347
|
+
updateApplicationBuilderWorkspaceConfigRule(sourceRoot, options, context),
|
|
348
|
+
updateApplicationBuilderTsConfigRule(options),
|
|
349
|
+
updateRootTsConfigRule(options)
|
|
350
|
+
]
|
|
351
|
+
: [
|
|
352
|
+
updateWebpackBuilderServerTsConfigRule(options),
|
|
353
|
+
updateWebpackBuilderWorkspaceConfigRule(sourceRoot, options),
|
|
354
|
+
]),
|
|
355
|
+
addServerFile(sourceRoot, options, isStandalone),
|
|
356
|
+
addScriptsRule(options, usingApplicationBuilder),
|
|
357
|
+
addDependencies(options, usingApplicationBuilder),
|
|
358
|
+
updateIndexHtml(options),
|
|
359
|
+
]);
|
|
360
|
+
};
|
|
361
|
+
}
|
|
363
362
|
//# sourceMappingURL=index.js.map
|