@igniteui/angular-schematics 18.1.1402 → 18.1.1410-beta.1

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": "18.1.1402",
3
+ "version": "18.1.1410-beta.1",
4
4
  "description": "Ignite UI for Angular Schematics for ng new and ng generate",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,18 +20,18 @@
20
20
  "license": "MIT",
21
21
  "schematics": "./src/collection.json",
22
22
  "dependencies": {
23
- "@angular-devkit/core": "~14.0.0",
24
- "@angular-devkit/schematics": "~14.0.0",
25
- "@igniteui/angular-templates": "~18.1.1402",
26
- "@igniteui/cli-core": "~14.0.2",
23
+ "@angular-devkit/core": "^18.2.4",
24
+ "@angular-devkit/schematics": "^18.2.4",
25
+ "@igniteui/angular-templates": "~18.1.1410-beta.1",
26
+ "@igniteui/cli-core": "~14.1.0-beta.1",
27
27
  "@schematics/angular": "~14.0.0",
28
- "rxjs": "^6.6.3"
28
+ "rxjs": "^7.8.1"
29
29
  },
30
30
  "devDependencies": {
31
- "@types/jasmine": "3.3.9",
32
- "@types/node": "^8.0.31",
33
- "jasmine": "3.5.0",
34
- "typescript": "~5.4.3"
31
+ "@types/jasmine": "^5.1.4",
32
+ "@types/node": "^22.5.5",
33
+ "jasmine": "^5.3.0",
34
+ "typescript": "~5.5.4"
35
35
  },
36
36
  "ng-update": {
37
37
  "migrations": "./src/migrations/migration-collection.json"
@@ -1,9 +1,32 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.SchematicsTemplateManager = void 0;
4
27
  const angular_templates_1 = require("@igniteui/angular-templates");
5
28
  const cli_core_1 = require("@igniteui/cli-core");
6
- const path = require("path");
29
+ const path = __importStar(require("path"));
7
30
  class SchematicsTemplateManager extends cli_core_1.BaseTemplateManager {
8
31
  constructor() {
9
32
  super("");
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
3
4
  const schematics_1 = require("@angular-devkit/schematics");
4
5
  const cli_core_1 = require("@igniteui/cli-core");
5
6
  const path_1 = require("path");
@@ -22,4 +23,3 @@ function default_1(options) {
22
23
  ]);
23
24
  };
24
25
  }
25
- exports.default = default_1;
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -11,7 +34,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
34
  Object.defineProperty(exports, "__esModule", { value: true });
12
35
  const schematics_1 = require("@angular-devkit/schematics");
13
36
  const testing_1 = require("@angular-devkit/schematics/testing");
14
- const path = require("path");
37
+ const path = __importStar(require("path"));
15
38
  const collectionPath = path.join(__dirname, "../collection.json");
16
39
  describe("app-projects", () => {
17
40
  it("works", () => __awaiter(void 0, void 0, void 0, function* () {
@@ -26,9 +49,9 @@ describe("app-projects", () => {
26
49
  },
27
50
  theme: "mock-theme"
28
51
  };
29
- spyOn(tree, "read").and.returnValue(`Mock package content "igniteui-cli":`);
52
+ spyOn(tree, "read").and.returnValue(Buffer.from(`Mock package content "igniteui-cli":`));
30
53
  spyOn(tree, "overwrite");
31
- yield runner.runSchematicAsync("app-projects", mockOptions, tree).toPromise();
54
+ yield runner.runSchematic("app-projects", mockOptions, tree);
32
55
  expect(mockOptions.projTemplate.generateConfig).toHaveBeenCalled();
33
56
  expect(tree.read).toHaveBeenCalledWith("./package.json");
34
57
  expect(tree.overwrite).toHaveBeenCalledWith("./package.json", `Mock package content "@igniteui/angular-schematics":`);
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -9,7 +32,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
32
  });
10
33
  };
11
34
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const ts = require("typescript");
35
+ exports.default = default_1;
36
+ const ts = __importStar(require("typescript"));
13
37
  const core_1 = require("@angular-devkit/core");
14
38
  const schematics_1 = require("@angular-devkit/schematics");
15
39
  const cli_core_1 = require("@igniteui/cli-core");
@@ -125,4 +149,3 @@ function default_1() {
125
149
  ]);
126
150
  };
127
151
  }
128
- exports.default = default_1;
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -9,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
32
  });
10
33
  };
11
34
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const path = require("path");
35
+ const path = __importStar(require("path"));
13
36
  const schematics_1 = require("@angular-devkit/schematics");
14
37
  const testing_1 = require("@angular-devkit/schematics/testing");
15
38
  const cli_core_1 = require("@igniteui/cli-core");
