@rxap/plugin-angular 16.1.0-dev.9 → 16.1.1-dev.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 (104) hide show
  1. package/CHANGELOG.md +485 -0
  2. package/README.md +15 -1
  3. package/generators.json +10 -0
  4. package/package.json +62 -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 +557 -89
  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/generators/schematic/generator.js +2 -1
  87. package/src/generators/schematic/generator.js.map +1 -1
  88. package/src/lib/add-route.d.ts +3 -0
  89. package/src/lib/add-route.js +27 -0
  90. package/src/lib/add-route.js.map +1 -0
  91. package/src/lib/build-route-object.d.ts +7 -0
  92. package/src/lib/build-route-object.js +18 -0
  93. package/src/lib/build-route-object.js.map +1 -0
  94. package/src/lib/coerce-cypress-component-testing.d.ts +2 -0
  95. package/src/lib/coerce-cypress-component-testing.js +79 -0
  96. package/src/lib/coerce-cypress-component-testing.js.map +1 -0
  97. package/src/lib/find-parent-route.d.ts +2 -0
  98. package/src/lib/find-parent-route.js +54 -0
  99. package/src/lib/find-parent-route.js.map +1 -0
  100. package/src/lib/skip-project.js +3 -3
  101. package/src/lib/skip-project.js.map +1 -1
  102. package/src/generators/init-application/files/shared/angular.Dockerfile +0 -3
  103. package/src/generators/init-application/files/shared/configuration/.gitkeep +0 -0
  104. /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,69 +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, _s, _t;
24
- var _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
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
31
  if (project.targets['docker']) {
30
- (_b = (_u = project.targets['docker']).options) !== null && _b !== void 0 ? _b : (_u.options = {});
31
- (_c = (_v = project.targets['docker'].options).dockerfile) !== null && _c !== void 0 ? _c : (_v.dockerfile = 'shared/angular.Dockerfile');
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');
32
34
  }
