igniteui-cli 13.1.13-beta.0 → 13.1.13-beta.3
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/lib/templates/IgniteUIForReactTemplate.js +1 -1
- package/package.json +3 -3
- package/templates/react/ReactTypeScriptFileUpdate.d.ts +4 -4
- package/templates/react/ReactTypeScriptFileUpdate.js +33 -19
- package/templates/react/igr-ts/bullet-graph/default/index.js +1 -1
- package/templates/react/igr-ts/category-chart/default/index.js +1 -1
- package/templates/react/igr-ts/doughnut-chart/default/index.js +1 -1
- package/templates/react/igr-ts/financial-chart/default/index.js +1 -1
- package/templates/react/igr-ts/grid/basic/index.js +2 -2
- package/templates/react/igr-ts/linear-gauge/default/index.js +1 -1
- package/templates/react/igr-ts/pie-chart/default/index.js +1 -1
- package/templates/react/igr-ts/projects/_base/files/__dot__eslintrc.cjs +1 -0
- package/templates/react/igr-ts/projects/_base/files/package.json +0 -3
- package/templates/react/igr-ts/projects/_base/files/src/app/app.tsx +1 -5
- package/templates/react/igr-ts/radial-gauge/default/index.js +1 -1
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__github/workflows/node.js.yml +2 -2
- package/templates/webcomponents/igc-ts/projects/_base/index.js +2 -1
|
@@ -58,7 +58,7 @@ class IgniteUIForReactTemplate {
|
|
|
58
58
|
let filePath = path.posix.join(projectPath, options.modulePath, `${lowerDashed}.tsx`);
|
|
59
59
|
const routingModule = new ReactTypeScriptFileUpdate_1.ReactTypeScriptFileUpdate(path.join(projectPath, routeModulePath));
|
|
60
60
|
if (defaultPath) {
|
|
61
|
-
routingModule.addRoute(
|
|
61
|
+
routingModule.addRoute(lowerDashed, options.className, nameFromPath, filePath, options.routerChildren, undefined, defaultPath);
|
|
62
62
|
}
|
|
63
63
|
routingModule.addRoute(lowerDashed, options.className, nameFromPath, filePath, options.routerChildren, undefined);
|
|
64
64
|
if (options.hasChildren) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "igniteui-cli",
|
|
3
|
-
"version": "13.1.13-beta.
|
|
3
|
+
"version": "13.1.13-beta.3",
|
|
4
4
|
"description": "CLI tool for creating Ignite UI projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"all": true
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@igniteui/angular-templates": "
|
|
76
|
-
"@igniteui/cli-core": "
|
|
75
|
+
"@igniteui/angular-templates": "^17.1.13113-beta.3",
|
|
76
|
+
"@igniteui/cli-core": "^13.1.13-beta.3",
|
|
77
77
|
"chalk": "^2.3.2",
|
|
78
78
|
"fs-extra": "^3.0.1",
|
|
79
79
|
"glob": "^7.1.2",
|
|
@@ -18,18 +18,18 @@ export declare class ReactTypeScriptFileUpdate {
|
|
|
18
18
|
constructor(targetPath: string);
|
|
19
19
|
/** Applies accumulated transforms, saves and formats the file */
|
|
20
20
|
finalize(): void;
|
|
21
|
-
addRoute(path: string, component: string, name: string, filePath: string, routerChildren: string, importAlias: string,
|
|
21
|
+
addRoute(path: string, component: string, name: string, filePath: string, routerChildren: string, importAlias: string, defaultRoute?: boolean): void;
|
|
22
22
|
/** Initializes existing imports info, [re]sets import and `NgModule` edits */
|
|
23
23
|
protected initState(): void;
|
|
24
24
|
protected loadImportsMeta(): {
|
|
25
25
|
lastIndex: number;
|
|
26
26
|
modulePaths: any[];
|
|
27
27
|
};
|
|
28
|
-
protected addRouteModuleEntry(path: string, component: string, name: string, filePath: string, routerChildren: string, importAlias: string,
|
|
29
|
-
protected requestImport(modulePath: string, routerAlias: string, componentName: string): void;
|
|
28
|
+
protected addRouteModuleEntry(path: string, component: string, name: string, filePath: string, routerChildren: string, importAlias: string, defaultRoute?: boolean): void;
|
|
29
|
+
protected requestImport(modulePath: string, routerAlias: string, componentName: string, namedImport?: boolean): void;
|
|
30
30
|
/** Add `import` statements not previously found in the file */
|
|
31
31
|
protected addNewFileImports(): void;
|
|
32
|
-
protected createIdentifierImport(importPath: string, as: string, component: string): ts.ImportDeclaration;
|
|
32
|
+
protected createIdentifierImport(importPath: string, as: string, component: string, namedImport: boolean): ts.ImportDeclaration;
|
|
33
33
|
/** Transformation to apply edits to existing named import declarations */
|
|
34
34
|
protected importsTransformer: ts.TransformerFactory<ts.Node>;
|
|
35
35
|
/** Format a TS source file, very TBD */
|
|
@@ -46,8 +46,8 @@ class ReactTypeScriptFileUpdate {
|
|
|
46
46
|
// reset state in case of further updates
|
|
47
47
|
this.initState();
|
|
48
48
|
}
|
|
49
|
-
addRoute(path, component, name, filePath, routerChildren, importAlias,
|
|
50
|
-
this.addRouteModuleEntry(path, component, name, filePath, routerChildren, importAlias,
|
|
49
|
+
addRoute(path, component, name, filePath, routerChildren, importAlias, defaultRoute = false) {
|
|
50
|
+
this.addRouteModuleEntry(path, component, name, filePath, routerChildren, importAlias, defaultRoute);
|
|
51
51
|
}
|
|
52
52
|
//#region File state
|
|
53
53
|
/** Initializes existing imports info, [re]sets import and `NgModule` edits */
|
|
@@ -82,12 +82,15 @@ class ReactTypeScriptFileUpdate {
|
|
|
82
82
|
return meta;
|
|
83
83
|
}
|
|
84
84
|
//#endregion File state
|
|
85
|
-
addRouteModuleEntry(path, component, name, filePath, routerChildren, importAlias,
|
|
86
|
-
const isRouting = path.indexOf(
|
|
85
|
+
addRouteModuleEntry(path, component, name, filePath, routerChildren, importAlias, defaultRoute = false) {
|
|
86
|
+
const isRouting = path.indexOf(DEFAULT_ROUTES_VARIABLE) >= 0;
|
|
87
87
|
if (isRouting && this.targetSource.text.indexOf(path.slice(0, -4)) > 0) {
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
|
-
if (
|
|
90
|
+
if (defaultRoute) {
|
|
91
|
+
this.requestImport("react-router-dom", undefined, "redirect", true);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
91
94
|
const relativePath = cli_core_1.Util.relativePath(this.targetPath, filePath, true, true);
|
|
92
95
|
this.requestImport(relativePath, importAlias, component);
|
|
93
96
|
}
|
|
@@ -96,7 +99,7 @@ class ReactTypeScriptFileUpdate {
|
|
|
96
99
|
// the visitor that should be used when adding routes to the main route array
|
|
97
100
|
const conditionalVisitor = (node) => {
|
|
98
101
|
if (node.kind === ts.SyntaxKind.ArrayLiteralExpression) {
|
|
99
|
-
const newObject = this.createRouteEntry(path, component, name, routerChildren);
|
|
102
|
+
const newObject = this.createRouteEntry(path, component, name, routerChildren, defaultRoute);
|
|
100
103
|
const array = node;
|
|
101
104
|
this.createdStringLiterals.push(path, name);
|
|
102
105
|
const notFoundWildCard = ".*";
|
|
@@ -126,7 +129,7 @@ class ReactTypeScriptFileUpdate {
|
|
|
126
129
|
if (!isRouting) {
|
|
127
130
|
visitCondition = (node) => {
|
|
128
131
|
return node.kind === ts.SyntaxKind.VariableDeclaration &&
|
|
129
|
-
node.name.getText() ===
|
|
132
|
+
node.name.getText() === DEFAULT_ROUTES_VARIABLE;
|
|
130
133
|
// no type currently
|
|
131
134
|
//(node as ts.VariableDeclaration).type.getText() === "Route[]";
|
|
132
135
|
};
|
|
@@ -145,20 +148,19 @@ class ReactTypeScriptFileUpdate {
|
|
|
145
148
|
}).transformed[0];
|
|
146
149
|
this.finalize();
|
|
147
150
|
}
|
|
148
|
-
requestImport(modulePath, routerAlias, componentName) {
|
|
151
|
+
requestImport(modulePath, routerAlias, componentName, namedImport = false) {
|
|
149
152
|
const existing = this.requestedImports.find(x => x.from === modulePath);
|
|
153
|
+
// TODO: better check for named imports. There could be several named imports from same modulePath
|
|
150
154
|
if (!existing) {
|
|
151
155
|
// new imports, check if already exists in file
|
|
152
156
|
this.requestedImports.push({
|
|
153
157
|
as: routerAlias,
|
|
154
158
|
from: modulePath,
|
|
155
159
|
component: componentName,
|
|
156
|
-
edit: this.importsMeta.modulePaths.indexOf(modulePath) !== -1
|
|
160
|
+
edit: this.importsMeta.modulePaths.indexOf(modulePath) !== -1,
|
|
161
|
+
namedImport
|
|
157
162
|
});
|
|
158
163
|
}
|
|
159
|
-
else {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
164
|
}
|
|
163
165
|
/** Add `import` statements not previously found in the file */
|
|
164
166
|
addNewFileImports() {
|
|
@@ -168,13 +170,13 @@ class ReactTypeScriptFileUpdate {
|
|
|
168
170
|
}
|
|
169
171
|
const newStatements = ts.factory.createNodeArray([
|
|
170
172
|
...this.targetSource.statements.slice(0, this.importsMeta.lastIndex),
|
|
171
|
-
...newImports.map(x => this.createIdentifierImport(x.from, x.as, x.component)),
|
|
173
|
+
...newImports.map(x => this.createIdentifierImport(x.from, x.as, x.component, x.namedImport)),
|
|
172
174
|
...this.targetSource.statements.slice(this.importsMeta.lastIndex)
|
|
173
175
|
]);
|
|
174
176
|
newImports.forEach(x => this.createdStringLiterals.push(x.from));
|
|
175
177
|
this.targetSource = ts.factory.updateSourceFile(this.targetSource, newStatements);
|
|
176
178
|
}
|
|
177
|
-
createIdentifierImport(importPath, as, component) {
|
|
179
|
+
createIdentifierImport(importPath, as, component, namedImport) {
|
|
178
180
|
let exportedObject;
|
|
179
181
|
let exportedObjectName;
|
|
180
182
|
let importClause;
|
|
@@ -186,7 +188,14 @@ class ReactTypeScriptFileUpdate {
|
|
|
186
188
|
]));
|
|
187
189
|
}
|
|
188
190
|
else {
|
|
189
|
-
|
|
191
|
+
if (namedImport) {
|
|
192
|
+
const importSpecifier = ts.factory.createImportSpecifier(false, undefined, ts.factory.createIdentifier(component));
|
|
193
|
+
const imports = ts.factory.createNamedImports([importSpecifier]);
|
|
194
|
+
importClause = ts.factory.createImportClause(false, undefined, imports);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
importClause = ts.factory.createImportClause(false, ts.factory.createIdentifier(component), undefined);
|
|
198
|
+
}
|
|
190
199
|
}
|
|
191
200
|
const importDeclaration = ts.factory.createImportDeclaration(undefined, undefined, importClause, ts.factory.createStringLiteral(importPath, true));
|
|
192
201
|
return importDeclaration;
|
|
@@ -316,7 +325,14 @@ class ReactTypeScriptFileUpdate {
|
|
|
316
325
|
return node;
|
|
317
326
|
};
|
|
318
327
|
}
|
|
319
|
-
createRouteEntry(path, component, name, routerAlias) {
|
|
328
|
+
createRouteEntry(path, component, name, routerAlias, defaultRoute = false) {
|
|
329
|
+
if (defaultRoute) {
|
|
330
|
+
// for default route in React we should generate index: true, loader: () => redirect(path)
|
|
331
|
+
const index = ts.factory.createPropertyAssignment("index", ts.factory.createTrue());
|
|
332
|
+
const loader = ts.factory.createArrowFunction(undefined, undefined, [], undefined, undefined, ts.factory.createCallExpression(ts.factory.createIdentifier("redirect"), [], [ts.factory.createStringLiteral(path, true)]));
|
|
333
|
+
const redirect = ts.factory.createPropertyAssignment("loader", loader);
|
|
334
|
+
return ts.factory.createObjectLiteralExpression([index, redirect]);
|
|
335
|
+
}
|
|
320
336
|
const routePath = ts.factory.createPropertyAssignment("path", ts.factory.createStringLiteral(path, true));
|
|
321
337
|
const jsxElement = ts.factory.createJsxSelfClosingElement(ts.factory.createIdentifier(component), [], undefined);
|
|
322
338
|
const routeComponent = ts.factory.createPropertyAssignment("element", jsxElement);
|
|
@@ -325,9 +341,7 @@ class ReactTypeScriptFileUpdate {
|
|
|
325
341
|
const childrenData = ts.factory.createPropertyAssignment("children", ts.factory.createIdentifier(routerAlias));
|
|
326
342
|
return ts.factory.createObjectLiteralExpression([routePath, routeComponent, routeData, childrenData]);
|
|
327
343
|
}
|
|
328
|
-
|
|
329
|
-
return ts.factory.createObjectLiteralExpression([routePath, routeComponent, routeData]);
|
|
330
|
-
}
|
|
344
|
+
return ts.factory.createObjectLiteralExpression([routePath, routeComponent, routeData]);
|
|
331
345
|
}
|
|
332
346
|
}
|
|
333
347
|
exports.ReactTypeScriptFileUpdate = ReactTypeScriptFileUpdate;
|
|
@@ -12,7 +12,7 @@ class IgrTsBulletGraphTemplate extends IgniteUIForReactTemplate_1.IgniteUIForRea
|
|
|
12
12
|
this.name = "Bullet Graph";
|
|
13
13
|
this.description = `allows for a linear and concise view of measures compared against a scale.`;
|
|
14
14
|
// TODO: read version from igniteui-react-core in package.json
|
|
15
|
-
this.packages = ["igniteui-react-gauges
|
|
15
|
+
this.packages = ["igniteui-react-gauges@~18.6.0"];
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
module.exports = new IgrTsBulletGraphTemplate();
|
|
@@ -13,7 +13,7 @@ class IgrTsCategoryChartTemplate extends IgniteUIForReactTemplate_1.IgniteUIForR
|
|
|
13
13
|
this.description = `makes visualizing category data easy. Simplifies the complexities
|
|
14
14
|
of the data visualization domain into manageable API`;
|
|
15
15
|
// TODO: read version from igniteui-react-core in package.json
|
|
16
|
-
this.packages = ["igniteui-react-charts
|
|
16
|
+
this.packages = ["igniteui-react-charts@~18.6.0"];
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
module.exports = new IgrTsCategoryChartTemplate();
|
|
@@ -12,7 +12,7 @@ class IgrTsDoughnutChartTemplate extends IgniteUIForReactTemplate_1.IgniteUIForR
|
|
|
12
12
|
this.name = "Doughnut Chart";
|
|
13
13
|
this.description = `proportionally illustrate the occurrences of variables.`;
|
|
14
14
|
// TODO: read version from igniteui-react-core in package.json
|
|
15
|
-
this.packages = ["igniteui-react-charts
|
|
15
|
+
this.packages = ["igniteui-react-charts@~18.6.0"];
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
module.exports = new IgrTsDoughnutChartTemplate();
|
|
@@ -14,7 +14,7 @@ class IgrTsFinancialChartTemplate extends IgniteUIForReactTemplate_1.IgniteUIFor
|
|
|
14
14
|
this.description = `charting component that makes it easy to visualize financial data by
|
|
15
15
|
using a simple and intuitive API.`;
|
|
16
16
|
// TODO: read version from igniteui-react-core in package.json
|
|
17
|
-
this.packages = ["igniteui-react-charts
|
|
17
|
+
this.packages = ["igniteui-react-charts@~18.6.0"];
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
module.exports = new IgrTsFinancialChartTemplate();
|
|
@@ -15,8 +15,8 @@ class GridTemplate extends IgniteUIForReactTemplate_1.IgniteUIForReactTemplate {
|
|
|
15
15
|
this.components = ["Grid"];
|
|
16
16
|
this.controlGroup = "Data Grids";
|
|
17
17
|
// TODO: read version from igniteui-react-core in package.json
|
|
18
|
-
this.packages = ["igniteui-react-grids
|
|
19
|
-
"igniteui-react-layouts
|
|
18
|
+
this.packages = ["igniteui-react-grids@~18.6.0", "igniteui-react-inputs@~18.6.0",
|
|
19
|
+
"igniteui-react-layouts@~18.6.0"];
|
|
20
20
|
this.hasExtraConfiguration = false;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -12,7 +12,7 @@ class IgrTsLinearGaugeTemplate extends IgniteUIForReactTemplate_1.IgniteUIForRea
|
|
|
12
12
|
this.name = "Linear Gauge";
|
|
13
13
|
this.description = `value compared against a scale and one or more ranges.`;
|
|
14
14
|
// TODO: read version from igniteui-react-core in package.json
|
|
15
|
-
this.packages = ["igniteui-react-gauges
|
|
15
|
+
this.packages = ["igniteui-react-gauges@~18.6.0"];
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
module.exports = new IgrTsLinearGaugeTemplate();
|
|
@@ -12,7 +12,7 @@ class IgrTsPieChartTemplate extends IgniteUIForReactTemplate_1.IgniteUIForReactT
|
|
|
12
12
|
this.name = "Pie Chart";
|
|
13
13
|
this.description = `easily illustate the proportions of data entries`;
|
|
14
14
|
// TODO: read version from igniteui-react-core in package.json
|
|
15
|
-
this.packages = ["igniteui-react-charts
|
|
15
|
+
this.packages = ["igniteui-react-charts@~18.6.0"];
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
module.exports = new IgrTsPieChartTemplate();
|
|
@@ -8,9 +8,6 @@
|
|
|
8
8
|
"@testing-library/react": "^14.0.0",
|
|
9
9
|
"element-internals-polyfill": "^1.3.10",
|
|
10
10
|
"functions-have-names": "^1.2.3",
|
|
11
|
-
"igniteui-dockmanager": "^1.13.0",
|
|
12
|
-
"igniteui-react": "18.3.0",
|
|
13
|
-
"igniteui-react-core": "18.3.0",
|
|
14
11
|
"react": "^18.2.0",
|
|
15
12
|
"react-app-polyfill": "^0.2.0",
|
|
16
13
|
"react-dom": "^18.2.0",
|
|
@@ -13,7 +13,7 @@ class IgrTsRadialGaugeTemplate extends IgniteUIForReactTemplate_1.IgniteUIForRea
|
|
|
13
13
|
this.description = `provides a number of visual elements, like a needle, tick marks, ranges
|
|
14
14
|
and labels, in order to create a predefined shape and scale.`;
|
|
15
15
|
// TODO: read version from igniteui-react-core in package.json
|
|
16
|
-
this.packages = ["igniteui-react-gauges
|
|
16
|
+
this.packages = ["igniteui-react-gauges@~18.6.0"];
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
module.exports = new IgrTsRadialGaugeTemplate();
|