@@ -22,6 +45,7 @@ describe("cli-config schematic", () => {
22
45
  const ngJsonConfig = {
23
46
  projects: {
24
47
  testProj: {
48
+ root: "",
25
49
  sourceRoot,
26
50
  architect: {
27
51
  build: {
@@ -93,20 +117,20 @@ describe("cli-config schematic", () => {
93
117
  expect(tree.exists("/src/index.html"));
94
118
  });
95
119
  it("should create an ignite-ui-cli.json file correctly", () => __awaiter(void 0, void 0, void 0, function* () {
96
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
120
+ yield runner.runSchematic("cli-config", {}, tree);
97
121
  expect(tree.exists("ignite-ui-cli.json")).toBeTruthy();
98
122
  const cliJsonData = JSON.parse(tree.readContent("/ignite-ui-cli.json"));
99
123
  expect(cliJsonData.project.projectTemplate).toEqual("ng-cli");
100
124
  }));
101
125
  it("should add typography correctly", () => __awaiter(void 0, void 0, void 0, function* () {
102
126
  const targetFile = "/src/index.html";
103
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
127
+ yield runner.runSchematic("cli-config", {}, tree);
104
128
  const content = tree.readContent(targetFile);
105
129
  expect(content.includes("<body class=\"ig-typography ig-scrollbar\">")).toBeTruthy();
106
130
  }));
107
131
  it("should add Titillium and Material Icons stylesheets correctly", () => __awaiter(void 0, void 0, void 0, function* () {
108
132
  const targetFile = "/src/index.html";
109
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
133
+ yield runner.runSchematic("cli-config", {}, tree);
110
134
  const content = tree.readContent(targetFile);
111
135
  const headContentsRegex = /(?:<head>)([\s\S]*)(?:<\/head>)/;
112
136
  expect(headContentsRegex.test(content)).toBeTruthy();
@@ -116,14 +140,14 @@ describe("cli-config schematic", () => {
116
140
  it("should add the default scss theme correctly", () => __awaiter(void 0, void 0, void 0, function* () {
117
141
  const targetFile = "/src/styles.scss";
118
142
  tree.create(targetFile, "");
119
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
143
+ yield runner.runSchematic("cli-config", {}, tree);
120
144
  let content = tree.readContent(targetFile);
121
145
  expect(content.includes(`@use "${cli_core_1.NPM_ANGULAR}`)).toBeTruthy();
122
146
  tree.overwrite(targetFile, "");
123
147
  resetTree();
124
148
  createIgPkgJson(cli_core_1.FEED_ANGULAR);
125
149
  populatePkgJson(cli_core_1.FEED_ANGULAR);
126
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
150
+ yield runner.runSchematic("cli-config", {}, tree);
127
151
  content = tree.readContent(targetFile);
128
152
  expect(content.includes(`@use "${cli_core_1.FEED_ANGULAR}`)).toBeTruthy();
129
153
  }));
@@ -131,7 +155,7 @@ describe("cli-config schematic", () => {
131
155
  const targetFile = "/angular.json";
132
156
  expect(tree.exists(targetFile)).toBeTruthy();
133
157
  let targetImport = `node_modules/${cli_core_1.NPM_ANGULAR}/styles/igniteui-angular.css`;
134
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
158
+ yield runner.runSchematic("cli-config", {}, tree);
135
159
  let workspace = JSON.parse(tree.read("/angular.json").toString());
136
160
  expect(workspace.projects.testProj.architect.build.options.styles.filter((s) => s.includes(targetImport)).length)
137
161
  .toBeGreaterThan(0);
@@ -141,7 +165,7 @@ describe("cli-config schematic", () => {
141
165
  createIgPkgJson(cli_core_1.FEED_ANGULAR);
142
166
  populatePkgJson(cli_core_1.FEED_ANGULAR);
143
167
  targetImport = `node_modules/${cli_core_1.FEED_ANGULAR}/styles/igniteui-angular.css`;
144
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
168
+ yield runner.runSchematic("cli-config", {}, tree);
145
169
  workspace = JSON.parse(tree.read("/angular.json").toString());
146
170
  expect(workspace.projects.testProj.architect.build.options.styles.filter((s) => s.includes(targetImport)).length)
147
171
  .toBeGreaterThan(0);
@@ -154,7 +178,7 @@ describe("cli-config schematic", () => {
154
178
  tree.create(stylesheet, "");
155
179
  const targetFile = "/angular.json";
156
180
  expect(tree.exists(targetFile)).toBeTruthy();
157
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
181
+ yield runner.runSchematic("cli-config", {}, tree);
158
182
  const workspace = JSON.parse(tree.read("/angular.json").toString());
159
183
  // the schematic creates the hierarchy that leads to the styles object within the workspace,
160
184
  // providing that it is not already present
@@ -164,14 +188,14 @@ describe("cli-config schematic", () => {
164
188
  it("should add the default sass theme correctly", () => __awaiter(void 0, void 0, void 0, function* () {
165
189
  const targetFile = "/src/styles.sass";
166
190
  tree.create(targetFile, "");
167
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
191
+ yield runner.runSchematic("cli-config", {}, tree);
168
192
  let content = tree.readContent(targetFile);
169
193
  expect(content.includes(`@use "${cli_core_1.NPM_ANGULAR}`)).toBeTruthy();
170
194
  tree.overwrite(targetFile, "");
171
195
  resetTree();
172
196
  createIgPkgJson(cli_core_1.FEED_ANGULAR);
173
197
  populatePkgJson(cli_core_1.FEED_ANGULAR);
174
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
198
+ yield runner.runSchematic("cli-config", {}, tree);
175
199
  content = tree.readContent(targetFile);
176
200
  expect(content.includes(`@use "${cli_core_1.FEED_ANGULAR}`)).toBeTruthy();
177
201
  }));
@@ -193,7 +217,7 @@ export class AppModule {
193
217
  `;
194
218
  const targetFile = "./src/app/app.module.ts";
195
219
  tree.create(targetFile, moduleContent);
196
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
220
+ yield runner.runSchematic("cli-config", {}, tree);
197
221
  const content = tree.readContent(targetFile);
198
222
  expect(content.replace(/\r\n/g, "\n")).toEqual(moduleContentAfterSchematic.replace(/\r\n/g, "\n"));
199
223
  }));
@@ -217,7 +241,7 @@ export const appConfig: ApplicationConfig = {
217
241
  `;
218
242
  const targetFile = "./src/app/app.config.ts";
219
243
  tree.create(targetFile, moduleContent);
220
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
244
+ yield runner.runSchematic("cli-config", {}, tree);
221
245
  const content = tree.readContent(targetFile);
222
246
  expect(content.replace(/\r\n/g, "\n")).toEqual(moduleContentAfterSchematic.replace(/\r\n/g, "\n"));
223
247
  }));
@@ -233,7 +257,7 @@ export const appConfig: ApplicationConfig = {
233
257
  `;
234
258
  const targetFile = "./src/app/app.config.ts";
235
259
  tree.create(targetFile, moduleContent);
236
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
260
+ yield runner.runSchematic("cli-config", {}, tree);
237
261
  const content = tree.readContent(targetFile);
238
262
  expect(content.replace(/\r\n/g, "\n")).toEqual(moduleContent.replace(/\r\n/g, "\n"));
239
263
  }));
@@ -244,14 +268,14 @@ export const appConfig: ApplicationConfig = {
244
268
  warns.push(entry.message);
245
269
  }
246
270
  });
247
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
271
+ yield runner.runSchematic("cli-config", {}, tree);
248
272
  let pattern = new RegExp(`WARNING Version mismatch detected - ${cli_core_1.NPM_ANGULAR}`);
249
273
  expect(warns).toContain(jasmine.stringMatching(pattern));
250
274
  resetTree();
251
275
  createIgPkgJson(cli_core_1.FEED_ANGULAR);
252
276
  populatePkgJson(cli_core_1.FEED_ANGULAR);
253
277
  pattern = new RegExp(`WARNING Version mismatch detected - ${cli_core_1.FEED_ANGULAR}`);
254
- yield runner.runSchematicAsync("cli-config", {}, tree).toPromise();
278
+ yield runner.runSchematic("cli-config", {}, tree);
255
279
  expect(warns).toContain(jasmine.stringMatching(pattern));
256
280
  }));
257
281
  });
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.component = exports.singleComponent = void 0;
12
+ exports.singleComponent = singleComponent;
13
+ exports.component = component;
13
14
  const core_1 = require("@angular-devkit/core");
14
15
  const schematics_1 = require("@angular-devkit/schematics");
15
16
  const tasks_1 = require("@angular-devkit/schematics/tasks");
@@ -65,7 +66,6 @@ function singleComponent(templateOptions, skipRoute) {
65
66
  ]);
66
67
  });
67
68
  }
68
- exports.singleComponent = singleComponent;
69
69
  function component(options) {
70
70
  return (tree, context) => __awaiter(this, void 0, void 0, function* () {
71
71
  cli_core_1.App.initialize("angular-cli");
@@ -150,4 +150,3 @@ function component(options) {
150
150
  ]);
151
151
  });
152
152
  }
153
- exports.component = component;
@@ -1,16 +1,39 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  const schematics_1 = require("@angular-devkit/schematics");
4
27
  const testing_1 = require("@angular-devkit/schematics/testing");
5
28
  const cli_core_1 = require("@igniteui/cli-core");
6
- const path = require("path");
29
+ const path = __importStar(require("path"));
7
30
  const SchematicsTemplateManager_1 = require("../SchematicsTemplateManager");
8
31
  const collectionPath = path.join(__dirname, "../collection.json");
9
32
  describe("component", () => {
10
33
  beforeAll(() => {
11
34
  spyOn(cli_core_1.GoogleAnalytics, "post");
12
35
  });
13
- it("works", done => {
36
+ it("works", () => {
14
37
  const runner = new testing_1.SchematicTestRunner("schematics", collectionPath);
15
38
  const mockInst = {
16
39
  generateConfig: jasmine.createSpy(),
@@ -18,30 +41,85 @@ describe("component", () => {
18
41
  registerInProject: jasmine.createSpy(),
19
42
  templatePaths: []
20
43
  };
44
+ const mockBaseTemplate = {
45
+ id: "mock-template-id",
46
+ name: "mock-template",
47
+ description: "A mock template",
48
+ delimiters: {
49
+ content: { start: "{{", end: "}}" },
50
+ path: { start: "[[", end: "]]" }
51
+ },
52
+ dependencies: ["mock-dependency"],
53
+ framework: "angular",
54
+ projectType: "ts",
55
+ hasExtraConfiguration: true,
56
+ templatePaths: ["/path/to/template"],
57
+ generateConfig: jasmine.createSpy().and.returnValue({}),
58
+ getExtraConfiguration: jasmine.createSpy().and.returnValue([]),
59
+ setExtraConfiguration: jasmine.createSpy()
60
+ };
61
+ const mockProjectTemplate = Object.assign(Object.assign({}, mockBaseTemplate), { installModules: jasmine.createSpy().and.callFake(() => { }), upgradeIgniteUIPackages: jasmine.createSpy().and.returnValue(Promise.resolve(true)) });
62
+ const mockTemplate = Object.assign(Object.assign({}, mockBaseTemplate), { components: ["mock-component"], controlGroup: "mock-group", listInComponentTemplates: true, listInCustomTemplates: true, packages: ["mock-package"], registerInProject: jasmine.createSpy() });
21
63
  const mockLib = {
22
- getCustomTemplates: () => { },
23
- getTemplateById: jasmine.createSpy().and.returnValue(mockInst),
24
- hasTemplate: jasmine.createSpy().and.returnValue(true)
64
+ name: "mock-library",
65
+ themes: ["mock-theme"],
66
+ components: [{
67
+ name: "mock-component",
68
+ description: "A mock component",
69
+ group: "mock-group",
70
+ groupPriority: 1,
71
+ templates: [mockTemplate]
72
+ }],
73
+ projectIds: ["another-mock"],
74
+ projects: [mockProjectTemplate],
75
+ templates: [mockTemplate],
76
+ projectType: "ts",
77
+ generateTemplateFolderPath: "/path/to/templates",
78
+ getCustomTemplateNames: jasmine.createSpy().and.returnValue([]),
79
+ getTemplateByName: jasmine.createSpy().and.returnValue(mockTemplate),
80
+ getTemplateById: jasmine.createSpy().and.returnValue(mockTemplate),
81
+ getComponentByName: jasmine.createSpy().and.returnValue({
82
+ name: "mock-component",
83
+ description: "A mock component",
84
+ group: "mock-group",
85
+ groupPriority: 1,
86
+ templates: [mockTemplate]
87
+ }),
88
+ getComponentGroupNames: jasmine.createSpy().and.returnValue(["mock-group"]),
89
+ getComponentsByGroup: jasmine.createSpy().and.returnValue([{
90
+ name: "mock-component",
91
+ description: "A mock component",
92
+ group: "mock-group",
93
+ groupPriority: 1,
94
+ templates: [mockTemplate]
95
+ }]),
96
+ getComponentGroups: jasmine.createSpy().and.returnValue([{
97
+ name: "mock-group",
98
+ description: "A mock component group"
99
+ }]),
100
+ getCustomTemplates: jasmine.createSpy().and.returnValue([mockTemplate]),
101
+ getProject: jasmine.createSpy().and.returnValue(mockProjectTemplate),
102
+ hasProject: jasmine.createSpy().and.returnValue(false),
103
+ hasTemplate: jasmine.createSpy().and.returnValue(false),
104
+ registerTemplate: jasmine.createSpy()
25
105
  };
26
106
  const projLibSpy = spyOn(SchematicsTemplateManager_1.SchematicsTemplateManager.prototype, "getProjectLibrary");
27
107
  projLibSpy.and.returnValue(mockLib);
28
108
  const mockConfig = {
29
- customTemplates: ["path:C:\work\GitHub\ignite-ui-cli\output\custom-templ"],
30
109
  project: {
31
110
  theme: "Custom"
32
111
  }
33
112
  };
34
113
  const projConfigSpy = spyOn(cli_core_1.ProjectConfig, "getConfig");
35
114
  projConfigSpy.and.returnValue(mockConfig);
36
- const tree = runner.runSchematicAsync("component", { name: "my-combo", template: "combo", templateInst: mockInst, skipRoute: false }, schematics_1.Tree.empty());
37
- tree.subscribe(state => {
115
+ const tree = runner.runSchematic("component", { name: "my-combo", template: "combo", templateInst: mockInst, skipRoute: false }, schematics_1.Tree.empty());
116
+ tree.then(state => {
38
117
  expect(mockInst.generateConfig).toHaveBeenCalledWith("my-combo", {});
39
118
  expect(mockInst.registerInProject).toHaveBeenCalledWith("", "my-combo", { skipRoute: false, modulePath: undefined });
40
119
  expect(projLibSpy).toHaveBeenCalledWith("angular", "igx-ts");
41
120
  expect(mockLib.hasTemplate).toHaveBeenCalledWith("combo");
42
121
  expect(mockLib.getTemplateById).toHaveBeenCalledWith("combo");
43
122
  expect(state.files).toEqual([]);
44
- done();
45
123
  });
46
124
  });
47
125
  });
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
3
4
  function default_1(options) {
4
5
  return (host, context) => {
5
6
  var _a;
@@ -17,4 +18,3 @@ function default_1(options) {
17
18
  }
18
19
  };
19
20
  }
20
- exports.default = default_1;
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -9,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
32
  });
10
33
  };
11
34
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const path = require("path");
35
+ const path = __importStar(require("path"));
13
36
  const schematics_1 = require("@angular-devkit/schematics");
14
37
  const testing_1 = require("@angular-devkit/schematics/testing");
15
38
  describe("Update 17.1.0", () => {
@@ -18,7 +41,7 @@ describe("Update 17.1.0", () => {
18
41
  beforeEach(() => {
19
42
  appTree = new testing_1.UnitTestTree(new schematics_1.EmptyTree());
20
43
  });
21
- it("change projectType to legacy", (done) => __awaiter(void 0, void 0, void 0, function* () {
44
+ it("change projectType to legacy", () => __awaiter(void 0, void 0, void 0, function* () {
22
45
  appTree.create("./ignite-ui-cli.json", `{
23
46
  "igPackageRegistry": "https://packages.infragistics.com/npm/js-licensed/",
24
47
  "customTemplates": [],
@@ -43,7 +66,7 @@ describe("Update 17.1.0", () => {
43
66
  "build": {}
44
67
  }
45
68
  `);
46
- const tree = yield schematicRunner.runSchematicAsync("migration-01", { applyMigrations: true }, appTree).toPromise();
69
+ const tree = yield schematicRunner.runSchematic("migration-01", { applyMigrations: true }, appTree);
47
70
  expect(tree.readContent("./ignite-ui-cli.json"))
48
71
  .toEqual(`{
49
72
  "igPackageRegistry": "https://packages.infragistics.com/npm/js-licensed/",
@@ -68,6 +91,5 @@ describe("Update 17.1.0", () => {
68
91
  },
69
92
  "build": {}
70
93
  }`);
71
- done();
72
94
  }));
73
95
  });
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.newProject = void 0;
12
+ exports.newProject = newProject;
13
13
  const schematics_1 = require("@angular-devkit/schematics");
14
14
  const tasks_1 = require("@angular-devkit/schematics/tasks");
15
15
  const cli_core_1 = require("@igniteui/cli-core");
@@ -55,6 +55,7 @@ function newProject(options) {
55
55
  name: "projectName",
56
56
  message: "Enter a name for your project:",
57
57
  default: cli_core_1.Util.getAvailableName(defaultProjName, true),
58
+ choices: null,
58
59
  validate: prompt.nameIsValid
59
60
  });
60
61
  nameProvided = false;
@@ -159,4 +160,3 @@ function newProject(options) {
159
160
  ]);
160
161
  };
161
162
  }
162
- exports.newProject = newProject;
@@ -1,23 +1,104 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  const schematics_1 = require("@angular-devkit/schematics");
4
27
  const testing_1 = require("@angular-devkit/schematics/testing");
5
28
  const cli_core_1 = require("@igniteui/cli-core");
6
- const path = require("path");
7
- const operators_1 = require("rxjs/operators");
8
- const AppProjectSchematic = require("../app-projects/index");
29
+ const path = __importStar(require("path"));
30
+ const AppProjectSchematic = __importStar(require("../app-projects/index"));
9
31
  const SchematicsPromptSession_1 = require("../prompt/SchematicsPromptSession");
10
32
  const collectionPath = path.join(__dirname, "../collection.json");
11
33
  describe("Schematics ng-new", () => {
12
34
  beforeAll(() => {
13
35
  spyOn(cli_core_1.GoogleAnalytics, "post");
14
36
  });
15
- it("works with no name provided", done => {
37
+ it("works with no name provided", () => {
16
38
  const runner = new testing_1.SchematicTestRunner("schematics", collectionPath);
17
39
  const myTree = schematics_1.Tree.empty();
18
40
  const workingDirectory = "my-test-project";
41
+ const mockBaseTemplate = {
42
+ id: "mock-template-id",
43
+ name: "mock-template",
44
+ description: "A mock template",
45
+ delimiters: {
46
+ content: { start: "{{", end: "}}" },
47
+ path: { start: "[[", end: "]]" }
48
+ },
49
+ dependencies: ["mock-dependency"],
50
+ framework: "angular",
51
+ projectType: "ts",
52
+ hasExtraConfiguration: true,
53
+ templatePaths: ["/path/to/template"],
54
+ generateConfig: jasmine.createSpy().and.returnValue({}),
55
+ getExtraConfiguration: jasmine.createSpy().and.returnValue([]),
56
+ setExtraConfiguration: jasmine.createSpy()
57
+ };
58
+ const mockProjectTemplate = Object.assign(Object.assign({}, mockBaseTemplate), { installModules: jasmine.createSpy().and.callFake(() => { }), upgradeIgniteUIPackages: jasmine.createSpy().and.returnValue(Promise.resolve(true)) });
59
+ const mockTemplate = Object.assign(Object.assign({}, mockBaseTemplate), { components: ["mock-component"], controlGroup: "mock-group", listInComponentTemplates: true, listInCustomTemplates: true, packages: ["mock-package"], registerInProject: jasmine.createSpy() });
19
60
  const mockLibrary = {
20
- getProject: jasmine.createSpy("getProject").and.returnValue(true), projectIds: ["empty-page"], themes: ["custom"]
61
+ name: "mock-library",
62
+ themes: ["mock-theme"],
63
+ components: [{
64
+ name: "mock-component",
65
+ description: "A mock component",
66
+ group: "mock-group",
67
+ groupPriority: 1,
68
+ templates: [mockTemplate]
69
+ }],
70
+ projectIds: ["another-mock"],
71
+ projects: [mockProjectTemplate],
72
+ templates: [mockTemplate],
73
+ projectType: "ts",
74
+ generateTemplateFolderPath: "/path/to/templates",
75
+ getCustomTemplateNames: jasmine.createSpy().and.returnValue([]),
76
+ getTemplateByName: jasmine.createSpy().and.returnValue(mockTemplate),
77
+ getTemplateById: jasmine.createSpy().and.returnValue(mockTemplate),
78
+ getComponentByName: jasmine.createSpy().and.returnValue({
79
+ name: "mock-component",
80
+ description: "A mock component",
81
+ group: "mock-group",
82
+ groupPriority: 1,
83
+ templates: [mockTemplate]
84
+ }),
85
+ getComponentGroupNames: jasmine.createSpy().and.returnValue(["mock-group"]),
86
+ getComponentsByGroup: jasmine.createSpy().and.returnValue([{
87
+ name: "mock-component",
88
+ description: "A mock component",
89
+ group: "mock-group",
90
+ groupPriority: 1,
91
+ templates: [mockTemplate]
92
+ }]),
93
+ getComponentGroups: jasmine.createSpy().and.returnValue([{
94
+ name: "mock-group",
95
+ description: "A mock component group"
96
+ }]),
97
+ getCustomTemplates: jasmine.createSpy().and.returnValue([mockTemplate]),
98
+ getProject: jasmine.createSpy().and.returnValue(mockProjectTemplate),
99
+ hasProject: jasmine.createSpy().and.returnValue(false),
100
+ hasTemplate: jasmine.createSpy().and.returnValue(false),
101
+ registerTemplate: jasmine.createSpy()
21
102
  };
22
103
  const mockProject = {
23
104
  upgradeIgniteUIPackages: () => Promise.resolve(true)
@@ -25,11 +106,11 @@ describe("Schematics ng-new", () => {
25
106
  spyOn(mockProject, "upgradeIgniteUIPackages").and.callThrough();
26
107
  const mockSession = {
27
108
  chooseActionLoop: spyOn(SchematicsPromptSession_1.SchematicsPromptSession.prototype, "chooseActionLoop")
28
- .and.returnValue(Promise.resolve(true)),
109
+ .and.returnValue(Promise.resolve()),
29
110
  getProjectLibraryByType: spyOn(SchematicsPromptSession_1.SchematicsPromptSession.prototype, "getProjectLibraryByType")
30
111
  .and.returnValue((Promise.resolve(mockLibrary))),
31
112
  getProjectTemplate: spyOn(SchematicsPromptSession_1.SchematicsPromptSession.prototype, "getProjectTemplate")
32
- .and.returnValue(Promise.resolve(mockProject)),
113
+ .and.returnValue(Promise.resolve(mockProjectTemplate)),
33
114
  getTheme: spyOn(SchematicsPromptSession_1.SchematicsPromptSession.prototype, "getTheme")
34
115
  .and.returnValue(Promise.resolve("custom")),
35
116
  getUserInput: spyOn(SchematicsPromptSession_1.SchematicsPromptSession.prototype, "getUserInput")
@@ -46,9 +127,8 @@ describe("Schematics ng-new", () => {
46
127
  currentTree.create("gitignore", "");
47
128
  return currentTree;
48
129
  });
49
- runner.runSchematicAsync("ng-new", { version: "8.0.3" }, myTree)
50
- .pipe((0, operators_1.take)(1))
51
- .subscribe((e) => {
130
+ runner.runSchematic("ng-new", { version: "8.0.3" }, myTree)
131
+ .then((e) => {
52
132
  for (const mockFunc of Object.entries(mockSession)) {
53
133
  expect(mockFunc[1]).toHaveBeenCalled();
54
134
  }
@@ -83,10 +163,9 @@ describe("Schematics ng-new", () => {
83
163
  expect(taskOptions).toContain(jasmine.objectContaining(expectedInstall));
84
164
  expect(taskOptions).toContain(expectedInit);
85
165
  expect(taskOptions).toContain(expectedStart);
86
- done();
87
166
  });
88
167
  });
89
- it("works with name provided", done => {
168
+ it("works with name provided", () => {
90
169
  const runner = new testing_1.SchematicTestRunner("schematics", collectionPath);
91
170
  const myTree = schematics_1.Tree.empty();
92
171
  const workingDirectory = "my-test-project";
@@ -94,15 +173,6 @@ describe("Schematics ng-new", () => {
94
173
  upgradeIgniteUIPackages: () => Promise.resolve(true)
95
174
  };
96
175
  spyOn(mockProject, "upgradeIgniteUIPackages").and.callThrough();
97
- const mockLibrary = {
98
- getProject: jasmine.createSpy("getProject").and.returnValue(mockProject),
99
- projectIds: ["empty-page"],
100
- themes: ["custom"]
101
- };
102
- const mockSession = {
103
- getProjectLibraryByType: spyOn(SchematicsPromptSession_1.SchematicsPromptSession.prototype, "getProjectLibraryByType")
104
- .and.returnValue((Promise.resolve(mockLibrary)))
105
- };
106
176
  const userAnswers = new Map();
107
177
  userAnswers.set("upgradePackages", true);
108
178
  spyOnProperty(SchematicsPromptSession_1.SchematicsPromptSession.prototype, "userAnswers", "get").and.returnValue(userAnswers);
@@ -110,12 +180,8 @@ describe("Schematics ng-new", () => {
110
180
  currentTree.create("gitignore", "");
111
181
  return currentTree;
112
182
  });
113
- runner.runSchematicAsync("ng-new", { version: "8.0.3", name: workingDirectory }, myTree)
114
- .pipe((0, operators_1.take)(1))
115
- .subscribe((e) => {
116
- for (const mockFunc of Object.entries(mockSession)) {
117
- expect(mockFunc[1]).toHaveBeenCalled();
118
- }
183
+ runner.runSchematic("ng-new", { version: "8.0.3", name: workingDirectory }, myTree)
184
+ .then((e) => {
119
185
  expect(AppProjectSchematic.default).toHaveBeenCalled();
120
186
  expect(e.files.length).toEqual(1);
121
187
  expect(e.exists(`${workingDirectory}/.gitignore`)).toBeTruthy();
@@ -139,7 +205,6 @@ describe("Schematics ng-new", () => {
139
205
  expect(mockProject.upgradeIgniteUIPackages).toHaveBeenCalled();
140
206
  expect(taskOptions).toContain(jasmine.objectContaining(expectedInstall));
141
207
  expect(taskOptions).toContain(expectedInit);
142
- done();
143
208
  });
144
209
  });
145
210
  });
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.default = default_1;
12
13
  const scoped_1 = require("@angular-devkit/schematics/src/tree/scoped");
13
14
  const cli_core_1 = require("@igniteui/cli-core");
14
15
  const rxjs_1 = require("rxjs");
@@ -25,4 +26,3 @@ function default_1(options) {
25
26
  }));
26
27
  };
27
28
  }
28
- exports.default = default_1;
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.default = default_1;
12
13
  const tasks_1 = require("@angular-devkit/schematics/tasks");
13
14
  const cli_core_1 = require("@igniteui/cli-core");
14
15
  const rxjs_1 = require("rxjs");
@@ -42,4 +43,3 @@ function default_1(options) {
42
43
  }));
43
44
  };
44
45
  }
45
- exports.default = default_1;
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -13,7 +36,7 @@ const schematics_1 = require("@angular-devkit/schematics");
13
36
  const tasks_1 = require("@angular-devkit/schematics/tasks");
14
37
  const testing_1 = require("@angular-devkit/schematics/testing");
15
38
  const cli_core_1 = require("@igniteui/cli-core");
16
- const path = require("path");
39
+ const path = __importStar(require("path"));
17
40
  const SchematicsTemplateManager_1 = require("../SchematicsTemplateManager");
18
41
  const NgFileSystem_1 = require("../utils/NgFileSystem");
19
42
  describe("Schematics upgrade-packages", () => {
@@ -25,35 +48,89 @@ describe("Schematics upgrade-packages", () => {
25
48
  spyOn(cli_core_1.GoogleAnalytics, "post");
26
49
  appTree = new testing_1.UnitTestTree(new schematics_1.EmptyTree());
27
50
  });
28
- it("calls project template upgradeIgniteUIPackages and schedules install accordingly", (done) => __awaiter(void 0, void 0, void 0, function* () {
51
+ it("calls project template upgradeIgniteUIPackages and schedules install accordingly", () => __awaiter(void 0, void 0, void 0, function* () {
29
52
  const runner = new testing_1.SchematicTestRunner("schematics", collectionPath);
30
53
  const mockConfig = {
31
54
  customTemplates: [],
32
55
  project: {
33
- framework: "mock-ng",
34
- projectType: "mock-igx-ts",
35
- projectTemplate: "mock-side-nav"
56
+ framework: "angular",
57
+ projectType: "igx-ts",
58
+ projectTemplate: "mock-side-nav",
36
59
  }
37
60
  };
38
61
  spyOn(cli_core_1.ProjectConfig, "getConfig").and.returnValue(mockConfig);
39
- const mockProjTemplate = {
40
- upgradeIgniteUIPackages: () => __awaiter(void 0, void 0, void 0, function* () { return true; })
62
+ const mockBaseTemplate = {
63
+ id: "mock-template-id",
64
+ name: "mock-template",
65
+ description: "A mock template",
66
+ delimiters: {
67
+ content: { start: "{{", end: "}}" },
68
+ path: { start: "[[", end: "]]" }
69
+ },
70
+ dependencies: ["mock-dependency"],
71
+ framework: "angular",
72
+ projectType: "ts",
73
+ hasExtraConfiguration: true,
74
+ templatePaths: ["/path/to/template"],
75
+ generateConfig: jasmine.createSpy().and.returnValue({}),
76
+ getExtraConfiguration: jasmine.createSpy().and.returnValue([]),
77
+ setExtraConfiguration: jasmine.createSpy()
41
78
  };
42
- const upgradeSpy = spyOn(mockProjTemplate, "upgradeIgniteUIPackages");
79
+ const mockProjectTemplate = Object.assign(Object.assign({}, mockBaseTemplate), { installModules: jasmine.createSpy().and.callFake(() => { }), upgradeIgniteUIPackages: () => __awaiter(void 0, void 0, void 0, function* () { return true; }) });
80
+ const mockTemplate = Object.assign(Object.assign({}, mockBaseTemplate), { components: ["mock-component"], controlGroup: "mock-group", listInComponentTemplates: true, listInCustomTemplates: true, packages: ["mock-package"], registerInProject: jasmine.createSpy() });
43
81
  const mockLib = {
44
- getProject: jasmine.createSpy().and.returnValue(mockProjTemplate),
82
+ name: "mock-library",
83
+ themes: ["mock-theme"],
84
+ components: [{
85
+ name: "mock-component",
86
+ description: "A mock component",
87
+ group: "mock-group",
88
+ groupPriority: 1,
89
+ templates: [mockTemplate]
90
+ }],
91
+ projectIds: ["another-mock"],
92
+ projects: [mockProjectTemplate],
93
+ templates: [mockTemplate],
94
+ projectType: "ts",
95
+ generateTemplateFolderPath: "/path/to/templates",
96
+ getCustomTemplateNames: jasmine.createSpy().and.returnValue([]),
97
+ getTemplateByName: jasmine.createSpy().and.returnValue(mockTemplate),
98
+ getTemplateById: jasmine.createSpy().and.returnValue(mockTemplate),
99
+ getComponentByName: jasmine.createSpy().and.returnValue({
100
+ name: "mock-component",
101
+ description: "A mock component",
102
+ group: "mock-group",
103
+ groupPriority: 1,
104
+ templates: [mockTemplate]
105
+ }),
106
+ getComponentGroupNames: jasmine.createSpy().and.returnValue(["mock-group"]),
107
+ getComponentsByGroup: jasmine.createSpy().and.returnValue([{
108
+ name: "mock-component",
109
+ description: "A mock component",
110
+ group: "mock-group",
111
+ groupPriority: 1,
112
+ templates: [mockTemplate]
113
+ }]),
114
+ getComponentGroups: jasmine.createSpy().and.returnValue([{
115
+ name: "mock-group",
116
+ description: "A mock component group"
117
+ }]),
118
+ getCustomTemplates: jasmine.createSpy().and.returnValue([mockTemplate]),
119
+ getProject: jasmine.createSpy().and.returnValue(mockProjectTemplate),
45
120
  hasProject: jasmine.createSpy().and.returnValue(false),
46
- projectIds: ["another-mock"]
121
+ hasTemplate: jasmine.createSpy().and.returnValue(false),
122
+ registerTemplate: jasmine.createSpy()
47
123
  };
48
124
  const projLibSpy = spyOn(SchematicsTemplateManager_1.SchematicsTemplateManager.prototype, "getProjectLibrary");
49
125
  projLibSpy.and.returnValue(mockLib);
126
+ const upgradeSpy = spyOn(mockProjectTemplate, "upgradeIgniteUIPackages");
50
127
  upgradeSpy.and.returnValue(Promise.resolve(false));
51
- yield runner.runSchematicAsync(schematicName, {}, appTree).toPromise();
128
+ yield runner.runSchematic(schematicName, {}, appTree);
52
129
  expect(cli_core_1.GoogleAnalytics.post).toHaveBeenCalledWith({
53
130
  t: "screenview",
54
131
  cd: "Upgrade packages"
55
132
  });
56
- expect(projLibSpy).toHaveBeenCalledWith("mock-ng", "mock-igx-ts");
133
+ expect(projLibSpy).toHaveBeenCalledWith("angular", "igx-ts");
57
134
  expect(mockLib.hasProject).toHaveBeenCalledWith("mock-side-nav");
58
135
  expect(mockLib.getProject).toHaveBeenCalledWith("another-mock");
59
136
  expect(cli_core_1.App.container.get(cli_core_1.FS_TYPE_TOKEN)).toEqual(cli_core_1.FsTypes.virtual, "setVirtual not called");
@@ -62,13 +139,12 @@ describe("Schematics upgrade-packages", () => {
62
139
  expect(upgradeSpy).toHaveBeenCalledWith("", "");
63
140
  expect(runner.tasks).toEqual([]);
64
141
  upgradeSpy.and.returnValue(Promise.resolve(true));
65
- yield runner.runSchematicAsync(schematicName, { skipInstall: true }, appTree).toPromise();
142
+ yield runner.runSchematic(schematicName, { skipInstall: true }, appTree);
66
143
  expect(upgradeSpy).toHaveBeenCalledTimes(2);
67
144
  expect(runner.tasks).toEqual([]);
68
- yield runner.runSchematicAsync(schematicName, {}, appTree).toPromise();
145
+ yield runner.runSchematic(schematicName, {}, appTree);
69
146
  expect(upgradeSpy).toHaveBeenCalledTimes(3);
70
147
  const installTaskOptions = new tasks_1.NodePackageInstallTask().toConfiguration();
71
148
  expect(runner.tasks).toContain(jasmine.objectContaining(installTaskOptions));
72
- done();
73
149
  }));
74
150
  });
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setVirtual = exports.NgTreeFileSystem = void 0;
3
+ exports.NgTreeFileSystem = void 0;
4
+ exports.setVirtual = setVirtual;
4
5
  const cli_core_1 = require("@igniteui/cli-core");
5
6
  class NgTreeFileSystem {
6
7
  constructor(tree) {
@@ -45,4 +46,3 @@ function setVirtual(tree) {
45
46
  cli_core_1.App.container.set(cli_core_1.FS_TOKEN, new NgTreeFileSystem(tree));
46
47
  cli_core_1.App.container.set(cli_core_1.FS_TYPE_TOKEN, cli_core_1.FsTypes.virtual);
47
48
  }
48
- exports.setVirtual = setVirtual;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createCliConfig = void 0;
12
+ exports.createCliConfig = createCliConfig;
13
13
  const core_1 = require("@angular-devkit/core");
14
14
  const schematics_1 = require("@angular-devkit/schematics");
15
15
  const cli_core_1 = require("@igniteui/cli-core");
@@ -26,7 +26,6 @@ function createCliConfig() {
26
26
  tree.create("ignite-ui-cli.json", JSON.stringify(config, null, 2) + "\n");
27
27
  });
28
28
  }
29
- exports.createCliConfig = createCliConfig;
30
29
  function GetCliConfig(tree) {
31
30
  return __awaiter(this, void 0, void 0, function* () {
32
31
  let workspace;
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -9,10 +32,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
32
  });
10
33
  };
11
34
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getProjects = exports.addFontsToIndexHtml = exports.importDefaultTheme = void 0;
35
+ exports.importDefaultTheme = importDefaultTheme;
36
+ exports.addFontsToIndexHtml = addFontsToIndexHtml;
37
+ exports.getProjects = getProjects;
13
38
  const core_1 = require("@angular-devkit/core");
14
39
  const cli_core_1 = require("@igniteui/cli-core");
15
- const path = require("path");
40
+ const path = __importStar(require("path"));
16
41
  function importDefaultTheme(tree) {
17
42
  return __awaiter(this, void 0, void 0, function* () {
18
43
  const projects = yield getProjects(tree);
@@ -35,7 +60,6 @@ function importDefaultTheme(tree) {
35
60
  }
36
61
  });
37
62
  }
38
- exports.importDefaultTheme = importDefaultTheme;
39
63
  function addFontsToIndexHtml(tree) {
40
64
  return __awaiter(this, void 0, void 0, function* () {
41
65
  const titillium = '<link href="https://fonts.googleapis.com/css?family=Titillium+Web" rel="stylesheet">';
@@ -57,7 +81,6 @@ function addFontsToIndexHtml(tree) {
57
81
  });
58
82
  });
59
83
  }
60
- exports.addFontsToIndexHtml = addFontsToIndexHtml;
61
84
  function importDefaultThemeSass(tree, filePath) {
62
85
  const igxPackage = (0, cli_core_1.resolvePackage)(cli_core_1.NPM_ANGULAR);
63
86
  const sassImports = `
@@ -95,7 +118,6 @@ function getProjects(tree) {
95
118
  return workspace.projects;
96
119
  });
97
120
  }
98
- exports.getProjects = getProjects;
99
121
  function importDefaultThemeToAngularWorkspace(workspace, key) {
100
122
  const igxPackage = (0, cli_core_1.resolvePackage)(cli_core_1.NPM_ANGULAR);
101
123
  const cssImport = `node_modules/${igxPackage}/styles/igniteui-angular.css`;