@igniteui/angular-schematics 17.0.1303 → 17.0.1314-beta.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 +3 -3
- package/src/SchematicsTemplateManager.js +1 -3
- package/src/migrations/interfaces/options.d.ts +4 -0
- package/src/migrations/interfaces/options.js +2 -0
- package/src/migrations/migration-collection.json +6 -0
- package/src/migrations/schema.json +14 -0
- package/src/migrations/update-1/index.d.ts +3 -0
- package/src/migrations/update-1/index.js +20 -0
- package/src/migrations/update-1/index.spec.d.ts +1 -0
- package/src/migrations/update-1/index.spec.js +73 -0
- package/src/ng-new/index.js +1 -1
- package/src/ng-new/index_spec.js +2 -2
- package/src/ng-new/schema.d.ts +1 -0
- package/src/ng-new/schema.json +6 -0
- package/src/prompt/SchematicsPromptSession.d.ts +1 -0
- package/src/prompt/SchematicsPromptSession.js +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igniteui/angular-schematics",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.1314-beta.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": "~14.0.0",
|
|
24
24
|
"@angular-devkit/schematics": "~14.0.0",
|
|
25
|
-
"@igniteui/angular-templates": "~17.0.
|
|
26
|
-
"@igniteui/cli-core": "~13.0
|
|
25
|
+
"@igniteui/angular-templates": "~17.0.1314-beta.0",
|
|
26
|
+
"@igniteui/cli-core": "~13.1.4-beta.0",
|
|
27
27
|
"@schematics/angular": "~14.0.0",
|
|
28
28
|
"rxjs": "^6.6.3"
|
|
29
29
|
},
|
|
@@ -10,9 +10,7 @@ class SchematicsTemplateManager extends cli_core_1.BaseTemplateManager {
|
|
|
10
10
|
this.frameworks.push({
|
|
11
11
|
id: "angular",
|
|
12
12
|
name: "angular",
|
|
13
|
-
projectLibraries:
|
|
14
|
-
require("@igniteui/angular-templates").default
|
|
15
|
-
]
|
|
13
|
+
projectLibraries: require("@igniteui/angular-templates").default
|
|
16
14
|
});
|
|
17
15
|
}
|
|
18
16
|
loadFromConfig(filePath) {
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "../../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
3
|
"schematics": {
|
|
4
|
+
"migration-01": {
|
|
5
|
+
"version": "17.1.0",
|
|
6
|
+
"description": "Updates Ignite UI for Angular Schematics project from 17.0.x to 17.1.x",
|
|
7
|
+
"factory": "./update-1",
|
|
8
|
+
"schema": "./schema.json"
|
|
9
|
+
}
|
|
4
10
|
}
|
|
5
11
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "igniteui-angular--schematics",
|
|
4
|
+
"title": "IgniteUI for Angular Schematics",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"applyMigrations": {
|
|
8
|
+
"type": "boolean",
|
|
9
|
+
"description": "We've updated our view templates to use Standalone Components. Those are compatible with your project and you can start using them now or remain with `NgModule` dependencies.",
|
|
10
|
+
"default": true,
|
|
11
|
+
"x-prompt": "Would you like to continue with Standalone Components for new views?"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function default_1(options) {
|
|
4
|
+
return (host, context) => {
|
|
5
|
+
var _a;
|
|
6
|
+
if (!options.applyMigrations) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
context.logger.info("We've updated your project type to `igx-ts-legacy` to continue using `NgModule`-s. You can always change back to `igx-ts` should you want to start using Standalone Components.");
|
|
10
|
+
const igConfig = "./ignite-ui-cli.json";
|
|
11
|
+
if (host.exists(igConfig)) {
|
|
12
|
+
const content = JSON.parse(host.read(igConfig).toString());
|
|
13
|
+
if (((_a = content === null || content === void 0 ? void 0 : content.project) === null || _a === void 0 ? void 0 : _a.projectType) === "igx-ts") {
|
|
14
|
+
content.project.projectType = "igx-ts-legacy";
|
|
15
|
+
host.overwrite(igConfig, JSON.stringify(content, null, 2));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
exports.default = default_1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const path = require("path");
|
|
13
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
15
|
+
describe("Update 17.1.0", () => {
|
|
16
|
+
let appTree;
|
|
17
|
+
const schematicRunner = new testing_1.SchematicTestRunner("ig-migrate", path.join(__dirname, "../migration-collection.json"));
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
appTree = new testing_1.UnitTestTree(new schematics_1.EmptyTree());
|
|
20
|
+
});
|
|
21
|
+
it("change projectType to legacy", (done) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
appTree.create("./ignite-ui-cli.json", `{
|
|
23
|
+
"igPackageRegistry": "https://packages.infragistics.com/npm/js-licensed/",
|
|
24
|
+
"customTemplates": [],
|
|
25
|
+
"skipGit": false,
|
|
26
|
+
"skipAnalytic": false,
|
|
27
|
+
"version": "13.0.1",
|
|
28
|
+
"project": {
|
|
29
|
+
"defaultPort": 4200,
|
|
30
|
+
"framework": "angular",
|
|
31
|
+
"projectType": "igx-ts",
|
|
32
|
+
"projectTemplate": "side-nav",
|
|
33
|
+
"theme": "Default",
|
|
34
|
+
"themePath": "node_modules/igniteui-angular/styles/igniteui-angular.css",
|
|
35
|
+
"isBundle": false,
|
|
36
|
+
"bundleFilePath": "",
|
|
37
|
+
"igniteuiSource": "",
|
|
38
|
+
"components": [],
|
|
39
|
+
"sourceFiles": [],
|
|
40
|
+
"isShowcase": false,
|
|
41
|
+
"version": ""
|
|
42
|
+
},
|
|
43
|
+
"build": {}
|
|
44
|
+
}
|
|
45
|
+
`);
|
|
46
|
+
const tree = yield schematicRunner.runSchematicAsync("migration-01", { applyMigrations: true }, appTree).toPromise();
|
|
47
|
+
expect(tree.readContent("./ignite-ui-cli.json"))
|
|
48
|
+
.toEqual(`{
|
|
49
|
+
"igPackageRegistry": "https://packages.infragistics.com/npm/js-licensed/",
|
|
50
|
+
"customTemplates": [],
|
|
51
|
+
"skipGit": false,
|
|
52
|
+
"skipAnalytic": false,
|
|
53
|
+
"version": "13.0.1",
|
|
54
|
+
"project": {
|
|
55
|
+
"defaultPort": 4200,
|
|
56
|
+
"framework": "angular",
|
|
57
|
+
"projectType": "igx-ts-legacy",
|
|
58
|
+
"projectTemplate": "side-nav",
|
|
59
|
+
"theme": "Default",
|
|
60
|
+
"themePath": "node_modules/igniteui-angular/styles/igniteui-angular.css",
|
|
61
|
+
"isBundle": false,
|
|
62
|
+
"bundleFilePath": "",
|
|
63
|
+
"igniteuiSource": "",
|
|
64
|
+
"components": [],
|
|
65
|
+
"sourceFiles": [],
|
|
66
|
+
"isShowcase": false,
|
|
67
|
+
"version": ""
|
|
68
|
+
},
|
|
69
|
+
"build": {}
|
|
70
|
+
}`);
|
|
71
|
+
done();
|
|
72
|
+
}));
|
|
73
|
+
});
|
package/src/ng-new/index.js
CHANGED
|
@@ -48,7 +48,7 @@ function newProject(options) {
|
|
|
48
48
|
throw new schematics_1.SchematicsException(`Folder "${options.name}" already exists!`);
|
|
49
49
|
}
|
|
50
50
|
const framework = templateManager.getFrameworkByName("angular");
|
|
51
|
-
projLibrary = yield prompt.
|
|
51
|
+
projLibrary = yield prompt.getProjectLibraryByType(framework, options.type);
|
|
52
52
|
if (!options.name || !prompt.nameIsValid(options.name)) {
|
|
53
53
|
options.name = yield prompt.getUserInput({
|
|
54
54
|
type: "input",
|
package/src/ng-new/index_spec.js
CHANGED
|
@@ -26,7 +26,7 @@ describe("Schematics ng-new", () => {
|
|
|
26
26
|
const mockSession = {
|
|
27
27
|
chooseActionLoop: spyOn(SchematicsPromptSession_1.SchematicsPromptSession.prototype, "chooseActionLoop")
|
|
28
28
|
.and.returnValue(Promise.resolve(true)),
|
|
29
|
-
|
|
29
|
+
getProjectLibraryByType: spyOn(SchematicsPromptSession_1.SchematicsPromptSession.prototype, "getProjectLibraryByType")
|
|
30
30
|
.and.returnValue((Promise.resolve(mockLibrary))),
|
|
31
31
|
getProjectTemplate: spyOn(SchematicsPromptSession_1.SchematicsPromptSession.prototype, "getProjectTemplate")
|
|
32
32
|
.and.returnValue(Promise.resolve(mockProject)),
|
|
@@ -100,7 +100,7 @@ describe("Schematics ng-new", () => {
|
|
|
100
100
|
themes: ["custom"]
|
|
101
101
|
};
|
|
102
102
|
const mockSession = {
|
|
103
|
-
|
|
103
|
+
getProjectLibraryByType: spyOn(SchematicsPromptSession_1.SchematicsPromptSession.prototype, "getProjectLibraryByType")
|
|
104
104
|
.and.returnValue((Promise.resolve(mockLibrary)))
|
|
105
105
|
};
|
|
106
106
|
const userAnswers = new Map();
|
package/src/ng-new/schema.d.ts
CHANGED
package/src/ng-new/schema.json
CHANGED
|
@@ -9,6 +9,7 @@ export declare class SchematicsPromptSession extends BasePromptSession {
|
|
|
9
9
|
setContext(context: SchematicContext, tree: Tree, projectName: string): void;
|
|
10
10
|
getUserInput(options: IUserInputOptions, withBackChoice?: boolean): Promise<string>;
|
|
11
11
|
getProjectLibrary(framework: Framework): Promise<ProjectLibrary>;
|
|
12
|
+
getProjectLibraryByType(framework: Framework, type: string): Promise<ProjectLibrary>;
|
|
12
13
|
getProjectTemplate(projectLibrary: ProjectLibrary): Promise<ProjectTemplate>;
|
|
13
14
|
getTheme(projectLibrary: ProjectLibrary): Promise<string>;
|
|
14
15
|
nameIsValid(name: string, checkFolder?: boolean): boolean;
|
|
@@ -39,6 +39,16 @@ class SchematicsPromptSession extends cli_core_1.BasePromptSession {
|
|
|
39
39
|
return _super.getProjectLibrary.call(this, framework);
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
+
getProjectLibraryByType(framework, type) {
|
|
43
|
+
const _super = Object.create(null, {
|
|
44
|
+
getProjectLibrary: { get: () => super.getProjectLibrary }
|
|
45
|
+
});
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
type = type === "igx-ts" || type === "igx-ts-legacy" ? type : "igx-ts";
|
|
48
|
+
framework.projectLibraries = [framework.projectLibraries.find(lib => lib.projectType === type)];
|
|
49
|
+
return _super.getProjectLibrary.call(this, framework);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
42
52
|
getProjectTemplate(projectLibrary) {
|
|
43
53
|
const _super = Object.create(null, {
|
|
44
54
|
getProjectTemplate: { get: () => super.getProjectTemplate }
|