@igniteui/angular-schematics 21.1.1491 → 21.1.14100-alpha.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igniteui/angular-schematics",
3
- "version": "21.1.1491",
3
+ "version": "21.1.14100-alpha.0",
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": "^21.0.0",
24
24
  "@angular-devkit/schematics": "^21.0.0",
25
- "@igniteui/angular-templates": "~21.1.1491",
26
- "@igniteui/cli-core": "~14.9.1",
25
+ "@igniteui/angular-templates": "^21.1.14100-alpha.0",
26
+ "@igniteui/cli-core": "^14.10.0-alpha.0",
27
27
  "@schematics/angular": "^21.0.0",
28
28
  "minimatch": "^10.0.1",
29
29
  "rxjs": "~7.8.1"
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // tslint:disable-next-line:no-implicit-dependencies
4
3
  const cli_core_1 = require("@igniteui/cli-core");
5
4
  function install() {
6
- if (!!process.env.npm_config_global) {
5
+ if (process.env.npm_config_global) {
7
6
  cli_core_1.App.initialize("angular-cli");
8
7
  cli_core_1.GoogleAnalytics.post({
9
8
  t: "screenview",
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // tslint:disable-next-line:no-implicit-dependencies
4
3
  const cli_core_1 = require("@igniteui/cli-core");
5
4
  function uninstall() {
6
- if (!!process.env.npm_config_global) {
5
+ if (process.env.npm_config_global) {
7
6
  cli_core_1.App.initialize("angular-cli");
8
7
  cli_core_1.GoogleAnalytics.post({
9
8
  t: "screenview",
@@ -91,7 +91,7 @@ function importBrowserAnimations() {
91
91
  const projects = yield (0, theme_import_1.getProjects)(tree);
92
92
  projects.forEach(project => {
93
93
  // TODO: Resolve hardcoded paths instead
94
- const moduleFilePath = `${project.sourceRoot}/app/app.module.ts`;
94
+ const moduleFilePath = `${project.sourceRoot}/app/app-module.ts`;
95
95
  if (tree.exists(moduleFilePath)) {
96
96
  const mainModule = new angular_templates_1.AngularTypeScriptFileUpdate(moduleFilePath, false, {
97
97
  indentSize: 4,
@@ -136,7 +136,6 @@ function importStyles() {
136
136
  yield (0, theme_import_1.importDefaultTheme)(tree);
137
137
  });
138
138
  }
139
- // tslint:disable-next-line:space-before-function-paren
140
139
  function default_1() {
141
140
  return (tree) => {
142
141
  (0, NgFileSystem_1.setVirtual)(tree);
@@ -41,7 +41,6 @@ describe("cli-config schematic", () => {
41
41
  const runner = new testing_1.SchematicTestRunner("cli-schematics", collectionPath);
42
42
  let tree;
43
43
  const sourceRoot = "src";
44
- // tslint:disable: object-literal-sort-keys
45
44
  const ngJsonConfig = {
46
45
  projects: {
47
46
  testProj: {
@@ -199,7 +198,7 @@ describe("cli-config schematic", () => {
199
198
  content = tree.readContent(targetFile);
200
199
  expect(content.includes(`@use "${cli_core_1.FEED_ANGULAR}`)).toBeTruthy();
201
200
  }));
202
- it("should add BrowserAnimationsModule to app.module.ts", () => __awaiter(void 0, void 0, void 0, function* () {
201
+ it("should add BrowserAnimationsModule to app-module.ts", () => __awaiter(void 0, void 0, void 0, function* () {
203
202
  const moduleContent = `import { NgModule } from '@angular/core';
204
203
  @NgModule({
205
204
  imports: []
@@ -215,7 +214,7 @@ import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
215
214
  export class AppModule {
216
215
  }
217
216
  `;
218
- const targetFile = "./src/app/app.module.ts";
217
+ const targetFile = "./src/app/app-module.ts";
219
218
  tree.create(targetFile, moduleContent);
220
219
  yield runner.runSchematic("cli-config", {}, tree);
221
220
  const content = tree.readContent(targetFile);
@@ -148,7 +148,7 @@ function newProject(options) {
148
148
  installChain.push(installTask);
149
149
  }
150
150
  if (!options.skipGit) {
151
- const gitTask = context.addTask(new tasks_1.RepositoryInitializerTask(options.name, { message: `Initial commit for project: ${options.name}` }), [...installChain] //copy
151
+ const gitTask = context.addTask(new tasks_1.RepositoryInitializerTask(options.name, { message: `Initial commit for project` }), [...installChain] //copy
152
152
  );
153
153
  installChain.push(gitTask);
154
154
  }
@@ -136,7 +136,6 @@ describe("Schematics ng-new", () => {
136
136
  expect(e.files.length).toEqual(1);
137
137
  expect(e.exists(`${workingDirectory}/.gitignore`)).toBeTruthy();
138
138
  const taskOptions = runner.tasks.map(task => task.options);
139
- // tslint:disable:object-literal-sort-keys
140
139
  const expectedInstall = {
141
140
  command: "install",
142
141
  quiet: true,
@@ -149,7 +148,7 @@ describe("Schematics ng-new", () => {
149
148
  authorEmail: undefined,
150
149
  authorName: undefined,
151
150
  commit: true,
152
- message: `Initial commit for project: ${workingDirectory}`
151
+ message: `Initial commit for project`
153
152
  };
154
153
  const expectedStart = {
155
154
  collection: null,
@@ -186,7 +185,6 @@ describe("Schematics ng-new", () => {
186
185
  expect(e.files.length).toEqual(1);
187
186
  expect(e.exists(`${workingDirectory}/.gitignore`)).toBeTruthy();
188
187
  const taskOptions = runner.tasks.map(task => task.options);
189
- // tslint:disable:object-literal-sort-keys
190
188
  const expectedInstall = {
191
189
  command: "install",
192
190
  quiet: true,
@@ -199,7 +197,7 @@ describe("Schematics ng-new", () => {
199
197
  authorEmail: undefined,
200
198
  authorName: undefined,
201
199
  commit: true,
202
- message: `Initial commit for project: ${workingDirectory}`
200
+ message: `Initial commit for project`
203
201
  };
204
202
  expect(taskOptions.length).toBe(2);
205
203
  expect(mockProject.upgradeIgniteUIPackages).toHaveBeenCalled();
@@ -40,7 +40,6 @@ const path = __importStar(require("path"));
40
40
  const SchematicsTemplateManager_1 = require("../SchematicsTemplateManager");
41
41
  const NgFileSystem_1 = require("../utils/NgFileSystem");
42
42
  describe("Schematics upgrade-packages", () => {
43
- // tslint:disable: object-literal-sort-keys
44
43
  let appTree;
45
44
  const collectionPath = path.join(__dirname, "../collection.json");
46
45
  const schematicName = "upgrade-packages";
@@ -39,7 +39,9 @@ class NgTreeFileSystem {
39
39
  return (this.tree.read(filePath) || "").toString();
40
40
  }
41
41
  writeFile(filePath, text) {
42
- return this.tree.overwrite(filePath, text);
42
+ this.tree.exists(filePath)
43
+ ? this.tree.overwrite(filePath, text)
44
+ : this.tree.create(filePath, text);
43
45
  }
44
46
  directoryExists(dirPath) {
45
47
  const dir = this.tree.getDir(dirPath);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schematics_1 = require("@angular-devkit/schematics");
4
+ const testing_1 = require("@angular-devkit/schematics/testing");
5
+ const NgFileSystem_1 = require("./NgFileSystem");
6
+ describe("NgTreeFileSystem", () => {
7
+ let tree;
8
+ let fs;
9
+ beforeEach(() => {
10
+ tree = new testing_1.UnitTestTree(new schematics_1.EmptyTree());
11
+ fs = new NgFileSystem_1.NgTreeFileSystem(tree);
12
+ });
13
+ describe("fileExists", () => {
14
+ it("should return true when the file exists in the tree", () => {
15
+ tree.create("/src/app/app.component.ts", "content");
16
+ expect(fs.fileExists("/src/app/app.component.ts")).toBeTrue();
17
+ });
18
+ it("should return false when the file does not exist in the tree", () => {
19
+ expect(fs.fileExists("/src/missing.ts")).toBeFalse();
20
+ });
21
+ });
22
+ describe("readFile", () => {
23
+ it("should return the file content as a string", () => {
24
+ tree.create("/src/app/app.component.ts", "export class AppComponent {}");
25
+ expect(fs.readFile("/src/app/app.component.ts")).toBe("export class AppComponent {}");
26
+ });
27
+ it("should return an empty string when the file does not exist", () => {
28
+ expect(fs.readFile("/src/nonexistent.ts")).toBe("");
29
+ });
30
+ it("should ignore the encoding parameter and still return the content", () => {
31
+ tree.create("/src/file.txt", "hello");
32
+ expect(fs.readFile("/src/file.txt", "utf-8")).toBe("hello");
33
+ });
34
+ });
35
+ describe("writeFile", () => {
36
+ it("should create a new file when it does not exist", () => {
37
+ fs.writeFile("/src/new-file.ts", "new content");
38
+ expect(tree.readContent("/src/new-file.ts")).toBe("new content");
39
+ });
40
+ it("should overwrite an existing file", () => {
41
+ tree.create("/src/existing.ts", "original content");
42
+ fs.writeFile("/src/existing.ts", "updated content");
43
+ expect(tree.readContent("/src/existing.ts")).toBe("updated content");
44
+ });
45
+ });
46
+ describe("directoryExists", () => {
47
+ it("should return true when the directory contains files", () => {
48
+ tree.create("/src/app/app.component.ts", "");
49
+ expect(fs.directoryExists("/src/app")).toBeTrue();
50
+ });
51
+ it("should return true when the directory contains subdirectories", () => {
52
+ tree.create("/src/app/nested/file.ts", "");
53
+ expect(fs.directoryExists("/src/app")).toBeTrue();
54
+ });
55
+ it("should return false for an empty or non-existent directory", () => {
56
+ expect(fs.directoryExists("/src/nonexistent")).toBeFalse();
57
+ });
58
+ });
59
+ describe("glob", () => {
60
+ beforeEach(() => {
61
+ tree.create("/src/app/app.component.ts", "");
62
+ tree.create("/src/app/app.module.ts", "");
63
+ tree.create("/src/app/shared/shared.component.ts", "");
64
+ tree.create("/src/environments/environment.ts", "");
65
+ tree.create("/src/environments/environment.prod.ts", "");
66
+ });
67
+ it("should return all files matching the pattern", () => {
68
+ const results = fs.glob("/src", "**/*.ts");
69
+ expect(results).toContain("/src/app/app.component.ts");
70
+ expect(results).toContain("/src/app/app.module.ts");
71
+ expect(results).toContain("/src/app/shared/shared.component.ts");
72
+ expect(results).toContain("/src/environments/environment.ts");
73
+ expect(results).toContain("/src/environments/environment.prod.ts");
74
+ });
75
+ it("should return only files matching a specific pattern", () => {
76
+ const results = fs.glob("/src", "**/environment*.ts");
77
+ expect(results).toContain("/src/environments/environment.ts");
78
+ expect(results).toContain("/src/environments/environment.prod.ts");
79
+ expect(results).not.toContain("/src/app/app.component.ts");
80
+ });
81
+ it("should return an empty array when no files match the pattern", () => {
82
+ const results = fs.glob("/src", "**/*.html");
83
+ expect(results).toEqual([]);
84
+ });
85
+ it("should skip subdirectories matching ignorePatterns", () => {
86
+ tree.create("/src/node_modules/lib/index.ts", "");
87
+ const results = fs.glob("/src", "**/*.ts", ["node_modules"]);
88
+ expect(results.some(r => r.includes("node_modules"))).toBeFalse();
89
+ });
90
+ it("should return an empty array when dirPath does not exist", () => {
91
+ const results = fs.glob("/nonexistent", "**/*.ts");
92
+ expect(results).toEqual([]);
93
+ });
94
+ });
95
+ });
package/src/tslint.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "../../../tslint.json",
3
- "rules": {
4
- "no-implicit-dependencies": [true, "dev"],
5
- "no-submodule-imports": [
6
- true,
7
- "@angular-devkit/core",
8
- "@angular-devkit/schematics",
9
- "rxjs"
10
- ]
11
- }
12
- }