@rxap/plugin-angular 16.1.0-dev.9 → 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.
- package/CHANGELOG.md +479 -0
- package/README.md +15 -1
- package/generators.json +10 -0
- package/package.json +61 -48
- package/src/generators/init/generator.js +14 -7
- package/src/generators/init/generator.js.map +1 -1
- package/src/generators/init/schema.d.ts +2 -0
- package/src/generators/init/schema.json +10 -0
- package/src/generators/init-application/files/app/app.navigation.ts.template +11 -0
- package/src/generators/init-application/files/app/app.routes.ts.template +14 -0
- package/src/generators/init-application/files/app/layout.routes.ts.template +33 -0
- package/src/generators/init-application/files/assets/icons/create-pwa-icons.sh +11 -0
- package/src/generators/init-application/files/assets/icons/icon-114x114.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-120x120.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-128x128.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-144x144.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-152x152.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-16x16.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-180x180.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-192x192.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-32x32.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-384x384.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-512x512.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-57x57.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-60x60.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-72x72.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-76x76.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon-96x96.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon.png +0 -0
- package/src/generators/init-application/files/assets/icons/icon.svg +43 -0
- package/src/generators/init-application/files/assets/logo.png +0 -0
- package/src/generators/init-application/files/assets/logo.svg +63 -0
- package/src/generators/init-application/files/{shared → i18n}/i18n.index.html.hbs +1 -1
- package/src/generators/init-application/files/monolithic/app/app.navigation.ts.template +11 -0
- package/src/generators/init-application/files/monolithic/app/app.routes.ts.template +14 -0
- package/src/generators/init-application/files/monolithic/app/layout.routes.ts.template +32 -0
- package/src/generators/init-application/files/monolithic/index.html.template +165 -0
- package/src/generators/init-application/files/monolithic/styles.scss.template +3 -0
- package/src/generators/init-application/files/oauth/silent-refresh.html +42 -0
- package/src/generators/init-application/files/service-worker/manifest.webmanifest +52 -0
- package/src/generators/init-application/files/shared/Dockerfile +29 -0
- package/src/generators/init-application/files/shared/assets/build.json +1 -0
- package/src/generators/init-application/files/shared/ngsw-config.json +2 -14
- package/src/generators/init-application/files/styles/_fonts.scss +9 -0
- package/src/generators/init-application/files/styles/_index.scss +10 -0
- package/src/generators/init-application/files/styles/_loading-animation.scss +200 -0
- package/src/generators/init-application/files/styles/_palette.scss +98 -0
- package/src/generators/init-application/files/styles/_table.scss +45 -0
- package/src/generators/init-application/files/styles/_theme.scss +14 -0
- package/src/generators/init-application/files/styles/_utilities.scss +112 -0
- package/src/generators/init-application/files/styles/_variables.scss +77 -0
- package/src/generators/init-application/files/styles/fonts/_croissant-one.scss +7 -0
- package/src/generators/init-application/files/styles/fonts/_fuggles.scss +7 -0
- package/src/generators/init-application/files/styles/fonts/_inclusive-sans.scss +7 -0
- package/src/generators/init-application/files/styles/fonts/_material-icons.scss +20 -0
- package/src/generators/init-application/files/styles/fonts/_mooli.scss +7 -0
- package/src/generators/init-application/files/styles/fonts/_pixelify-sans.scss +7 -0
- package/src/generators/init-application/files/styles/fonts/_roboto-mono.scss +7 -0
- package/src/generators/init-application/files/styles/fonts/_roboto.scss +95 -0
- package/src/generators/init-application/files/styles/fonts/_young-serif.scss +7 -0
- package/src/generators/init-application/files/styles/fonts/croissant-one.ttf +0 -0
- package/src/generators/init-application/files/styles/fonts/fuggles.ttf +0 -0
- package/src/generators/init-application/files/styles/fonts/inclusive-sans.ttf +0 -0
- package/src/generators/init-application/files/styles/fonts/material-icons.ttf +0 -0
- package/src/generators/init-application/files/styles/fonts/molli.ttf +0 -0
- package/src/generators/init-application/files/styles/fonts/pixelify-sans.ttf +0 -0
- package/src/generators/init-application/files/styles/fonts/roboto-mono.ttf +0 -0
- package/src/generators/init-application/files/styles/fonts/young-serif.ttf +0 -0
- package/src/generators/init-application/generator.js +558 -89
- package/src/generators/init-application/generator.js.map +1 -1
- package/src/generators/init-application/schema.d.ts +9 -0
- package/src/generators/init-application/schema.json +59 -8
- package/src/generators/init-feature/files/feature/__name__/routes.ts.template +10 -0
- package/src/generators/init-feature/generator.d.ts +4 -0
- package/src/generators/init-feature/generator.js +26 -0
- package/src/generators/init-feature/generator.js.map +1 -0
- package/src/generators/init-feature/index.d.ts +2 -0
- package/src/generators/init-feature/index.js +7 -0
- package/src/generators/init-feature/index.js.map +1 -0
- package/src/generators/init-feature/schema.d.ts +4 -0
- package/src/generators/init-feature/schema.json +20 -0
- package/src/generators/init-library/generator.js +106 -14
- package/src/generators/init-library/generator.js.map +1 -1
- package/src/generators/init-library/schema.d.ts +3 -0
- package/src/generators/init-library/schema.json +14 -0
- package/src/lib/add-route.d.ts +3 -0
- package/src/lib/add-route.js +27 -0
- package/src/lib/add-route.js.map +1 -0
- package/src/lib/build-route-object.d.ts +7 -0
- package/src/lib/build-route-object.js +18 -0
- package/src/lib/build-route-object.js.map +1 -0
- package/src/lib/coerce-cypress-component-testing.d.ts +2 -0
- package/src/lib/coerce-cypress-component-testing.js +79 -0
- package/src/lib/coerce-cypress-component-testing.js.map +1 -0
- package/src/lib/find-parent-route.d.ts +2 -0
- package/src/lib/find-parent-route.js +54 -0
- package/src/lib/find-parent-route.js.map +1 -0
- package/src/lib/skip-project.js +3 -3
- package/src/lib/skip-project.js.map +1 -1
- package/src/generators/init-application/files/shared/angular.Dockerfile +0 -3
- package/src/generators/init-application/files/shared/configuration/.gitkeep +0 -0
- /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
|
|
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
|
|
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 = (
|
|
31
|
-
(_c = (
|
|
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
|
-
(
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
(
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
(
|
|
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
|
-
(
|
|
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
|
-
(
|
|
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
|
-
(
|
|
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
|
-
(
|
|
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
|
-
(
|
|
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: '
|
|
99
|
-
input: '
|
|
100
|
-
output: '
|
|
109
|
+
glob: '*',
|
|
110
|
+
input: 'shared/angular/assets/',
|
|
111
|
+
output: '.',
|
|
101
112
|
},
|
|
102
113
|
{
|
|
103
|
-
glob: '
|
|
104
|
-
input: '
|
|
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
|
-
(
|
|
113
|
-
(
|
|
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
|
-
(
|
|
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
|
-
|
|
160
|
-
|
|
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,
|
|
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: ['
|
|
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({
|
|
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({
|
|
213
|
-
|
|
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({
|
|
347
|
+
importDeclarations.push({
|
|
348
|
+
moduleSpecifier: '@rxap/ngx-sentry',
|
|
349
|
+
namedImports: ['SentryInit'],
|
|
350
|
+
});
|
|
217
351
|
statements.push('application.before(() => SentryInit(environment));');
|
|
218
352
|
}
|
|
219
|
-
(0,
|
|
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,362 @@ 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
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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);
|
|
260
731
|
}
|
|
261
|
-
// apply changes to the project configuration
|
|
262
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
|
263
732
|
}
|
|
264
733
|
yield (0, plugin_localazy_1.LocalazyGitlabCiGenerator)(tree, options);
|
|
265
734
|
});
|