@igniteui/angular-schematics 14.0.1003 → 14.0.1004-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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igniteui/angular-schematics",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.1004-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": "~14.0.
|
|
26
|
-
"@igniteui/cli-core": "~10.0.
|
|
25
|
+
"@igniteui/angular-templates": "~14.0.1004-beta.0",
|
|
26
|
+
"@igniteui/cli-core": "~10.0.4-beta.0",
|
|
27
27
|
"@schematics/angular": "~14.0.0",
|
|
28
28
|
"rxjs": "^6.6.3"
|
|
29
29
|
},
|
package/src/cli-config/index.js
CHANGED
|
@@ -63,13 +63,15 @@ function addTypographyToProj() {
|
|
|
63
63
|
}
|
|
64
64
|
function importBrowserAnimations() {
|
|
65
65
|
return (tree) => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
const projects = yield (0, theme_import_1.getProjects)(tree);
|
|
67
|
+
projects.forEach(project => {
|
|
68
|
+
const moduleFile = `${project.sourceRoot}/app/app.module.ts`;
|
|
69
|
+
if (tree.exists(moduleFile)) {
|
|
70
|
+
const mainModule = new cli_core_1.TypeScriptFileUpdate(moduleFile);
|
|
71
|
+
mainModule.addNgModuleMeta({ import: "BrowserAnimationsModule", from: "@angular/platform-browser/animations" });
|
|
72
|
+
mainModule.finalize();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
73
75
|
});
|
|
74
76
|
}
|
|
75
77
|
function importStyles() {
|
package/src/utils/cli-config.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.createCliConfig = void 0;
|
|
|
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");
|
|
16
|
+
const theme_import_1 = require("./theme-import");
|
|
16
17
|
function createCliConfig() {
|
|
17
18
|
return (tree, context) => __awaiter(this, void 0, void 0, function* () {
|
|
18
19
|
context.logger.info(``);
|
|
@@ -40,18 +41,16 @@ function GetCliConfig(tree) {
|
|
|
40
41
|
}
|
|
41
42
|
const cliConfig = require("../cli-config/files/ignite-ui-cli.json");
|
|
42
43
|
cliConfig.version = cli_core_1.Util.version();
|
|
43
|
-
const
|
|
44
|
+
const projects = yield (0, theme_import_1.getProjects)(tree);
|
|
45
|
+
const userPort = getPort(projects.values().next().value);
|
|
44
46
|
if (userPort) {
|
|
45
47
|
cliConfig.project.defaultPort = userPort;
|
|
46
48
|
}
|
|
47
49
|
return cliConfig;
|
|
48
50
|
});
|
|
49
51
|
}
|
|
50
|
-
function getPort(
|
|
52
|
+
function getPort(project) {
|
|
51
53
|
var _a;
|
|
52
|
-
const project = workspace.extensions.defaultProject ?
|
|
53
|
-
workspace.projects.get(workspace.extensions.defaultProject) :
|
|
54
|
-
workspace.projects.values().next().value;
|
|
55
54
|
const projectServe = (_a = project === null || project === void 0 ? void 0 : project.targets.get("serve")) === null || _a === void 0 ? void 0 : _a.options;
|
|
56
55
|
if (projectServe) {
|
|
57
56
|
return projectServe.port;
|
|
@@ -2,4 +2,4 @@ import { workspaces } from "@angular-devkit/core";
|
|
|
2
2
|
import { Tree } from "@angular-devkit/schematics/src/tree/interface";
|
|
3
3
|
export declare function importDefaultTheme(tree: Tree): Promise<void>;
|
|
4
4
|
export declare function addFontsToIndexHtml(tree: Tree): Promise<void>;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function getProjects(tree: Tree): Promise<workspaces.ProjectDefinitionCollection>;
|
|
@@ -9,48 +9,53 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.getProjects = exports.addFontsToIndexHtml = exports.importDefaultTheme = void 0;
|
|
13
13
|
const core_1 = require("@angular-devkit/core");
|
|
14
14
|
const angular_templates_1 = require("@igniteui/angular-templates");
|
|
15
15
|
const cli_core_1 = require("@igniteui/cli-core");
|
|
16
16
|
const path = require("path");
|
|
17
17
|
function importDefaultTheme(tree) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
const projects = yield getProjects(tree);
|
|
20
|
+
for (const project of projects.values()) {
|
|
21
|
+
const sourceRoot = project === null || project === void 0 ? void 0 : project.sourceRoot;
|
|
22
|
+
if (!sourceRoot) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
const pathWithoutExt = path.join(sourceRoot, "styles");
|
|
26
|
+
if (tree.exists(`${pathWithoutExt}.sass`)) {
|
|
27
|
+
importDefaultThemeSass(tree, `${pathWithoutExt}.sass`);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
else if (tree.exists(`${pathWithoutExt}.scss`)) {
|
|
31
|
+
importDefaultThemeSass(tree, `${pathWithoutExt}.scss`);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
yield importIgDefaultTheme(tree);
|
|
35
|
+
continue;
|
|
31
36
|
}
|
|
32
|
-
yield importIgDefaultTheme(tree);
|
|
33
|
-
return;
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
39
|
exports.importDefaultTheme = importDefaultTheme;
|
|
37
40
|
function addFontsToIndexHtml(tree) {
|
|
38
|
-
var _a, _b;
|
|
39
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
42
|
const titillium = '<link href="https://fonts.googleapis.com/css?family=Titillium+Web" rel="stylesheet">';
|
|
41
43
|
const materialIcons = '<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">';
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
content =
|
|
44
|
+
const projects = yield getProjects(tree);
|
|
45
|
+
projects.forEach(project => {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
const targetFile = (_b = (_a = project.targets.get("build")) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.index;
|
|
48
|
+
if (targetFile && tree.exists(targetFile)) {
|
|
49
|
+
let content = tree.read(targetFile).toString();
|
|
50
|
+
if (!content.includes(titillium)) {
|
|
51
|
+
content = content.replace("</head>", ` ${titillium}\n</head>`);
|
|
52
|
+
}
|
|
53
|
+
if (!content.includes(materialIcons)) {
|
|
54
|
+
content = content.replace("</head>", ` ${materialIcons}\n</head>`);
|
|
55
|
+
}
|
|
56
|
+
tree.overwrite(targetFile, content);
|
|
48
57
|
}
|
|
49
|
-
|
|
50
|
-
content = content.replace("</head>", ` ${materialIcons}\n</head>`);
|
|
51
|
-
}
|
|
52
|
-
tree.overwrite(targetFile, content);
|
|
53
|
-
}
|
|
58
|
+
});
|
|
54
59
|
});
|
|
55
60
|
}
|
|
56
61
|
exports.addFontsToIndexHtml = addFontsToIndexHtml;
|
|
@@ -85,16 +90,13 @@ function importIgDefaultTheme(tree) {
|
|
|
85
90
|
yield core_1.workspaces.writeWorkspace(workspace, host);
|
|
86
91
|
});
|
|
87
92
|
}
|
|
88
|
-
function
|
|
93
|
+
function getProjects(tree) {
|
|
89
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
95
|
const { workspace } = yield core_1.workspaces.readWorkspace("/", (0, cli_core_1.createWorkspaceHost)(tree));
|
|
91
|
-
|
|
92
|
-
workspace.projects.get(workspace.extensions.defaultProject) :
|
|
93
|
-
workspace.projects.values().next().value;
|
|
94
|
-
return project;
|
|
96
|
+
return workspace.projects;
|
|
95
97
|
});
|
|
96
98
|
}
|
|
97
|
-
exports.
|
|
99
|
+
exports.getProjects = getProjects;
|
|
98
100
|
function importDefaultThemeToAngularWorkspace(workspace, key) {
|
|
99
101
|
const igxPackage = (0, angular_templates_1.resolveIgxPackage)(angular_templates_1.NPM_PACKAGE);
|
|
100
102
|
const cssImport = `node_modules/${igxPackage}/styles/igniteui-angular.css`;
|