@igniteui/angular-schematics 17.1.1316-rc.0 → 17.1.1316
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igniteui/angular-schematics",
|
|
3
|
-
"version": "17.1.1316
|
|
3
|
+
"version": "17.1.1316",
|
|
4
4
|
"description": "Ignite UI for Angular Schematics for ng new and ng generate",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@angular-devkit/core": "~14.0.0",
|
|
24
24
|
"@angular-devkit/schematics": "~14.0.0",
|
|
25
|
-
"@igniteui/angular-templates": "~17.1.1316
|
|
26
|
-
"@igniteui/cli-core": "~13.1.6
|
|
25
|
+
"@igniteui/angular-templates": "~17.1.1316",
|
|
26
|
+
"@igniteui/cli-core": "~13.1.6",
|
|
27
27
|
"@schematics/angular": "~14.0.0",
|
|
28
28
|
"rxjs": "^6.6.3"
|
|
29
29
|
},
|
package/src/cli-config/index.js
CHANGED
|
@@ -65,12 +65,19 @@ function importBrowserAnimations() {
|
|
|
65
65
|
return (tree) => __awaiter(this, void 0, void 0, function* () {
|
|
66
66
|
const projects = yield (0, theme_import_1.getProjects)(tree);
|
|
67
67
|
projects.forEach(project => {
|
|
68
|
+
// TODO: Resolve hardcoded paths instead
|
|
68
69
|
const moduleFile = `${project.sourceRoot}/app/app.module.ts`;
|
|
69
70
|
if (tree.exists(moduleFile)) {
|
|
70
71
|
const mainModule = new cli_core_1.TypeScriptFileUpdate(moduleFile);
|
|
71
72
|
mainModule.addNgModuleMeta({ import: "BrowserAnimationsModule", from: "@angular/platform-browser/animations" });
|
|
72
73
|
mainModule.finalize();
|
|
73
74
|
}
|
|
75
|
+
const appConfigFile = `${project.sourceRoot}/app/app.config.ts`;
|
|
76
|
+
if (tree.exists(appConfigFile)) {
|
|
77
|
+
const appConfig = new cli_core_1.TypeScriptFileUpdate(appConfigFile);
|
|
78
|
+
appConfig.addAppConfigProvider({ provide: "provideAnimations", from: "@angular/platform-browser/animations" });
|
|
79
|
+
appConfig.finalize();
|
|
80
|
+
}
|
|
74
81
|
});
|
|
75
82
|
});
|
|
76
83
|
}
|
|
@@ -197,6 +197,46 @@ export class AppModule {
|
|
|
197
197
|
const content = tree.readContent(targetFile);
|
|
198
198
|
expect(content.replace(/\r\n/g, "\n")).toEqual(moduleContentAfterSchematic.replace(/\r\n/g, "\n"));
|
|
199
199
|
}));
|
|
200
|
+
it("should add provideAnimations to app.config.ts", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
201
|
+
const moduleContent = `import { ApplicationConfig } from '@angular/core';
|
|
202
|
+
import { provideRouter } from '@angular/router';
|
|
203
|
+
import { routes } from './app.routes';
|
|
204
|
+
|
|
205
|
+
export const appConfig: ApplicationConfig = {
|
|
206
|
+
providers: [provideRouter(routes)]
|
|
207
|
+
};
|
|
208
|
+
`;
|
|
209
|
+
const moduleContentAfterSchematic = `import { ApplicationConfig } from '@angular/core';
|
|
210
|
+
import { provideRouter } from '@angular/router';
|
|
211
|
+
import { routes } from './app.routes';
|
|
212
|
+
import { provideAnimations } from "@angular/platform-browser/animations";
|
|
213
|
+
|
|
214
|
+
export const appConfig: ApplicationConfig = {
|
|
215
|
+
providers: [provideRouter(routes), provideAnimations()]
|
|
216
|
+
};
|
|
217
|
+
`;
|
|
218
|
+
const targetFile = "./src/app/app.config.ts";
|
|
219
|
+
tree.create(targetFile, moduleContent);
|
|
220
|
+
yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
|
|
221
|
+
const content = tree.readContent(targetFile);
|
|
222
|
+
expect(content.replace(/\r\n/g, "\n")).toEqual(moduleContentAfterSchematic.replace(/\r\n/g, "\n"));
|
|
223
|
+
}));
|
|
224
|
+
it("should NOT add provideAnimations to app.config.ts if it already exists", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
225
|
+
const moduleContent = `import { ApplicationConfig } from '@angular/core';
|
|
226
|
+
import { provideRouter } from '@angular/router';
|
|
227
|
+
import { routes } from './app.routes';
|
|
228
|
+
import { provideAnimations } from "@angular/platform-browser/animations";
|
|
229
|
+
|
|
230
|
+
export const appConfig: ApplicationConfig = {
|
|
231
|
+
providers: [provideRouter(routes), provideAnimations()]
|
|
232
|
+
};
|
|
233
|
+
`;
|
|
234
|
+
const targetFile = "./src/app/app.config.ts";
|
|
235
|
+
tree.create(targetFile, moduleContent);
|
|
236
|
+
yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
|
|
237
|
+
const content = tree.readContent(targetFile);
|
|
238
|
+
expect(content.replace(/\r\n/g, "\n")).toEqual(moduleContent.replace(/\r\n/g, "\n"));
|
|
239
|
+
}));
|
|
200
240
|
it("should properly display the dependency mismatch warning", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
201
241
|
const warns = [];
|
|
202
242
|
runner.logger.subscribe(entry => {
|