igniteui-cli 13.2.2-beta.1 → 13.2.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/lib/templates/AngularTemplate.js +8 -29
- package/lib/templates/IgniteUIForReactTemplate.d.ts +0 -1
- package/lib/templates/IgniteUIForReactTemplate.js +11 -36
- package/lib/templates/IgniteUIForWebComponentsTemplate.js +5 -35
- package/migrations/update-5_0_0/index.js +2 -3
- package/package.json +3 -3
- package/templates/react/ReactTypeScriptFileUpdate.d.ts +49 -10
- package/templates/react/ReactTypeScriptFileUpdate.js +336 -60
- package/templates/react/igr-ts/projects/_base/files/src/setupTests.ts +6 -0
- package/templates/webcomponents/TypeScriptFileUpdate.d.ts +52 -0
- package/templates/webcomponents/TypeScriptFileUpdate.js +341 -0
- package/templates/webcomponents/igc-ts/accordion/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/avatar/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/badge/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/button/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/button-group/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/calendar/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/card/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/checkbox/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/chip/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/circular-progress/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/custom-templates/subscription-form/index.js +3 -0
- package/templates/webcomponents/igc-ts/date-time-input/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/dock-manager/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/dropdown/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/expansion-panel/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/financial-chart/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/form/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/grid/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/grid/grid-editing/index.js +3 -0
- package/templates/webcomponents/igc-ts/grid/grid-summaries/index.js +3 -0
- package/templates/webcomponents/igc-ts/icon/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/icon-button/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/input/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/linear-gauge/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/linear-progress/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/list/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/navbar/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/pie-chart/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/package.json +7 -7
- package/templates/webcomponents/igc-ts/projects/_base_with_home/files/package.json +13 -13
- package/templates/webcomponents/igc-ts/radial-gauge/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/radio-group/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/rating/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/ripple/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/slider/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/switch/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/tabs/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/text-area/default/index.js +3 -0
- package/templates/webcomponents/igc-ts/text-area/index.js +3 -0
- package/templates/webcomponents/igc-ts/tree/default/index.js +3 -0
- package/templates/react/types/ReactRouteEntry.d.ts +0 -6
- package/templates/react/types/ReactRouteEntry.js +0 -2
- package/templates/react/types/ReactRouteLike.d.ts +0 -25
- package/templates/react/types/ReactRouteLike.js +0 -2
- package/templates/react/types/ReactRouteTarget.d.ts +0 -7
- package/templates/react/types/ReactRouteTarget.js +0 -11
- package/templates/react/types/index.d.ts +0 -3
- package/templates/react/types/index.js +0 -19
- package/templates/webcomponents/WebComponentsTypeScriptFileUpdate.d.ts +0 -11
- package/templates/webcomponents/WebComponentsTypeScriptFileUpdate.js +0 -82
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypeScriptFileUpdate = void 0;
|
|
4
|
+
const cli_core_1 = require("@igniteui/cli-core");
|
|
5
|
+
const ts = require("typescript");
|
|
6
|
+
const DEFAULT_ROUTES_VARIABLE = "routes";
|
|
7
|
+
/**
|
|
8
|
+
* Apply various updates to typescript files using AST
|
|
9
|
+
*/
|
|
10
|
+
class TypeScriptFileUpdate {
|
|
11
|
+
/** Create updates for a file. Use `add<X>` methods to add transformations and `finalize` to apply and save them. */
|
|
12
|
+
constructor(targetPath) {
|
|
13
|
+
this.targetPath = targetPath;
|
|
14
|
+
this.formatOptions = { spaces: false, indentSize: 4, singleQuotes: false };
|
|
15
|
+
//#region ts.TransformerFactory
|
|
16
|
+
/** Transformation to apply edits to existing named import declarations */
|
|
17
|
+
this.importsTransformer = (context) => (rootNode) => {
|
|
18
|
+
const editImports = this.requestedImports.filter(x => x.edit);
|
|
19
|
+
// https://github.com/Microsoft/TypeScript/issues/14419#issuecomment-307256171
|
|
20
|
+
const visitor = (node) => {
|
|
21
|
+
if (node.kind === ts.SyntaxKind.ImportDeclaration &&
|
|
22
|
+
editImports.find(x => x.from === node.moduleSpecifier.text)) {
|
|
23
|
+
// visit just the source file main array (second visit)
|
|
24
|
+
return visitImport(node);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
node = ts.visitEachChild(node, visitor, context);
|
|
28
|
+
}
|
|
29
|
+
return node;
|
|
30
|
+
};
|
|
31
|
+
function visitImport(node) {
|
|
32
|
+
node = ts.visitEachChild(node, visitImport, context);
|
|
33
|
+
return node;
|
|
34
|
+
}
|
|
35
|
+
return ts.visitNode(rootNode, visitor);
|
|
36
|
+
};
|
|
37
|
+
this.fileSystem = cli_core_1.App.container.get(cli_core_1.FS_TOKEN);
|
|
38
|
+
this.initState();
|
|
39
|
+
}
|
|
40
|
+
/** Applies accumulated transforms, saves and formats the file */
|
|
41
|
+
finalize() {
|
|
42
|
+
// add new import statements after visitor walks:
|
|
43
|
+
this.addNewFileImports();
|
|
44
|
+
cli_core_1.TypeScriptUtils.saveFile(this.targetPath, this.targetSource);
|
|
45
|
+
this.formatFile(this.targetPath);
|
|
46
|
+
// reset state in case of further updates
|
|
47
|
+
this.initState();
|
|
48
|
+
}
|
|
49
|
+
addRoute(path, component, name, routerChildren, importAlias, routesVariable = DEFAULT_ROUTES_VARIABLE) {
|
|
50
|
+
this.addRouteModuleEntry(path, component, name, routerChildren, importAlias, routesVariable);
|
|
51
|
+
}
|
|
52
|
+
//#region File state
|
|
53
|
+
/** Initializes existing imports info, [re]sets import and `NgModule` edits */
|
|
54
|
+
initState() {
|
|
55
|
+
this.targetSource = cli_core_1.TypeScriptUtils.getFileSource(this.targetPath);
|
|
56
|
+
this.importsMeta = this.loadImportsMeta();
|
|
57
|
+
this.requestedImports = [];
|
|
58
|
+
this.createdStringLiterals = [];
|
|
59
|
+
}
|
|
60
|
+
/* load some metadata about imports */
|
|
61
|
+
loadImportsMeta() {
|
|
62
|
+
const meta = { lastIndex: 0, modulePaths: [] };
|
|
63
|
+
for (let i = 0; i < this.targetSource.statements.length; i++) {
|
|
64
|
+
const statement = this.targetSource.statements[i];
|
|
65
|
+
switch (statement.kind) {
|
|
66
|
+
case ts.SyntaxKind.ImportDeclaration:
|
|
67
|
+
const importStmt = statement;
|
|
68
|
+
if (importStmt.importClause && importStmt.importClause.namedBindings &&
|
|
69
|
+
importStmt.importClause.namedBindings.kind !== ts.SyntaxKind.NamespaceImport) {
|
|
70
|
+
// don't add imports without named (e.g. `import $ from "JQuery"` or `import "./my-module.js";`)
|
|
71
|
+
// don't add namespace imports (`import * as fs`) as available for editing, maybe in the future
|
|
72
|
+
meta.modulePaths.push(importStmt.moduleSpecifier.text);
|
|
73
|
+
}
|
|
74
|
+
// don't add equals imports (`import url = require("url")`) as available for editing, maybe in the future
|
|
75
|
+
case ts.SyntaxKind.ImportEqualsDeclaration:
|
|
76
|
+
meta.lastIndex = i + 1;
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return meta;
|
|
83
|
+
}
|
|
84
|
+
//#endregion File state
|
|
85
|
+
addRouteModuleEntry(path, component, name, routerChildren, importAlias, routesVariable = DEFAULT_ROUTES_VARIABLE) {
|
|
86
|
+
const isRouting = path.indexOf("routing") >= 0;
|
|
87
|
+
if (isRouting && this.targetSource.text.indexOf(path.slice(0, -3)) > 0) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const moduleName = path.substring(0, path.indexOf("-routing"));
|
|
91
|
+
if (path) {
|
|
92
|
+
const relativePath = isRouting ?
|
|
93
|
+
"./" + moduleName + "/" + path.slice(0, -3) : "./" + path + "/" + path;
|
|
94
|
+
this.requestImport(relativePath, importAlias);
|
|
95
|
+
}
|
|
96
|
+
// https://github.com/Microsoft/TypeScript/issues/14419#issuecomment-307256171
|
|
97
|
+
const transformer = (context) => (rootNode) => {
|
|
98
|
+
// the visitor that should be used when adding routes to the main route array
|
|
99
|
+
const conditionalVisitor = (node) => {
|
|
100
|
+
if (node.kind === ts.SyntaxKind.ArrayLiteralExpression) {
|
|
101
|
+
const newObject = this.createRouteEntry(path, component, name, routerChildren);
|
|
102
|
+
const array = node;
|
|
103
|
+
this.createdStringLiterals.push(path, name);
|
|
104
|
+
const notFoundWildCard = ".*";
|
|
105
|
+
const nodes = ts.visitNodes(array.elements, visitor);
|
|
106
|
+
const errorRouteNode = nodes.filter(element => element.getText().includes(notFoundWildCard))[0];
|
|
107
|
+
let resultNodes = null;
|
|
108
|
+
if (errorRouteNode) {
|
|
109
|
+
resultNodes = nodes
|
|
110
|
+
.slice(0, nodes.indexOf(errorRouteNode))
|
|
111
|
+
.concat(newObject)
|
|
112
|
+
.concat(errorRouteNode);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
resultNodes = nodes
|
|
116
|
+
.concat(newObject);
|
|
117
|
+
}
|
|
118
|
+
const elements = ts.factory.createNodeArray([
|
|
119
|
+
...resultNodes
|
|
120
|
+
]);
|
|
121
|
+
return ts.factory.updateArrayLiteralExpression(array, elements);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
return ts.visitEachChild(node, conditionalVisitor, context);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
let visitCondition;
|
|
128
|
+
if (!isRouting) {
|
|
129
|
+
visitCondition = (node) => {
|
|
130
|
+
return node.kind === ts.SyntaxKind.VariableDeclaration &&
|
|
131
|
+
node.name.getText() === routesVariable &&
|
|
132
|
+
node.type.getText() === "Route[]";
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
visitCondition = (node) => {
|
|
137
|
+
return undefined;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
const visitor = this.createVisitor(conditionalVisitor, visitCondition, context);
|
|
141
|
+
context.enableSubstitution(ts.SyntaxKind.ClassDeclaration);
|
|
142
|
+
return ts.visitNode(rootNode, visitor);
|
|
143
|
+
};
|
|
144
|
+
this.targetSource = ts.transform(this.targetSource, [transformer], {
|
|
145
|
+
pretty: true // oh well..
|
|
146
|
+
}).transformed[0];
|
|
147
|
+
this.finalize();
|
|
148
|
+
}
|
|
149
|
+
requestImport(modulePath, routerAlias) {
|
|
150
|
+
const existing = this.requestedImports.find(x => x.from === modulePath);
|
|
151
|
+
if (!existing) {
|
|
152
|
+
// new imports, check if already exists in file
|
|
153
|
+
this.requestedImports.push({
|
|
154
|
+
as: routerAlias,
|
|
155
|
+
from: modulePath,
|
|
156
|
+
edit: this.importsMeta.modulePaths.indexOf(modulePath) !== -1
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/** Add `import` statements not previously found in the file */
|
|
164
|
+
addNewFileImports() {
|
|
165
|
+
const newImports = this.requestedImports.filter(x => !x.edit);
|
|
166
|
+
if (!newImports.length) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const newStatements = ts.factory.createNodeArray([
|
|
170
|
+
...this.targetSource.statements.slice(0, this.importsMeta.lastIndex),
|
|
171
|
+
...newImports.map(x => this.createIdentifierImport(x.from, x.as)),
|
|
172
|
+
...this.targetSource.statements.slice(this.importsMeta.lastIndex)
|
|
173
|
+
]);
|
|
174
|
+
newImports.forEach(x => this.createdStringLiterals.push(x.from));
|
|
175
|
+
this.targetSource = ts.factory.updateSourceFile(this.targetSource, newStatements);
|
|
176
|
+
}
|
|
177
|
+
createIdentifierImport(importPath, as) {
|
|
178
|
+
let exportedObject;
|
|
179
|
+
let exportedObjectName;
|
|
180
|
+
let importClause;
|
|
181
|
+
if (as) {
|
|
182
|
+
exportedObject = "routes";
|
|
183
|
+
exportedObjectName = as.replace(/\s/g, "");
|
|
184
|
+
importClause = ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([
|
|
185
|
+
ts.factory.createImportSpecifier(false, ts.factory.createIdentifier(exportedObject), ts.factory.createIdentifier(exportedObjectName))
|
|
186
|
+
]));
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
importClause = undefined;
|
|
190
|
+
}
|
|
191
|
+
const importDeclaration = ts.factory.createImportDeclaration(undefined, importClause, ts.factory.createStringLiteral(importPath, true), undefined);
|
|
192
|
+
return importDeclaration;
|
|
193
|
+
}
|
|
194
|
+
//#endregion ts.TransformerFactory
|
|
195
|
+
//#region Formatting
|
|
196
|
+
/** Format a TS source file, very TBD */
|
|
197
|
+
formatFile(filePath) {
|
|
198
|
+
// formatting via LanguageService https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API
|
|
199
|
+
// https://github.com/Microsoft/TypeScript/issues/1651
|
|
200
|
+
let text = this.fileSystem.readFile(filePath);
|
|
201
|
+
// create the language service files
|
|
202
|
+
const services = ts.createLanguageService(this.getLanguageHost(filePath), ts.createDocumentRegistry());
|
|
203
|
+
this.readFormatConfigs();
|
|
204
|
+
const textChanges = services.getFormattingEditsForDocument(filePath, this.getFormattingOptions());
|
|
205
|
+
text = this.applyChanges(text, textChanges);
|
|
206
|
+
if (this.formatOptions.singleQuotes) {
|
|
207
|
+
for (const str of this.createdStringLiterals) {
|
|
208
|
+
// there shouldn't be duplicate strings of these
|
|
209
|
+
text = text.replace(`"${str}"`, `'${str}'`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
this.fileSystem.writeFile(filePath, text);
|
|
213
|
+
}
|
|
214
|
+
/** Try and parse formatting from project `.editorconfig` / `tslint.json` */
|
|
215
|
+
readFormatConfigs() {
|
|
216
|
+
if (this.fileSystem.fileExists(".editorconfig")) {
|
|
217
|
+
// very basic parsing support
|
|
218
|
+
const text = this.fileSystem.readFile(".editorconfig", "utf-8");
|
|
219
|
+
const options = text
|
|
220
|
+
.replace(/\s*[#;].*([\r\n])/g, "$1") //remove comments
|
|
221
|
+
.replace(/\[(?!\*\]|\*.ts).+\][^\[]+/g, "") // leave [*]/[*.ts] sections
|
|
222
|
+
.split(/\r\n|\r|\n/)
|
|
223
|
+
.reduce((obj, x) => {
|
|
224
|
+
if (x.indexOf("=") !== -1) {
|
|
225
|
+
const pair = x.split("=");
|
|
226
|
+
obj[pair[0].trim()] = pair[1].trim();
|
|
227
|
+
}
|
|
228
|
+
return obj;
|
|
229
|
+
}, {});
|
|
230
|
+
this.formatOptions.spaces = options["indent_style"] === "space";
|
|
231
|
+
if (options["indent_size"]) {
|
|
232
|
+
this.formatOptions.indentSize = parseInt(options["indent_size"], 10) || this.formatOptions.indentSize;
|
|
233
|
+
}
|
|
234
|
+
if (options["quote_type"]) {
|
|
235
|
+
this.formatOptions.singleQuotes = options["quote_type"] === "single";
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (this.fileSystem.fileExists("tslint.json")) {
|
|
239
|
+
// tslint prio - overrides other settings
|
|
240
|
+
const options = JSON.parse(this.fileSystem.readFile("tslint.json", "utf-8"));
|
|
241
|
+
if (options.rules && options.rules.indent && options.rules.indent[0]) {
|
|
242
|
+
this.formatOptions.spaces = options.rules.indent[1] === "spaces";
|
|
243
|
+
if (options.rules.indent[2]) {
|
|
244
|
+
this.formatOptions.indentSize = parseInt(options.rules.indent[2], 10);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (options.rules && options.rules.quotemark && options.rules.quotemark[0]) {
|
|
248
|
+
this.formatOptions.singleQuotes = options.rules.quotemark.indexOf("single") !== -1;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Apply formatting changes (position based) in reverse
|
|
254
|
+
* from https://github.com/Microsoft/TypeScript/issues/1651#issuecomment-69877863
|
|
255
|
+
*/
|
|
256
|
+
applyChanges(orig, changes) {
|
|
257
|
+
let result = orig;
|
|
258
|
+
for (let i = changes.length - 1; i >= 0; i--) {
|
|
259
|
+
const change = changes[i];
|
|
260
|
+
const head = result.slice(0, change.span.start);
|
|
261
|
+
const tail = result.slice(change.span.start + change.span.length);
|
|
262
|
+
result = head + change.newText + tail;
|
|
263
|
+
}
|
|
264
|
+
return result;
|
|
265
|
+
}
|
|
266
|
+
/** Return source file formatting options */
|
|
267
|
+
getFormattingOptions() {
|
|
268
|
+
const formatOptions = {
|
|
269
|
+
// tslint:disable:object-literal-sort-keys
|
|
270
|
+
indentSize: this.formatOptions.indentSize,
|
|
271
|
+
tabSize: 4,
|
|
272
|
+
newLineCharacter: ts.sys.newLine,
|
|
273
|
+
convertTabsToSpaces: this.formatOptions.spaces,
|
|
274
|
+
indentStyle: ts.IndentStyle.Smart,
|
|
275
|
+
insertSpaceAfterCommaDelimiter: true,
|
|
276
|
+
insertSpaceAfterSemicolonInForStatements: true,
|
|
277
|
+
insertSpaceBeforeAndAfterBinaryOperators: true,
|
|
278
|
+
insertSpaceAfterKeywordsInControlFlowStatements: true,
|
|
279
|
+
insertSpaceAfterTypeAssertion: true
|
|
280
|
+
// tslint:enable:object-literal-sort-keys
|
|
281
|
+
};
|
|
282
|
+
return formatOptions;
|
|
283
|
+
}
|
|
284
|
+
/** Get language service host, sloppily */
|
|
285
|
+
getLanguageHost(filePath) {
|
|
286
|
+
const files = {};
|
|
287
|
+
files[filePath] = { version: 0 };
|
|
288
|
+
// create the language service host to allow the LS to communicate with the host
|
|
289
|
+
const servicesHost = {
|
|
290
|
+
getCompilationSettings: () => ({}),
|
|
291
|
+
getScriptFileNames: () => Object.keys(files),
|
|
292
|
+
getScriptVersion: fileName => files[fileName] && files[fileName].version.toString(),
|
|
293
|
+
getScriptSnapshot: fileName => {
|
|
294
|
+
if (!this.fileSystem.fileExists(fileName)) {
|
|
295
|
+
return undefined;
|
|
296
|
+
}
|
|
297
|
+
return ts.ScriptSnapshot.fromString(this.fileSystem.readFile(fileName));
|
|
298
|
+
},
|
|
299
|
+
getCurrentDirectory: () => process.cwd(),
|
|
300
|
+
getDefaultLibFileName: options => ts.getDefaultLibFilePath(options),
|
|
301
|
+
readDirectory: ts.sys.readDirectory,
|
|
302
|
+
readFile: ts.sys.readFile,
|
|
303
|
+
fileExists: ts.sys.fileExists
|
|
304
|
+
};
|
|
305
|
+
return servicesHost;
|
|
306
|
+
}
|
|
307
|
+
//#endregion Formatting
|
|
308
|
+
/** Convert a string or string array union to array. Splits strings as comma delimited */
|
|
309
|
+
asArray(value, variables) {
|
|
310
|
+
let result = [];
|
|
311
|
+
if (value) {
|
|
312
|
+
result = typeof value === "string" ? value.split(/\s*,\s*/) : value;
|
|
313
|
+
result = result.map(x => cli_core_1.Util.applyConfigTransformation(x, variables));
|
|
314
|
+
}
|
|
315
|
+
return result;
|
|
316
|
+
}
|
|
317
|
+
createVisitor(conditionalVisitor, visitCondition, nodeContext) {
|
|
318
|
+
return function visitor(node) {
|
|
319
|
+
if (visitCondition(node)) {
|
|
320
|
+
node = ts.visitEachChild(node, conditionalVisitor, nodeContext);
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
node = ts.visitEachChild(node, visitor, nodeContext);
|
|
324
|
+
}
|
|
325
|
+
return node;
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
createRouteEntry(filePath, className, linkText, routerAlias) {
|
|
329
|
+
const routePath = ts.factory.createPropertyAssignment("path", ts.factory.createStringLiteral(filePath, true));
|
|
330
|
+
const routeComponent = ts.factory.createPropertyAssignment("component", ts.factory.createStringLiteral(className, true));
|
|
331
|
+
const routeData = ts.factory.createPropertyAssignment("name", ts.factory.createStringLiteral(linkText, true));
|
|
332
|
+
if (routerAlias) {
|
|
333
|
+
const childrenData = ts.factory.createPropertyAssignment("children", ts.factory.createIdentifier(routerAlias));
|
|
334
|
+
return ts.factory.createObjectLiteralExpression([routePath, routeComponent, routeData, childrenData]);
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
return ts.factory.createObjectLiteralExpression([routePath, routeComponent, routeData]);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
exports.TypeScriptFileUpdate = TypeScriptFileUpdate;
|
|
@@ -12,5 +12,8 @@ class IgcAccordionTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIFo
|
|
|
12
12
|
this.name = "Accordion";
|
|
13
13
|
this.description = "basic IgcAccordion";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcAccordionTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcAvatarTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForWe
|
|
|
12
12
|
this.name = "Avatar";
|
|
13
13
|
this.description = "basic IgcAvatar";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcAvatarTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcBadgeTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForWeb
|
|
|
12
12
|
this.name = "Badge";
|
|
13
13
|
this.description = "basic IgcBadge";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcBadgeTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcBButtonTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForW
|
|
|
12
12
|
this.name = "Button";
|
|
13
13
|
this.description = "basic IgcButton";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcBButtonTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcTabsTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForWebC
|
|
|
12
12
|
this.name = "Button group";
|
|
13
13
|
this.description = "basic IgcButtonGroup";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcTabsTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcCalendarTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIFor
|
|
|
12
12
|
this.name = "Calendar";
|
|
13
13
|
this.description = "basic IgcCalendar";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcCalendarTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcCardTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForWebC
|
|
|
12
12
|
this.name = "Card";
|
|
13
13
|
this.description = "basic IgcCard";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcCardTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcCheckboxTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIFor
|
|
|
12
12
|
this.name = "Checkbox";
|
|
13
13
|
this.description = "basic IgcCheckbox";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcCheckboxTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcChipTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForWebC
|
|
|
12
12
|
this.name = "Chip";
|
|
13
13
|
this.description = "Basic IgcChip";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcChipTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcCircularProgressTemplate extends IgniteUIForWebComponentsTemplate_1.Ign
|
|
|
12
12
|
this.name = "Circular Progress";
|
|
13
13
|
this.description = "Basic Circular Progress";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcCircularProgressTemplate();
|
|
@@ -11,5 +11,8 @@ class IgcSubscriptionFormTemplate extends IgniteUIForWebComponentsTemplate_1.Ign
|
|
|
11
11
|
this.name = "Subscription Form";
|
|
12
12
|
this.description = "Subscription form with inputs, buttons and a checkbox inside";
|
|
13
13
|
}
|
|
14
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
15
|
+
// not applicable with custom module
|
|
16
|
+
}
|
|
14
17
|
}
|
|
15
18
|
module.exports = new IgcSubscriptionFormTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcDateTimeInputTemplate extends IgniteUIForWebComponentsTemplate_1.Ignite
|
|
|
12
12
|
this.name = "Date Time Input";
|
|
13
13
|
this.description = "basic IgcDateTimeInput";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcDateTimeInputTemplate();
|
|
@@ -13,5 +13,8 @@ class IgcDockManagerTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUI
|
|
|
13
13
|
this.description = "Dock Manager with most functionalities and docking options";
|
|
14
14
|
this.packages = ["igniteui-dockmanager@~1.12.4"];
|
|
15
15
|
}
|
|
16
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
17
|
+
// not applicable with custom module
|
|
18
|
+
}
|
|
16
19
|
}
|
|
17
20
|
module.exports = new IgcDockManagerTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcDropdownTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIFor
|
|
|
12
12
|
this.name = "Dropdown";
|
|
13
13
|
this.description = "IgcDropdown with groups and disabled items";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcDropdownTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcDropdownTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIFor
|
|
|
12
12
|
this.name = "Expansion Panel";
|
|
13
13
|
this.description = "A lightweight accordion component";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcDropdownTemplate();
|
|
@@ -16,5 +16,8 @@ class IgcFinancialChartTemplate extends IgniteUIForWebComponentsTemplate_1.Ignit
|
|
|
16
16
|
"igniteui-webcomponents-charts@~4.2.5"
|
|
17
17
|
];
|
|
18
18
|
}
|
|
19
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
20
|
+
// not applicable with custom module
|
|
21
|
+
}
|
|
19
22
|
}
|
|
20
23
|
module.exports = new IgcFinancialChartTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcFormTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForWebC
|
|
|
12
12
|
this.name = "Form";
|
|
13
13
|
this.description = "basic IgcForm";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcFormTemplate();
|
|
@@ -18,5 +18,8 @@ class IgcGridTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForWebC
|
|
|
18
18
|
"igniteui-webcomponents-layouts@~4.2.5"
|
|
19
19
|
];
|
|
20
20
|
}
|
|
21
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
22
|
+
// not applicable with custom module
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
25
|
module.exports = new IgcGridTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcGridEditingTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUI
|
|
|
12
12
|
this.name = "Grid Editing";
|
|
13
13
|
this.description = "IgcGrid with editing enabled";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcGridEditingTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcGridSummariesTemplate extends IgniteUIForWebComponentsTemplate_1.Ignite
|
|
|
12
12
|
this.name = "Grid Summaries";
|
|
13
13
|
this.description = "IgcGrid with column summaries";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcGridSummariesTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcIconTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForWebC
|
|
|
12
12
|
this.name = "Icon";
|
|
13
13
|
this.description = "basic IgcIcon";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcIconTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcIconButtonTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIF
|
|
|
12
12
|
this.name = "Icon Button";
|
|
13
13
|
this.description = "basic IgcIconButton";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcIconButtonTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcInputTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForWeb
|
|
|
12
12
|
this.name = "Input";
|
|
13
13
|
this.description = "basic IgcInput";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcInputTemplate();
|
|
@@ -16,5 +16,8 @@ class IgcLinearGaugeTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUI
|
|
|
16
16
|
"igniteui-webcomponents-gauges@~4.2.5"
|
|
17
17
|
];
|
|
18
18
|
}
|
|
19
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
20
|
+
// not applicable with custom module
|
|
21
|
+
}
|
|
19
22
|
}
|
|
20
23
|
module.exports = new IgcLinearGaugeTemplate();
|
|
@@ -16,5 +16,8 @@ class IgcLinearProgressComponent extends IgniteUIForWebComponentsTemplate_1.Igni
|
|
|
16
16
|
"igniteui-webcomponents-charts@~4.2.5"
|
|
17
17
|
];
|
|
18
18
|
}
|
|
19
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
20
|
+
// not applicable with custom module
|
|
21
|
+
}
|
|
19
22
|
}
|
|
20
23
|
module.exports = new IgcLinearProgressComponent();
|
|
@@ -12,5 +12,8 @@ class IgcListTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForWebC
|
|
|
12
12
|
this.name = "List";
|
|
13
13
|
this.description = "basic IgcList";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcListTemplate();
|
|
@@ -12,5 +12,8 @@ class IgcNavbarTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForWe
|
|
|
12
12
|
this.name = "Navbar";
|
|
13
13
|
this.description = "basic IgcNavbar";
|
|
14
14
|
}
|
|
15
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
16
|
+
// not applicable with custom module
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
module.exports = new IgcNavbarTemplate();
|
|
@@ -16,5 +16,8 @@ class IgcPieChartTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIFor
|
|
|
16
16
|
"igniteui-webcomponents-charts@~4.2.5"
|
|
17
17
|
];
|
|
18
18
|
}
|
|
19
|
+
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
20
|
+
// not applicable with custom module
|
|
21
|
+
}
|
|
19
22
|
}
|
|
20
23
|
module.exports = new IgcPieChartTemplate();
|