@igniteui/angular-templates 17.1.13111 → 17.1.13112-beta.2
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/IgniteUIForAngularTemplate.js +2 -3
- package/igx-ts/dock-manager/default/index.js +2 -2
- package/igx-ts/projects/_base/files/__dot__github/workflows/node.js.yml +2 -2
- package/igx-ts/projects/_base/index.d.ts +11 -0
- package/igx-ts/projects/_base/index.js +14 -2
- package/igx-ts-legacy/dock-manager/default/index.js +2 -2
- package/igx-ts-legacy/projects/_base/files/__dot__github/workflows/node.js.yml +2 -2
- package/igx-ts-legacy/projects/_base/index.d.ts +11 -0
- package/igx-ts-legacy/projects/_base/index.js +14 -2
- package/index.d.ts +0 -2
- package/index.js +0 -2
- package/package.json +2 -2
- package/Update.d.ts +0 -1
- package/Update.js +0 -131
- package/Update.spec.d.ts +0 -1
- package/Update.spec.js +0 -194
- package/package-resolve.d.ts +0 -15
- package/package-resolve.js +0 -45
- package/package-resolve.spec.d.ts +0 -1
- package/package-resolve.spec.js +0 -103
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.IgniteUIForAngularTemplate = void 0;
|
|
4
4
|
const cli_core_1 = require("@igniteui/cli-core");
|
|
5
5
|
const path = require("path");
|
|
6
|
-
const package_resolve_1 = require("./package-resolve");
|
|
7
6
|
class IgniteUIForAngularTemplate {
|
|
8
7
|
constructor(rootPath) {
|
|
9
8
|
this.rootPath = rootPath;
|
|
@@ -122,8 +121,8 @@ class IgniteUIForAngularTemplate {
|
|
|
122
121
|
config["description"] = this.description;
|
|
123
122
|
config["cliVersion"] = cli_core_1.Util.version();
|
|
124
123
|
config["camelCaseName"] = cli_core_1.Util.camelCase(name);
|
|
125
|
-
config["igxPackage"] = (0,
|
|
126
|
-
config["dockManagerPackage"] = (0,
|
|
124
|
+
config["igxPackage"] = (0, cli_core_1.resolvePackage)(cli_core_1.NPM_ANGULAR);
|
|
125
|
+
config["dockManagerPackage"] = (0, cli_core_1.resolvePackage)(cli_core_1.NPM_DOCK_MANAGER);
|
|
127
126
|
/** 'nameMerged' is never used igx templates, removed */
|
|
128
127
|
return config;
|
|
129
128
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_core_1 = require("@igniteui/cli-core");
|
|
3
4
|
const IgniteUIForAngularTemplate_1 = require("../../../IgniteUIForAngularTemplate");
|
|
4
|
-
const package_resolve_1 = require("../../../package-resolve");
|
|
5
5
|
class IgcDockManagerTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAngularTemplate {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(__dirname);
|
|
@@ -13,7 +13,7 @@ class IgcDockManagerTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
|
|
|
13
13
|
this.name = "Dock Manager";
|
|
14
14
|
this.description = "basic IgcDockManager";
|
|
15
15
|
// "igniteui-dockmanager@~1.0.0":
|
|
16
|
-
this.packages = [`${(0,
|
|
16
|
+
this.packages = [`${(0, cli_core_1.resolvePackage)(cli_core_1.NPM_DOCK_MANAGER)}@~1.8.0`];
|
|
17
17
|
}
|
|
18
18
|
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
19
19
|
// not applicable with custom module
|
|
@@ -27,4 +27,15 @@ export declare class BaseIgxProject implements ProjectTemplate {
|
|
|
27
27
|
generateConfig(name: string, theme: string, ...options: any[]): {
|
|
28
28
|
[key: string]: any;
|
|
29
29
|
};
|
|
30
|
+
protected getVariablesConfig(name: string, theme: string): {
|
|
31
|
+
name: string;
|
|
32
|
+
theme: string;
|
|
33
|
+
cliVersion: string;
|
|
34
|
+
"dash-name": string;
|
|
35
|
+
description: string;
|
|
36
|
+
dot: string;
|
|
37
|
+
path: string;
|
|
38
|
+
projectTemplate: string;
|
|
39
|
+
yamlDefaultBranch: string;
|
|
40
|
+
};
|
|
30
41
|
}
|
|
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.BaseIgxProject = void 0;
|
|
13
13
|
const cli_core_1 = require("@igniteui/cli-core");
|
|
14
14
|
const path = require("path");
|
|
15
|
-
const Update_1 = require(".././../../Update");
|
|
16
15
|
class BaseIgxProject {
|
|
17
16
|
constructor() {
|
|
18
17
|
this.id = "base";
|
|
@@ -58,7 +57,7 @@ $app-palette: palette($primary, $secondary, $surface);
|
|
|
58
57
|
}
|
|
59
58
|
upgradeIgniteUIPackages(projectPath, packagePath) {
|
|
60
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
return (0,
|
|
60
|
+
return (0, cli_core_1.updateWorkspace)(projectPath);
|
|
62
61
|
});
|
|
63
62
|
}
|
|
64
63
|
getExtraConfiguration() {
|
|
@@ -91,5 +90,18 @@ $app-palette: palette($primary, $secondary, $surface);
|
|
|
91
90
|
}
|
|
92
91
|
return config;
|
|
93
92
|
}
|
|
93
|
+
getVariablesConfig(name, theme) {
|
|
94
|
+
return {
|
|
95
|
+
name,
|
|
96
|
+
theme,
|
|
97
|
+
"cliVersion": cli_core_1.Util.version(),
|
|
98
|
+
"dash-name": cli_core_1.Util.lowerDashed(name),
|
|
99
|
+
"description": this.description,
|
|
100
|
+
"dot": ".",
|
|
101
|
+
"path": name,
|
|
102
|
+
"projectTemplate": this.id,
|
|
103
|
+
"yamlDefaultBranch": this.id === "base" ? "<%=yaml-default-branch%>" : "main"
|
|
104
|
+
};
|
|
105
|
+
}
|
|
94
106
|
}
|
|
95
107
|
exports.BaseIgxProject = BaseIgxProject;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_core_1 = require("@igniteui/cli-core");
|
|
3
4
|
const IgniteUIForAngularTemplate_1 = require("../../../IgniteUIForAngularTemplate");
|
|
4
|
-
const package_resolve_1 = require("../../../package-resolve");
|
|
5
5
|
class IgcDockManagerTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAngularTemplate {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(__dirname);
|
|
@@ -16,7 +16,7 @@ class IgcDockManagerTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
|
|
|
16
16
|
{ import: "<%=ClassName%>Module", from: "./src/app/<%=path%>/<%=filePrefix%>.module.ts" }
|
|
17
17
|
];
|
|
18
18
|
// "igniteui-dockmanager@~1.0.0":
|
|
19
|
-
this.packages = [`${(0,
|
|
19
|
+
this.packages = [`${(0, cli_core_1.resolvePackage)(cli_core_1.NPM_DOCK_MANAGER)}@~1.8.0`];
|
|
20
20
|
}
|
|
21
21
|
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
22
22
|
// not applicable with custom module
|
|
@@ -27,4 +27,15 @@ export declare class BaseIgxProject implements ProjectTemplate {
|
|
|
27
27
|
generateConfig(name: string, theme: string, ...options: any[]): {
|
|
28
28
|
[key: string]: any;
|
|
29
29
|
};
|
|
30
|
+
protected getVariablesConfig(name: string, theme: string): {
|
|
31
|
+
name: string;
|
|
32
|
+
theme: string;
|
|
33
|
+
cliVersion: string;
|
|
34
|
+
"dash-name": string;
|
|
35
|
+
description: string;
|
|
36
|
+
dot: string;
|
|
37
|
+
path: string;
|
|
38
|
+
projectTemplate: string;
|
|
39
|
+
yamlDefaultBranch: string;
|
|
40
|
+
};
|
|
30
41
|
}
|
|
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.BaseIgxProject = void 0;
|
|
13
13
|
const cli_core_1 = require("@igniteui/cli-core");
|
|
14
14
|
const path = require("path");
|
|
15
|
-
const Update_1 = require("../../../Update");
|
|
16
15
|
class BaseIgxProject {
|
|
17
16
|
constructor() {
|
|
18
17
|
this.id = "base";
|
|
@@ -58,7 +57,7 @@ $app-palette: palette($primary, $secondary, $surface);
|
|
|
58
57
|
}
|
|
59
58
|
upgradeIgniteUIPackages(projectPath, packagePath) {
|
|
60
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
return (0,
|
|
60
|
+
return (0, cli_core_1.updateWorkspace)(projectPath);
|
|
62
61
|
});
|
|
63
62
|
}
|
|
64
63
|
getExtraConfiguration() {
|
|
@@ -91,5 +90,18 @@ $app-palette: palette($primary, $secondary, $surface);
|
|
|
91
90
|
}
|
|
92
91
|
return config;
|
|
93
92
|
}
|
|
93
|
+
getVariablesConfig(name, theme) {
|
|
94
|
+
return {
|
|
95
|
+
name,
|
|
96
|
+
theme,
|
|
97
|
+
"cliVersion": cli_core_1.Util.version(),
|
|
98
|
+
"dash-name": cli_core_1.Util.lowerDashed(name),
|
|
99
|
+
"description": this.description,
|
|
100
|
+
"dot": ".",
|
|
101
|
+
"path": name,
|
|
102
|
+
"projectTemplate": this.id,
|
|
103
|
+
"yamlDefaultBranch": this.id === "base" ? "<%=yaml-default-branch%>" : "main"
|
|
104
|
+
};
|
|
105
|
+
}
|
|
94
106
|
}
|
|
95
107
|
exports.BaseIgxProject = BaseIgxProject;
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -12,7 +12,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
const standalone = require("./igx-ts");
|
|
14
14
|
const legacy = require("./igx-ts-legacy");
|
|
15
|
-
__exportStar(require("./package-resolve"), exports);
|
|
16
15
|
__exportStar(require("./IgniteUIForAngularTemplate"), exports);
|
|
17
|
-
__exportStar(require("./Update"), exports);
|
|
18
16
|
exports.default = [standalone, legacy];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igniteui/angular-templates",
|
|
3
|
-
"version": "17.1.
|
|
3
|
+
"version": "17.1.13112-beta.2",
|
|
4
4
|
"description": "Templates for Ignite UI for Angular projects and components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"author": "Infragistics",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@igniteui/cli-core": "
|
|
15
|
+
"@igniteui/cli-core": "^13.1.12-beta.2",
|
|
16
16
|
"typescript": "~4.7.2"
|
|
17
17
|
}
|
|
18
18
|
}
|
package/Update.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function updateWorkspace(rootPath: string): Promise<boolean>;
|
package/Update.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
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
|
-
exports.updateWorkspace = void 0;
|
|
13
|
-
const cli_core_1 = require("@igniteui/cli-core");
|
|
14
|
-
const path = require("path");
|
|
15
|
-
const package_resolve_1 = require("./package-resolve");
|
|
16
|
-
const styleExtension = ["css", "scss", "sass"];
|
|
17
|
-
var RegularExpressionType;
|
|
18
|
-
(function (RegularExpressionType) {
|
|
19
|
-
RegularExpressionType[RegularExpressionType["STYLE"] = 0] = "STYLE";
|
|
20
|
-
RegularExpressionType[RegularExpressionType["LOGIC"] = 1] = "LOGIC";
|
|
21
|
-
})(RegularExpressionType || (RegularExpressionType = {}));
|
|
22
|
-
function createExpression(expressionType, packageName) {
|
|
23
|
-
if (expressionType === RegularExpressionType.LOGIC) {
|
|
24
|
-
return String.raw `(from ["'])${packageName}(?<submodules>\/.*?)?(["'])`;
|
|
25
|
-
}
|
|
26
|
-
else if (expressionType === RegularExpressionType.STYLE) {
|
|
27
|
-
return String.raw `(node_modules\/|[~"'])${packageName}(\/)`;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function updateWorkspace(rootPath) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const fs = cli_core_1.App.container.get(cli_core_1.FS_TOKEN);
|
|
33
|
-
const upgradeable = (0, package_resolve_1.getUpgradeablePackages)();
|
|
34
|
-
if (!upgradeable.length) {
|
|
35
|
-
cli_core_1.Util.log("Your app is already using packages from the Infragistics registry. You are good to go.", "green");
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
const packageJsonPath = path.join(rootPath, "package.json");
|
|
39
|
-
const fileString = fs.readFile(packageJsonPath);
|
|
40
|
-
// check for registry user in npm
|
|
41
|
-
const config = cli_core_1.ProjectConfig.getConfig();
|
|
42
|
-
if (!fileString) {
|
|
43
|
-
cli_core_1.Util.log("Package.json not found!");
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
const pkgJSON = JSON.parse(fileString);
|
|
47
|
-
const errorMsg = "Something went wrong, " +
|
|
48
|
-
"please follow the steps in this guide: https://www.infragistics.com/products/ignite-ui-angular/angular/components/general/ignite-ui-licensing";
|
|
49
|
-
if (!cli_core_1.PackageManager.ensureRegistryUser(config, errorMsg)) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
// get all workspace roots
|
|
53
|
-
const workspaces = [];
|
|
54
|
-
let workspaceConfig = null;
|
|
55
|
-
const workspacePath = path.join(rootPath, "angular.json");
|
|
56
|
-
if (fs.fileExists(workspacePath)) {
|
|
57
|
-
workspaceConfig = JSON.parse(fs.readFile(workspacePath));
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
cli_core_1.Util.log("No angular.json file found! Aborting.");
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
for (const entry of Object.keys(workspaceConfig.projects)) {
|
|
64
|
-
if (workspaceConfig.projects[entry].sourceRoot) {
|
|
65
|
-
// ignore projects without sourceRoot (likely older e2e proj)
|
|
66
|
-
workspaces.push(path.join(rootPath, workspaceConfig.projects[entry].sourceRoot));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
// once all workspace are gotten, get all files for all workspaces
|
|
70
|
-
const logicFiles = [];
|
|
71
|
-
const styleFiles = [];
|
|
72
|
-
for (const workspace of workspaces) {
|
|
73
|
-
logicFiles.push(...fs.glob(workspace, "**/*.ts"));
|
|
74
|
-
for (const extension of styleExtension) {
|
|
75
|
-
styleFiles.push(...fs.glob(workspace, `**/*.${extension}`));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
styleFiles.push(workspacePath);
|
|
79
|
-
for (const packageDef of upgradeable) {
|
|
80
|
-
updatePackageJSON(packageDef.trial, packageDef.licensed, pkgJSON);
|
|
81
|
-
}
|
|
82
|
-
fs.writeFile(packageJsonPath, cli_core_1.Util.formatPackageJson(pkgJSON));
|
|
83
|
-
updateFileImports(logicFiles, styleFiles, upgradeable, fs);
|
|
84
|
-
return true;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
exports.updateWorkspace = updateWorkspace;
|
|
88
|
-
function updateFileContent(fileContent, regexString, replaceWith) {
|
|
89
|
-
const match = fileContent.match(new RegExp(regexString));
|
|
90
|
-
if (match) {
|
|
91
|
-
fileContent = fileContent.replace(new RegExp(regexString, "g"), `$1${replaceWith}$2${match.length === 4 ? "$3" : ""}`);
|
|
92
|
-
}
|
|
93
|
-
return fileContent;
|
|
94
|
-
}
|
|
95
|
-
function updateFileImports(logicFiles, styleFiles, packageDefs, fs) {
|
|
96
|
-
for (const file of logicFiles) {
|
|
97
|
-
let fileContent = fs.readFile(file);
|
|
98
|
-
let fileChange = false;
|
|
99
|
-
for (const packageDef of packageDefs) {
|
|
100
|
-
if (fileContent.includes(packageDef.trial)) {
|
|
101
|
-
const newContent = updateFileContent(fileContent, createExpression(RegularExpressionType.LOGIC, packageDef.trial), packageDef.licensed);
|
|
102
|
-
fileChange = fileContent !== newContent;
|
|
103
|
-
fileContent = newContent;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (fileChange) {
|
|
107
|
-
fs.writeFile(file, fileContent);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
for (const file of styleFiles) {
|
|
111
|
-
let fileContent = fs.readFile(file);
|
|
112
|
-
let fileChange = false;
|
|
113
|
-
for (const packageDef of packageDefs) {
|
|
114
|
-
if (fileContent.includes(packageDef.trial)) {
|
|
115
|
-
const newContent = updateFileContent(fileContent, createExpression(RegularExpressionType.STYLE, packageDef.trial), packageDef.licensed);
|
|
116
|
-
fileChange = fileContent !== newContent;
|
|
117
|
-
fileContent = newContent;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (fileChange) {
|
|
121
|
-
fs.writeFile(file, fileContent);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function updatePackageJSON(initName, replaceWith, pkgJSON) {
|
|
126
|
-
if (!pkgJSON.dependencies.hasOwnProperty(initName)) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
pkgJSON.dependencies[replaceWith] = pkgJSON.dependencies[initName];
|
|
130
|
-
delete pkgJSON.dependencies[initName];
|
|
131
|
-
}
|
package/Update.spec.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/Update.spec.js
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
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 cli_core_1 = require("@igniteui/cli-core");
|
|
13
|
-
const pkgResolve = require("./package-resolve");
|
|
14
|
-
const Update_1 = require("./Update");
|
|
15
|
-
// tslint:disable: object-literal-sort-keys
|
|
16
|
-
describe("Igx templates - updateWorkspace", () => {
|
|
17
|
-
let fsSpy;
|
|
18
|
-
beforeAll(() => {
|
|
19
|
-
fsSpy = jasmine.createSpyObj("fsSpy", ["fileExists", "directoryExists", "readFile", "writeFile", "glob"]);
|
|
20
|
-
spyOn(cli_core_1.App.container, "get").and.returnValue(fsSpy);
|
|
21
|
-
spyOnProperty(cli_core_1.App, "workDir", "get").and.returnValue("mockDir");
|
|
22
|
-
spyOn(cli_core_1.ProjectConfig, "getConfig").and.returnValue({});
|
|
23
|
-
});
|
|
24
|
-
it("Should fail if current used package is registry package", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
spyOn(pkgResolve, "getUpgradeablePackages").and.returnValue([]);
|
|
26
|
-
spyOn(cli_core_1.Util, "log");
|
|
27
|
-
expect(yield (0, Update_1.updateWorkspace)("")).toEqual(false);
|
|
28
|
-
expect(cli_core_1.Util.log).toHaveBeenCalledWith("Your app is already using packages from the Infragistics registry. You are good to go.", "green");
|
|
29
|
-
}));
|
|
30
|
-
it("Should fail if no packages.json is found", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
-
const upgradable = {
|
|
32
|
-
trial: pkgResolve.NPM_PACKAGE,
|
|
33
|
-
licensed: pkgResolve.FEED_PACKAGE
|
|
34
|
-
};
|
|
35
|
-
spyOn(pkgResolve, "getUpgradeablePackages").and.returnValue([upgradable]);
|
|
36
|
-
fsSpy.directoryExists.and.returnValue(false);
|
|
37
|
-
fsSpy.readFile.and.returnValue("");
|
|
38
|
-
spyOn(cli_core_1.Util, "log");
|
|
39
|
-
expect(yield (0, Update_1.updateWorkspace)("")).toEqual(false);
|
|
40
|
-
expect(cli_core_1.Util.log).toHaveBeenCalledWith("Package.json not found!");
|
|
41
|
-
}));
|
|
42
|
-
it("Should fail if infragistics registry cannot be reached", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
-
const mockJSONInput = {
|
|
44
|
-
someName: "testValue"
|
|
45
|
-
};
|
|
46
|
-
const upgradable = {
|
|
47
|
-
trial: pkgResolve.NPM_PACKAGE,
|
|
48
|
-
licensed: pkgResolve.FEED_PACKAGE
|
|
49
|
-
};
|
|
50
|
-
spyOn(pkgResolve, "getUpgradeablePackages").and.returnValue([upgradable]);
|
|
51
|
-
fsSpy.directoryExists.and.returnValue(false);
|
|
52
|
-
fsSpy.readFile.and.returnValue(JSON.stringify(mockJSONInput, null, 4));
|
|
53
|
-
spyOn(cli_core_1.PackageManager, "ensureRegistryUser").and.returnValue(false);
|
|
54
|
-
expect(yield (0, Update_1.updateWorkspace)("")).toEqual(false);
|
|
55
|
-
}));
|
|
56
|
-
it("Should update package.json file, removing non-scoped igniteui-angular packages", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
-
const mockPackageJSON = {
|
|
58
|
-
dependencies: {
|
|
59
|
-
"@alphabetically-sorted-scope/package": "^0.0.0",
|
|
60
|
-
"alphabetically-second-package": "^0.0.0",
|
|
61
|
-
"igniteui-angular": "^9.1.0",
|
|
62
|
-
"igniteui-dockmanager": "^1.0.0",
|
|
63
|
-
"some-package": "^0.0.0"
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
fsSpy.fileExists.and.returnValue(true);
|
|
67
|
-
fsSpy.readFile.and.callFake((filePath) => {
|
|
68
|
-
if (filePath.indexOf("package.json") > -1) {
|
|
69
|
-
return JSON.stringify(mockPackageJSON);
|
|
70
|
-
}
|
|
71
|
-
if (filePath.indexOf("angular.json") > -1) {
|
|
72
|
-
return JSON.stringify({
|
|
73
|
-
projects: {}
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
spyOn(cli_core_1.PackageManager, "ensureRegistryUser").and.returnValue(true);
|
|
78
|
-
spyOn(cli_core_1.Util, "log");
|
|
79
|
-
expect(yield (0, Update_1.updateWorkspace)("")).toEqual(true);
|
|
80
|
-
expect(fsSpy.writeFile).toHaveBeenCalledWith("package.json", cli_core_1.Util.formatPackageJson({
|
|
81
|
-
dependencies: {
|
|
82
|
-
"@alphabetically-sorted-scope/package": "^0.0.0",
|
|
83
|
-
"@infragistics/igniteui-angular": "^9.1.0",
|
|
84
|
-
"@infragistics/igniteui-dockmanager": "^1.0.0",
|
|
85
|
-
"alphabetically-second-package": "^0.0.0",
|
|
86
|
-
"some-package": "^0.0.0"
|
|
87
|
-
}
|
|
88
|
-
}));
|
|
89
|
-
expect(fsSpy.writeFile).toHaveBeenCalledTimes(1);
|
|
90
|
-
}));
|
|
91
|
-
it("Should update import paths in files correctly", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
92
|
-
const mockPackageJSON = {
|
|
93
|
-
dependencies: {
|
|
94
|
-
"some-package": "^0.0.0",
|
|
95
|
-
"igniteui-angular": "^9.1.0",
|
|
96
|
-
"igniteui-dockmanager": "^1.0.0"
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const mockFileArray = [{
|
|
100
|
-
path: "src/home.component.ts",
|
|
101
|
-
content: `import { something } from 'module';
|
|
102
|
-
import { bait } from 'igniteui-angular-core';
|
|
103
|
-
import { IgxGridComponent } from 'igniteui-angular';
|
|
104
|
-
import { IgcDockManager } from 'igniteui-dockmanager';
|
|
105
|
-
|
|
106
|
-
export class HomeComponent {
|
|
107
|
-
title = 'igniteui-angular example';
|
|
108
|
-
}`,
|
|
109
|
-
expected: `import { something } from 'module';
|
|
110
|
-
import { bait } from 'igniteui-angular-core';
|
|
111
|
-
import { IgxGridComponent } from '@infragistics/igniteui-angular';
|
|
112
|
-
import { IgcDockManager } from '@infragistics/igniteui-dockmanager';
|
|
113
|
-
|
|
114
|
-
export class HomeComponent {
|
|
115
|
-
title = 'igniteui-angular example';
|
|
116
|
-
}`
|
|
117
|
-
}, {
|
|
118
|
-
path: "src/home.component.scss",
|
|
119
|
-
content: `@use 'igniteui-angular/theming' as *;
|
|
120
|
-
@use 'igniteui-dockmanager/styles/themes/test' as *;
|
|
121
|
-
@include igx-core();
|
|
122
|
-
`,
|
|
123
|
-
expected: `@use '@infragistics/igniteui-angular/theming' as *;
|
|
124
|
-
@use '@infragistics/igniteui-dockmanager/styles/themes/test' as *;
|
|
125
|
-
@include igx-core();
|
|
126
|
-
`
|
|
127
|
-
}, {
|
|
128
|
-
path: "angular.json",
|
|
129
|
-
content: `{
|
|
130
|
-
"projects": {
|
|
131
|
-
"test": {
|
|
132
|
-
"projectType": "application",
|
|
133
|
-
"sourceRoot": "src",
|
|
134
|
-
"root": "",
|
|
135
|
-
"styles": [
|
|
136
|
-
"src/styles.scss",
|
|
137
|
-
"node_modules/igniteui-angular/styles/igniteui-angular.css",
|
|
138
|
-
"node_modules/igniteui-dockmanager/styles/themes/test"
|
|
139
|
-
]
|
|
140
|
-
},
|
|
141
|
-
"test-e2e": {}
|
|
142
|
-
}
|
|
143
|
-
}`,
|
|
144
|
-
expected: `{
|
|
145
|
-
"projects": {
|
|
146
|
-
"test": {
|
|
147
|
-
"projectType": "application",
|
|
148
|
-
"sourceRoot": "src",
|
|
149
|
-
"root": "",
|
|
150
|
-
"styles": [
|
|
151
|
-
"src/styles.scss",
|
|
152
|
-
"node_modules/@infragistics/igniteui-angular/styles/igniteui-angular.css",
|
|
153
|
-
"node_modules/@infragistics/igniteui-dockmanager/styles/themes/test"
|
|
154
|
-
]
|
|
155
|
-
},
|
|
156
|
-
"test-e2e": {}
|
|
157
|
-
}
|
|
158
|
-
}`
|
|
159
|
-
}, {
|
|
160
|
-
path: "src/app.module.ts",
|
|
161
|
-
content: `import { something } from 'module';
|
|
162
|
-
import { bait } from 'igniteui-angular-core';
|
|
163
|
-
import { IgxGridComponent } from 'igniteui-angular';
|
|
164
|
-
import { dockManagerLoader } from 'igniteui-dockmanager/loader';
|
|
165
|
-
|
|
166
|
-
export class HomeComponent {
|
|
167
|
-
title = 'igniteui-angular example';
|
|
168
|
-
}`,
|
|
169
|
-
expected: `import { something } from 'module';
|
|
170
|
-
import { bait } from 'igniteui-angular-core';
|
|
171
|
-
import { IgxGridComponent } from '@infragistics/igniteui-angular';
|
|
172
|
-
import { dockManagerLoader } from '@infragistics/igniteui-dockmanager/loader';
|
|
173
|
-
|
|
174
|
-
export class HomeComponent {
|
|
175
|
-
title = 'igniteui-angular example';
|
|
176
|
-
}`
|
|
177
|
-
}];
|
|
178
|
-
fsSpy.glob.and.returnValues(["src/home.component.ts", "src/app.module.ts"], ["src/home.component.scss"], [], []);
|
|
179
|
-
fsSpy.readFile.and.callFake((filePath) => {
|
|
180
|
-
if (filePath.indexOf("package.json") > -1) {
|
|
181
|
-
return JSON.stringify(mockPackageJSON);
|
|
182
|
-
}
|
|
183
|
-
const fileEntry = mockFileArray.find(entry => entry.path === filePath);
|
|
184
|
-
return fileEntry.content;
|
|
185
|
-
});
|
|
186
|
-
fsSpy.fileExists.and.returnValue(true);
|
|
187
|
-
spyOn(cli_core_1.PackageManager, "ensureRegistryUser").and.returnValue(true);
|
|
188
|
-
expect(yield (0, Update_1.updateWorkspace)("")).toEqual(true);
|
|
189
|
-
for (const fileEntry of mockFileArray) {
|
|
190
|
-
expect(fsSpy.writeFile).toHaveBeenCalledWith(fileEntry.path, fileEntry.expected);
|
|
191
|
-
}
|
|
192
|
-
expect(fsSpy.glob).toHaveBeenCalledTimes(4);
|
|
193
|
-
}));
|
|
194
|
-
});
|
package/package-resolve.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const NPM_PACKAGE = "igniteui-angular";
|
|
2
|
-
export declare const FEED_PACKAGE = "@infragistics/igniteui-angular";
|
|
3
|
-
export declare const NPM_DOCK_MANAGER = "igniteui-dockmanager";
|
|
4
|
-
export declare const FEED_DOCK_MANAGER = "@infragistics/igniteui-dockmanager";
|
|
5
|
-
export interface PackageDefinition {
|
|
6
|
-
trial: string;
|
|
7
|
-
licensed: string;
|
|
8
|
-
}
|
|
9
|
-
/** packages map of `trial: licensed` names */
|
|
10
|
-
export declare const UPGRADEABLE_PACKAGES: {
|
|
11
|
-
"igniteui-angular": string;
|
|
12
|
-
"igniteui-dockmanager": string;
|
|
13
|
-
};
|
|
14
|
-
export declare function resolveIgxPackage(packageName: keyof typeof UPGRADEABLE_PACKAGES): string;
|
|
15
|
-
export declare function getUpgradeablePackages(): PackageDefinition[];
|
package/package-resolve.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUpgradeablePackages = exports.resolveIgxPackage = exports.UPGRADEABLE_PACKAGES = exports.FEED_DOCK_MANAGER = exports.NPM_DOCK_MANAGER = exports.FEED_PACKAGE = exports.NPM_PACKAGE = void 0;
|
|
4
|
-
const cli_core_1 = require("@igniteui/cli-core");
|
|
5
|
-
exports.NPM_PACKAGE = "igniteui-angular";
|
|
6
|
-
exports.FEED_PACKAGE = "@infragistics/igniteui-angular";
|
|
7
|
-
exports.NPM_DOCK_MANAGER = "igniteui-dockmanager";
|
|
8
|
-
exports.FEED_DOCK_MANAGER = "@infragistics/igniteui-dockmanager";
|
|
9
|
-
/** packages map of `trial: licensed` names */
|
|
10
|
-
exports.UPGRADEABLE_PACKAGES = {
|
|
11
|
-
[exports.NPM_PACKAGE]: exports.FEED_PACKAGE,
|
|
12
|
-
[exports.NPM_DOCK_MANAGER]: exports.FEED_DOCK_MANAGER
|
|
13
|
-
};
|
|
14
|
-
function resolveIgxPackage(packageName) {
|
|
15
|
-
const fs = cli_core_1.App.container.get(cli_core_1.FS_TOKEN);
|
|
16
|
-
// read project package JSON
|
|
17
|
-
if (fs.fileExists("./package.json")) {
|
|
18
|
-
const packageJson = JSON.parse(fs.readFile("./package.json"));
|
|
19
|
-
const dependencies = packageJson["dependencies"];
|
|
20
|
-
const licensed = exports.UPGRADEABLE_PACKAGES[packageName];
|
|
21
|
-
if (dependencies[licensed]) {
|
|
22
|
-
return licensed;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return packageName;
|
|
26
|
-
}
|
|
27
|
-
exports.resolveIgxPackage = resolveIgxPackage;
|
|
28
|
-
function getUpgradeablePackages() {
|
|
29
|
-
const fs = cli_core_1.App.container.get(cli_core_1.FS_TOKEN);
|
|
30
|
-
const upgradeable = [];
|
|
31
|
-
if (fs.fileExists("./package.json")) {
|
|
32
|
-
const packageJson = JSON.parse(fs.readFile("./package.json"));
|
|
33
|
-
const dependencies = packageJson["dependencies"];
|
|
34
|
-
for (const packageEntry in exports.UPGRADEABLE_PACKAGES) {
|
|
35
|
-
if (dependencies[packageEntry]) {
|
|
36
|
-
upgradeable.push({
|
|
37
|
-
trial: packageEntry,
|
|
38
|
-
licensed: exports.UPGRADEABLE_PACKAGES[packageEntry]
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return upgradeable;
|
|
44
|
-
}
|
|
45
|
-
exports.getUpgradeablePackages = getUpgradeablePackages;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/package-resolve.spec.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cli_core_1 = require("@igniteui/cli-core");
|
|
4
|
-
const package_resolve_1 = require("./package-resolve");
|
|
5
|
-
class MockFileSystem {
|
|
6
|
-
fileExists(filePath) {
|
|
7
|
-
throw new Error("Method not implemented.");
|
|
8
|
-
}
|
|
9
|
-
readFile(filePath, encoding) {
|
|
10
|
-
throw new Error("Method not implemented.");
|
|
11
|
-
}
|
|
12
|
-
writeFile(filePath, text) {
|
|
13
|
-
throw new Error("Method not implemented.");
|
|
14
|
-
}
|
|
15
|
-
directoryExists(dirPath) {
|
|
16
|
-
throw new Error("Method not implemented.");
|
|
17
|
-
}
|
|
18
|
-
glob(dirPath, pattern) {
|
|
19
|
-
throw new Error("Method not implemented.");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
describe("Igx templates - package resolve", () => {
|
|
23
|
-
describe("resolveIgxPackage", () => {
|
|
24
|
-
it("should return npm package as fallback", () => {
|
|
25
|
-
const mockFs = new MockFileSystem();
|
|
26
|
-
spyOn(mockFs, "fileExists").and.returnValue(false);
|
|
27
|
-
cli_core_1.App.container.set(cli_core_1.FS_TOKEN, mockFs);
|
|
28
|
-
const result = (0, package_resolve_1.resolveIgxPackage)(package_resolve_1.NPM_PACKAGE);
|
|
29
|
-
expect(result).toEqual(package_resolve_1.NPM_PACKAGE);
|
|
30
|
-
expect(mockFs.fileExists).toHaveBeenCalledWith("./package.json");
|
|
31
|
-
});
|
|
32
|
-
it("should return npm package if feed package in not in project", () => {
|
|
33
|
-
const mockFs = new MockFileSystem();
|
|
34
|
-
spyOn(mockFs, "fileExists").and.returnValue(true);
|
|
35
|
-
const readSpy = spyOn(mockFs, "readFile").and.returnValue(`{ "dependencies": { "${package_resolve_1.NPM_PACKAGE}": "*" } }`);
|
|
36
|
-
cli_core_1.App.container.set(cli_core_1.FS_TOKEN, mockFs);
|
|
37
|
-
let result = (0, package_resolve_1.resolveIgxPackage)(package_resolve_1.NPM_PACKAGE);
|
|
38
|
-
expect(result).toEqual(package_resolve_1.NPM_PACKAGE);
|
|
39
|
-
expect(mockFs.fileExists).toHaveBeenCalledWith("./package.json");
|
|
40
|
-
expect(mockFs.readFile).toHaveBeenCalledWith("./package.json");
|
|
41
|
-
readSpy.and.returnValue(`{ "dependencies": { "${package_resolve_1.NPM_DOCK_MANAGER}": "*" } }`);
|
|
42
|
-
result = (0, package_resolve_1.resolveIgxPackage)(package_resolve_1.NPM_DOCK_MANAGER);
|
|
43
|
-
expect(result).toEqual(package_resolve_1.NPM_DOCK_MANAGER);
|
|
44
|
-
});
|
|
45
|
-
it("should return feed package if installed in project", () => {
|
|
46
|
-
const mockFs = new MockFileSystem();
|
|
47
|
-
spyOn(mockFs, "fileExists").and.returnValue(true);
|
|
48
|
-
const readSpy = spyOn(mockFs, "readFile").and.returnValue(`{ "dependencies": { "${package_resolve_1.FEED_PACKAGE}": "*" } }`);
|
|
49
|
-
cli_core_1.App.container.set(cli_core_1.FS_TOKEN, mockFs);
|
|
50
|
-
let result = (0, package_resolve_1.resolveIgxPackage)(package_resolve_1.NPM_PACKAGE);
|
|
51
|
-
expect(result).toEqual(package_resolve_1.FEED_PACKAGE);
|
|
52
|
-
expect(mockFs.fileExists).toHaveBeenCalledWith("./package.json");
|
|
53
|
-
expect(mockFs.readFile).toHaveBeenCalledWith("./package.json");
|
|
54
|
-
readSpy.and.returnValue(`{ "dependencies": { "${package_resolve_1.FEED_DOCK_MANAGER}": "*" } }`);
|
|
55
|
-
result = (0, package_resolve_1.resolveIgxPackage)(package_resolve_1.NPM_DOCK_MANAGER);
|
|
56
|
-
expect(result).toEqual(package_resolve_1.FEED_DOCK_MANAGER);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
describe("getUpgradeablePackages", () => {
|
|
60
|
-
it("should return an empty array if there are no upgradeable packages", () => {
|
|
61
|
-
const mockFs = new MockFileSystem();
|
|
62
|
-
const existsSpy = spyOn(mockFs, "fileExists").and.returnValue(false);
|
|
63
|
-
cli_core_1.App.container.set(cli_core_1.FS_TOKEN, mockFs);
|
|
64
|
-
expect((0, package_resolve_1.getUpgradeablePackages)()).toEqual([]);
|
|
65
|
-
existsSpy.and.returnValue(true);
|
|
66
|
-
spyOn(mockFs, "readFile").and.returnValue(JSON.stringify({
|
|
67
|
-
dependencies: {
|
|
68
|
-
"@infragistics/igniteui-angular": "0.1.0",
|
|
69
|
-
"igniteui-bait": "^9.0.1",
|
|
70
|
-
"kek": "1.0.1"
|
|
71
|
-
}
|
|
72
|
-
}));
|
|
73
|
-
expect((0, package_resolve_1.getUpgradeablePackages)()).toEqual([]);
|
|
74
|
-
});
|
|
75
|
-
it("should return an array if containing ONLY upgradeable packages", () => {
|
|
76
|
-
const mockFs = new MockFileSystem();
|
|
77
|
-
const existsSpy = spyOn(mockFs, "fileExists").and.returnValue(false);
|
|
78
|
-
cli_core_1.App.container.set(cli_core_1.FS_TOKEN, mockFs);
|
|
79
|
-
expect((0, package_resolve_1.getUpgradeablePackages)()).toEqual([]);
|
|
80
|
-
existsSpy.and.returnValue(true);
|
|
81
|
-
const mockObj = {
|
|
82
|
-
dependencies: {
|
|
83
|
-
"@infragistics/igniteui-angular": "0.1.0",
|
|
84
|
-
"igniteui-angular": "^9.0.1",
|
|
85
|
-
"kek": "1.0.1"
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
const mockRead = spyOn(mockFs, "readFile").and.returnValue(JSON.stringify(mockObj));
|
|
89
|
-
const expected = [
|
|
90
|
-
{ trial: package_resolve_1.NPM_PACKAGE, licensed: package_resolve_1.FEED_PACKAGE }
|
|
91
|
-
];
|
|
92
|
-
expect((0, package_resolve_1.getUpgradeablePackages)()).toEqual(expected);
|
|
93
|
-
mockObj.dependencies = {
|
|
94
|
-
"igniteui-angular": "^9.0.1",
|
|
95
|
-
"igniteui-dockmanager": "0.1.0",
|
|
96
|
-
"kek": "1.0.1"
|
|
97
|
-
};
|
|
98
|
-
expected.push({ trial: package_resolve_1.NPM_DOCK_MANAGER, licensed: package_resolve_1.FEED_DOCK_MANAGER });
|
|
99
|
-
mockRead.and.returnValue(JSON.stringify(mockObj));
|
|
100
|
-
expect((0, package_resolve_1.getUpgradeablePackages)()).toEqual(expected);
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
});
|