@ionic/angular 7.5.6-dev.11700492285.1581ed02 → 7.5.6-dev.11700520218.1c07312e
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/esm2020/standalone/providers/action-sheet-controller.mjs +1 -3
- package/esm2020/standalone/providers/alert-controller.mjs +1 -3
- package/esm2020/standalone/providers/loading-controller.mjs +2 -1
- package/esm2020/standalone/providers/modal-controller.mjs +1 -3
- package/esm2020/standalone/providers/picker-controller.mjs +2 -1
- package/esm2020/standalone/providers/popover-controller.mjs +1 -3
- package/esm2020/standalone/providers/toast-controller.mjs +1 -3
- package/fesm2015/ionic-angular-standalone.mjs +2 -5
- package/fesm2015/ionic-angular-standalone.mjs.map +1 -1
- package/fesm2020/ionic-angular-standalone.mjs +2 -5
- package/fesm2020/ionic-angular-standalone.mjs.map +1 -1
- package/package.json +2 -2
- package/schematics/add/files/root/theme/variables.css +241 -0
- package/schematics/add/index.js +77 -11
- package/schematics/utils/ast.js +10 -25
- package/schematics/utils/config.js +42 -16
- package/schematics/utils/devkit-utils/ast-utils.js +0 -488
- package/schematics/utils/devkit-utils/change.js +0 -96
- package/schematics/utils/devkit-utils/route-utils.js +0 -72
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ionic/angular",
|
|
3
|
-
"version": "7.5.6-dev.
|
|
3
|
+
"version": "7.5.6-dev.11700520218.1c07312e",
|
|
4
4
|
"description": "Angular specific wrappers for @ionic/core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ionic",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@ionic/core": "7.5.6-dev.
|
|
59
|
+
"@ionic/core": "7.5.6-dev.11700520218.1c07312e",
|
|
60
60
|
"ionicons": "^7.0.0",
|
|
61
61
|
"jsonc-parser": "^3.0.0",
|
|
62
62
|
"tslib": "^2.3.0"
|
|
@@ -4,3 +4,244 @@
|
|
|
4
4
|
|
|
5
5
|
/* To quickly generate your own theme, check out the color generator */
|
|
6
6
|
/* https://ionicframework.com/docs/theming/color-generator */
|
|
7
|
+
|
|
8
|
+
/** Ionic CSS Variables **/
|
|
9
|
+
:root {
|
|
10
|
+
/** primary **/
|
|
11
|
+
--ion-color-primary: #3880ff;
|
|
12
|
+
--ion-color-primary-rgb: 56, 128, 255;
|
|
13
|
+
--ion-color-primary-contrast: #ffffff;
|
|
14
|
+
--ion-color-primary-contrast-rgb: 255, 255, 255;
|
|
15
|
+
--ion-color-primary-shade: #3171e0;
|
|
16
|
+
--ion-color-primary-tint: #4c8dff;
|
|
17
|
+
|
|
18
|
+
/** secondary **/
|
|
19
|
+
--ion-color-secondary: #3dc2ff;
|
|
20
|
+
--ion-color-secondary-rgb: 61, 194, 255;
|
|
21
|
+
--ion-color-secondary-contrast: #ffffff;
|
|
22
|
+
--ion-color-secondary-contrast-rgb: 255, 255, 255;
|
|
23
|
+
--ion-color-secondary-shade: #36abe0;
|
|
24
|
+
--ion-color-secondary-tint: #50c8ff;
|
|
25
|
+
|
|
26
|
+
/** tertiary **/
|
|
27
|
+
--ion-color-tertiary: #5260ff;
|
|
28
|
+
--ion-color-tertiary-rgb: 82, 96, 255;
|
|
29
|
+
--ion-color-tertiary-contrast: #ffffff;
|
|
30
|
+
--ion-color-tertiary-contrast-rgb: 255, 255, 255;
|
|
31
|
+
--ion-color-tertiary-shade: #4854e0;
|
|
32
|
+
--ion-color-tertiary-tint: #6370ff;
|
|
33
|
+
|
|
34
|
+
/** success **/
|
|
35
|
+
--ion-color-success: #2dd36f;
|
|
36
|
+
--ion-color-success-rgb: 45, 211, 111;
|
|
37
|
+
--ion-color-success-contrast: #ffffff;
|
|
38
|
+
--ion-color-success-contrast-rgb: 255, 255, 255;
|
|
39
|
+
--ion-color-success-shade: #28ba62;
|
|
40
|
+
--ion-color-success-tint: #42d77d;
|
|
41
|
+
|
|
42
|
+
/** warning **/
|
|
43
|
+
--ion-color-warning: #ffc409;
|
|
44
|
+
--ion-color-warning-rgb: 255, 196, 9;
|
|
45
|
+
--ion-color-warning-contrast: #000000;
|
|
46
|
+
--ion-color-warning-contrast-rgb: 0, 0, 0;
|
|
47
|
+
--ion-color-warning-shade: #e0ac08;
|
|
48
|
+
--ion-color-warning-tint: #ffca22;
|
|
49
|
+
|
|
50
|
+
/** danger **/
|
|
51
|
+
--ion-color-danger: #eb445a;
|
|
52
|
+
--ion-color-danger-rgb: 235, 68, 90;
|
|
53
|
+
--ion-color-danger-contrast: #ffffff;
|
|
54
|
+
--ion-color-danger-contrast-rgb: 255, 255, 255;
|
|
55
|
+
--ion-color-danger-shade: #cf3c4f;
|
|
56
|
+
--ion-color-danger-tint: #ed576b;
|
|
57
|
+
|
|
58
|
+
/** dark **/
|
|
59
|
+
--ion-color-dark: #222428;
|
|
60
|
+
--ion-color-dark-rgb: 34, 36, 40;
|
|
61
|
+
--ion-color-dark-contrast: #ffffff;
|
|
62
|
+
--ion-color-dark-contrast-rgb: 255, 255, 255;
|
|
63
|
+
--ion-color-dark-shade: #1e2023;
|
|
64
|
+
--ion-color-dark-tint: #383a3e;
|
|
65
|
+
|
|
66
|
+
/** medium **/
|
|
67
|
+
--ion-color-medium: #92949c;
|
|
68
|
+
--ion-color-medium-rgb: 146, 148, 156;
|
|
69
|
+
--ion-color-medium-contrast: #ffffff;
|
|
70
|
+
--ion-color-medium-contrast-rgb: 255, 255, 255;
|
|
71
|
+
--ion-color-medium-shade: #808289;
|
|
72
|
+
--ion-color-medium-tint: #9d9fa6;
|
|
73
|
+
|
|
74
|
+
/** light **/
|
|
75
|
+
--ion-color-light: #f4f5f8;
|
|
76
|
+
--ion-color-light-rgb: 244, 245, 248;
|
|
77
|
+
--ion-color-light-contrast: #000000;
|
|
78
|
+
--ion-color-light-contrast-rgb: 0, 0, 0;
|
|
79
|
+
--ion-color-light-shade: #d7d8da;
|
|
80
|
+
--ion-color-light-tint: #f5f6f9;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media (prefers-color-scheme: dark) {
|
|
84
|
+
/*
|
|
85
|
+
* Dark Colors
|
|
86
|
+
* -------------------------------------------
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
body {
|
|
90
|
+
--ion-color-primary: #428cff;
|
|
91
|
+
--ion-color-primary-rgb: 66, 140, 255;
|
|
92
|
+
--ion-color-primary-contrast: #ffffff;
|
|
93
|
+
--ion-color-primary-contrast-rgb: 255, 255, 255;
|
|
94
|
+
--ion-color-primary-shade: #3a7be0;
|
|
95
|
+
--ion-color-primary-tint: #5598ff;
|
|
96
|
+
|
|
97
|
+
--ion-color-secondary: #50c8ff;
|
|
98
|
+
--ion-color-secondary-rgb: 80, 200, 255;
|
|
99
|
+
--ion-color-secondary-contrast: #ffffff;
|
|
100
|
+
--ion-color-secondary-contrast-rgb: 255, 255, 255;
|
|
101
|
+
--ion-color-secondary-shade: #46b0e0;
|
|
102
|
+
--ion-color-secondary-tint: #62ceff;
|
|
103
|
+
|
|
104
|
+
--ion-color-tertiary: #6a64ff;
|
|
105
|
+
--ion-color-tertiary-rgb: 106, 100, 255;
|
|
106
|
+
--ion-color-tertiary-contrast: #ffffff;
|
|
107
|
+
--ion-color-tertiary-contrast-rgb: 255, 255, 255;
|
|
108
|
+
--ion-color-tertiary-shade: #5d58e0;
|
|
109
|
+
--ion-color-tertiary-tint: #7974ff;
|
|
110
|
+
|
|
111
|
+
--ion-color-success: #2fdf75;
|
|
112
|
+
--ion-color-success-rgb: 47, 223, 117;
|
|
113
|
+
--ion-color-success-contrast: #000000;
|
|
114
|
+
--ion-color-success-contrast-rgb: 0, 0, 0;
|
|
115
|
+
--ion-color-success-shade: #29c467;
|
|
116
|
+
--ion-color-success-tint: #44e283;
|
|
117
|
+
|
|
118
|
+
--ion-color-warning: #ffd534;
|
|
119
|
+
--ion-color-warning-rgb: 255, 213, 52;
|
|
120
|
+
--ion-color-warning-contrast: #000000;
|
|
121
|
+
--ion-color-warning-contrast-rgb: 0, 0, 0;
|
|
122
|
+
--ion-color-warning-shade: #e0bb2e;
|
|
123
|
+
--ion-color-warning-tint: #ffd948;
|
|
124
|
+
|
|
125
|
+
--ion-color-danger: #ff4961;
|
|
126
|
+
--ion-color-danger-rgb: 255, 73, 97;
|
|
127
|
+
--ion-color-danger-contrast: #ffffff;
|
|
128
|
+
--ion-color-danger-contrast-rgb: 255, 255, 255;
|
|
129
|
+
--ion-color-danger-shade: #e04055;
|
|
130
|
+
--ion-color-danger-tint: #ff5b71;
|
|
131
|
+
|
|
132
|
+
--ion-color-dark: #f4f5f8;
|
|
133
|
+
--ion-color-dark-rgb: 244, 245, 248;
|
|
134
|
+
--ion-color-dark-contrast: #000000;
|
|
135
|
+
--ion-color-dark-contrast-rgb: 0, 0, 0;
|
|
136
|
+
--ion-color-dark-shade: #d7d8da;
|
|
137
|
+
--ion-color-dark-tint: #f5f6f9;
|
|
138
|
+
|
|
139
|
+
--ion-color-medium: #989aa2;
|
|
140
|
+
--ion-color-medium-rgb: 152, 154, 162;
|
|
141
|
+
--ion-color-medium-contrast: #000000;
|
|
142
|
+
--ion-color-medium-contrast-rgb: 0, 0, 0;
|
|
143
|
+
--ion-color-medium-shade: #86888f;
|
|
144
|
+
--ion-color-medium-tint: #a2a4ab;
|
|
145
|
+
|
|
146
|
+
--ion-color-light: #222428;
|
|
147
|
+
--ion-color-light-rgb: 34, 36, 40;
|
|
148
|
+
--ion-color-light-contrast: #ffffff;
|
|
149
|
+
--ion-color-light-contrast-rgb: 255, 255, 255;
|
|
150
|
+
--ion-color-light-shade: #1e2023;
|
|
151
|
+
--ion-color-light-tint: #383a3e;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/*
|
|
155
|
+
* iOS Dark Theme
|
|
156
|
+
* -------------------------------------------
|
|
157
|
+
*/
|
|
158
|
+
|
|
159
|
+
.ios body {
|
|
160
|
+
--ion-background-color: #000000;
|
|
161
|
+
--ion-background-color-rgb: 0, 0, 0;
|
|
162
|
+
|
|
163
|
+
--ion-text-color: #ffffff;
|
|
164
|
+
--ion-text-color-rgb: 255, 255, 255;
|
|
165
|
+
|
|
166
|
+
--ion-color-step-50: #0d0d0d;
|
|
167
|
+
--ion-color-step-100: #1a1a1a;
|
|
168
|
+
--ion-color-step-150: #262626;
|
|
169
|
+
--ion-color-step-200: #333333;
|
|
170
|
+
--ion-color-step-250: #404040;
|
|
171
|
+
--ion-color-step-300: #4d4d4d;
|
|
172
|
+
--ion-color-step-350: #595959;
|
|
173
|
+
--ion-color-step-400: #666666;
|
|
174
|
+
--ion-color-step-450: #737373;
|
|
175
|
+
--ion-color-step-500: #808080;
|
|
176
|
+
--ion-color-step-550: #8c8c8c;
|
|
177
|
+
--ion-color-step-600: #999999;
|
|
178
|
+
--ion-color-step-650: #a6a6a6;
|
|
179
|
+
--ion-color-step-700: #b3b3b3;
|
|
180
|
+
--ion-color-step-750: #bfbfbf;
|
|
181
|
+
--ion-color-step-800: #cccccc;
|
|
182
|
+
--ion-color-step-850: #d9d9d9;
|
|
183
|
+
--ion-color-step-900: #e6e6e6;
|
|
184
|
+
--ion-color-step-950: #f2f2f2;
|
|
185
|
+
|
|
186
|
+
--ion-item-background: #000000;
|
|
187
|
+
|
|
188
|
+
--ion-card-background: #1c1c1d;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.ios ion-modal {
|
|
192
|
+
--ion-background-color: var(--ion-color-step-100);
|
|
193
|
+
--ion-toolbar-background: var(--ion-color-step-150);
|
|
194
|
+
--ion-toolbar-border-color: var(--ion-color-step-250);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/*
|
|
198
|
+
* Material Design Dark Theme
|
|
199
|
+
* -------------------------------------------
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
.md body {
|
|
203
|
+
--ion-background-color: #121212;
|
|
204
|
+
--ion-background-color-rgb: 18, 18, 18;
|
|
205
|
+
|
|
206
|
+
--ion-text-color: #ffffff;
|
|
207
|
+
--ion-text-color-rgb: 255, 255, 255;
|
|
208
|
+
|
|
209
|
+
--ion-border-color: #222222;
|
|
210
|
+
|
|
211
|
+
--ion-color-step-50: #1e1e1e;
|
|
212
|
+
--ion-color-step-100: #2a2a2a;
|
|
213
|
+
--ion-color-step-150: #363636;
|
|
214
|
+
--ion-color-step-200: #414141;
|
|
215
|
+
--ion-color-step-250: #4d4d4d;
|
|
216
|
+
--ion-color-step-300: #595959;
|
|
217
|
+
--ion-color-step-350: #656565;
|
|
218
|
+
--ion-color-step-400: #717171;
|
|
219
|
+
--ion-color-step-450: #7d7d7d;
|
|
220
|
+
--ion-color-step-500: #898989;
|
|
221
|
+
--ion-color-step-550: #949494;
|
|
222
|
+
--ion-color-step-600: #a0a0a0;
|
|
223
|
+
--ion-color-step-650: #acacac;
|
|
224
|
+
--ion-color-step-700: #b8b8b8;
|
|
225
|
+
--ion-color-step-750: #c4c4c4;
|
|
226
|
+
--ion-color-step-800: #d0d0d0;
|
|
227
|
+
--ion-color-step-850: #dbdbdb;
|
|
228
|
+
--ion-color-step-900: #e7e7e7;
|
|
229
|
+
--ion-color-step-950: #f3f3f3;
|
|
230
|
+
|
|
231
|
+
--ion-item-background: #1e1e1e;
|
|
232
|
+
|
|
233
|
+
--ion-toolbar-background: #1f1f1f;
|
|
234
|
+
|
|
235
|
+
--ion-tab-bar-background: #1f1f1f;
|
|
236
|
+
|
|
237
|
+
--ion-card-background: #1e1e1e;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
html {
|
|
242
|
+
/*
|
|
243
|
+
* For more information on dynamic font scaling, visit the documentation:
|
|
244
|
+
* https://ionicframework.com/docs/layout/dynamic-font-scaling
|
|
245
|
+
*/
|
|
246
|
+
--ion-dynamic-font: var(--ion-default-dynamic-font);
|
|
247
|
+
}
|
package/schematics/add/index.js
CHANGED
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@angular-devkit/core");
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
6
|
+
const utility_1 = require("@schematics/angular/utility");
|
|
6
7
|
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
7
|
-
const ast_1 = require("
|
|
8
|
+
const ast_1 = require("../utils/ast");
|
|
8
9
|
const config_1 = require("./../utils/config");
|
|
9
10
|
const package_1 = require("./../utils/package");
|
|
10
11
|
function addIonicAngularToPackageJson() {
|
|
@@ -19,9 +20,48 @@ function addIonicAngularToolkitToPackageJson() {
|
|
|
19
20
|
return host;
|
|
20
21
|
};
|
|
21
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Adds the @ionic/angular-toolkit schematics and cli configuration to the project's `angular.json` file.
|
|
25
|
+
* @param projectName The name of the project.
|
|
26
|
+
*/
|
|
27
|
+
function addIonicAngularToolkitToAngularJson() {
|
|
28
|
+
return (host) => {
|
|
29
|
+
(0, config_1.addCli)(host, '@ionic/angular-toolkit');
|
|
30
|
+
(0, config_1.addSchematics)(host, '@ionic/angular-toolkit:component', {
|
|
31
|
+
styleext: 'scss',
|
|
32
|
+
});
|
|
33
|
+
(0, config_1.addSchematics)(host, '@ionic/angular-toolkit:page', {
|
|
34
|
+
styleext: 'scss',
|
|
35
|
+
});
|
|
36
|
+
return host;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Adds the `IonicModule.forRoot()` usage to the project's `AppModule`.
|
|
41
|
+
* If the project does not use modules this will operate as a noop.
|
|
42
|
+
* @param projectSourceRoot The source root path of the project.
|
|
43
|
+
*/
|
|
22
44
|
function addIonicAngularModuleToAppModule(projectSourceRoot) {
|
|
23
45
|
return (host) => {
|
|
24
|
-
|
|
46
|
+
const appModulePath = `${projectSourceRoot}/app/app.module.ts`;
|
|
47
|
+
if (host.exists(appModulePath)) {
|
|
48
|
+
(0, ast_1.addIonicModuleImportToNgModule)(host, appModulePath);
|
|
49
|
+
}
|
|
50
|
+
return host;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Adds the `provideIonicAngular` usage to the project's app config.
|
|
55
|
+
* If the project does not use an app config this will operate as a noop.
|
|
56
|
+
* @param projectName The name of the project.
|
|
57
|
+
* @param projectSourceRoot The source root path of the project.
|
|
58
|
+
*/
|
|
59
|
+
function addProvideIonicAngular(projectName, projectSourceRoot) {
|
|
60
|
+
return (host) => {
|
|
61
|
+
const appConfig = `${projectSourceRoot}/app/app.config.ts`;
|
|
62
|
+
if (host.exists(appConfig)) {
|
|
63
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => code `${external('provideIonicAngular', '@ionic/angular/standalone')}({})`);
|
|
64
|
+
}
|
|
25
65
|
return host;
|
|
26
66
|
};
|
|
27
67
|
}
|
|
@@ -46,15 +86,38 @@ function addIonicStyles(projectName, projectSourceRoot) {
|
|
|
46
86
|
return host;
|
|
47
87
|
};
|
|
48
88
|
}
|
|
49
|
-
function addIonicons(projectName) {
|
|
89
|
+
function addIonicons(projectName, projectSourceRoot) {
|
|
50
90
|
return (host) => {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
91
|
+
const hasAppModule = host.exists(`${projectSourceRoot}/app/app.module.ts`);
|
|
92
|
+
if (hasAppModule) {
|
|
93
|
+
/**
|
|
94
|
+
* Add Ionicons to the `angular.json` file only if the project
|
|
95
|
+
* is using the lazy build of `@ionic/angular` with modules.
|
|
96
|
+
*/
|
|
97
|
+
const ioniconsGlob = {
|
|
98
|
+
glob: '**/*.svg',
|
|
99
|
+
input: 'node_modules/ionicons/dist/ionicons/svg',
|
|
100
|
+
output: './svg',
|
|
101
|
+
};
|
|
102
|
+
(0, config_1.addAsset)(host, projectName, 'build', ioniconsGlob);
|
|
103
|
+
(0, config_1.addAsset)(host, projectName, 'test', ioniconsGlob);
|
|
104
|
+
}
|
|
105
|
+
return host;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function addIonicConfig(projectSourceRoot) {
|
|
109
|
+
return (host) => {
|
|
110
|
+
const ionicConfig = 'ionic.config.json';
|
|
111
|
+
if (!host.exists(ionicConfig)) {
|
|
112
|
+
const hasAppModule = host.exists(`${projectSourceRoot}/app/app.module.ts`);
|
|
113
|
+
const type = hasAppModule ? 'angular' : 'angular-standalone';
|
|
114
|
+
host.create(ionicConfig, JSON.stringify({
|
|
115
|
+
name: 'ionic-app',
|
|
116
|
+
app_id: '',
|
|
117
|
+
type,
|
|
118
|
+
integrations: {},
|
|
119
|
+
}, null, 2));
|
|
120
|
+
}
|
|
58
121
|
return host;
|
|
59
122
|
};
|
|
60
123
|
}
|
|
@@ -108,10 +171,13 @@ function ngAdd(options) {
|
|
|
108
171
|
// @ionic/angular
|
|
109
172
|
addIonicAngularToPackageJson(),
|
|
110
173
|
addIonicAngularToolkitToPackageJson(),
|
|
174
|
+
addIonicAngularToolkitToAngularJson(),
|
|
111
175
|
addIonicAngularModuleToAppModule(sourcePath),
|
|
176
|
+
addProvideIonicAngular(options.project, sourcePath),
|
|
112
177
|
addIonicBuilder(options.project),
|
|
113
178
|
addIonicStyles(options.project, sourcePath),
|
|
114
|
-
addIonicons(options.project),
|
|
179
|
+
addIonicons(options.project, sourcePath),
|
|
180
|
+
addIonicConfig(sourcePath),
|
|
115
181
|
(0, schematics_1.mergeWith)(rootTemplateSource),
|
|
116
182
|
// install freshly added dependencies
|
|
117
183
|
installNodeDeps(),
|
package/schematics/utils/ast.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const core_1 = require("@angular-devkit/core");
|
|
3
|
+
exports.addIonicModuleImportToNgModule = void 0;
|
|
5
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
6
|
+
const change_1 = require("@schematics/angular/utility/change");
|
|
6
7
|
const ts = require("typescript");
|
|
7
|
-
const ast_utils_1 = require("./devkit-utils/ast-utils");
|
|
8
|
-
const change_1 = require("./devkit-utils/change");
|
|
9
8
|
/**
|
|
10
9
|
* Reads file given path and returns TypeScript source file.
|
|
11
10
|
*/
|
|
@@ -18,30 +17,16 @@ function getSourceFile(host, path) {
|
|
|
18
17
|
const source = ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);
|
|
19
18
|
return source;
|
|
20
19
|
}
|
|
21
|
-
exports.getSourceFile = getSourceFile;
|
|
22
20
|
/**
|
|
23
21
|
* Import and add module to root app module.
|
|
24
22
|
*/
|
|
25
|
-
function
|
|
26
|
-
addModuleImportToModule(host, (0, core_1.normalize)(`${projectSourceRoot}/app/app.module.ts`), moduleName, importSrc);
|
|
27
|
-
}
|
|
28
|
-
exports.addModuleImportToRootModule = addModuleImportToRootModule;
|
|
29
|
-
/**
|
|
30
|
-
* Import and add module to specific module path.
|
|
31
|
-
* @param host the tree we are updating
|
|
32
|
-
* @param modulePath src location of the module to import
|
|
33
|
-
* @param moduleName name of module to import
|
|
34
|
-
* @param src src location to import
|
|
35
|
-
*/
|
|
36
|
-
function addModuleImportToModule(host, modulePath, moduleName, src) {
|
|
37
|
-
const moduleSource = getSourceFile(host, modulePath);
|
|
38
|
-
const changes = (0, ast_utils_1.addImportToModule)(moduleSource, modulePath, moduleName, src);
|
|
23
|
+
function addIonicModuleImportToNgModule(host, modulePath) {
|
|
39
24
|
const recorder = host.beginUpdate(modulePath);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
25
|
+
const moduleSource = getSourceFile(host, modulePath);
|
|
26
|
+
const ionicModuleChange = (0, ast_utils_1.insertImport)(moduleSource, modulePath, 'IonicModule', '@ionic/angular');
|
|
27
|
+
(0, change_1.applyToUpdateRecorder)(recorder, [ionicModuleChange]);
|
|
28
|
+
const metadataChange = (0, ast_utils_1.addSymbolToNgModuleMetadata)(moduleSource, modulePath, 'imports', 'IonicModule.forRoot({})');
|
|
29
|
+
(0, change_1.applyToUpdateRecorder)(recorder, metadataChange);
|
|
45
30
|
host.commitUpdate(recorder);
|
|
46
31
|
}
|
|
47
|
-
exports.
|
|
32
|
+
exports.addIonicModuleImportToNgModule = addIonicModuleImportToNgModule;
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWorkspace = exports.getWorkspacePath = exports.
|
|
3
|
+
exports.getWorkspace = exports.getWorkspacePath = exports.addSchematics = exports.addCli = exports.addArchitectBuilder = exports.addAsset = exports.addStyle = exports.getDefaultAngularAppName = exports.writeConfig = exports.readConfig = void 0;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
6
|
-
const
|
|
7
|
-
// TODO(FW-2827): types
|
|
6
|
+
const ANGULAR_JSON_PATH = 'angular.json';
|
|
8
7
|
function readConfig(host) {
|
|
9
|
-
|
|
10
|
-
const sourceText = (_a = host.read(CONFIG_PATH)) === null || _a === void 0 ? void 0 : _a.toString('utf-8');
|
|
11
|
-
return JSON.parse(sourceText);
|
|
8
|
+
return host.readJson(ANGULAR_JSON_PATH);
|
|
12
9
|
}
|
|
13
10
|
exports.readConfig = readConfig;
|
|
14
11
|
function writeConfig(host, config) {
|
|
15
|
-
host.overwrite(
|
|
12
|
+
host.overwrite(ANGULAR_JSON_PATH, JSON.stringify(config, null, 2));
|
|
16
13
|
}
|
|
17
14
|
exports.writeConfig = writeConfig;
|
|
18
15
|
function isAngularBrowserProject(projectConfig) {
|
|
19
16
|
if (projectConfig.projectType === 'application') {
|
|
20
17
|
const buildConfig = projectConfig.architect.build;
|
|
21
|
-
|
|
18
|
+
// Angular 16 and lower
|
|
19
|
+
const legacyAngularBuilder = buildConfig.builder === '@angular-devkit/build-angular:browser';
|
|
20
|
+
// Angular 17+
|
|
21
|
+
const modernAngularBuilder = buildConfig.builder === '@angular-devkit/build-angular:application';
|
|
22
|
+
return legacyAngularBuilder || modernAngularBuilder;
|
|
22
23
|
}
|
|
23
24
|
return false;
|
|
24
25
|
}
|
|
@@ -34,7 +35,7 @@ function getDefaultAngularAppName(config) {
|
|
|
34
35
|
return projectNames[0];
|
|
35
36
|
}
|
|
36
37
|
exports.getDefaultAngularAppName = getDefaultAngularAppName;
|
|
37
|
-
function
|
|
38
|
+
function getAngularJson(config, projectName) {
|
|
38
39
|
// eslint-disable-next-line no-prototype-builtins
|
|
39
40
|
if (!config.projects.hasOwnProperty(projectName)) {
|
|
40
41
|
throw new schematics_1.SchematicsException(`Could not find project: ${projectName}`);
|
|
@@ -51,11 +52,10 @@ function getAngularAppConfig(config, projectName) {
|
|
|
51
52
|
throw new schematics_1.SchematicsException(`Invalid builder for ${projectName}: ${buildConfig.builder}`);
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
exports.getAngularAppConfig = getAngularAppConfig;
|
|
55
55
|
function addStyle(host, projectName, stylePath) {
|
|
56
56
|
const config = readConfig(host);
|
|
57
|
-
const
|
|
58
|
-
|
|
57
|
+
const angularJson = getAngularJson(config, projectName);
|
|
58
|
+
angularJson.architect.build.options.styles.push({
|
|
59
59
|
input: stylePath,
|
|
60
60
|
});
|
|
61
61
|
writeConfig(host, config);
|
|
@@ -63,8 +63,8 @@ function addStyle(host, projectName, stylePath) {
|
|
|
63
63
|
exports.addStyle = addStyle;
|
|
64
64
|
function addAsset(host, projectName, architect, asset) {
|
|
65
65
|
const config = readConfig(host);
|
|
66
|
-
const
|
|
67
|
-
const target =
|
|
66
|
+
const angularJson = getAngularJson(config, projectName);
|
|
67
|
+
const target = angularJson.architect[architect];
|
|
68
68
|
if (target) {
|
|
69
69
|
target.options.assets.push(asset);
|
|
70
70
|
writeConfig(host, config);
|
|
@@ -73,11 +73,37 @@ function addAsset(host, projectName, architect, asset) {
|
|
|
73
73
|
exports.addAsset = addAsset;
|
|
74
74
|
function addArchitectBuilder(host, projectName, builderName, builderOpts) {
|
|
75
75
|
const config = readConfig(host);
|
|
76
|
-
const
|
|
77
|
-
|
|
76
|
+
const angularJson = getAngularJson(config, projectName);
|
|
77
|
+
angularJson.architect[builderName] = builderOpts;
|
|
78
78
|
writeConfig(host, config);
|
|
79
79
|
}
|
|
80
80
|
exports.addArchitectBuilder = addArchitectBuilder;
|
|
81
|
+
/**
|
|
82
|
+
* Updates the angular.json to add an additional schematic collection
|
|
83
|
+
* to the CLI configuration.
|
|
84
|
+
*/
|
|
85
|
+
function addCli(host, collectionName) {
|
|
86
|
+
const angularJson = readConfig(host);
|
|
87
|
+
if (angularJson.cli === undefined) {
|
|
88
|
+
angularJson.cli = {};
|
|
89
|
+
}
|
|
90
|
+
if (angularJson.cli.schematicCollections === undefined) {
|
|
91
|
+
angularJson.cli.schematicCollections = [];
|
|
92
|
+
}
|
|
93
|
+
angularJson.cli.schematicCollections.push(collectionName);
|
|
94
|
+
writeConfig(host, angularJson);
|
|
95
|
+
}
|
|
96
|
+
exports.addCli = addCli;
|
|
97
|
+
// TODO(FW-5639): can remove [property: string]: any; when upgrading @angular/cli dev-dep to v16 or later
|
|
98
|
+
function addSchematics(host, schematicName, schematicOpts) {
|
|
99
|
+
const angularJson = readConfig(host);
|
|
100
|
+
if (angularJson.schematics === undefined) {
|
|
101
|
+
angularJson.schematics = {};
|
|
102
|
+
}
|
|
103
|
+
angularJson.schematics[schematicName] = schematicOpts;
|
|
104
|
+
writeConfig(host, angularJson);
|
|
105
|
+
}
|
|
106
|
+
exports.addSchematics = addSchematics;
|
|
81
107
|
function getWorkspacePath(host) {
|
|
82
108
|
const possibleFiles = ['/angular.json', '/.angular.json'];
|
|
83
109
|
const path = possibleFiles.filter((path) => host.exists(path))[0];
|