@rxap/plugin-angular 19.1.0-dev.11 → 19.1.0-dev.12
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/CHANGELOG.md +11 -0
- package/GUIDES.md +26 -0
- package/package.json +8 -8
- package/src/generators/init-application/assert-main-statements.d.ts +4 -0
- package/src/generators/init-application/assert-main-statements.js +76 -0
- package/src/generators/init-application/assert-main-statements.js.map +1 -0
- package/src/generators/init-application/cleanup.d.ts +3 -0
- package/src/generators/init-application/cleanup.js +109 -0
- package/src/generators/init-application/cleanup.js.map +1 -0
- package/src/generators/init-application/coerce-environment-files.d.ts +5 -0
- package/src/generators/init-application/coerce-environment-files.js +76 -0
- package/src/generators/init-application/coerce-environment-files.js.map +1 -0
- package/src/generators/init-application/coerce-localazy-config-file.d.ts +2 -0
- package/src/generators/init-application/coerce-localazy-config-file.js +25 -0
- package/src/generators/init-application/coerce-localazy-config-file.js.map +1 -0
- package/src/generators/init-application/generator.js +20 -689
- package/src/generators/init-application/generator.js.map +1 -1
- package/src/generators/init-application/link-mfe-remote-with-host.d.ts +3 -0
- package/src/generators/init-application/link-mfe-remote-with-host.js +50 -0
- package/src/generators/init-application/link-mfe-remote-with-host.js.map +1 -0
- package/src/generators/init-application/project-i18n-configuration.d.ts +7 -0
- package/src/generators/init-application/project-i18n-configuration.js +3 -0
- package/src/generators/init-application/project-i18n-configuration.js.map +1 -0
- package/src/generators/init-application/update-git-ignore.d.ts +3 -0
- package/src/generators/init-application/update-git-ignore.js +18 -0
- package/src/generators/init-application/update-git-ignore.js.map +1 -0
- package/src/generators/init-application/update-main-file.d.ts +3 -0
- package/src/generators/init-application/update-main-file.js +107 -0
- package/src/generators/init-application/update-main-file.js.map +1 -0
- package/src/generators/init-application/update-project-targets.d.ts +6 -0
- package/src/generators/init-application/update-project-targets.js +216 -0
- package/src/generators/init-application/update-project-targets.js.map +1 -0
- package/src/generators/init-application/update-tags.d.ts +3 -0
- package/src/generators/init-application/update-tags.js +26 -0
- package/src/generators/init-application/update-tags.js.map +1 -0
- package/src/generators/init-application/update-target-defaults.d.ts +3 -0
- package/src/generators/init-application/update-target-defaults.js +32 -0
- package/src/generators/init-application/update-target-defaults.js.map +1 -0
- package/src/generators/init-application/update-ts-config.d.ts +2 -0
- package/src/generators/init-application/update-ts-config.js +31 -0
- package/src/generators/init-application/update-ts-config.js.map +1 -0
- package/src/generators/init-component/generator.js +53 -8
- package/src/generators/init-component/generator.js.map +1 -1
- package/src/generators/init-component/schema.d.ts +3 -1
- package/src/generators/init-component/schema.json +12 -2
|
@@ -10,12 +10,21 @@ const utilities_1 = require("@rxap/utilities");
|
|
|
10
10
|
const workspace_ts_morph_1 = require("@rxap/workspace-ts-morph");
|
|
11
11
|
const workspace_utilities_1 = require("@rxap/workspace-utilities");
|
|
12
12
|
const path_1 = require("path");
|
|
13
|
-
const ts_morph_2 = require("ts-morph");
|
|
14
13
|
const angular_version_1 = require("../../lib/angular-version");
|
|
15
14
|
const coerce_test_setup_1 = require("../../lib/coerce-test-setup");
|
|
15
|
+
const cleanup_1 = require("./cleanup");
|
|
16
|
+
const coerce_environment_files_1 = require("./coerce-environment-files");
|
|
17
|
+
const coerce_localazy_config_file_1 = require("./coerce-localazy-config-file");
|
|
16
18
|
const coerce_project_1 = require("./coerce-project");
|
|
17
19
|
const generate_authentication_1 = require("./generate-authentication");
|
|
18
20
|
const generate_monolithic_1 = require("./generate-monolithic");
|
|
21
|
+
const link_mfe_remote_with_host_1 = require("./link-mfe-remote-with-host");
|
|
22
|
+
const update_git_ignore_1 = require("./update-git-ignore");
|
|
23
|
+
const update_main_file_1 = require("./update-main-file");
|
|
24
|
+
const update_project_targets_1 = require("./update-project-targets");
|
|
25
|
+
const update_tags_1 = require("./update-tags");
|
|
26
|
+
const update_target_defaults_1 = require("./update-target-defaults");
|
|
27
|
+
const update_ts_config_1 = require("./update-ts-config");
|
|
19
28
|
function skipProject(tree, options, project, projectName) {
|
|
20
29
|
if ((0, workspace_utilities_1.SkipNonAngularProject)(tree, options, project, projectName)) {
|
|
21
30
|
return true;
|
|
@@ -25,684 +34,6 @@ function skipProject(tree, options, project, projectName) {
|
|
|
25
34
|
}
|
|
26
35
|
return false;
|
|
27
36
|
}
|
|
28
|
-
function updateProjectTargets(projectName, project, options) {
|
|
29
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
30
|
-
var _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18;
|
|
31
|
-
(_a = project.targets) !== null && _a !== void 0 ? _a : (project.targets = {});
|
|
32
|
-
if (!project.targets['build']) {
|
|
33
|
-
throw new Error(`The project '${project.name}' has no build target`);
|
|
34
|
-
}
|
|
35
|
-
if (!options.skipDocker) {
|
|
36
|
-
if (project.targets['docker']) {
|
|
37
|
-
(_b = (_z = project.targets['docker']).options) !== null && _b !== void 0 ? _b : (_z.options = {});
|
|
38
|
-
(_c = (_0 = project.targets['docker'].options).dockerfile) !== null && _c !== void 0 ? _c : (_0.dockerfile = options.moduleFederation === 'remote' ?
|
|
39
|
-
(0, path_1.join)(project.sourceRoot, 'Dockerfile') :
|
|
40
|
-
'shared/angular/Dockerfile');
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
(0, workspace_utilities_1.CoerceTarget)(project, 'serve', {
|
|
44
|
-
options: {
|
|
45
|
-
proxyConfig: 'shared/angular/proxy.conf.json',
|
|
46
|
-
},
|
|
47
|
-
}, workspace_utilities_1.Strategy.OVERWRITE);
|
|
48
|
-
if (project.targets['extract-i18n']) {
|
|
49
|
-
if (options.i18n) {
|
|
50
|
-
(_d = options.languages) !== null && _d !== void 0 ? _d : (options.languages = []);
|
|
51
|
-
if (options.languages.length === 0) {
|
|
52
|
-
options.languages.push('en');
|
|
53
|
-
}
|
|
54
|
-
(_e = (_1 = project.targets['build']).configurations) !== null && _e !== void 0 ? _e : (_1.configurations = {});
|
|
55
|
-
if (options.overwrite) {
|
|
56
|
-
project.targets['build'].configurations.production.localize = options.languages;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
(_f = (_2 = project.targets['build'].configurations.production).localize) !== null && _f !== void 0 ? _f : (_2.localize = []);
|
|
60
|
-
project.targets['build'].configurations.production.localize.push(...options.languages);
|
|
61
|
-
project.targets['build'].configurations.production.localize
|
|
62
|
-
= project.targets['build'].configurations.production.localize.filter((0, utilities_1.unique)());
|
|
63
|
-
}
|
|
64
|
-
(_g = project.i18n) !== null && _g !== void 0 ? _g : (project.i18n = {});
|
|
65
|
-
(_h = (_3 = project.i18n).sourceLocale) !== null && _h !== void 0 ? _h : (_3.sourceLocale = 'en-US');
|
|
66
|
-
(_j = (_4 = project.i18n).locales) !== null && _j !== void 0 ? _j : (_4.locales = {});
|
|
67
|
-
for (const language of options.languages) {
|
|
68
|
-
(_k = (_5 = project.i18n.locales)[language]) !== null && _k !== void 0 ? _k : (_5[language] = {
|
|
69
|
-
translation: `${project.sourceRoot}/i18n/${language}.xlf`,
|
|
70
|
-
baseHref: `${language}/`,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (!project.sourceRoot) {
|
|
75
|
-
throw new Error(`The project ${project.name} has no source root`);
|
|
76
|
-
}
|
|
77
|
-
(_l = (_6 = project.targets['extract-i18n']).options) !== null && _l !== void 0 ? _l : (_6.options = {});
|
|
78
|
-
project.targets['extract-i18n'].options.format = 'xliff2';
|
|
79
|
-
project.targets['extract-i18n'].options.outputPath = (0, path_1.join)(project.sourceRoot, 'i18n');
|
|
80
|
-
if (options.localazy) {
|
|
81
|
-
(_m = (_7 = project.targets)['localazy-download']) !== null && _m !== void 0 ? _m : (_7['localazy-download'] = {
|
|
82
|
-
executor: '@rxap/plugin-localazy:download',
|
|
83
|
-
options: (0, utilities_1.DeleteEmptyProperties)({
|
|
84
|
-
readKey: options.localazyReadKey,
|
|
85
|
-
workingDirectory: project.root,
|
|
86
|
-
}),
|
|
87
|
-
});
|
|
88
|
-
(_o = (_8 = project.targets)['localazy-upload']) !== null && _o !== void 0 ? _o : (_8['localazy-upload'] = {
|
|
89
|
-
executor: '@rxap/plugin-localazy:upload',
|
|
90
|
-
options: {
|
|
91
|
-
extractTarget: `${project.name}:extract-i18n`,
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
(0, workspace_utilities_1.CoerceTarget)(project, 'build', {
|
|
97
|
-
options: {
|
|
98
|
-
sourceMap: true,
|
|
99
|
-
},
|
|
100
|
-
configurations: {
|
|
101
|
-
production: {
|
|
102
|
-
fileReplacements: [
|
|
103
|
-
{
|
|
104
|
-
replace: `${project.sourceRoot}/environments/environment.ts`,
|
|
105
|
-
with: `${project.sourceRoot}/environments/environment.prod.ts`,
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
}, workspace_utilities_1.Strategy.OVERWRITE);
|
|
111
|
-
(_p = (_9 = project.targets['build']).options) !== null && _p !== void 0 ? _p : (_9.options = {});
|
|
112
|
-
project.targets['build'].options.sourceMap = true;
|
|
113
|
-
(_q = (_10 = project.targets['build'].options).assets) !== null && _q !== void 0 ? _q : (_10.assets = []);
|
|
114
|
-
(_r = (_11 = project.targets['build'].options).scripts) !== null && _r !== void 0 ? _r : (_11.scripts = []);
|
|
115
|
-
if (options.moduleFederation !== 'remote') {
|
|
116
|
-
if (!project.targets['build'].options.scripts.includes('node_modules/marked/marked.min.js')) {
|
|
117
|
-
project.targets['build'].options.scripts.push('node_modules/marked/marked.min.js');
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
(0, workspace_utilities_1.CoerceAssets)(project.targets['build'].options.assets, [
|
|
121
|
-
{
|
|
122
|
-
glob: '*',
|
|
123
|
-
input: 'shared/angular/assets/',
|
|
124
|
-
output: '.',
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
glob: 'mdi.svg',
|
|
128
|
-
input: './node_modules/@mdi/angular-material',
|
|
129
|
-
output: '.',
|
|
130
|
-
},
|
|
131
|
-
]);
|
|
132
|
-
// ensure the property polyfills are defined
|
|
133
|
-
(_s = (_12 = project.targets['build'].options).polyfills) !== null && _s !== void 0 ? _s : (_12.polyfills = []);
|
|
134
|
-
if (!Array.isArray(project.targets['build'].options.polyfills)) {
|
|
135
|
-
// ensure the property is an array
|
|
136
|
-
project.targets['build'].options.polyfills = ['zone.js'];
|
|
137
|
-
}
|
|
138
|
-
// always add the localize init polyfill as some rxap components use the i18n directive
|
|
139
|
-
(0, workspace_utilities_1.CoerceAssets)(project.targets['build'].options.polyfills, ['@angular/localize/init']);
|
|
140
|
-
if (options.serviceWorker) {
|
|
141
|
-
if (!project.sourceRoot) {
|
|
142
|
-
throw new Error(`The project ${project.name} has no source root`);
|
|
143
|
-
}
|
|
144
|
-
(0, workspace_utilities_1.CoerceAssets)(project.targets['build'].options.assets, [
|
|
145
|
-
(0, path_1.join)(project.sourceRoot, 'manifest.webmanifest'),
|
|
146
|
-
]);
|
|
147
|
-
(_t = (_13 = project.targets['build']).configurations) !== null && _t !== void 0 ? _t : (_13.configurations = {});
|
|
148
|
-
(_u = (_14 = project.targets['build'].configurations).production) !== null && _u !== void 0 ? _u : (_14.production = {});
|
|
149
|
-
project.targets['build'].configurations.production.serviceWorker = true;
|
|
150
|
-
(_v = (_15 = project.targets['build'].configurations.production).ngswConfigPath) !== null && _v !== void 0 ? _v : (_15.ngswConfigPath = 'shared/angular/ngsw-config.json');
|
|
151
|
-
}
|
|
152
|
-
(_w = (_16 = project.targets['build']).configurations) !== null && _w !== void 0 ? _w : (_16.configurations = {});
|
|
153
|
-
(_x = (_17 = project.targets['build'].configurations).production) !== null && _x !== void 0 ? _x : (_17.production = {});
|
|
154
|
-
(_y = (_18 = project.targets['build'].configurations.production).budgets) !== null && _y !== void 0 ? _y : (_18.budgets = []);
|
|
155
|
-
const budget = project.targets['build'].configurations.production.budgets.find((b) => b.type === 'initial');
|
|
156
|
-
const defaultWarning = '2mb';
|
|
157
|
-
const defaultError = '5mb';
|
|
158
|
-
if (!budget) {
|
|
159
|
-
project.targets['build'].configurations.production.budgets.push({
|
|
160
|
-
type: 'initial',
|
|
161
|
-
maximumWarning: defaultWarning,
|
|
162
|
-
maximumError: defaultError,
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
if (options.overwrite) {
|
|
167
|
-
budget.maximumWarning = defaultWarning;
|
|
168
|
-
budget.maximumError = defaultError;
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
if (compareBudget(budget.maximumWarning, defaultWarning) === -1) {
|
|
172
|
-
budget.maximumWarning = defaultWarning;
|
|
173
|
-
}
|
|
174
|
-
if (compareBudget(budget.maximumError, defaultError) === -1) {
|
|
175
|
-
budget.maximumError = defaultError;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
if (options.incrementalBuild) {
|
|
180
|
-
project.targets['build'].executor = '@nx/angular:webpack-browser';
|
|
181
|
-
project.targets['build'].options.buildLibsFromSource = false;
|
|
182
|
-
(0, workspace_utilities_1.CoerceTarget)(project, 'serve-static', {
|
|
183
|
-
executor: '@nx/web:file-server',
|
|
184
|
-
options: {
|
|
185
|
-
proxyUrl: 'https://127-0-0-1.nip.io:8443'
|
|
186
|
-
},
|
|
187
|
-
configurations: {
|
|
188
|
-
production: {
|
|
189
|
-
buildTarget: `${projectName}:build:production`
|
|
190
|
-
},
|
|
191
|
-
development: {
|
|
192
|
-
buildTarget: `${projectName}:build:development`
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
if (options.deploy) {
|
|
198
|
-
switch (options.deploy) {
|
|
199
|
-
case 'web3-storage':
|
|
200
|
-
if (options.i18n) {
|
|
201
|
-
(0, workspace_utilities_1.CoerceTarget)(project, 'i18n-index-html', {});
|
|
202
|
-
}
|
|
203
|
-
(0, workspace_utilities_1.CoerceTarget)(project, 'deploy', {
|
|
204
|
-
executor: '@rxap/plugin-web3-storage:deploy',
|
|
205
|
-
outputs: ['dist/{projectRoot}/ipfs-cid.txt'],
|
|
206
|
-
}, workspace_utilities_1.Strategy.OVERWRITE);
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Compare two budget strings
|
|
213
|
-
*
|
|
214
|
-
* @param a
|
|
215
|
-
* @param b
|
|
216
|
-
* @returns -1 if a < b, 0 if a === b, 1 if a > b
|
|
217
|
-
*/
|
|
218
|
-
function compareBudget(a, b) {
|
|
219
|
-
const aUnit = a.slice(-2);
|
|
220
|
-
const bUnit = b.slice(-2);
|
|
221
|
-
const aNumber = Number(a.slice(0, -2));
|
|
222
|
-
const bNumber = Number(b.slice(0, -2));
|
|
223
|
-
if (aUnit === bUnit) {
|
|
224
|
-
return aNumber < bNumber ? -1 : aNumber > bNumber ? 1 : 0;
|
|
225
|
-
}
|
|
226
|
-
if (aUnit === 'kb') {
|
|
227
|
-
return bUnit === 'mb' ? -1 : 1;
|
|
228
|
-
}
|
|
229
|
-
if (aUnit === 'mb') {
|
|
230
|
-
return bUnit === 'kb' ? 1 : -1;
|
|
231
|
-
}
|
|
232
|
-
return 0;
|
|
233
|
-
}
|
|
234
|
-
function updateTargetDefaults(tree, options) {
|
|
235
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
236
|
-
if (!nxJson) {
|
|
237
|
-
throw new Error('NxJson not found');
|
|
238
|
-
}
|
|
239
|
-
if (options.localazy) {
|
|
240
|
-
(0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'build', 'localazy-download');
|
|
241
|
-
(0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'localazy-upload', 'extract-i18n');
|
|
242
|
-
(0, workspace_utilities_1.CoerceTargetDefaultsInput)(nxJson, 'localazy-upload', '{projectRoot}/src/i18n/messages.xlf');
|
|
243
|
-
(0, workspace_utilities_1.CoerceTargetDefaultsInput)(nxJson, 'localazy-download', { runtime: 'date' }, { env: 'CI_COMMIT_TIMESTAMP' }, { env: 'CI_COMMIT_SHA' }, { env: 'CI_JOB_ID' }, { env: 'CI_PIPELINE_ID' });
|
|
244
|
-
(0, workspace_utilities_1.CoerceTargetDefaultsOutput)(nxJson, 'localazy-download', '{projectRoot}/src/i18n');
|
|
245
|
-
}
|
|
246
|
-
(0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'build', '^generate-open-api');
|
|
247
|
-
(0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'serve', '^generate-open-api');
|
|
248
|
-
(0, workspace_utilities_1.CoerceNxJsonCacheableOperation)(nxJson, 'localazy-download', 'localazy-upload', 'extract-i18n', 'i18n-index-html');
|
|
249
|
-
(0, workspace_utilities_1.CoerceTargetDefaultsInput)(nxJson, 'deploy', '{workspaceRoot}/dist/{projectRoot}');
|
|
250
|
-
(0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'deploy', 'i18n-index-html');
|
|
251
|
-
(0, workspace_utilities_1.CoerceTarget)(nxJson, 'i18n-index-html', {
|
|
252
|
-
dependsOn: ['build'],
|
|
253
|
-
executor: '@rxap/plugin-application:i18n',
|
|
254
|
-
outputs: ['dist/{projectRoot}/index.html'],
|
|
255
|
-
inputs: ['{workspaceRoot}/{projectRoot}/project.json'],
|
|
256
|
-
});
|
|
257
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
258
|
-
}
|
|
259
|
-
function updateGitIgnore(project, tree, options) {
|
|
260
|
-
if (options.i18n) {
|
|
261
|
-
if (!project.sourceRoot) {
|
|
262
|
-
throw new Error(`The project ${project.name} has no source root`);
|
|
263
|
-
}
|
|
264
|
-
const gitIgnorePath = (0, path_1.join)(project.sourceRoot, '.gitignore');
|
|
265
|
-
(0, workspace_utilities_1.CoerceIgnorePattern)(tree, gitIgnorePath, [
|
|
266
|
-
'/i18n',
|
|
267
|
-
]);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
function updateTags(project, options) {
|
|
271
|
-
const tags = ['frontend', 'user-interface'];
|
|
272
|
-
if (options.i18n) {
|
|
273
|
-
tags.push('i18n');
|
|
274
|
-
}
|
|
275
|
-
if (options.localazy) {
|
|
276
|
-
tags.push('localazy');
|
|
277
|
-
}
|
|
278
|
-
if (options.serviceWorker) {
|
|
279
|
-
tags.push('service-worker');
|
|
280
|
-
}
|
|
281
|
-
if (options.sentry) {
|
|
282
|
-
tags.push('sentry');
|
|
283
|
-
}
|
|
284
|
-
if (options.moduleFederation) {
|
|
285
|
-
tags.push('module-federation');
|
|
286
|
-
tags.push(`mfe:${options.moduleFederation}`);
|
|
287
|
-
}
|
|
288
|
-
(0, workspace_utilities_1.CoerceProjectTags)(project, tags);
|
|
289
|
-
}
|
|
290
|
-
const MAIN_BOOTSTRAP_STATEMENT = `application.bootstrap().catch((err) => console.error(err));`;
|
|
291
|
-
const MAIN_LOGGER_STATEMENT = `application.importProvidersFrom(LoggerModule.forRoot({
|
|
292
|
-
serverLoggingUrl: '/api/logs',
|
|
293
|
-
level: NgxLoggerLevel.DEBUG,
|
|
294
|
-
serverLogLevel: NgxLoggerLevel.ERROR,
|
|
295
|
-
}));`;
|
|
296
|
-
const MAIN_APP_CREATION_STATEMENT = `const application = new StandaloneApplication(
|
|
297
|
-
environment,
|
|
298
|
-
AppComponent,
|
|
299
|
-
appConfig,
|
|
300
|
-
);`;
|
|
301
|
-
const REMOTE_MAIN_APP_CREATION_STATEMENT = `const application = new StandaloneApplication(
|
|
302
|
-
environment,
|
|
303
|
-
RemoteEntryComponent,
|
|
304
|
-
appConfig,
|
|
305
|
-
);`;
|
|
306
|
-
function assertMainStatements(sourceFile, options) {
|
|
307
|
-
var _a;
|
|
308
|
-
const statements = [];
|
|
309
|
-
statements.push('const application = new StandaloneApplication(');
|
|
310
|
-
statements.push('application.importProvidersFrom(LoggerModule.forRoot({');
|
|
311
|
-
const existingStatements = (_a = sourceFile.getStatements().map(s => s.getText())) !== null && _a !== void 0 ? _a : [];
|
|
312
|
-
for (const statement of statements) {
|
|
313
|
-
if (!existingStatements.includes(statement)) {
|
|
314
|
-
console.error(`Missing statement from angular main.ts: ${statement}`);
|
|
315
|
-
sourceFile.set({
|
|
316
|
-
statements: [
|
|
317
|
-
options.moduleFederation === 'remote' ? REMOTE_MAIN_APP_CREATION_STATEMENT : MAIN_APP_CREATION_STATEMENT,
|
|
318
|
-
MAIN_LOGGER_STATEMENT,
|
|
319
|
-
MAIN_BOOTSTRAP_STATEMENT,
|
|
320
|
-
],
|
|
321
|
-
});
|
|
322
|
-
(0, ts_morph_1.CoerceImports)(sourceFile, [
|
|
323
|
-
{
|
|
324
|
-
moduleSpecifier: './app/app.config',
|
|
325
|
-
namedImports: ['appConfig'],
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
moduleSpecifier: './environments/environment',
|
|
329
|
-
namedImports: ['environment'],
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
moduleSpecifier: 'ngx-logger',
|
|
333
|
-
namedImports: ['LoggerModule', 'NgxLoggerLevel'],
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
moduleSpecifier: '@rxap/ngx-bootstrap',
|
|
337
|
-
namedImports: ['StandaloneApplication'],
|
|
338
|
-
},
|
|
339
|
-
]);
|
|
340
|
-
if (options.moduleFederation === 'remote') {
|
|
341
|
-
(0, ts_morph_1.CoerceImports)(sourceFile, [
|
|
342
|
-
{
|
|
343
|
-
moduleSpecifier: './app/remote-entry/entry.component',
|
|
344
|
-
namedImports: ['RemoteEntryComponent'],
|
|
345
|
-
},
|
|
346
|
-
]);
|
|
347
|
-
}
|
|
348
|
-
else {
|
|
349
|
-
(0, ts_morph_1.CoerceImports)(sourceFile, [
|
|
350
|
-
{
|
|
351
|
-
moduleSpecifier: './app/app.component',
|
|
352
|
-
namedImports: ['AppComponent'],
|
|
353
|
-
},
|
|
354
|
-
]);
|
|
355
|
-
}
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
function cleanup(tree, projectName, options) {
|
|
361
|
-
const sourceRoot = (0, workspace_utilities_1.GetProjectSourceRoot)(tree, projectName);
|
|
362
|
-
const deleteFiles = [
|
|
363
|
-
'app/app.component.spec.ts',
|
|
364
|
-
'app/nx-welcome.component.ts',
|
|
365
|
-
'app/remote-entry/nx-welcome.component.ts',
|
|
366
|
-
'app/nx-welcome.component.cy.ts',
|
|
367
|
-
];
|
|
368
|
-
for (const file of deleteFiles) {
|
|
369
|
-
if (tree.exists((0, path_1.join)(sourceRoot, file))) {
|
|
370
|
-
tree.delete((0, path_1.join)(sourceRoot, file));
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
if (tree.exists((0, path_1.join)(sourceRoot, 'app/app.component.html'))) {
|
|
374
|
-
const content = tree.read((0, path_1.join)(sourceRoot, 'app/app.component.html'), 'utf-8')
|
|
375
|
-
.replace(/<.+-nx-welcome><\/.+-nx-welcome> /, '')
|
|
376
|
-
.replace(/<ul class="remote-menu">[\s\S]*<\/ul>/, '');
|
|
377
|
-
(0, workspace_utilities_1.CoerceFile)(tree, (0, path_1.join)(sourceRoot, 'app/app.component.html'), content, true);
|
|
378
|
-
}
|
|
379
|
-
if (options.moduleFederation !== 'remote') {
|
|
380
|
-
(0, workspace_ts_morph_1.TsMorphAngularProjectTransform)(tree, {
|
|
381
|
-
project: projectName,
|
|
382
|
-
}, (_, [appRoutes, appComponent]) => {
|
|
383
|
-
var _a, _b, _c;
|
|
384
|
-
(0, ts_morph_1.RemoveRoute)(appRoutes, {
|
|
385
|
-
component: 'NxWelcomeComponent',
|
|
386
|
-
name: 'appRoutes'
|
|
387
|
-
});
|
|
388
|
-
(_a = appRoutes.getImportDeclaration('./nx-welcome.component')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
389
|
-
(_c = (_b = appComponent.getClass('AppComponent')) === null || _b === void 0 ? void 0 : _b.getProperty('title')) === null || _c === void 0 ? void 0 : _c.remove();
|
|
390
|
-
(0, ts_morph_1.RemoveComponentImport)(appComponent, 'NxWelcomeComponent');
|
|
391
|
-
}, ['app/app.routes.ts', 'app/app.component.ts']);
|
|
392
|
-
}
|
|
393
|
-
if (options.moduleFederation === 'remote') {
|
|
394
|
-
// region module-federation config
|
|
395
|
-
const projectRoot = (0, workspace_utilities_1.GetProjectRoot)(tree, projectName);
|
|
396
|
-
let content = tree.read((0, path_1.join)(projectRoot, 'module-federation.config.js'), 'utf-8');
|
|
397
|
-
content = content.replace('./Routes', './routes');
|
|
398
|
-
(0, workspace_utilities_1.CoerceFile)(tree, (0, path_1.join)(projectRoot, 'module-federation.config.js'), content, true);
|
|
399
|
-
// endregion
|
|
400
|
-
// region tsconfig.base.json
|
|
401
|
-
(0, workspace_utilities_1.UpdateTsConfigJson)(tree, tsConfig => {
|
|
402
|
-
var _a, _b;
|
|
403
|
-
var _c;
|
|
404
|
-
(_a = tsConfig.compilerOptions) !== null && _a !== void 0 ? _a : (tsConfig.compilerOptions = {});
|
|
405
|
-
(_b = (_c = tsConfig.compilerOptions).paths) !== null && _b !== void 0 ? _b : (_c.paths = {});
|
|
406
|
-
if (tsConfig.compilerOptions.paths[`${projectName}/Routes`]) {
|
|
407
|
-
delete tsConfig.compilerOptions.paths[`${projectName}/Routes`];
|
|
408
|
-
}
|
|
409
|
-
}, { infix: 'base' });
|
|
410
|
-
// endregion
|
|
411
|
-
(0, workspace_ts_morph_1.TsMorphAngularProjectTransform)(tree, {
|
|
412
|
-
project: projectName,
|
|
413
|
-
}, (_, [entryRoutes]) => {
|
|
414
|
-
(0, ts_morph_1.CoerceDefaultExport)(entryRoutes.getVariableStatement('remoteRoutes').getDeclarations()[0]);
|
|
415
|
-
}, [
|
|
416
|
-
'app/remote-entry/entry.routes.ts',
|
|
417
|
-
]);
|
|
418
|
-
if (tree.exists((0, path_1.join)(sourceRoot, 'app/remote-entry/entry.component.ts'))) {
|
|
419
|
-
(0, workspace_ts_morph_1.TsMorphAngularProjectTransform)(tree, {
|
|
420
|
-
project: projectName,
|
|
421
|
-
}, (_, [entryComponent]) => {
|
|
422
|
-
var _a, _b;
|
|
423
|
-
(_a = entryComponent.getImportDeclaration('./nx-welcome.component')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
424
|
-
(0, ts_morph_1.RemoveComponentImport)(entryComponent, 'NxWelcomeComponent');
|
|
425
|
-
(0, ts_morph_1.RemoveComponentImport)(entryComponent, 'CommonModule');
|
|
426
|
-
const componentOptions = (0, ts_morph_1.GetComponentDecoratorObject)(entryComponent);
|
|
427
|
-
const templateProp = componentOptions.getProperty('template');
|
|
428
|
-
if (templateProp && ((_b = templateProp.asKindOrThrow(ts_morph_2.SyntaxKind.PropertyAssignment).getInitializer()) === null || _b === void 0 ? void 0 : _b.getText().match(/<.+nx-welcome><\/.+nx-welcome>/))) {
|
|
429
|
-
templateProp.remove();
|
|
430
|
-
componentOptions.addPropertyAssignment({
|
|
431
|
-
name: 'template',
|
|
432
|
-
initializer: w => w.quote('<router-outlet></router-outlet>'),
|
|
433
|
-
});
|
|
434
|
-
(0, ts_morph_1.CoerceComponentImport)(entryComponent, {
|
|
435
|
-
name: 'RouterModule',
|
|
436
|
-
moduleSpecifier: '@angular/router'
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
}, [
|
|
440
|
-
'app/remote-entry/entry.component.ts',
|
|
441
|
-
]);
|
|
442
|
-
}
|
|
443
|
-
if (options.host) {
|
|
444
|
-
(0, workspace_ts_morph_1.TsMorphAngularProjectTransform)(tree, {
|
|
445
|
-
project: options.host,
|
|
446
|
-
}, (_, [appRoutes]) => {
|
|
447
|
-
(0, ts_morph_1.RemoveRoute)(appRoutes, {
|
|
448
|
-
loadRemoteModule: {
|
|
449
|
-
name: projectName,
|
|
450
|
-
entry: './Routes',
|
|
451
|
-
},
|
|
452
|
-
name: 'appRoutes'
|
|
453
|
-
});
|
|
454
|
-
appRoutes.organizeImports();
|
|
455
|
-
}, ['app/app.routes.ts']);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
function updateMainFile(tree, projectName, project, options) {
|
|
460
|
-
(0, workspace_ts_morph_1.TsMorphAngularProjectTransform)(tree, {
|
|
461
|
-
project: projectName,
|
|
462
|
-
// directory: '..' // to move from the apps/demo/src/app folder into the apps/demo/src folder
|
|
463
|
-
}, (project, [sourceFile, mainSourceFile]) => {
|
|
464
|
-
var _a;
|
|
465
|
-
assertMainStatements(sourceFile, options);
|
|
466
|
-
const importDeclarations = [];
|
|
467
|
-
const statements = [];
|
|
468
|
-
if (options.serviceWorker) {
|
|
469
|
-
importDeclarations.push({
|
|
470
|
-
moduleSpecifier: '@rxap/service-worker',
|
|
471
|
-
namedImports: ['UnregisterServiceWorker'],
|
|
472
|
-
});
|
|
473
|
-
statements.push('application.before(() => UnregisterServiceWorker(environment));');
|
|
474
|
-
}
|
|
475
|
-
if (options.openApi) {
|
|
476
|
-
importDeclarations.push({
|
|
477
|
-
moduleSpecifier: '@rxap/open-api',
|
|
478
|
-
namedImports: ['OpenApiInit'],
|
|
479
|
-
});
|
|
480
|
-
if (options.openApiLegacy) {
|
|
481
|
-
statements.push('application.before(() => OpenApiInit(environment, { load: true }));');
|
|
482
|
-
}
|
|
483
|
-
else {
|
|
484
|
-
statements.push('application.before(() => OpenApiInit(environment));');
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
if (options.sentry) {
|
|
488
|
-
importDeclarations.push({
|
|
489
|
-
moduleSpecifier: '@rxap/ngx-sentry',
|
|
490
|
-
namedImports: ['SentryInit'],
|
|
491
|
-
});
|
|
492
|
-
statements.push('application.before(() => SentryInit(environment));');
|
|
493
|
-
}
|
|
494
|
-
(0, ts_morph_1.CoerceImports)(sourceFile, importDeclarations);
|
|
495
|
-
for (let i = 0; i < statements.length; i++) {
|
|
496
|
-
const statement = statements[i];
|
|
497
|
-
const lastStatement = i > 0 ? statements[i - 1] : null;
|
|
498
|
-
const nestStatement = i < statements.length - 1 ? statements[i + 1] : null;
|
|
499
|
-
const existingStatements = (_a = sourceFile.getStatements().map((s) => s.getText())) !== null && _a !== void 0 ? _a : [];
|
|
500
|
-
if (!existingStatements.includes(statement)) {
|
|
501
|
-
let index;
|
|
502
|
-
if (lastStatement) {
|
|
503
|
-
index = existingStatements.findIndex(s => s.includes(lastStatement)) + 1;
|
|
504
|
-
}
|
|
505
|
-
else if (nestStatement) {
|
|
506
|
-
index = existingStatements.findIndex(s => s.includes(nestStatement));
|
|
507
|
-
}
|
|
508
|
-
else {
|
|
509
|
-
index = existingStatements.findIndex(s => s.includes(MAIN_BOOTSTRAP_STATEMENT));
|
|
510
|
-
}
|
|
511
|
-
console.log(`insert statement: ${statement} at index ${index}`);
|
|
512
|
-
sourceFile.insertStatements(index, statement);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
if (options.moduleFederation === 'host') {
|
|
516
|
-
mainSourceFile.set({
|
|
517
|
-
statements: [
|
|
518
|
-
`import {
|
|
519
|
-
setRemoteDefinitions,
|
|
520
|
-
setRemoteUrlResolver
|
|
521
|
-
} from '@nx/angular/mf';
|
|
522
|
-
import type { Environment } from '@rxap/environment';
|
|
523
|
-
import { environment } from './environments/environment';
|
|
524
|
-
|
|
525
|
-
export async function SetupDynamicMfe(environment: Environment) {
|
|
526
|
-
|
|
527
|
-
const manifest = environment.moduleFederation?.manifest;
|
|
528
|
-
|
|
529
|
-
if (!manifest) {
|
|
530
|
-
const release = environment.tag || environment.branch || 'latest';
|
|
531
|
-
setRemoteUrlResolver((remoteName: string) => \`\${ location.origin }/__mfe/\${ release }/\${ remoteName }\`);
|
|
532
|
-
} else {
|
|
533
|
-
|
|
534
|
-
let definitions: Record<string, string>;
|
|
535
|
-
|
|
536
|
-
if (typeof manifest === 'object') {
|
|
537
|
-
definitions = manifest;
|
|
538
|
-
} else {
|
|
539
|
-
definitions = await fetch(manifest).then((res) => res.json());
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
setRemoteDefinitions(definitions);
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
SetupDynamicMfe(environment).then(() => import('./bootstrap').catch((err) => console.error(err)));
|
|
549
|
-
`,
|
|
550
|
-
]
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
}, [
|
|
554
|
-
options.moduleFederation ? 'bootstrap.ts' : 'main.ts',
|
|
555
|
-
'main.ts'
|
|
556
|
-
]);
|
|
557
|
-
}
|
|
558
|
-
function coerceEnvironmentFiles(tree, options) {
|
|
559
|
-
(0, workspace_ts_morph_1.TsMorphAngularProjectTransform)(tree, {
|
|
560
|
-
project: options.project,
|
|
561
|
-
}, (project, [sourceFile, prodSourceFile]) => {
|
|
562
|
-
(0, ts_morph_1.CoerceImports)(sourceFile, {
|
|
563
|
-
moduleSpecifier: '@rxap/environment',
|
|
564
|
-
namedImports: ['Environment'],
|
|
565
|
-
});
|
|
566
|
-
(0, ts_morph_1.CoerceImports)(prodSourceFile, {
|
|
567
|
-
moduleSpecifier: '@rxap/environment',
|
|
568
|
-
namedImports: ['Environment'],
|
|
569
|
-
});
|
|
570
|
-
const baseEnvironment = {
|
|
571
|
-
name: w => w.quote('development'),
|
|
572
|
-
production: 'false',
|
|
573
|
-
app: w => w.quote(options.project),
|
|
574
|
-
};
|
|
575
|
-
// region dev environment
|
|
576
|
-
if (options.serviceWorker) {
|
|
577
|
-
baseEnvironment['serviceWorker'] = 'false';
|
|
578
|
-
}
|
|
579
|
-
if (options.sentry) {
|
|
580
|
-
baseEnvironment['sentry'] = ts_morph_2.Writers.object({
|
|
581
|
-
enabled: 'false',
|
|
582
|
-
debug: 'false',
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
if (options.moduleFederation === 'host') {
|
|
586
|
-
baseEnvironment['moduleFederation'] = ts_morph_2.Writers.object({
|
|
587
|
-
manifest: w => w.quote('/assets/module-federation.manifest.json'),
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
const normal = (0, ts_morph_1.CoerceVariableDeclaration)(sourceFile, 'environment', {
|
|
591
|
-
type: 'Environment',
|
|
592
|
-
initializer: ts_morph_2.Writers.object(baseEnvironment),
|
|
593
|
-
});
|
|
594
|
-
if (options.overwrite) {
|
|
595
|
-
normal.set({ initializer: ts_morph_2.Writers.object(baseEnvironment) });
|
|
596
|
-
}
|
|
597
|
-
// region
|
|
598
|
-
// region prod environment
|
|
599
|
-
if (options.moduleFederation === 'host') {
|
|
600
|
-
delete baseEnvironment['moduleFederation'];
|
|
601
|
-
}
|
|
602
|
-
if (options.serviceWorker) {
|
|
603
|
-
baseEnvironment['serviceWorker'] = 'true';
|
|
604
|
-
}
|
|
605
|
-
if (options.sentry) {
|
|
606
|
-
baseEnvironment['sentry'] = ts_morph_2.Writers.object({
|
|
607
|
-
enabled: 'true',
|
|
608
|
-
debug: 'false',
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
baseEnvironment['name'] = w => w.quote('production');
|
|
612
|
-
baseEnvironment['production'] = 'true';
|
|
613
|
-
const prod = (0, ts_morph_1.CoerceVariableDeclaration)(prodSourceFile, 'environment', {
|
|
614
|
-
type: 'Environment',
|
|
615
|
-
initializer: ts_morph_2.Writers.object(baseEnvironment),
|
|
616
|
-
});
|
|
617
|
-
if (options.overwrite) {
|
|
618
|
-
prod.set({ initializer: ts_morph_2.Writers.object(baseEnvironment) });
|
|
619
|
-
}
|
|
620
|
-
// endregion
|
|
621
|
-
}, [
|
|
622
|
-
'/environments/environment.ts?',
|
|
623
|
-
'/environments/environment.prod.ts?',
|
|
624
|
-
]);
|
|
625
|
-
}
|
|
626
|
-
function coerceLocalazyConfigFile(tree, project) {
|
|
627
|
-
const projectRoot = project.root;
|
|
628
|
-
const localazyConfigPath = (0, path_1.join)(projectRoot, 'localazy.json');
|
|
629
|
-
(0, workspace_utilities_1.CoerceFile)(tree, localazyConfigPath, JSON.stringify({
|
|
630
|
-
upload: {
|
|
631
|
-
type: 'xliff',
|
|
632
|
-
deprecate: 'file',
|
|
633
|
-
features: [
|
|
634
|
-
'use_defined_lang_for_source',
|
|
635
|
-
'dont_parse_target',
|
|
636
|
-
],
|
|
637
|
-
files: 'src/i18n/messages.xlf',
|
|
638
|
-
},
|
|
639
|
-
download: {
|
|
640
|
-
files: 'src/i18n/${languageCode}.xlf',
|
|
641
|
-
},
|
|
642
|
-
}, null, 2));
|
|
643
|
-
}
|
|
644
|
-
function updateTsConfig(tree, projectName) {
|
|
645
|
-
const projectRoot = (0, workspace_utilities_1.GetProjectRoot)(tree, projectName);
|
|
646
|
-
for (const tsConfigName of ['app', 'editor', 'spec']) {
|
|
647
|
-
(0, workspace_utilities_1.UpdateTsConfigJson)(tree, tsConfig => {
|
|
648
|
-
var _a, _b, _c;
|
|
649
|
-
var _d;
|
|
650
|
-
(_a = tsConfig.compilerOptions) !== null && _a !== void 0 ? _a : (tsConfig.compilerOptions = {});
|
|
651
|
-
(_b = (_d = tsConfig.compilerOptions).types) !== null && _b !== void 0 ? _b : (_d.types = []);
|
|
652
|
-
if (!tsConfig.compilerOptions.types.includes('@angular/localize')) {
|
|
653
|
-
tsConfig.compilerOptions.types.push('@angular/localize');
|
|
654
|
-
}
|
|
655
|
-
if (['app', 'spec'].includes(tsConfigName)) {
|
|
656
|
-
(_c = tsConfig.exclude) !== null && _c !== void 0 ? _c : (tsConfig.exclude = []);
|
|
657
|
-
(0, utilities_1.CoerceArrayItems)(tsConfig.exclude, [
|
|
658
|
-
'src/**/*.stories.ts',
|
|
659
|
-
'src/**/*.cy.ts',
|
|
660
|
-
]);
|
|
661
|
-
}
|
|
662
|
-
}, { infix: tsConfigName, basePath: projectRoot });
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
function linkMfeRemoteWithHost(tree, projectName, options) {
|
|
666
|
-
if (!options.host) {
|
|
667
|
-
throw new Error('The host project must be defined');
|
|
668
|
-
}
|
|
669
|
-
const hostSourceRoot = (0, workspace_utilities_1.GetProjectSourceRoot)(tree, options.host);
|
|
670
|
-
const isHostMonolithic = tree.exists((0, path_1.join)(hostSourceRoot, 'app/layout.routes.ts'));
|
|
671
|
-
const path = projectName.replace('user-interface-', '').replace('feature-', '');
|
|
672
|
-
if (isHostMonolithic && !options.standaloneImport) {
|
|
673
|
-
(0, workspace_ts_morph_1.TsMorphAngularProjectTransform)(tree, {
|
|
674
|
-
project: options.host,
|
|
675
|
-
}, (project, [layoutSourceFile]) => {
|
|
676
|
-
(0, ts_morph_1.CoerceLayoutRoutes)(layoutSourceFile, {
|
|
677
|
-
itemList: [
|
|
678
|
-
{
|
|
679
|
-
route: {
|
|
680
|
-
path,
|
|
681
|
-
loadRemoteModule: projectName
|
|
682
|
-
},
|
|
683
|
-
component: 'LayoutComponent'
|
|
684
|
-
}
|
|
685
|
-
]
|
|
686
|
-
});
|
|
687
|
-
}, ['app/layout.routes.ts']);
|
|
688
|
-
}
|
|
689
|
-
else {
|
|
690
|
-
(0, workspace_ts_morph_1.TsMorphAngularProjectTransform)(tree, {
|
|
691
|
-
project: options.host,
|
|
692
|
-
}, (project, [appRoutes]) => {
|
|
693
|
-
(0, ts_morph_1.CoerceAppRoutes)(appRoutes, {
|
|
694
|
-
itemList: [
|
|
695
|
-
{
|
|
696
|
-
route: {
|
|
697
|
-
path,
|
|
698
|
-
loadRemoteModule: projectName
|
|
699
|
-
},
|
|
700
|
-
},
|
|
701
|
-
],
|
|
702
|
-
});
|
|
703
|
-
}, ['app/app.routes.ts']);
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
37
|
function initApplicationGenerator(tree, options) {
|
|
707
38
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
708
39
|
var _a, _b, _c;
|
|
@@ -836,7 +167,7 @@ function initApplicationGenerator(tree, options) {
|
|
|
836
167
|
overwrite: options.overwrite,
|
|
837
168
|
});
|
|
838
169
|
}
|
|
839
|
-
updateTargetDefaults(tree, options);
|
|
170
|
+
(0, update_target_defaults_1.updateTargetDefaults)(tree, options);
|
|
840
171
|
yield (0, coerce_project_1.CoerceProjects)(tree, options);
|
|
841
172
|
if (!options.skipProjects) {
|
|
842
173
|
for (const [projectName, project] of (0, devkit_1.getProjects)(tree).entries()) {
|
|
@@ -850,14 +181,14 @@ function initApplicationGenerator(tree, options) {
|
|
|
850
181
|
if (options.overwrite || !((_c = tree.read((0, path_1.join)(sourceRoot, 'styles.scss'), 'utf-8')) === null || _c === void 0 ? void 0 : _c.match(/@use ".+\/shared\/angular\/styles";/))) {
|
|
851
182
|
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files', 'root'), sourceRoot, Object.assign(Object.assign({ serviceWorker: false }, options), { relativePathToWorkspaceRoot: (0, path_1.relative)(sourceRoot, ''), name: projectName.replace(/^user-interface-/, ''), classify: utilities_1.classify, prefix: (0, workspace_utilities_1.GetProjectPrefix)(tree, projectName, 'rxap') }));
|
|
852
183
|
}
|
|
853
|
-
updateProjectTargets(projectName, project, options);
|
|
854
|
-
updateTags(project, options);
|
|
855
|
-
updateGitIgnore(project, tree, options);
|
|
856
|
-
updateTsConfig(tree, projectName);
|
|
184
|
+
(0, update_project_targets_1.updateProjectTargets)(tree, projectName, project, options);
|
|
185
|
+
(0, update_tags_1.updateTags)(project, options);
|
|
186
|
+
(0, update_git_ignore_1.updateGitIgnore)(project, tree, options);
|
|
187
|
+
(0, update_ts_config_1.updateTsConfig)(tree, projectName);
|
|
857
188
|
if (options.cleanup || options.coerce) {
|
|
858
|
-
cleanup(tree, projectName, options);
|
|
189
|
+
(0, cleanup_1.cleanup)(tree, projectName, options);
|
|
859
190
|
}
|
|
860
|
-
coerceEnvironmentFiles(tree, Object.assign(Object.assign({}, options), { project: projectName }));
|
|
191
|
+
(0, coerce_environment_files_1.coerceEnvironmentFiles)(tree, Object.assign(Object.assign({}, options), { project: projectName }));
|
|
861
192
|
(0, workspace_ts_morph_1.TsMorphAngularProjectTransform)(tree, {
|
|
862
193
|
project: projectName,
|
|
863
194
|
}, (_, [sourceFile]) => {
|
|
@@ -975,10 +306,10 @@ function initApplicationGenerator(tree, options) {
|
|
|
975
306
|
});
|
|
976
307
|
}, ['/app/app.config.ts']);
|
|
977
308
|
if (options.generateMain) {
|
|
978
|
-
updateMainFile(tree, projectName, project, options);
|
|
309
|
+
(0, update_main_file_1.updateMainFile)(tree, projectName, project, options);
|
|
979
310
|
}
|
|
980
311
|
if (options.localazy) {
|
|
981
|
-
coerceLocalazyConfigFile(tree, project);
|
|
312
|
+
(0, coerce_localazy_config_file_1.coerceLocalazyConfigFile)(tree, project);
|
|
982
313
|
}
|
|
983
314
|
if (options.authentication) {
|
|
984
315
|
yield (0, generate_authentication_1.generateAuthentication)(tree, projectName, project, options);
|
|
@@ -994,7 +325,7 @@ function initApplicationGenerator(tree, options) {
|
|
|
994
325
|
dasherize: utilities_1.dasherize, prefix: (0, workspace_utilities_1.GetProjectPrefix)(tree, projectName, 'rxap') }));
|
|
995
326
|
}
|
|
996
327
|
if (options.host) {
|
|
997
|
-
linkMfeRemoteWithHost(tree, projectName, options);
|
|
328
|
+
(0, link_mfe_remote_with_host_1.linkMfeRemoteWithHost)(tree, projectName, options);
|
|
998
329
|
}
|
|
999
330
|
}
|
|
1000
331
|
if (options.serviceWorker) {
|