@rxap/plugin-angular 16.1.0-dev.8 → 16.1.0

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.
Files changed (102) hide show
  1. package/CHANGELOG.md +485 -0
  2. package/README.md +15 -1
  3. package/generators.json +10 -0
  4. package/package.json +61 -48
  5. package/src/generators/init/generator.js +14 -7
  6. package/src/generators/init/generator.js.map +1 -1
  7. package/src/generators/init/schema.d.ts +2 -0
  8. package/src/generators/init/schema.json +10 -0
  9. package/src/generators/init-application/files/app/app.navigation.ts.template +11 -0
  10. package/src/generators/init-application/files/app/app.routes.ts.template +14 -0
  11. package/src/generators/init-application/files/app/layout.routes.ts.template +33 -0
  12. package/src/generators/init-application/files/assets/icons/create-pwa-icons.sh +11 -0
  13. package/src/generators/init-application/files/assets/icons/icon-114x114.png +0 -0
  14. package/src/generators/init-application/files/assets/icons/icon-120x120.png +0 -0
  15. package/src/generators/init-application/files/assets/icons/icon-128x128.png +0 -0
  16. package/src/generators/init-application/files/assets/icons/icon-144x144.png +0 -0
  17. package/src/generators/init-application/files/assets/icons/icon-152x152.png +0 -0
  18. package/src/generators/init-application/files/assets/icons/icon-16x16.png +0 -0
  19. package/src/generators/init-application/files/assets/icons/icon-180x180.png +0 -0
  20. package/src/generators/init-application/files/assets/icons/icon-192x192.png +0 -0
  21. package/src/generators/init-application/files/assets/icons/icon-32x32.png +0 -0
  22. package/src/generators/init-application/files/assets/icons/icon-384x384.png +0 -0
  23. package/src/generators/init-application/files/assets/icons/icon-512x512.png +0 -0
  24. package/src/generators/init-application/files/assets/icons/icon-57x57.png +0 -0
  25. package/src/generators/init-application/files/assets/icons/icon-60x60.png +0 -0
  26. package/src/generators/init-application/files/assets/icons/icon-72x72.png +0 -0
  27. package/src/generators/init-application/files/assets/icons/icon-76x76.png +0 -0
  28. package/src/generators/init-application/files/assets/icons/icon-96x96.png +0 -0
  29. package/src/generators/init-application/files/assets/icons/icon.png +0 -0
  30. package/src/generators/init-application/files/assets/icons/icon.svg +43 -0
  31. package/src/generators/init-application/files/assets/logo.png +0 -0
  32. package/src/generators/init-application/files/assets/logo.svg +63 -0
  33. package/src/generators/init-application/files/{shared → i18n}/i18n.index.html.hbs +1 -1
  34. package/src/generators/init-application/files/monolithic/app/app.navigation.ts.template +11 -0
  35. package/src/generators/init-application/files/monolithic/app/app.routes.ts.template +14 -0
  36. package/src/generators/init-application/files/monolithic/app/layout.routes.ts.template +32 -0
  37. package/src/generators/init-application/files/monolithic/index.html.template +165 -0
  38. package/src/generators/init-application/files/monolithic/styles.scss.template +3 -0
  39. package/src/generators/init-application/files/oauth/silent-refresh.html +42 -0
  40. package/src/generators/init-application/files/service-worker/manifest.webmanifest +52 -0
  41. package/src/generators/init-application/files/shared/Dockerfile +29 -0
  42. package/src/generators/init-application/files/shared/assets/build.json +1 -0
  43. package/src/generators/init-application/files/shared/ngsw-config.json +2 -14
  44. package/src/generators/init-application/files/styles/_fonts.scss +9 -0
  45. package/src/generators/init-application/files/styles/_index.scss +10 -0
  46. package/src/generators/init-application/files/styles/_loading-animation.scss +200 -0
  47. package/src/generators/init-application/files/styles/_palette.scss +98 -0
  48. package/src/generators/init-application/files/styles/_table.scss +45 -0
  49. package/src/generators/init-application/files/styles/_theme.scss +14 -0
  50. package/src/generators/init-application/files/styles/_utilities.scss +112 -0
  51. package/src/generators/init-application/files/styles/_variables.scss +77 -0
  52. package/src/generators/init-application/files/styles/fonts/_croissant-one.scss +7 -0
  53. package/src/generators/init-application/files/styles/fonts/_fuggles.scss +7 -0
  54. package/src/generators/init-application/files/styles/fonts/_inclusive-sans.scss +7 -0
  55. package/src/generators/init-application/files/styles/fonts/_material-icons.scss +20 -0
  56. package/src/generators/init-application/files/styles/fonts/_mooli.scss +7 -0
  57. package/src/generators/init-application/files/styles/fonts/_pixelify-sans.scss +7 -0
  58. package/src/generators/init-application/files/styles/fonts/_roboto-mono.scss +7 -0
  59. package/src/generators/init-application/files/styles/fonts/_roboto.scss +95 -0
  60. package/src/generators/init-application/files/styles/fonts/_young-serif.scss +7 -0
  61. package/src/generators/init-application/files/styles/fonts/croissant-one.ttf +0 -0
  62. package/src/generators/init-application/files/styles/fonts/fuggles.ttf +0 -0
  63. package/src/generators/init-application/files/styles/fonts/inclusive-sans.ttf +0 -0
  64. package/src/generators/init-application/files/styles/fonts/material-icons.ttf +0 -0
  65. package/src/generators/init-application/files/styles/fonts/molli.ttf +0 -0
  66. package/src/generators/init-application/files/styles/fonts/pixelify-sans.ttf +0 -0
  67. package/src/generators/init-application/files/styles/fonts/roboto-mono.ttf +0 -0
  68. package/src/generators/init-application/files/styles/fonts/young-serif.ttf +0 -0
  69. package/src/generators/init-application/generator.js +560 -87
  70. package/src/generators/init-application/generator.js.map +1 -1
  71. package/src/generators/init-application/schema.d.ts +9 -0
  72. package/src/generators/init-application/schema.json +59 -8
  73. package/src/generators/init-feature/files/feature/__name__/routes.ts.template +10 -0
  74. package/src/generators/init-feature/generator.d.ts +4 -0
  75. package/src/generators/init-feature/generator.js +26 -0
  76. package/src/generators/init-feature/generator.js.map +1 -0
  77. package/src/generators/init-feature/index.d.ts +2 -0
  78. package/src/generators/init-feature/index.js +7 -0
  79. package/src/generators/init-feature/index.js.map +1 -0
  80. package/src/generators/init-feature/schema.d.ts +4 -0
  81. package/src/generators/init-feature/schema.json +20 -0
  82. package/src/generators/init-library/generator.js +106 -14
  83. package/src/generators/init-library/generator.js.map +1 -1
  84. package/src/generators/init-library/schema.d.ts +3 -0
  85. package/src/generators/init-library/schema.json +14 -0
  86. package/src/lib/add-route.d.ts +3 -0
  87. package/src/lib/add-route.js +27 -0
  88. package/src/lib/add-route.js.map +1 -0
  89. package/src/lib/build-route-object.d.ts +7 -0
  90. package/src/lib/build-route-object.js +18 -0
  91. package/src/lib/build-route-object.js.map +1 -0
  92. package/src/lib/coerce-cypress-component-testing.d.ts +2 -0
  93. package/src/lib/coerce-cypress-component-testing.js +79 -0
  94. package/src/lib/coerce-cypress-component-testing.js.map +1 -0
  95. package/src/lib/find-parent-route.d.ts +2 -0
  96. package/src/lib/find-parent-route.js +54 -0
  97. package/src/lib/find-parent-route.js.map +1 -0
  98. package/src/lib/skip-project.js +3 -3
  99. package/src/lib/skip-project.js.map +1 -1
  100. package/src/generators/init-application/files/shared/angular.Dockerfile +0 -3
  101. package/src/generators/init-application/files/shared/configuration/.gitkeep +0 -0
  102. /package/src/generators/init-application/files/{shared → assets}/.gitkeep +0 -0