33
- (_d = (_w = project.targets)['config']) !== null && _d !== void 0 ? _d : (_w['config'] = {
34
- executor: '@rxap/plugin-application:config',
35
- options: {},
36
- configurations: {
37
- production: {},
38
- development: {},
35
+ (0, workspace_utilities_1.CoerceTarget)(project, 'serve', {
36
+ options: {
37
+ proxyConfig: 'shared/angular/proxy.conf.json',
39
38
  },
40
- });
39
+ }, workspace_utilities_1.Strategy.OVERWRITE);
40
+ (0, workspace_utilities_1.CoerceTarget)(project, 'config', {});
41
41
  if (project.targets['extract-i18n']) {
42
42
  if (options.i18n) {
43
- (_e = options.languages) !== null && _e !== void 0 ? _e : (options.languages = []);
43
+ (_d = options.languages) !== null && _d !== void 0 ? _d : (options.languages = []);
44
44
  if (options.languages.length === 0) {
45
45
  options.languages.push('en');
46
46
  }
47
- (_f = (_x = project.targets)['i18n']) !== null && _f !== void 0 ? _f : (_x['i18n'] = {
48
- executor: '@rxap/plugin-application:i18n',
49
- options: {
50
- availableLanguages: options.languages,
51
- defaultLanguage: options.languages[0],
52
- indexHtmlTemplate: 'shared/i18n.index.html.hbs',
53
- assets: true,
54
- },
55
- configurations: {
56
- production: {},
57
- development: {},
58
- },
59
- });
60
- project.targets['build'].configurations.production.localize = options.languages;
61
- (_g = project.i18n) !== null && _g !== void 0 ? _g : (project.i18n = {});
62
- (_h = (_y = project.i18n).sourceLocale) !== null && _h !== void 0 ? _h : (_y.sourceLocale = 'en-US');
63
- (_j = (_z = project.i18n).locales) !== null && _j !== void 0 ? _j : (_z.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 = {});
64
59
  for (const language of options.languages) {
65
- (_k = (_0 = project.i18n.locales)[language]) !== null && _k !== void 0 ? _k : (_0[language] = {
60
+ (_j = (_2 = project.i18n.locales)[language]) !== null && _j !== void 0 ? _j : (_2[language] = {
66
61
  translation: `${project.sourceRoot}/i18n/${language}.xlf`,
67
62
  baseHref: `${language}/`,
68
63
  });
69
64
  }
70
65
  }
71
- (_l = (_1 = project.targets['extract-i18n']).options) !== null && _l !== void 0 ? _l : (_1.options = {});
66
+ (_k = (_3 = project.targets['extract-i18n']).options) !== null && _k !== void 0 ? _k : (_3.options = {});
72
67
  project.targets['extract-i18n'].options.format = 'xliff2';
73
68
  project.targets['extract-i18n'].options.outputPath = (0, path_1.join)(project.sourceRoot, 'i18n');
74
69
  if (options.localazy) {
75
- (_m = (_2 = project.targets)['localazy-download']) !== null && _m !== void 0 ? _m : (_2['localazy-download'] = {
70
+ (_l = (_4 = project.targets)['localazy-download']) !== null && _l !== void 0 ? _l : (_4['localazy-download'] = {
76
71
  executor: '@rxap/plugin-localazy:download',
77
- options: {
72
+ options: (0, utilities_1.DeleteEmptyProperties)({
73
+ readKey: options.localazyReadKey,
78
74
  workingDirectory: project.root,
79
- },
80
- configurations: {
81
- production: {},
82
- development: {},
83
- },
75
+ }),
84
76
  });
85
- (_o = (_3 = project.targets)['localazy-upload']) !== null && _o !== void 0 ? _o : (_3['localazy-upload'] = {
77
+ (_m = (_5 = project.targets)['localazy-upload']) !== null && _m !== void 0 ? _m : (_5['localazy-upload'] = {
86
78
  executor: '@rxap/plugin-localazy:upload',
87
79
  options: {
88
80
  extractTarget: `${project.name}:extract-i18n`,
@@ -90,40 +82,140 @@ function updateProjectTargets(project, options) {
90
82
  });
91
83
  }
92
84
  }
93
- (_p = (_4 = project.targets['build']).options) !== null && _p !== void 0 ? _p : (_4.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 = {});
94
101
  project.targets['build'].options.sourceMap = true;
95
- (_q = (_5 = project.targets['build'].options).assets) !== null && _q !== void 0 ? _q : (_5.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
+ }
96
107
  (0, generator_utilities_1.CoerceAssets)(project.targets['build'].options.assets, [
97
108
  {
98
- glob: '*.json',
99
- input: 'config/',
100
- output: '/',
109
+ glob: '*',
110
+ input: 'shared/angular/assets/',
111
+ output: '.',
101
112
  },
102
113
  {
103
- glob: '*',
104
- input: 'shared/assets/',
105
- output: '/',
114
+ glob: 'mdi.svg',
115
+ input: './node_modules/@mdi/angular-material',
116
+ output: '.',
106
117
  },
107
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
+ }
108
128
  if (options.serviceWorker) {
109
129
  (0, generator_utilities_1.CoerceAssets)(project.targets['build'].options.assets, [
110
130
  (0, path_1.join)(project.sourceRoot, 'manifest.webmanifest'),
111
131
  ]);
112
- (_r = (_6 = project.targets['build']).configurations) !== null && _r !== void 0 ? _r : (_6.configurations = {});
113
- (_s = (_7 = project.targets['build'].configurations).production) !== null && _s !== void 0 ? _s : (_7.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 = {});
114
134
  project.targets['build'].configurations.production.serviceWorker = true;
115
- (_t = (_8 = project.targets['build'].configurations.production).ngswConfigPath) !== null && _t !== void 0 ? _t : (_8.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;
116
197
  }
117
198
  }
118
199
  function updateTargetDefaults(tree, options) {
119
200
  const nxJson = (0, devkit_1.readNxJson)(tree);
120
- if (options.i18n) {
121
- (0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'i18n', 'build');
122
- }
123
201
  if (options.localazy) {
124
202
  (0, workspace_utilities_1.CoerceTargetDefaultsDependency)(nxJson, 'build', 'localazy-download');
125
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');
126
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
+ });
127
219
  (0, devkit_1.updateNxJson)(tree, nxJson);
128
220
  }
129
221
  function updateGitIgnore(project, tree, options) {
@@ -135,16 +227,32 @@ function updateGitIgnore(project, tree, options) {
135
227
  }
136
228
  }
137
229
  function updateTags(project, options) {
138
- const tags = ['frontend'];
230
+ const tags = ['frontend', 'user-interface'];
139
231
  if (options.i18n) {
140
232
  tags.push('i18n');
141
233
  }
142
234
  if (options.localazy) {
143
235
  tags.push('localazy');
144
236
  }
237
+ if (options.serviceWorker) {
238
+ tags.push('service-worker');
239
+ }
240
+ if (options.sentry) {
241
+ tags.push('sentry');
242
+ }
145
243
  (0, generator_utilities_1.CoerceProjectTags)(project, tags);
146
244
  }
147
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
+ );`;
148
256
  function assertMainStatements(sourceFile) {
149
257
  var _a;
150
258
  const statements = [];
@@ -156,20 +264,12 @@ function assertMainStatements(sourceFile) {
156
264
  console.error(`Missing statement from main.ts: ${statement}`);
157
265
  sourceFile.set({
158
266
  statements: [
159
- `const application = new StandaloneApplication(
160
- environment,
161
- AppComponent,
162
- appConfig,
163
- );`,
164
- `application.importProvidersFrom(LoggerModule.forRoot({
165
- serverLoggingUrl: '/api/logs',
166
- level: NgxLoggerLevel.DEBUG,
167
- serverLogLevel: NgxLoggerLevel.ERROR
168
- }));`,
267
+ MAIN_APP_CREATION_STATEMENT,
268
+ MAIN_LOGGER_STATEMENT,
169
269
  MAIN_BOOTSTRAP_STATEMENT,
170
270
  ],
171
271
  });
172
- (0, schematics_ts_morph_1.CoerceImports)(sourceFile, [
272
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
173
273
  {
174
274
  moduleSpecifier: './app/app.component',
175
275
  namedImports: ['AppComponent'],
@@ -179,12 +279,12 @@ function assertMainStatements(sourceFile) {
179
279
  namedImports: ['appConfig'],
180
280
  },
181
281
  {
182
- moduleSpecifier: './environment',
282
+ moduleSpecifier: './environments/environment',
183
283
  namedImports: ['environment'],
184
284
  },
185
285
  {
186
286
  moduleSpecifier: 'ngx-logger',
187
- namedImports: ['NgxLoggerLevel', 'LoggerModule'],
287
+ namedImports: ['LoggerModule', 'NgxLoggerLevel'],
188
288
  },
189
289
  {
190
290
  moduleSpecifier: '@rxap/ngx-bootstrap',
@@ -195,6 +295,26 @@ function assertMainStatements(sourceFile) {
195
295
  }
196
296
  }
197
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
+ }
198
318
  function updateMainFile(tree, project, options) {
199
319
  (0, workspace_ts_morph_1.TsMorphAngularProjectTransform)(tree, {
200
320
  project: project.name,
@@ -205,18 +325,32 @@ function updateMainFile(tree, project, options) {
205
325
  const importDeclarations = [];
206
326
  const statements = [];
207
327
  if (options.serviceWorker) {
208
- importDeclarations.push({ moduleSpecifier: '@rxap/service-worker', namedImports: ['UnregisterServiceWorker'] });
328
+ importDeclarations.push({
329
+ moduleSpecifier: '@rxap/service-worker',
330
+ namedImports: ['UnregisterServiceWorker'],
331
+ });
209
332
  statements.push('application.before(() => UnregisterServiceWorker(environment));');
210
333
  }
211
334
  if (options.openApi) {
212
- importDeclarations.push({ moduleSpecifier: '@rxap/open-api', namedImports: ['OpenApiInit'] });
213
- 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
+ }
214
345
  }
215
346
  if (options.sentry) {
216
- importDeclarations.push({ moduleSpecifier: '@rxap/ngx-sentry', namedImports: ['SentryInit'] });
347
+ importDeclarations.push({
348
+ moduleSpecifier: '@rxap/ngx-sentry',
349
+ namedImports: ['SentryInit'],
350
+ });
217
351
  statements.push('application.before(() => SentryInit(environment));');
218
352
  }
219
- (0, schematics_ts_morph_1.CoerceImports)(sourceFile, importDeclarations);
353
+ (0, ts_morph_1.CoerceImports)(sourceFile, importDeclarations);
220
354
  for (let i = 0; i < statements.length; i++) {
221
355
  const statement = statements[i];
222
356
  const lastStatement = i > 0 ? statements[i - 1] : null;
@@ -239,27 +373,361 @@ function updateMainFile(tree, project, options) {
239
373
  }
240
374
  }, ['main.ts']);
241
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
+ }
242
466
  function initApplicationGenerator(tree, options) {
467
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
243
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;
244
484
  console.log('angular application init generator:', options);
245
- // only add the shared folder if it does not exist
246
- if (!tree.exists('shared')) {
247
- (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 });
248
509
  }
249
- for (const [projectName, project] of (0, devkit_1.getProjects)(tree).entries()) {
250
- if (skipProject(tree, options, project, projectName)) {
251
- continue;
252
- }
253
- console.log(`init project: ${projectName}`);
254
- updateProjectTargets(project, options);
255
- updateTags(project, options);
256
- updateTargetDefaults(tree, options);
257
- updateGitIgnore(project, tree, options);
258
- if (options.generateMain) {
259
- 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, '@rxap/authorization', 'latest', { soft: true });
531
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-user', 'latest', { soft: true });
532
+ }
533
+ if (options.openApi) {
534
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/open-api', 'latest', { soft: true });
535
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/remote-method', 'latest', { soft: true });
536
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/definition', 'latest', { soft: true });
537
+ }
538
+ if (options.sentry) {
539
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-sentry', 'latest', { soft: true });
540
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@sentry/angular-ivy', 'latest', { soft: true });
541
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@sentry/browser', 'latest', { soft: true });
542
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@sentry/integrations', 'latest', { soft: true });
543
+ }
544
+ if (options.i18n) {
545
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@angular/localize', 'latest', { soft: true });
546
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-localize', 'latest', { soft: true });
547
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/ngx-user', 'latest', { soft: true });
548
+ }
549
+ if (options.localazy) {
550
+ yield (0, workspace_utilities_1.AddPackageJsonDevDependency)(tree, '@localazy/cli', 'latest', { soft: true });
551
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/plugin-localazy', 'latest', { soft: true });
552
+ }
553
+ if (options.deploy === 'web3-storage') {
554
+ yield (0, workspace_utilities_1.AddPackageJsonDependency)(tree, '@rxap/plugin-web3-storage', 'latest', { soft: true });
555
+ }
556
+ if (options.i18n && options.deploy === 'web3-storage') {
557
+ (0, workspace_utilities_1.CoerceFilesStructure)(tree, {
558
+ srcFolder: (0, path_1.join)(__dirname, 'files', 'i18n'),
559
+ target: 'shared/angular',
560
+ overwrite: options.overwrite,
561
+ });
562
+ }
563
+ (0, workspace_utilities_1.CoerceFilesStructure)(tree, {
564
+ srcFolder: (0, path_1.join)(__dirname, 'files', 'shared'),
565
+ target: 'shared/angular',
566
+ overwrite: options.overwrite,
567
+ });
568
+ (0, workspace_utilities_1.CoerceFilesStructure)(tree, {
569
+ srcFolder: (0, path_1.join)(__dirname, 'files', 'styles'),
570
+ target: 'shared/angular/styles',
571
+ overwrite: options.overwrite,
572
+ });
573
+ if (options.oauth) {
574
+ (0, workspace_utilities_1.CoerceFilesStructure)(tree, {
575
+ srcFolder: (0, path_1.join)(__dirname, 'files', 'oauth'),
576
+ target: 'shared/angular/assets',
577
+ overwrite: options.overwrite,
578
+ });
579
+ }
580
+ updateTargetDefaults(tree, options);
581
+ if (!options.skipProjects) {
582
+ for (const [projectName, project] of (0, devkit_1.getProjects)(tree).entries()) {
583
+ if (skipProject(tree, options, project, projectName)) {
584
+ continue;
585
+ }
586
+ console.log(`init project: ${projectName}`);
587
+ updateProjectTargets(project, options);
588
+ updateTags(project, options);
589
+ updateGitIgnore(project, tree, options);
590
+ yield updateTsConfig(tree, project, options);
591
+ coerceEnvironmentFiles(tree, {
592
+ project: projectName,
593
+ sentry: options.sentry,
594
+ overwrite: options.overwrite,
595
+ });
596
+ (0, workspace_ts_morph_1.TsMorphNestProjectTransform)(tree, {
597
+ project: projectName,
598
+ }, (_, [sourceFile]) => {
599
+ const providers = [
600
+ 'provideRouter(appRoutes, withEnabledBlockingInitialNavigation())',
601
+ 'provideAnimations()',
602
+ 'ProvideErrorHandler()',
603
+ 'ProvideEnvironment(environment)',
604
+ ];
605
+ const httpInterceptors = [
606
+ 'HttpErrorInterceptor',
607
+ ];
608
+ const importProvidersFrom = [];
609
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
610
+ {
611
+ moduleSpecifier: '@angular/platform-browser/animations',
612
+ namedImports: ['provideAnimations'],
613
+ },
614
+ {
615
+ moduleSpecifier: '@angular/router',
616
+ namedImports: ['provideRouter', 'withEnabledBlockingInitialNavigation'],
617
+ },
618
+ {
619
+ moduleSpecifier: './app.routes',
620
+ namedImports: ['appRoutes'],
621
+ },
622
+ {
623
+ moduleSpecifier: '@rxap/ngx-error',
624
+ namedImports: ['ProvideErrorHandler', 'HttpErrorInterceptor'],
625
+ },
626
+ {
627
+ moduleSpecifier: '@rxap/environment',
628
+ namedImports: ['ProvideEnvironment'],
629
+ },
630
+ {
631
+ moduleSpecifier: '../environments/environment',
632
+ namedImports: ['environment'],
633
+ },
634
+ ]);
635
+ if (options.monolithic) {
636
+ providers.push('ProvideChangelog()');
637
+ importProvidersFrom.push('MarkdownModule.forRoot()');
638
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
639
+ {
640
+ moduleSpecifier: '@rxap/ngx-changelog',
641
+ namedImports: ['ProvideChangelog'],
642
+ },
643
+ {
644
+ moduleSpecifier: 'ngx-markdown',
645
+ namedImports: ['MarkdownModule'],
646
+ },
647
+ ]);
648
+ }
649
+ if (options.oauth) {
650
+ providers.push('provideOAuthClient()');
651
+ providers.push('ProvideAuth()');
652
+ httpInterceptors.push('BearerTokenInterceptor');
653
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
654
+ {
655
+ moduleSpecifier: 'angular-oauth2-oidc',
656
+ namedImports: ['provideOAuthClient'],
657
+ },
658
+ {
659
+ moduleSpecifier: '@rxap/oauth',
660
+ namedImports: ['ProvideAuth'],
661
+ },
662
+ {
663
+ moduleSpecifier: '@rxap/authentication',
664
+ namedImports: ['BearerTokenInterceptor'],
665
+ },
666
+ ]);
667
+ }
668
+ if (options.i18n) {
669
+ httpInterceptors.push('LanguageInterceptor');
670
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
671
+ {
672
+ moduleSpecifier: '@rxap/ngx-localize',
673
+ namedImports: ['LanguageInterceptor'],
674
+ },
675
+ ]);
676
+ }
677
+ if (options.serviceWorker) {
678
+ providers.push(`provideServiceWorker('ngsw-worker.js', { enabled: environment.serviceWorker, registrationStrategy: 'registerWhenStable:30000' })`);
679
+ providers.push('ProvideServiceWorkerUpdater(withDialogUpdater())');
680
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
681
+ {
682
+ moduleSpecifier: '@angular/service-worker',
683
+ namedImports: ['provideServiceWorker'],
684
+ },
685
+ {
686
+ moduleSpecifier: '@rxap/service-worker',
687
+ namedImports: ['ProvideServiceWorkerUpdater', 'withDialogUpdater'],
688
+ },
689
+ ]);
690
+ }
691
+ (0, ts_morph_1.CoerceAppConfigProvider)(sourceFile, {
692
+ overwrite: options.overwrite,
693
+ providers,
694
+ httpInterceptors,
695
+ importProvidersFrom,
696
+ });
697
+ }, ['/app/app.config.ts']);
698
+ if (options.generateMain) {
699
+ updateMainFile(tree, project, options);
700
+ }
701
+ if (options.cleanup) {
702
+ cleanup(tree, project.sourceRoot);
703
+ }
704
+ if (options.localazy) {
705
+ coerceLocalazyConfigFile(tree, project);
706
+ }
707
+ if (options.monolithic) {
708
+ if (!tree.exists((0, path_1.join)(project.sourceRoot, 'assets', 'logo.png'))) {
709
+ if (tree.exists('logo.png')) {
710
+ tree.write((0, path_1.join)(project.sourceRoot, 'assets', 'logo.png'), tree.read('logo.png'));
711
+ }
712
+ }
713
+ if (options.overwrite) {
714
+ (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') }));
715
+ }
716
+ }
717
+ if (options.serviceWorker) {
718
+ if (options.overwrite || !tree.exists((0, path_1.join)(project.sourceRoot, 'manifest.webmanifest'))) {
719
+ (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,
720
+ dasherize: utilities_1.dasherize }));
721
+ }
722
+ }
723
+ (0, workspace_utilities_1.CoerceFilesStructure)(tree, {
724
+ srcFolder: (0, path_1.join)(__dirname, 'files', 'assets'),
725
+ target: (0, path_1.join)(project.sourceRoot, 'assets'),
726
+ overwrite: options.overwrite,
727
+ });
728
+ // apply changes to the project configuration
729
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
260
730
  }
261
- // apply changes to the project configuration
262
- (0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
263
731
  }
264
732
  yield (0, plugin_localazy_1.LocalazyGitlabCiGenerator)(tree, options);
265
733
  });