igniteui-cli 13.2.1 → 13.2.2-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/lib/templates/AngularTemplate.js +29 -8
- package/lib/templates/IgniteUIForReactTemplate.d.ts +1 -0
- package/lib/templates/IgniteUIForReactTemplate.js +36 -11
- package/lib/templates/IgniteUIForWebComponentsTemplate.js +33 -5
- package/migrations/update-5_0_0/index.js +3 -2
- package/package.json +3 -3
- package/templates/react/ReactTypeScriptFileUpdate.d.ts +10 -49
- package/templates/react/ReactTypeScriptFileUpdate.js +60 -336
- package/templates/react/types/ReactRouteEntry.d.ts +6 -0
- package/templates/react/types/ReactRouteEntry.js +2 -0
- package/templates/react/types/ReactRouteLike.d.ts +25 -0
- package/templates/react/types/ReactRouteLike.js +2 -0
- package/templates/react/types/ReactRouteTarget.d.ts +7 -0
- package/templates/react/types/ReactRouteTarget.js +11 -0
- package/templates/react/types/index.d.ts +3 -0
- package/templates/react/types/index.js +19 -0
- package/templates/webcomponents/WebComponentsTypeScriptFileUpdate.d.ts +11 -0
- package/templates/webcomponents/WebComponentsTypeScriptFileUpdate.js +82 -0
- package/templates/webcomponents/igc-ts/accordion/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/avatar/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/badge/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/button/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/button-group/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/calendar/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/card/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/checkbox/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/chip/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/circular-progress/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/custom-templates/subscription-form/index.js +0 -3
- package/templates/webcomponents/igc-ts/date-time-input/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/dock-manager/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/dropdown/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/expansion-panel/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/financial-chart/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/form/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/grid/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/grid/grid-editing/index.js +0 -3
- package/templates/webcomponents/igc-ts/grid/grid-summaries/index.js +0 -3
- package/templates/webcomponents/igc-ts/icon/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/icon-button/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/input/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/linear-gauge/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/linear-progress/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/list/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/navbar/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/pie-chart/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/projects/_base/files/package.json +1 -1
- package/templates/webcomponents/igc-ts/projects/_base_with_home/files/package.json +7 -7
- package/templates/webcomponents/igc-ts/radial-gauge/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/radio-group/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/rating/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/ripple/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/slider/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/switch/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/tabs/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/text-area/default/index.js +0 -3
- package/templates/webcomponents/igc-ts/text-area/index.js +0 -3
- package/templates/webcomponents/igc-ts/tree/default/index.js +0 -3
- package/templates/webcomponents/TypeScriptFileUpdate.d.ts +0 -52
- package/templates/webcomponents/TypeScriptFileUpdate.js +0 -341
|
@@ -40,21 +40,42 @@ class AngularTemplate {
|
|
|
40
40
|
// tslint:disable-next-line:variable-name
|
|
41
41
|
const TsUpdate =
|
|
42
42
|
// tslint:disable-next-line:no-submodule-imports
|
|
43
|
-
require("@igniteui/
|
|
43
|
+
require("@igniteui/angular-templates").AngularTypeScriptFileUpdate;
|
|
44
|
+
const componentPath = path.join(projectPath, `src/app/components/${this.folderName(name)}/${this.fileName(name)}.component.ts`);
|
|
45
|
+
const className = `${cli_core_1.Util.className(cli_core_1.Util.nameFromPath(name))}Component`;
|
|
44
46
|
if (!(options && options.skipRoute)) {
|
|
45
47
|
//1) import the component class name,
|
|
46
48
|
//2) and populate the Routes array with the path and component
|
|
47
49
|
//for example: { path: "combo", component: ComboComponent }
|
|
48
|
-
const
|
|
49
|
-
routingModule
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const routingModulePath = path.join(projectPath, "src/app/app-routing.module.ts");
|
|
51
|
+
const routingModule = new TsUpdate(routingModulePath, false, { singleQuotes: false });
|
|
52
|
+
routingModule.addRoute({
|
|
53
|
+
path: this.folderName(name),
|
|
54
|
+
identifierName: className,
|
|
55
|
+
modulePath: cli_core_1.Util.relativePath(routingModulePath, componentPath, true, true),
|
|
56
|
+
data: { text: cli_core_1.Util.nameFromPath(name) }
|
|
57
|
+
});
|
|
58
|
+
const content = routingModule.finalize();
|
|
59
|
+
if (content) {
|
|
60
|
+
// add to a finalize override in the NG File Update instead?
|
|
61
|
+
cli_core_1.TypeScriptUtils.saveFile(routingModulePath, content);
|
|
62
|
+
}
|
|
52
63
|
}
|
|
53
64
|
//3) add an import of the component class from its file location.
|
|
54
65
|
//4) populate the declarations portion of the @NgModule with the component class name.
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
mainModule
|
|
66
|
+
const mainModulePath = path.join(projectPath, `src/app/${modulePath}`);
|
|
67
|
+
const relativePath = cli_core_1.Util.relativePath(mainModulePath, componentPath, true, true);
|
|
68
|
+
const mainModule = new TsUpdate(mainModulePath, false, { singleQuotes: false });
|
|
69
|
+
mainModule.addNgModuleMeta({
|
|
70
|
+
declare: [className],
|
|
71
|
+
from: relativePath,
|
|
72
|
+
export: modulePath !== "app.module.ts" ? [className] : []
|
|
73
|
+
});
|
|
74
|
+
const content = mainModule.finalize();
|
|
75
|
+
if (content) {
|
|
76
|
+
// add to a finalize override in the NG File Update instead?
|
|
77
|
+
cli_core_1.TypeScriptUtils.saveFile(mainModulePath, content);
|
|
78
|
+
}
|
|
58
79
|
this.ensureSourceFiles(projectPath);
|
|
59
80
|
}
|
|
60
81
|
getExtraConfiguration() {
|
|
@@ -28,6 +28,7 @@ export declare class IgniteUIForReactTemplate implements Template {
|
|
|
28
28
|
getExtraConfiguration(): ControlExtraConfiguration[];
|
|
29
29
|
setExtraConfiguration(extraConfigKeys: {}): void;
|
|
30
30
|
protected folderName(pathName: string): string;
|
|
31
|
+
protected fileName(pathName: string): string;
|
|
31
32
|
protected registerJSONRoute(projectPath: string, name: string, routingModulePath: string): void;
|
|
32
33
|
protected getViewLink(name: string): string;
|
|
33
34
|
protected getToolbarLink(name: string): string;
|
|
@@ -5,6 +5,7 @@ const cli_core_1 = require("@igniteui/cli-core");
|
|
|
5
5
|
const fs = require("fs-extra");
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const ReactTypeScriptFileUpdate_1 = require("../../templates/react/ReactTypeScriptFileUpdate");
|
|
8
|
+
const typescript_1 = require("typescript");
|
|
8
9
|
class IgniteUIForReactTemplate {
|
|
9
10
|
/**
|
|
10
11
|
* Base ReactTemplate constructor
|
|
@@ -53,20 +54,40 @@ class IgniteUIForReactTemplate {
|
|
|
53
54
|
const routeModulePath = options.parentRoutingModulePath;
|
|
54
55
|
if (!(options && options.skipRoute)
|
|
55
56
|
&& cli_core_1.App.container.get(cli_core_1.FS_TOKEN).fileExists(routeModulePath)) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
const routingModule = new ReactTypeScriptFileUpdate_1.ReactTypeScriptFileUpdate(path.join(projectPath, routeModulePath), { convertTabsToSpaces: false, indentSize: 4, singleQuotes: true }, { jsx: typescript_1.JsxEmit.Preserve });
|
|
58
|
+
const modulePath = `./${cli_core_1.Util.lowerDashed(name)}/${cli_core_1.Util.lowerDashed(name)}-routes`;
|
|
59
|
+
const child = {
|
|
60
|
+
identifierName: cli_core_1.ROUTES_VARIABLE_NAME,
|
|
61
|
+
aliasName: options.routerChildren,
|
|
62
|
+
modulePath
|
|
63
|
+
};
|
|
60
64
|
if (defaultPath) {
|
|
61
|
-
routingModule.addRoute(
|
|
65
|
+
routingModule.addRoute({
|
|
66
|
+
index: true,
|
|
67
|
+
redirectTo: options.path,
|
|
68
|
+
});
|
|
62
69
|
}
|
|
63
|
-
|
|
70
|
+
const children = routeModulePath.includes(cli_core_1.REACT_APP_ROUTING_NAME)
|
|
71
|
+
? child
|
|
72
|
+
: undefined;
|
|
64
73
|
if (options.hasChildren) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
routingModule.addRoute({
|
|
75
|
+
path: this.fileName(name),
|
|
76
|
+
element: cli_core_1.Util.className(name),
|
|
77
|
+
text: cli_core_1.Util.nameFromPath(name),
|
|
78
|
+
children
|
|
79
|
+
});
|
|
69
80
|
}
|
|
81
|
+
else {
|
|
82
|
+
routingModule.addRoute({
|
|
83
|
+
path: this.fileName(name),
|
|
84
|
+
element: cli_core_1.Util.className(name),
|
|
85
|
+
text: cli_core_1.Util.nameFromPath(name)
|
|
86
|
+
}, false, // multiline
|
|
87
|
+
false // prepend
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
routingModule.finalize();
|
|
70
91
|
}
|
|
71
92
|
}
|
|
72
93
|
getExtraConfiguration() {
|
|
@@ -90,11 +111,15 @@ class IgniteUIForReactTemplate {
|
|
|
90
111
|
cli_core_1.Util.error(`Path ${"src/views/" + folderName} is not valid!`, "red");
|
|
91
112
|
process.exit(1);
|
|
92
113
|
}
|
|
93
|
-
//clean up potential leading spaces in folder names (`path/
|
|
114
|
+
//clean up potential leading spaces in folder names (`path/ name`):
|
|
94
115
|
folderName = folderName.replace(/\/\s+/g, "/");
|
|
95
116
|
}
|
|
96
117
|
return cli_core_1.Util.lowerDashed(folderName);
|
|
97
118
|
}
|
|
119
|
+
fileName(pathName) {
|
|
120
|
+
const name = cli_core_1.Util.nameFromPath(pathName);
|
|
121
|
+
return cli_core_1.Util.lowerDashed(name);
|
|
122
|
+
}
|
|
98
123
|
registerJSONRoute(projectPath, name, routingModulePath) {
|
|
99
124
|
const configFile = fs.readFileSync(path.join(projectPath, routingModulePath), "utf8");
|
|
100
125
|
const viewsArr = JSON.parse(configFile);
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.IgniteUIForWebComponentsTemplate = void 0;
|
|
4
4
|
const cli_core_1 = require("@igniteui/cli-core");
|
|
5
5
|
const path = require("path");
|
|
6
|
-
const
|
|
6
|
+
const WebComponentsTypeScriptFileUpdate_1 = require("../../templates/webcomponents/WebComponentsTypeScriptFileUpdate");
|
|
7
7
|
class IgniteUIForWebComponentsTemplate {
|
|
8
8
|
get templatePaths() {
|
|
9
9
|
return [path.join(this.rootPath, "files")];
|
|
@@ -31,16 +31,44 @@ class IgniteUIForWebComponentsTemplate {
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
const routeModulePath = options.parentRoutingModulePath;
|
|
34
|
-
const routingModule = new
|
|
34
|
+
const routingModule = new WebComponentsTypeScriptFileUpdate_1.WebComponentsTypeScriptFileUpdate(path.join(projectPath, routeModulePath), { convertTabsToSpaces: false, indentSize: 4, singleQuotes: false });
|
|
35
35
|
if (!(options && options.skipRoute) && cli_core_1.App.container.get(cli_core_1.FS_TOKEN)
|
|
36
36
|
.fileExists(routeModulePath)) {
|
|
37
|
+
const modulePath = `./${cli_core_1.Util.lowerDashed(fullName)}/${cli_core_1.Util.lowerDashed(fullName)}-routing`;
|
|
38
|
+
const child = {
|
|
39
|
+
identifierName: cli_core_1.ROUTES_VARIABLE_NAME,
|
|
40
|
+
aliasName: options.routerChildren,
|
|
41
|
+
modulePath
|
|
42
|
+
};
|
|
43
|
+
const children = routeModulePath.includes(cli_core_1.WC_APP_ROUTING_NAME)
|
|
44
|
+
? child
|
|
45
|
+
: undefined;
|
|
37
46
|
if (defaultPath) {
|
|
38
|
-
routingModule.addRoute(
|
|
47
|
+
routingModule.addRoute({
|
|
48
|
+
path: "",
|
|
49
|
+
redirectTo: options.selector,
|
|
50
|
+
name: cli_core_1.Util.nameFromPath(fullName),
|
|
51
|
+
children
|
|
52
|
+
});
|
|
39
53
|
}
|
|
40
|
-
routingModule.addRoute(this.fileName(fullName), options.selector, cli_core_1.Util.nameFromPath(fullName), options.routerChildren, undefined);
|
|
41
54
|
if (options.hasChildren) {
|
|
42
|
-
routingModule.addRoute(
|
|
55
|
+
routingModule.addRoute({
|
|
56
|
+
path: this.fileName(fullName),
|
|
57
|
+
identifierName: options.selector,
|
|
58
|
+
name: cli_core_1.Util.nameFromPath(fullName),
|
|
59
|
+
children
|
|
60
|
+
});
|
|
43
61
|
}
|
|
62
|
+
else {
|
|
63
|
+
routingModule.addRoute({
|
|
64
|
+
path: this.fileName(fullName),
|
|
65
|
+
identifierName: options.selector,
|
|
66
|
+
name: cli_core_1.Util.nameFromPath(fullName)
|
|
67
|
+
}, false, // multiline
|
|
68
|
+
false // prepend
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
routingModule.finalize();
|
|
44
72
|
}
|
|
45
73
|
}
|
|
46
74
|
getExtraConfiguration() {
|
|
@@ -13,6 +13,7 @@ exports.setVirtual = exports.NgTreeFileSystem = void 0;
|
|
|
13
13
|
// tslint:disable:no-implicit-dependencies
|
|
14
14
|
const core_1 = require("@angular-devkit/core");
|
|
15
15
|
const cli_core_1 = require("@igniteui/cli-core");
|
|
16
|
+
const angular_templates_1 = require("@igniteui/angular-templates");
|
|
16
17
|
//#region Temp duplicate of schematics pack fs
|
|
17
18
|
class NgTreeFileSystem {
|
|
18
19
|
constructor(tree) {
|
|
@@ -51,9 +52,9 @@ function default_1() {
|
|
|
51
52
|
context.logger.info(`Applying migration for Ignite UI CLI 5.0.0`);
|
|
52
53
|
if (tree.exists(moduleFile)) {
|
|
53
54
|
setVirtual(tree);
|
|
54
|
-
const mainModule = new
|
|
55
|
+
const mainModule = new angular_templates_1.AngularTypeScriptFileUpdate(moduleFile, false, { indentSize: 2 });
|
|
55
56
|
mainModule.addNgModuleMeta({ import: "HammerModule", from: "@angular/platform-browser" });
|
|
56
|
-
mainModule.finalize();
|
|
57
|
+
cli_core_1.TypeScriptUtils.saveFile(moduleFile, mainModule.finalize());
|
|
57
58
|
}
|
|
58
59
|
});
|
|
59
60
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "igniteui-cli",
|
|
3
|
-
"version": "13.2.
|
|
3
|
+
"version": "13.2.2-beta.0",
|
|
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": "~17.2.
|
|
76
|
-
"@igniteui/cli-core": "~13.2.
|
|
75
|
+
"@igniteui/angular-templates": "~17.2.1322-beta.0",
|
|
76
|
+
"@igniteui/cli-core": "~13.2.2-beta.0",
|
|
77
77
|
"chalk": "^2.3.2",
|
|
78
78
|
"fs-extra": "^3.0.1",
|
|
79
79
|
"glob": "^7.1.2",
|
|
@@ -1,50 +1,11 @@
|
|
|
1
|
-
import * as ts from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
protected
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
private fileSystem;
|
|
13
|
-
private targetSource;
|
|
14
|
-
private importsMeta;
|
|
15
|
-
private requestedImports;
|
|
16
|
-
private createdStringLiterals;
|
|
17
|
-
/** Create updates for a file. Use `add<X>` methods to add transformations and `finalize` to apply and save them. */
|
|
18
|
-
constructor(targetPath: string);
|
|
19
|
-
/** Applies accumulated transforms, saves and formats the file */
|
|
20
|
-
finalize(): void;
|
|
21
|
-
addRoute(path: string, component: string, name: string, filePath: string, routerChildren: string, importAlias: string, defaultRoute?: boolean): void;
|
|
22
|
-
/** Initializes existing imports info, [re]sets import and `NgModule` edits */
|
|
23
|
-
protected initState(): void;
|
|
24
|
-
protected loadImportsMeta(): {
|
|
25
|
-
lastIndex: number;
|
|
26
|
-
modulePaths: any[];
|
|
27
|
-
};
|
|
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
|
-
/** Add `import` statements not previously found in the file */
|
|
31
|
-
protected addNewFileImports(): void;
|
|
32
|
-
protected createIdentifierImport(importPath: string, as: string, component: string, namedImport: boolean): ts.ImportDeclaration;
|
|
33
|
-
/** Transformation to apply edits to existing named import declarations */
|
|
34
|
-
protected importsTransformer: ts.TransformerFactory<ts.Node>;
|
|
35
|
-
/** Format a TS source file, very TBD */
|
|
36
|
-
protected formatFile(filePath: string): void;
|
|
37
|
-
/** Try and parse formatting from project `.editorconfig` / `tslint.json` */
|
|
38
|
-
protected readFormatConfigs(): void;
|
|
39
|
-
/**
|
|
40
|
-
* Apply formatting changes (position based) in reverse
|
|
41
|
-
* from https://github.com/Microsoft/TypeScript/issues/1651#issuecomment-69877863
|
|
42
|
-
*/
|
|
43
|
-
private applyChanges;
|
|
44
|
-
/** Return source file formatting options */
|
|
45
|
-
private getFormattingOptions;
|
|
46
|
-
/** Get language service host, sloppily */
|
|
47
|
-
private getLanguageHost;
|
|
48
|
-
private createVisitor;
|
|
49
|
-
private createRouteEntry;
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import { FormatSettings, PropertyAssignment, TypeScriptFileUpdate } from '@igniteui/cli-core';
|
|
3
|
+
import { ReactRouteLike } from './types';
|
|
4
|
+
export declare class ReactTypeScriptFileUpdate extends TypeScriptFileUpdate {
|
|
5
|
+
constructor(filePath: string, formatSettings?: FormatSettings, compilerOptions?: ts.CompilerOptions);
|
|
6
|
+
addRoute(route: ReactRouteLike, multiline?: boolean, prepend?: boolean, anchorElement?: PropertyAssignment): ts.SourceFile;
|
|
7
|
+
protected addRouteEntry(route: ReactRouteLike, visitCondition: (node: ts.Node) => boolean, multiline: boolean, prepend: boolean, anchorElement: PropertyAssignment): ts.SourceFile;
|
|
8
|
+
protected addRedirectRouteEntry(route: ReactRouteLike, visitCondition: (node: ts.Node) => boolean, multiline?: boolean, prepend?: boolean, anchorElement?: PropertyAssignment): ts.SourceFile;
|
|
9
|
+
protected addChildRouteEntry(route: ReactRouteLike, asIdentifier?: boolean, multiline?: boolean, prepend?: boolean): ts.SourceFile;
|
|
10
|
+
private requestImportForRouteLoader;
|
|
50
11
|
}
|