@@ -5,10 +5,12 @@ const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const generator_utilities_1 = require("@rxap/generator-utilities");
7
7
  const plugin_localazy_1 = require("@rxap/plugin-localazy");
8
- const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
8
+ const ts_morph_1 = require("@rxap/ts-morph");
9
+ const utilities_1 = require("@rxap/utilities");
9
10
  const workspace_ts_morph_1 = require("@rxap/workspace-ts-morph");
10
11
  const workspace_utilities_1 = require("@rxap/workspace-utilities");
11
12
  const path_1 = require("path");
13
+ const ts_morph_2 = require("ts-morph");
12
14
  const skip_project_1 = require("../../lib/skip-project");
13
15
  function skipProject(tree, options, project, projectName) {
14
16
  if ((0, skip_project_1.SkipNonAngularProject)(tree, options, project, projectName)) {
@@ -20,65 +22,59 @@ function skipProject(tree, options, project, projectName) {
20
22
  return false;
21
23
  }
22
24
  function updateProjectTargets(project, options) {
23
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
24
- var _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
25
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
26
+ var _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
25
27
  (_a = project.targets) !== null && _a !== void 0 ? _a : (project.targets = {});
26
28
  if (!project.targets['build']) {
27
29
  throw new Error(`The project '${project.name}' has no build target`);
28
30
  }
29
- (_b = (_s = project.targets)['config']) !== null && _b !== void 0 ? _b : (_s['config'] = {
30
- executor: '@rxap/plugin-application:config',
31
- options: {},
32
- configurations: {
33
- production: {},
34
- development: {},
31
+ if (project.targets['docker']) {
32
+ (_b = (_x = project.targets['docker']).options) !== null && _b !== void 0 ? _b : (_x.options = {});
33
+ (_c = (_y = project.targets['docker'].options).dockerfile) !== null && _c !== void 0 ? _c : (_y.dockerfile = 'shared/angular/Dockerfile');
34
+ }
35
+ (0, workspace_utilities_1.CoerceTarget)(project, 'serve', {
36
+ options: {
37
+ proxyConfig: 'shared/angular/proxy.conf.json',
35
38
  },
36
- });
39
+ }, workspace_utilities_1.Strategy.OVERWRITE);
40
+ (0, workspace_utilities_1.CoerceTarget)(project, 'config', {});
37
41
  if (project.targets['extract-i18n']) {
38
42
  if (options.i18n) {
39
- (_c = options.languages) !== null && _c !== void 0 ? _c : (options.languages = []);
43
+ (_d = options.languages) !== null && _d !== void 0 ? _d : (options.languages = []);
40
44
  if (options.languages.length === 0) {
41
45
  options.languages.push('en');
42
46
  }
43
- (_d = (_t = project.targets)['i18n']) !== null && _d !== void 0 ? _d : (_t['i18n'] = {
44
- executor: '@rxap/plugin-application:i18n',
45
- options: {
46
- availableLanguages: options.languages,
47
- defaultLanguage: options.languages[0],
48
- indexHtmlTemplate: 'shared/i18n.index.html.hbs',
49
- assets: true,
50
- },
51
- configurations: {
52
- production: {},
53
- development: {},
54
- },
55
- });
56
- project.targets['build'].configurations.production.localize = options.languages;
57
- (_e = project.i18n) !== null && _e !== void 0 ? _e : (project.i18n = {});
58
- (_f = (_u = project.i18n).sourceLocale) !== null && _f !== void 0 ? _f : (_u.sourceLocale = 'en-US');
59
- (_g = (_v = project.i18n).locales) !== null && _g !== void 0 ? _g : (_v.locales = {});
47
+ if (options.overwrite) {
48
+ project.targets['build'].configurations.production.localize = options.languages;
49
+ }
50
+ else {
51
+ (_e = (_z = project.targets['build'].configurations.production).localize) !== null && _e !== void 0 ? _e : (_z.localize = []);
52
+ project.targets['build'].configurations.production.localize.push(...options.languages);
53
+ project.targets['build'].configurations.production.localize
54
+ = project.targets['build'].configurations.production.localize.filter((0, utilities_1.unique)());
55
+ }
56
+ (_f = project.i18n) !== null && _f !== void 0 ? _f : (project.i18n = {});
57
+ (_g = (_0 = project.i18n).sourceLocale) !== null && _g !== void 0 ? _g : (_0.sourceLocale = 'en-US');
58
+ (_h = (_1 = project.i18n).locales) !== null && _h !== void 0 ? _h : (_1.locales = {});
60
59
  for (const language of options.languages) {
61
- (_h = (_w = project.i18n.locales)[language]) !== null && _h !== void 0 ? _h : (_w[language] = {
60
+ (_j = (_2 = project.i18n.locales)[language]) !== null && _j !== void 0 ? _j : (_2[language] = {
62
61
  translation: `${project.sourceRoot}/i18n/${language}.xlf`,
63
62
  baseHref: `${language}/`,
64
63
  });
65
64
  }
66
65
  }
67
- (_j = (_x = project.targets['extract-i18n']).options) !== null && _j !== void 0 ? _j : (_x.options = {});
66
+ (_k = (_3 = project.targets['extract-i18n']).options) !== null && _k !== void 0 ? _k : (_3.options = {});
68
67
  project.targets['extract-i18n'].options.format = 'xliff2';
69
68
  project.targets['extract-i18n'].options.outputPath = (0, path_1.join)(project.sourceRoot, 'i18n');
70
69
  if (options.localazy) {
71
- (_k = (_y = project.targets)['localazy-download']) !== null && _k !== void 0 ? _k : (_y['localazy-download'] = {
70
+ (_l = (_4 = project.targets)['localazy-download']) !== null && _l !== void 0 ? _l : (_4['localazy-download'] = {
72
71
  executor: '@rxap/plugin-localazy:download',
73
- options: {
72
+ options: (0, utilities_1.DeleteEmptyProperties)({
73
+ readKey: options.localazyReadKey,
74
74
  workingDirectory: project.root,
75
- },
76
- configurations: {
77
- production: {},
78
- development: {},
79
- },
75
+ }),
80
76
  });
81
- (_l = (_z = project.targets)['localazy-upload']) !== null && _l !== void 0 ? _l : (_z['localazy-upload'] = {
77
+ (_m = (_5 = project.targets)['localazy-upload']) !== null && _m !== void 0 ? _m : (_5['localazy-upload'] = {
82
78
  executor: '@rxap/plugin-localazy:upload',
83
79
  options: {
84
80
  extractTarget: `${project.name}:extract-i18n`,
@@ -86,40 +82,140 @@ function updateProjectTargets(project, options) {
86
82
  });
87
83
  }
88
84
  }
89
- (_m = (_0 = project.targets['build']).options) !== null && _m !== void 0 ? _m : (_0.options = {});
85
+ (0, workspace_utilities_1.CoerceTarget)(project, 'build', {
86
+ options: {
87
+ sourceMap: true,
88
+ },
89
+ configurations: {
90
+ production: {
91
+ fileReplacements: [
92
+ {
93
+ replace: `${project.sourceRoot}/environments/environment.ts`,
94
+ with: `${project.sourceRoot}/environments/environment.prod.ts`,
95
+ },
96
+ ],
97
+ },
98
+ },
99
+ }, workspace_utilities_1.Strategy.OVERWRITE);
100
+ (_o = (_6 = project.targets['build']).options) !== null && _o !== void 0 ? _o : (_6.options = {});
90
101
  project.targets['build'].options.sourceMap = true;
91
- (_o = (_1 = project.targets['build'].options).assets) !== null && _o !== void 0 ? _o : (_1.assets = []);
102
+ (_p = (_7 = project.targets['build'].options).assets) !== null && _p !== void 0 ? _p : (_7.assets = []);
103
+ (_q = (_8 = project.targets['build'].options).scripts) !== null && _q !== void 0 ? _q : (_8.scripts = []);
104
+ if (!project.targets['build'].options.scripts.includes('node_modules/marked/marked.min.js')) {
105
+ project.targets['build'].options.scripts.push('node_modules/marked/marked.min.js');
106
+ }
92
107
  (0, generator_utilities_1.CoerceAssets)(project.targets['build'].options.assets, [
93
108
  {
94
- glob: '*.json',
95
- input: 'config/',
96
- output: '/',
109
+ glob: '*',
110
+ input: 'shared/angular/assets/',
111
+ output: '.',
97
112
  },
98
113
  {
99
- glob: '*',
100
- input: 'shared/assets/',
101
- output: '/',
114
+ glob: 'mdi.svg',
115
+ input: './node_modules/@mdi/angular-material',
116
+ output: '.',
102
117
  },
103
118
  ]);
119
+ // ensure the property polyfills are defined
120
+ (_r = (_9 = project.targets['build'].options).polyfills) !== null && _r !== void 0 ? _r : (_9.polyfills = []);
121
+ if (!Array.isArray(project.targets['build'].options.polyfills)) {
122
+ // ensure the property is an array
123
+ project.targets['build'].options.polyfills = ['zone.js'];
124
+ }
125
+ if (options.i18n) {
126
+ (0, generator_utilities_1.CoerceAssets)(project.targets['build'].options.polyfills, ['@angular/localize/init']);
127
+ }
104
128
  if (options.serviceWorker) {
105
129
  (0, generator_utilities_1.CoerceAssets)(project.targets['build'].options.assets, [
106
130
  (0, path_1.join)(project.sourceRoot, 'manifest.webmanifest'),
107
131
  ]);
108
- (_p = (_2 = project.targets['build']).configurations) !== null && _p !== void 0 ? _p : (_2.configurations = {});
109
- (_q = (_3 = project.targets['build'].configurations).production) !== null && _q !== void 0 ? _q : (_3.production = {});
132
+ (_s = (_10 = project.targets['build']).configurations) !== null && _s !== void 0 ? _s : (_10.configurations = {});
133
+ (_t = (_11 = project.targets['build'].configurations).production) !== null && _t !== void 0 ? _t : (_11.production = {});
110
134
  project.targets['build'].configurations.production.serviceWorker = true;
111
- (_r = (_4 = project.targets['build'].configurations.production).ngswConfigPath) !== null && _r !== void 0 ? _r : (_4.ngswConfigPath = 'shared/ngsw-config.json');
135
+ (_u = (_12 = project.targets['build'].configurations.production).ngswConfigPath) !== null && _u !== void 0 ? _u : (_12.ngswConfigPath = 'shared/angular/ngsw-config.json');
136
+ }
137
+ (_v = (_13 = project.targets['build'].configurations).production) !== null && _v !== void 0 ? _v : (_13.production = {});
138
+ (_w = (_14 = project.targets['build'].configurations.production).budgets) !== null && _w !== void 0 ? _w : (_14.budgets = []);
139
+ const budget = project.targets['build'].configurations.production.budgets.find(b => b.type === 'initial');
140
+ const defaultWarning = '2mb';
141
+ const defaultError = '5mb';
142
+ if (!budget) {
143
+ project.targets['build'].configurations.production.budgets.push({
144
+ type: 'initial',
145
+ maximumWarning: defaultWarning,
146
+ maximumError: defaultError,
147
+ });
148
+ }
149
+ else {
150
+ if (options.overwrite) {
151
+ budget.maximumWarning = defaultWarning;
152
+ budget.maximumError = defaultError;
153
+ }
154
+ else {
155
+ if (compareBudget(budget.maximumWarning, defaultWarning) === -1) {
156
+ budget.maximumWarning = defaultWarning;
157
+ }
158
+ if (compareBudget(budget.maximumError, defaultError) === -1) {
159
+ budget.maximumError = defaultError;
160
+ }
161
+ }
162
+ }
163
+ if (options.deploy) {
164
+ switch (options.deploy) {
165
+ case 'web3-storage':
166
+ if (options.i18n) {
167
+ (0, workspace_utilities_1.CoerceTarget)(project, 'i18n-index-html', {});
168
+ }
169
+ (0, workspace_utilities_1.CoerceTarget)(project, 'deploy', {
170
+ executor: '@rxap/plugin-web3-storage:deploy',
171
+ outputs: ['dist/{projectRoot}/ipfs-cid.txt'],
172
+ }, workspace_utilities_1.Strategy.OVERWRITE);
173
+ break;
174
+ }
175
+ }
176
+ }
177
+ /**
178
+ * Compare two budget strings
179
+ *
180
+ * @param a
181
+ * @param b
182
+ * @returns -1 if a < b, 0 if a === b, 1 if a > b
183
+ */
184
+ function compareBudget(a, b) {
185
+ const aUnit = a.slice(-2);
186
+ const bUnit = b.slice(-2);
187
+ const aNumber = Number(a.slice(0, -2));
188
+ const bNumber = Number(b.slice(0, -2));
189
+ if (aUnit === bUnit) {
190
+ return aNumber < bNumber ? -1 : aNumber > bNumber ? 1 : 0;
191
+ }
192
+ if (aUnit === 'kb') {
193
+ return bUnit === 'mb' ? -1 : 1;
194
+ }
195
+ if (aUnit === 'mb') {
196
+ return bUnit === 'kb' ? 1 : -1;
112
197
  }
113
198
  }
114
199
  function updateTargetDefaults(tree, options) {
115
200
  const nxJson = (0, devkit_1.readNxJson)(tree);
116
- if (options.i18n) {
117
- (0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'i18n', 'build');
118
- }
119
201
  if (options.localazy) {
120
202
  (0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'build', 'localazy-download');
121
203
  (0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'localazy-upload', 'extract-i18n');
204
+ (0, workspace_utilities_1.CoerceTargetDefaultsInput)(nxJson, 'localazy-upload', '{projectRoot}/src/i18n/messages.xlf');
205
+ (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' });
206
+ (0, workspace_utilities_1.CoerceTargetDefaultsOutput)(nxJson, 'localazy-download', '{projectRoot}/src/i18n');
122
207
  }
208
+ (0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'build', '^generate-open-api');
209
+ (0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'serve', '^generate-open-api');
210
+ (0, workspace_utilities_1.CoerceNxJsonCacheableOperation)(nxJson, 'localazy-download', 'localazy-upload', 'extract-i18n', 'i18n-index-html');
211
+ (0, workspace_utilities_1.CoerceTargetDefaultsInput)(nxJson, 'deploy', '{workspaceRoot}/dist/{projectRoot}');
212
+ (0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'deploy', 'i18n-index-html');
213
+ (0, workspace_utilities_1.CoerceTarget)(nxJson, 'i18n-index-html', {
214
+ dependsOn: ['build'],
215
+ executor: '@rxap/plugin-application:i18n',
216
+ outputs: ['dist/{projectRoot}/index.html'],
217
+ inputs: ['{workspaceRoot}/{projectRoot}/project.json'],
218
+ });
123
219
  (0, devkit_1.updateNxJson)(tree, nxJson);
124
220
  }
125
221
  function updateGitIgnore(project, tree, options) {
@@ -131,16 +227,32 @@ function updateGitIgnore(project, tree, options) {
131
227
  }
132
228
  }
133
229
  function updateTags(project, options) {
134
- const tags = ['frontend'];
230
+ const tags = ['frontend', 'user-interface'];
135
231
  if (options.i18n) {
136
232
  tags.push('i18n');
137
233
  }
138
234
  if (options.localazy) {
139
235
  tags.push('localazy');
140
236
  }
237
+ if (options.serviceWorker) {
238
+ tags.push('service-worker');
239
+ }
240
+ if (options.sentry) {
241
+ tags.push('sentry');
242
+ }
141
243
  (0, generator_utilities_1.CoerceProjectTags)(project, tags);
142
244
  }
143
245
  const MAIN_BOOTSTRAP_STATEMENT = `application.bootstrap().catch((err) => console.error(err));`;
246
+ const MAIN_LOGGER_STATEMENT = `application.importProvidersFrom(LoggerModule.forRoot({
247
+ serverLoggingUrl: '/api/logs',
248
+ level: NgxLoggerLevel.DEBUG,
249
+ serverLogLevel: NgxLoggerLevel.ERROR,
250
+ }));`;
251
+ const MAIN_APP_CREATION_STATEMENT = `const application = new StandaloneApplication(
252
+ environment,
253
+ AppComponent,
254
+ appConfig,
255
+ );`;
144
256
  function assertMainStatements(sourceFile) {
145
257
  var _a;
146
258
  const statements = [];
@@ -152,20 +264,12 @@ function assertMainStatements(sourceFile) {
152
264
  console.error(`Missing statement from main.ts: ${statement}`);
153
265
  sourceFile.set({
154
266
  statements: [
155
- `const application = new StandaloneApplication(
156
- environment,
157
- AppComponent,
158
- appConfig,
159
- );`,
160
- `application.importProvidersFrom(LoggerModule.forRoot({
161
- serverLoggingUrl: '/api/logs',
162
- level: NgxLoggerLevel.DEBUG,
163
- serverLogLevel: NgxLoggerLevel.ERROR
164
- }));`,
267
+ MAIN_APP_CREATION_STATEMENT,
268
+ MAIN_LOGGER_STATEMENT,
165
269
  MAIN_BOOTSTRAP_STATEMENT,
166
270
  ],
167
271
  });
168
- (0, schematics_ts_morph_1.CoerceImports)(sourceFile, [
272
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
169
273
  {
170
274
  moduleSpecifier: './app/app.component',
171
275
  namedImports: ['AppComponent'],
@@ -175,12 +279,12 @@ function assertMainStatements(sourceFile) {
175
279
  namedImports: ['appConfig'],
176
280
  },
177
281
  {
178
- moduleSpecifier: './environment',
282
+ moduleSpecifier: './environments/environment',
179
283
  namedImports: ['environment'],
180
284
  },
181
285
  {
182
286
  moduleSpecifier: 'ngx-logger',
183
- namedImports: ['NgxLoggerLevel', 'LoggerModule'],
287
+ namedImports: ['LoggerModule', 'NgxLoggerLevel'],
184
288
  },
185
289
  {
186
290
  moduleSpecifier: '@rxap/ngx-bootstrap',
@@ -191,6 +295,26 @@ function assertMainStatements(sourceFile) {
191
295
  }
192
296
  }
193
297
  }
298
+ function cleanup(tree, projectSourceRoot) {
299
+ const deleteFiles = [
300
+ 'app/app.component.spec.ts',
301
+ 'app/nx-welcome.component.ts',
302
+ 'app/nx-welcome.component.cy.ts',
303
+ ];
304
+ for (const file of deleteFiles) {
305
+ if (tree.exists((0, path_1.join)(projectSourceRoot, file))) {
306
+ tree.delete((0, path_1.join)(projectSourceRoot, file));
307
+ }
308
+ }
309
+ let content = tree.read((0, path_1.join)(projectSourceRoot, 'app/app.component.ts'), 'utf-8')
310
+ .replace('title = \'domain-product\';', '')
311
+ .replace('import { NxWelcomeComponent } from \'./nx-welcome.component\';', '')
312
+ .replace('NxWelcomeComponent, ', '');
313
+ tree.write((0, path_1.join)(projectSourceRoot, 'app/app.component.ts'), content);
314
+ content = tree.read((0, path_1.join)(projectSourceRoot, 'app/app.component.html'), 'utf-8')
315
+ .replace(/<.+-nx-welcome><\/.+-nx-welcome> /, '');
316
+ tree.write((0, path_1.join)(projectSourceRoot, 'app/app.component.html'), content);
317
+ }
194
318
  function updateMainFile(tree, project, options) {
195
319
  (0, workspace_ts_morph_1.TsMorphAngularProjectTransform)(tree, {
196
320
  project: project.name,
@@ -201,18 +325,32 @@ function updateMainFile(tree, project, options) {
201
325
  const importDeclarations = [];
202
326
  const statements = [];
203
327
  if (options.serviceWorker) {
204
- importDeclarations.push({ moduleSpecifier: '@rxap/service-worker', namedImports: ['UnregisterServiceWorker'] });
328
+ importDeclarations.push({
329
+ moduleSpecifier: '@rxap/service-worker',
330
+ namedImports: ['UnregisterServiceWorker'],
331
+ });
205
332
  statements.push('application.before(() => UnregisterServiceWorker(environment));');
206
333
  }
207
334
  if (options.openApi) {
208
- importDeclarations.push({ moduleSpecifier: '@rxap/open-api', namedImports: ['OpenApiInit'] });
209
- statements.push('application.before(() => OpenApiInit());');
335
+ importDeclarations.push({
336
+ moduleSpecifier: '@rxap/open-api',
337
+ namedImports: ['OpenApiInit'],
338
+ });
339
+ if (options.openApiLegacy) {
340
+ statements.push('application.before(() => OpenApiInit(environment, { load: true }));');
341
+ }
342
+ else {
343
+ statements.push('application.before(() => OpenApiInit(environment));');
344
+ }
210
345
  }
211
346
  if (options.sentry) {
212
- importDeclarations.push({ moduleSpecifier: '@rxap/ngx-sentry', namedImports: ['SentryInit'] });
347
+ importDeclarations.push({
348
+ moduleSpecifier: '@rxap/ngx-sentry',
349
+ namedImports: ['SentryInit'],
350
+ });
213
351
  statements.push('application.before(() => SentryInit(environment));');
214
352
  }
215
- (0, schematics_ts_morph_1.CoerceImports)(sourceFile, importDeclarations);
353
+ (0, ts_morph_1.CoerceImports)(sourceFile, importDeclarations);
216
354
  for (let i = 0; i < statements.length; i++) {
217
355
  const statement = statements[i];
218
356
  const lastStatement = i > 0 ? statements[i - 1] : null;
@@ -235,27 +373,362 @@ function updateMainFile(tree, project, options) {
235
373
  }
236
374
  }, ['main.ts']);
237
375
  }
376
+ function coerceEnvironmentFiles(tree, options) {
377
+ (0, workspace_ts_morph_1.TsMorphNestProjectTransform)(tree, {
378
+ project: options.project,
379
+ }, (project, [sourceFile, prodSourceFile]) => {
380
+ (0, ts_morph_1.CoerceImports)(sourceFile, {
381
+ moduleSpecifier: '@rxap/environment',
382
+ namedImports: ['Environment'],
383
+ });
384
+ (0, ts_morph_1.CoerceImports)(prodSourceFile, {
385
+ moduleSpecifier: '@rxap/environment',
386
+ namedImports: ['Environment'],
387
+ });
388
+ const baseEnvironment = {
389
+ name: w => w.quote('development'),
390
+ production: 'false',
391
+ app: w => w.quote(options.project),
392
+ serviceWorker: 'false',
393
+ };
394
+ if (options.sentry) {
395
+ baseEnvironment['sentry'] = ts_morph_2.Writers.object({
396
+ enabled: 'false',
397
+ debug: 'false',
398
+ });
399
+ }
400
+ const normal = (0, ts_morph_1.CoerceVariableDeclaration)(sourceFile, 'environment', {
401
+ type: 'Environment',
402
+ initializer: ts_morph_2.Writers.object(baseEnvironment),
403
+ });
404
+ if (options.overwrite) {
405
+ normal.set({ initializer: ts_morph_2.Writers.object(baseEnvironment) });
406
+ }
407
+ baseEnvironment['name'] = w => w.quote('production');
408
+ baseEnvironment['production'] = 'true';
409
+ baseEnvironment['serviceWorker'] = 'true';
410
+ if (options.sentry) {
411
+ baseEnvironment['sentry'] = ts_morph_2.Writers.object({
412
+ enabled: 'true',
413
+ debug: 'false',
414
+ });
415
+ }
416
+ const prod = (0, ts_morph_1.CoerceVariableDeclaration)(prodSourceFile, 'environment', {
417
+ type: 'Environment',
418
+ initializer: ts_morph_2.Writers.object(baseEnvironment),
419
+ });
420
+ if (options.overwrite) {
421
+ prod.set({ initializer: ts_morph_2.Writers.object(baseEnvironment) });
422
+ }
423
+ }, [
424
+ '/environments/environment.ts?',
425
+ '/environments/environment.prod.ts?',
426
+ ]);
427
+ }
428
+ function coerceLocalazyConfigFile(tree, project) {
429
+ const projectRoot = project.root;
430
+ const localazyConfigPath = (0, path_1.join)(projectRoot, 'localazy.json');
431
+ if (!tree.exists(localazyConfigPath)) {
432
+ tree.write(localazyConfigPath, JSON.stringify({
433
+ upload: {
434
+ type: 'xliff',
435
+ deprecate: 'file',
436
+ features: [
437
+ 'use_defined_lang_for_source',
438
+ 'dont_parse_target',
439
+ ],
440
+ files: 'src/i18n/messages.xlf',
441
+ },
442
+ download: {
443
+ files: 'src/i18n/${languageCode}.xlf',
444
+ },
445
+ }, null, 2));
446
+ }
447
+ }
448
+ function updateTsConfig(tree, project, options) {
449
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
450
+ const projectRoot = project.root;
451
+ if (options.i18n) {
452
+ for (const tsConfigName of ['app', 'editor', 'spec']) {
453
+ yield (0, workspace_utilities_1.UpdateJsonFile)(tree, tsConfig => {
454
+ var _a, _b;
455
+ var _c;
456
+ (_a = tsConfig.compilerOptions) !== null && _a !== void 0 ? _a : (tsConfig.compilerOptions = {});
457
+ (_b = (_c = tsConfig.compilerOptions).types) !== null && _b !== void 0 ? _b : (_c.types = []);
458
+ if (!tsConfig.compilerOptions.types.includes('@angular/localize')) {
459
+ tsConfig.compilerOptions.types.push('@angular/localize');
460
+ }
461
+ }, (0, path_1.join)(projectRoot, `tsconfig.${tsConfigName}.json`));
462
+ }
463
+ }
464
+ });
465
+ }
238
466
  function initApplicationGenerator(tree, options) {
467
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
239
468
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
469
+ (_a = options.sentry) !== null && _a !== void 0 ? _a : (options.sentry = true);
470
+ (_b = options.openApi) !== null && _b !== void 0 ? _b : (options.openApi = false);
471
+ (_c = options.config) !== null && _c !== void 0 ? _c : (options.config = true);
472
+ (_d = options.localazy) !== null && _d !== void 0 ? _d : (options.localazy = false);
473
+ (_e = options.i18n) !== null && _e !== void 0 ? _e : (options.i18n = false);
474
+ (_f = options.serviceWorker) !== null && _f !== void 0 ? _f : (options.serviceWorker = false);
475
+ (_g = options.languages) !== null && _g !== void 0 ? _g : (options.languages = options.i18n ? ['en'] : []);
476
+ (_h = options.material) !== null && _h !== void 0 ? _h : (options.material = true);
477
+ (_j = options.generateMain) !== null && _j !== void 0 ? _j : (options.generateMain = false);
478
+ (_k = options.overwrite) !== null && _k !== void 0 ? _k : (options.overwrite = false);
479
+ (_l = options.monolithic) !== null && _l !== void 0 ? _l : (options.monolithic = false);
480
+ options.openApi = options.openApi || options.monolithic;
481
+ (_m = options.authentik) !== null && _m !== void 0 ? _m : (options.authentik = false);
482
+ (_o = options.oauth) !== null && _o !== void 0 ? _o : (options.oauth = false);
483
+ options.oauth = options.oauth || options.authentik;
240
484
  console.log('angular application init generator:', options);
241
- // only add the shared folder if it does not exist
242
- if (!tree.exists('shared')) {
243
- (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files', 'shared'), 'shared', options);
485
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@mdi/angular-material', 'latest', { soft: true });
486
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-bootstrap', 'latest', { soft: true });
487
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, 'ngx-logger', 'latest', { soft: true });
488
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/environment', 'latest', { soft: true });
489
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-status-check', 'latest', { soft: true });
490
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-error', 'latest', { soft: true });
491
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-localize', 'latest', { soft: true });
492
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-changelog', 'latest', { soft: true });
493
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, 'ngx-markdown', 'latest', { soft: true });
494
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, 'marked', '4.3.0', { soft: true });
495
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/config', 'latest', { soft: true });
496
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/directives', 'latest', { soft: true });
497
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/components', 'latest', { soft: true });
498
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/rxjs', 'latest', { soft: true });
499
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/data-grid', 'latest', { soft: true });
500
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/forms', 'latest', { soft: true });
501
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/validator', 'latest', { soft: true });
502
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/pipes', 'latest', { soft: true });
503
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/mixin', 'latest', { soft: true });
504
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/reflect-metadata', 'latest', { soft: true });
505
+ if (options.oauth) {
506
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, 'angular-oauth2-oidc', 'latest', { soft: true });
507
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, 'angular-oauth2-oidc-jwks', 'latest', { soft: true });
508
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/oauth', 'latest', { soft: true });
244
509
  }
245
- for (const [projectName, project] of (0, devkit_1.getProjects)(tree).entries()) {
246
- if (skipProject(tree, options, project, projectName)) {
247
- continue;
248
- }
249
- console.log(`init project: ${projectName}`);
250
- updateProjectTargets(project, options);
251
- updateTags(project, options);
252
- updateTargetDefaults(tree, options);
253
- updateGitIgnore(project, tree, options);
254
- if (options.generateMain) {
255
- updateMainFile(tree, project, options);
510
+ if (options.material) {
511
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@angular/material', 'latest', { soft: true });
512
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@angular/cdk', 'latest', { soft: true });
513
+ }
514
+ if (options.serviceWorker) {
515
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/service-worker', 'latest', { soft: true });
516
+ }
517
+ if (options.monolithic) {
518
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/layout', 'latest', { soft: true });
519
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-theme', 'latest', { soft: true });
520
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@ctrl/tinycolor', 'latest', { soft: true });
521
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-pub-sub', 'latest', { soft: true });
522
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/services', 'latest', { soft: true });
523
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/data-source', 'latest', { soft: true });
524
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/pattern', 'latest', { soft: true });
525
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/definition', 'latest', { soft: true });
526
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/authentication', 'latest', { soft: true });
527
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/icon', 'latest', { soft: true });
528
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/material-directives', 'latest', { soft: true });
529
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/browser-utilities', 'latest', { soft: true });
530
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@angular/flex-layout', 'latest', { soft: true });
531
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/authorization', 'latest', { soft: true });
532
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-user', 'latest', { soft: true });
533
+ }
534
+ if (options.openApi) {
535
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/open-api', 'latest', { soft: true });
536
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/remote-method', 'latest', { soft: true });
537
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/definition', 'latest', { soft: true });
538
+ }
539
+ if (options.sentry) {
540
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-sentry', 'latest', { soft: true });
541
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@sentry/angular-ivy', 'latest', { soft: true });
542
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@sentry/browser', 'latest', { soft: true });
543
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@sentry/integrations', 'latest', { soft: true });
544
+ }
545
+ if (options.i18n) {
546
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@angular/localize', 'latest', { soft: true });
547
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-localize', 'latest', { soft: true });
548
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-user', 'latest', { soft: true });
549
+ }
550
+ if (options.localazy) {
551
+ yield (0, workspace_utilities_1.AddPackageJsonDevDependency)(tree, '@localazy/cli', 'latest', { soft: true });
552
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/plugin-localazy', 'latest', { soft: true });
553
+ }
554
+ if (options.deploy === 'web3-storage') {
555
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/plugin-web3-storage', 'latest', { soft: true });
556
+ }
557
+ if (options.i18n && options.deploy === 'web3-storage') {
558
+ (0, workspace_utilities_1.CoerceFilesStructure)(tree, {
559
+ srcFolder: (0, path_1.join)(__dirname, 'files', 'i18n'),
560
+ target: 'shared/angular',
561
+ overwrite: options.overwrite,
562
+ });
563
+ }
564
+ (0, workspace_utilities_1.CoerceFilesStructure)(tree, {
565
+ srcFolder: (0, path_1.join)(__dirname, 'files', 'shared'),
566
+ target: 'shared/angular',
567
+ overwrite: options.overwrite,
568
+ });
569
+ (0, workspace_utilities_1.CoerceFilesStructure)(tree, {
570
+ srcFolder: (0, path_1.join)(__dirname, 'files', 'styles'),
571
+ target: 'shared/angular/styles',
572
+ overwrite: options.overwrite,
573
+ });
574
+ if (options.oauth) {
575
+ (0, workspace_utilities_1.CoerceFilesStructure)(tree, {
576
+ srcFolder: (0, path_1.join)(__dirname, 'files', 'oauth'),
577
+ target: 'shared/angular/assets',
578
+ overwrite: options.overwrite,
579
+ });
580
+ }
581
+ updateTargetDefaults(tree, options);
582
+ if (!options.skipProjects) {
583
+ for (const [projectName, project] of (0, devkit_1.getProjects)(tree).entries()) {
584
+ if (skipProject(tree, options, project, projectName)) {
585
+ continue;
586
+ }
587
+ console.log(`init project: ${projectName}`);
588
+ updateProjectTargets(project, options);
589
+ updateTags(project, options);
590
+ updateGitIgnore(project, tree, options);
591
+ yield updateTsConfig(tree, project, options);
592
+ coerceEnvironmentFiles(tree, {
593
+ project: projectName,
594
+ sentry: options.sentry,
595
+ overwrite: options.overwrite,
596
+ });
597
+ (0, workspace_ts_morph_1.TsMorphNestProjectTransform)(tree, {
598
+ project: projectName,
599
+ }, (_, [sourceFile]) => {
600
+ const providers = [
601
+ 'provideRouter(appRoutes, withEnabledBlockingInitialNavigation())',
602
+ 'provideAnimations()',
603
+ 'ProvideErrorHandler()',
604
+ 'ProvideEnvironment(environment)',
605
+ ];
606
+ const httpInterceptors = [
607
+ 'HttpErrorInterceptor',
608
+ ];
609
+ const importProvidersFrom = [];
610
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
611
+ {
612
+ moduleSpecifier: '@angular/platform-browser/animations',
613
+ namedImports: ['provideAnimations'],
614
+ },
615
+ {
616
+ moduleSpecifier: '@angular/router',
617
+ namedImports: ['provideRouter', 'withEnabledBlockingInitialNavigation'],
618
+ },
619
+ {
620
+ moduleSpecifier: './app.routes',
621
+ namedImports: ['appRoutes'],
622
+ },
623
+ {
624
+ moduleSpecifier: '@rxap/ngx-error',
625
+ namedImports: ['ProvideErrorHandler', 'HttpErrorInterceptor'],
626
+ },
627
+ {
628
+ moduleSpecifier: '@rxap/environment',
629
+ namedImports: ['ProvideEnvironment'],
630
+ },
631
+ {
632
+ moduleSpecifier: '../environments/environment',
633
+ namedImports: ['environment'],
634
+ },
635
+ ]);
636
+ if (options.monolithic) {
637
+ providers.push('ProvideChangelog()');
638
+ importProvidersFrom.push('MarkdownModule.forRoot()');
639
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
640
+ {
641
+ moduleSpecifier: '@rxap/ngx-changelog',
642
+ namedImports: ['ProvideChangelog'],
643
+ },
644
+ {
645
+ moduleSpecifier: 'ngx-markdown',
646
+ namedImports: ['MarkdownModule'],
647
+ },
648
+ ]);
649
+ }
650
+ if (options.oauth) {
651
+ providers.push('provideOAuthClient()');
652
+ providers.push('ProvideAuth()');
653
+ httpInterceptors.push('BearerTokenInterceptor');
654
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
655
+ {
656
+ moduleSpecifier: 'angular-oauth2-oidc',
657
+ namedImports: ['provideOAuthClient'],
658
+ },
659
+ {
660
+ moduleSpecifier: '@rxap/oauth',
661
+ namedImports: ['ProvideAuth'],
662
+ },
663
+ {
664
+ moduleSpecifier: '@rxap/authentication',
665
+ namedImports: ['BearerTokenInterceptor'],
666
+ },
667
+ ]);
668
+ }
669
+ if (options.i18n) {
670
+ httpInterceptors.push('LanguageInterceptor');
671
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
672
+ {
673
+ moduleSpecifier: '@rxap/ngx-localize',
674
+ namedImports: ['LanguageInterceptor'],
675
+ },
676
+ ]);
677
+ }
678
+ if (options.serviceWorker) {
679
+ providers.push(`provideServiceWorker('ngsw-worker.js', { enabled: environment.serviceWorker, registrationStrategy: 'registerWhenStable:30000' })`);
680
+ providers.push('ProvideServiceWorkerUpdater(withDialogUpdater())');
681
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
682
+ {
683
+ moduleSpecifier: '@angular/service-worker',
684
+ namedImports: ['provideServiceWorker'],
685
+ },
686
+ {
687
+ moduleSpecifier: '@rxap/service-worker',
688
+ namedImports: ['ProvideServiceWorkerUpdater', 'withDialogUpdater'],
689
+ },
690
+ ]);
691
+ }
692
+ (0, ts_morph_1.CoerceAppConfigProvider)(sourceFile, {
693
+ overwrite: options.overwrite,
694
+ providers,
695
+ httpInterceptors,
696
+ importProvidersFrom,
697
+ });
698
+ }, ['/app/app.config.ts']);
699
+ if (options.generateMain) {
700
+ updateMainFile(tree, project, options);
701
+ }
702
+ if (options.cleanup) {
703
+ cleanup(tree, project.sourceRoot);
704
+ }
705
+ if (options.localazy) {
706
+ coerceLocalazyConfigFile(tree, project);
707
+ }
708
+ if (options.monolithic) {
709
+ if (!tree.exists((0, path_1.join)(project.sourceRoot, 'assets', 'logo.png'))) {
710
+ if (tree.exists('logo.png')) {
711
+ tree.write((0, path_1.join)(project.sourceRoot, 'assets', 'logo.png'), tree.read('logo.png'));
712
+ }
713
+ }
714
+ if (options.overwrite) {
715
+ (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files', 'monolithic'), project.sourceRoot, Object.assign(Object.assign({}, options), { relativePathToWorkspaceRoot: (0, path_1.relative)(project.sourceRoot, ''), name: projectName.replace(/^user-interface-/, ''), classify: utilities_1.classify, prefix: (0, workspace_utilities_1.GetProjectPrefix)(tree, projectName, 'rxap') }));
716
+ }
717
+ }
718
+ if (options.serviceWorker) {
719
+ if (options.overwrite || !tree.exists((0, path_1.join)(project.sourceRoot, 'manifest.webmanifest'))) {
720
+ (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files', 'service-worker'), project.sourceRoot, Object.assign(Object.assign({}, options), { name: projectName.replace(/^user-interface-/, ''), classify: utilities_1.classify,
721
+ dasherize: utilities_1.dasherize }));
722
+ }
723
+ }
724
+ (0, workspace_utilities_1.CoerceFilesStructure)(tree, {
725
+ srcFolder: (0, path_1.join)(__dirname, 'files', 'assets'),
726
+ target: (0, path_1.join)(project.sourceRoot, 'assets'),
727
+ overwrite: options.overwrite,
728
+ });
729
+ // apply changes to the project configuration
730
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
256
731
  }
257
- // apply changes to the project configuration
258
- (0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
259
732
  }
260
733
  yield (0, plugin_localazy_1.LocalazyGitlabCiGenerator)(tree, options);
261
734
  });