@magic-xpa/cli 4.800.0-dev480.94 → 4.801.0-dev000.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/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/collection.json +1 -0
- package/src/public_api.js +3 -3
- package/src/public_api.js.map +1 -1
- package/src/schematics/magic-utils/env.js +5 -5
- package/src/schematics/magic-utils/env.js.map +1 -1
- package/src/schematics/magic-utils/env.ts +5 -5
- package/src/schematics/magic-utils/metadata.class.js +3 -3
- package/src/schematics/magic-utils/metadata.class.js.map +1 -1
- package/src/schematics/magic-utils/process-json.js +4 -4
- package/src/schematics/magic-utils/process-json.js.map +1 -1
- package/src/schematics/magic-utils/rules/build-control.rule.js +4 -4
- package/src/schematics/magic-utils/rules/build-control.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/build-view.rule.js +4 -4
- package/src/schematics/magic-utils/rules/build-view.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/component-list.rule.js +31 -54
- package/src/schematics/magic-utils/rules/component-list.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/component-list.rule.ts +3 -32
- package/src/schematics/magic-utils/rules/generate.rule.js +3 -3
- package/src/schematics/magic-utils/rules/generate.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-add-modules.rule.js +40 -24
- package/src/schematics/magic-utils/rules/init-add-modules.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-add-modules.rule.ts +21 -1
- package/src/schematics/magic-utils/rules/init-gen-components.rule.js +9 -9
- package/src/schematics/magic-utils/rules/init-gen-components.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js +2 -2
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/load-views-gen.rule.js +5 -5
- package/src/schematics/magic-utils/rules/load-views-gen.rule.js.map +1 -1
- package/src/schematics/magic-utils/utils.js +10 -10
- package/src/schematics/magic-utils/utils.js.map +1 -1
- package/src/schematics/mg-Install-prerequisites/index.js +3 -3
- package/src/schematics/mg-Install-prerequisites/index.js.map +1 -1
- package/src/schematics/mg-Install-prerequisites/schema.json +1 -1
- package/src/schematics/mg-add/files/src/app/magic/lazy-loader.service.ts +10 -0
- package/src/schematics/mg-add/files/src/app/magic/magic.gen.lib.module.ts +3 -1
- package/src/schematics/mg-add/index.js +52 -16
- package/src/schematics/mg-add/index.js.map +1 -1
- package/src/schematics/mg-add/index.ts +42 -3
- package/src/schematics/mg-add/schema.json +1 -1
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.js +2 -2
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.js.map +1 -1
- package/src/schematics/mg-add-tasks/schema.json +1 -1
- package/src/schematics/mg-delete-files/index.js +3 -3
- package/src/schematics/mg-delete-files/index.js.map +1 -1
- package/src/schematics/mg-delete-files/schema.json +1 -1
- package/src/schematics/mg-gen-module/index.js +4 -4
- package/src/schematics/mg-gen-module/index.js.map +1 -1
- package/src/schematics/mg-gen-module/schema.json +1 -1
- package/src/schematics/mg-generate/index.js +3 -3
- package/src/schematics/mg-generate/index.js.map +1 -1
- package/src/schematics/mg-generate/schema.json +1 -1
- package/src/schematics/mg-install/index.js +2 -2
- package/src/schematics/mg-install/index.js.map +1 -1
- package/src/schematics/mg-install/schema.json +1 -1
- package/src/schematics/mg-routes/index.js +6 -6
- package/src/schematics/mg-routes/index.js.map +1 -1
- package/src/schematics/mg-routes/schema.json +1 -1
- package/src/schematics/mg-single-control/index.js +4 -4
- package/src/schematics/mg-single-control/index.js.map +1 -1
- package/src/schematics/mg-single-control/schema.json +1 -1
- package/src/schematics/utils/ast.js +6 -6
- package/src/schematics/utils/ast.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ast-utils_old.js +2 -2
- package/src/schematics/utils/devkit-utils/ast-utils_old.js.map +1 -1
- package/src/schematics/utils/devkit-utils/component.js +16 -16
- package/src/schematics/utils/devkit-utils/component.js.map +1 -1
- package/src/schematics/utils/devkit-utils/find-module.js +11 -11
- package/src/schematics/utils/devkit-utils/find-module.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ng-ast-utils.js +6 -6
- package/src/schematics/utils/devkit-utils/ng-ast-utils.js.map +1 -1
- package/src/schematics/utils/devkit-utils/parse-name.js +3 -3
- package/src/schematics/utils/devkit-utils/parse-name.js.map +1 -1
- package/src/schematics/utils/devkit-utils/route-utils.js +16 -16
- package/src/schematics/utils/devkit-utils/route-utils.js.map +1 -1
- package/src/schematics/utils/html.js +1 -1
- package/src/schematics/utils/html.js.map +1 -1
- package/src/schematics/utils/testing.js +1 -1
- package/src/schematics/utils/testing.js.map +1 -1
- package/src/types/enums/Enums.js +5 -1
- package/src/types/enums/Enums.js.map +1 -1
- package/src/types/index.js +7 -7
- package/src/types/index.js.map +1 -1
- package/templates/themes/material/edit.ejs +16 -0
|
@@ -27,7 +27,7 @@ function initGenModules(options) {
|
|
|
27
27
|
env_1.env.modulesGen.push(moduleInfo);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
Util_1.LogLn(` Number of modules to be check for generate: ${web_modules.length}`);
|
|
30
|
+
(0, Util_1.LogLn)(` Number of modules to be check for generate: ${web_modules.length}`);
|
|
31
31
|
return tree;
|
|
32
32
|
};
|
|
33
33
|
}
|
|
@@ -38,7 +38,7 @@ exports.initGenModules = initGenModules;
|
|
|
38
38
|
function overwriteWebModuleFileName(options, moduleNameFileName, content) {
|
|
39
39
|
return (tree, _context) => {
|
|
40
40
|
if (!tree.exists(moduleNameFileName)) {
|
|
41
|
-
Util_1.LogLn(` [>Error] File cannot be overwrite, The file is not exist !!! : ${moduleNameFileName}`);
|
|
41
|
+
(0, Util_1.LogLn)(` [>Error] File cannot be overwrite, The file is not exist !!! : ${moduleNameFileName}`);
|
|
42
42
|
}
|
|
43
43
|
tree.overwrite(moduleNameFileName, content);
|
|
44
44
|
return tree;
|
|
@@ -64,7 +64,7 @@ function updateWebModuleFileWithNewClassName(options, webModuleName) {
|
|
|
64
64
|
let newsourceText = sourceText.replace(`MagicGenLibModule`, newClassModuleName);
|
|
65
65
|
rules.push(overwriteWebModuleFileName(options, origModuleFileName, newsourceText));
|
|
66
66
|
}
|
|
67
|
-
return schematics_1.chain(rules)(tree, context);
|
|
67
|
+
return (0, schematics_1.chain)(rules)(tree, context);
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
exports.updateWebModuleFileWithNewClassName = updateWebModuleFileWithNewClassName;
|
|
@@ -74,16 +74,31 @@ exports.updateWebModuleFileWithNewClassName = updateWebModuleFileWithNewClassNam
|
|
|
74
74
|
function copyDefaultMagicFilesToWebModule(options, webModuleName) {
|
|
75
75
|
return (tree, context) => {
|
|
76
76
|
const webModulePath = getDestinationModulePathByWebModuleName(webModuleName);
|
|
77
|
-
return schematics_1.chain([
|
|
78
|
-
schematics_1.branchAndMerge(schematics_1.chain([
|
|
79
|
-
schematics_1.mergeWith(schematics_1.apply(schematics_1.url(`./../mg-add/files/src/app/magic/`), [
|
|
80
|
-
schematics_1.move(webModulePath)
|
|
77
|
+
return (0, schematics_1.chain)([
|
|
78
|
+
(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
|
|
79
|
+
(0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(`./../mg-add/files/src/app/magic/`), [
|
|
80
|
+
(0, schematics_1.move)(webModulePath)
|
|
81
81
|
]), schematics_1.MergeStrategy.AllowCreationConflict)
|
|
82
82
|
]))
|
|
83
83
|
])(tree, context);
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
//-------------------------------------------------------------------------------------------------
|
|
87
|
+
// delete LazyLoadService for non root modules
|
|
88
|
+
//-------------------------------------------------------------------------------------------------
|
|
89
|
+
function deleteLazyLoadService(webModuleName) {
|
|
90
|
+
return (tree) => {
|
|
91
|
+
const lazyLoaderServicePath = getDestinationModulePathByWebModuleName(webModuleName) + '/lazy-loader.service.ts';
|
|
92
|
+
if (webModuleName != '') {
|
|
93
|
+
if (!tree.exists(lazyLoaderServicePath)) {
|
|
94
|
+
(0, Util_1.LogLn)(` [>Error] File cannot be overwrite, The file is not exist !!! :lazyLoaderServicePath`);
|
|
95
|
+
}
|
|
96
|
+
tree.delete(lazyLoaderServicePath);
|
|
97
|
+
return tree;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
//-------------------------------------------------------------------------------------------------
|
|
87
102
|
// get destination path according to the send webModuleName
|
|
88
103
|
//-------------------------------------------------------------------------------------------------
|
|
89
104
|
function getDestinationModulePathByWebModuleName(webModuleName) {
|
|
@@ -111,10 +126,10 @@ function getWebModuleClass(webModuleName) {
|
|
|
111
126
|
function addMagicModuleToAppModule(options, modulePath, moduleName, srcModuleName) {
|
|
112
127
|
return (tree, context) => {
|
|
113
128
|
const project = env_1.env.project;
|
|
114
|
-
Util_1.LogLn(` [>] add New Web Module :[${moduleName}] `);
|
|
115
|
-
Util_1.LogLn(` [>] from :[${srcModuleName}]`);
|
|
116
|
-
Util_1.LogLn(` [>] To App Module :[${modulePath}]`);
|
|
117
|
-
ast_1.addModuleImportToModule(tree, modulePath, // for now we will update env.metadata.paths.magicGenLibModule
|
|
129
|
+
(0, Util_1.LogLn)(` [>] add New Web Module :[${moduleName}] `);
|
|
130
|
+
(0, Util_1.LogLn)(` [>] from :[${srcModuleName}]`);
|
|
131
|
+
(0, Util_1.LogLn)(` [>] To App Module :[${modulePath}]`);
|
|
132
|
+
(0, ast_1.addModuleImportToModule)(tree, modulePath, // for now we will update env.metadata.paths.magicGenLibModule
|
|
118
133
|
moduleName, // 'MagicXXXModule',
|
|
119
134
|
srcModuleName);
|
|
120
135
|
return tree;
|
|
@@ -131,13 +146,14 @@ function checkAndCreateModule(options, webModuleName, loadOnDemand) {
|
|
|
131
146
|
if (!tree.exists(webModuleFullFileName)) {
|
|
132
147
|
rules.push(copyDefaultMagicFilesToWebModule(options, webModuleName));
|
|
133
148
|
rules.push(updateWebModuleFileWithNewClassName(tree, webModuleName));
|
|
149
|
+
rules.push(deleteLazyLoadService(webModuleName));
|
|
134
150
|
// for NON load on demand we need to update magic root module
|
|
135
151
|
if (!loadOnDemand) {
|
|
136
152
|
const newDestModulePath = `./${webModuleName}/magic.gen.lib.module`;
|
|
137
153
|
const webModuleClass = getWebModuleClass(webModuleName);
|
|
138
154
|
rules.push(addMagicModuleToAppModule(options, env_1.env.metadata.paths.magicGenLibModule, webModuleClass, newDestModulePath));
|
|
139
155
|
}
|
|
140
|
-
return schematics_1.chain(rules)(tree, context);
|
|
156
|
+
return (0, schematics_1.chain)(rules)(tree, context);
|
|
141
157
|
}
|
|
142
158
|
;
|
|
143
159
|
};
|
|
@@ -149,10 +165,10 @@ exports.checkAndCreateModule = checkAndCreateModule;
|
|
|
149
165
|
function generateWebModule(options, webModuleName, loadOnDemand) {
|
|
150
166
|
return (tree, context) => {
|
|
151
167
|
let rules = [];
|
|
152
|
-
Util_1.LogLn(` [>]Handling Web Module named: [${webModuleName}] isLoadOnDemand: [${loadOnDemand}]`);
|
|
168
|
+
(0, Util_1.LogLn)(` [>]Handling Web Module named: [${webModuleName}] isLoadOnDemand: [${loadOnDemand}]`);
|
|
153
169
|
rules.push(checkAndCreateModule(options, webModuleName, loadOnDemand));
|
|
154
170
|
rules.push(checkAndCreateRouteForModule(options, webModuleName, loadOnDemand));
|
|
155
|
-
return schematics_1.chain(rules)(tree, context);
|
|
171
|
+
return (0, schematics_1.chain)(rules)(tree, context);
|
|
156
172
|
};
|
|
157
173
|
}
|
|
158
174
|
exports.generateWebModule = generateWebModule;
|
|
@@ -167,7 +183,7 @@ function generateWebModules(options) {
|
|
|
167
183
|
rules.push(generateWebModule(options, webModuleInfo.moduleName, webModuleInfo.loadOnDemand));
|
|
168
184
|
}
|
|
169
185
|
}
|
|
170
|
-
return schematics_1.chain(rules)(tree, context);
|
|
186
|
+
return (0, schematics_1.chain)(rules)(tree, context);
|
|
171
187
|
};
|
|
172
188
|
}
|
|
173
189
|
exports.generateWebModules = generateWebModules;
|
|
@@ -188,7 +204,7 @@ function checkAndCreateRouteForModule(options, webModuleName, loadOnDemand) {
|
|
|
188
204
|
rules.push(addRouteFileToModuleFile(options, webModuleName));
|
|
189
205
|
}
|
|
190
206
|
}
|
|
191
|
-
return schematics_1.chain(rules)(tree, context);
|
|
207
|
+
return (0, schematics_1.chain)(rules)(tree, context);
|
|
192
208
|
};
|
|
193
209
|
}
|
|
194
210
|
exports.checkAndCreateRouteForModule = checkAndCreateRouteForModule;
|
|
@@ -215,7 +231,7 @@ function createRoute(options, webModuleName) {
|
|
|
215
231
|
// --------------------------------------------------------
|
|
216
232
|
// update the new MagicRoutingModule in file magic.gen.lib.module.ts of the module
|
|
217
233
|
rules.push(addRouteFileToModuleFile(options, webModuleName));
|
|
218
|
-
return schematics_1.chain(rules)(tree, context);
|
|
234
|
+
return (0, schematics_1.chain)(rules)(tree, context);
|
|
219
235
|
};
|
|
220
236
|
}
|
|
221
237
|
exports.createRoute = createRoute;
|
|
@@ -229,7 +245,7 @@ function addRouteFileToModuleFile(options, webModuleName) {
|
|
|
229
245
|
const moduleName = `MagicRoutingModule`; //for now it will be the same for all modules ... getWebModuleClass(webModuleName);
|
|
230
246
|
const srcModuleName = `./app.routes`;
|
|
231
247
|
rules.push(addMagicModuleToAppModule(options, modulePath, moduleName, srcModuleName));
|
|
232
|
-
return schematics_1.chain(rules)(tree, context);
|
|
248
|
+
return (0, schematics_1.chain)(rules)(tree, context);
|
|
233
249
|
};
|
|
234
250
|
}
|
|
235
251
|
exports.addRouteFileToModuleFile = addRouteFileToModuleFile;
|
|
@@ -241,15 +257,15 @@ function copyDefaultRouteMagicFilesToWebModule(options, webModuleName) {
|
|
|
241
257
|
const routeFileForWebModulePath = env_1.env.metadata.paths.getRoutePathForWebModule(webModuleName);
|
|
242
258
|
if (tree.exists(routeFileForWebModulePath)) {
|
|
243
259
|
let rules = [];
|
|
244
|
-
return schematics_1.chain(rules)(tree, context);
|
|
260
|
+
return (0, schematics_1.chain)(rules)(tree, context);
|
|
245
261
|
}
|
|
246
262
|
else {
|
|
247
263
|
const webModulePath = getDestinationModulePathByWebModuleName(webModuleName);
|
|
248
|
-
Util_1.LogLn(`[ >] copy default Route file to webModule [${webModuleName}]`);
|
|
249
|
-
return schematics_1.chain([
|
|
250
|
-
schematics_1.branchAndMerge(schematics_1.chain([
|
|
251
|
-
schematics_1.mergeWith(schematics_1.apply(schematics_1.url(`./../mg-add/webModule/`), [
|
|
252
|
-
schematics_1.move(webModulePath)
|
|
264
|
+
(0, Util_1.LogLn)(`[ >] copy default Route file to webModule [${webModuleName}]`);
|
|
265
|
+
return (0, schematics_1.chain)([
|
|
266
|
+
(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
|
|
267
|
+
(0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(`./../mg-add/webModule/`), [
|
|
268
|
+
(0, schematics_1.move)(webModulePath)
|
|
253
269
|
]), schematics_1.MergeStrategy.AllowCreationConflict)
|
|
254
270
|
]))
|
|
255
271
|
])(tree, context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-add-modules.rule.js","sourceRoot":"","sources":["init-add-modules.rule.ts"],"names":[],"mappings":";;;AAAA,2DASoC;AAEpC,gCAAoE;AACpE,kCAAgC;AAEhC,yCAAuE;AACvE,2EAAqE;AAIrE,mGAAmG;AACnG,2CAA2C;AAC3C,mGAAmG;AACnG,SAAgB,cAAc,CAAC,OAA0B;IACvD,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,IAAI,QAAQ,GAAG,SAAG,CAAC,QAAQ,CAAC;QAC5B,SAAG,CAAC,UAAU,GAAG,EAAE,CAAC;QACpB,IAAI,WAAW,GAAoB,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;QAE/D,8CAA8C;QAC9C,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,IAAI,UAAU,GAAiB,IAAI,0BAAU,CAA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AAC,CAAC;AACJ,CAAC;AAbD,4DAaC;AACD,mGAAmG;AACnG,sDAAsD;AACtD,mGAAmG;AACnG,SAAS,qCAAqC,CAAC,OAAyB,EAAE,aAAoB;IAC5F,OAAO,CAAC,IAAU,EAAC,OAAwB,EAAE,EAAE;QAC7C,MAAM,yBAAyB,GAAG,SAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;QAG7F,IAAG,IAAI,CAAC,MAAM,CAAC,yBAAyB,CAAC,EACzC;YACE,IAAI,KAAK,GAAU,EAAE,CAAC;YACtB,OAAO,kBAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAC,OAAO,CAAC,CAAC;SACnC;aAED;YACE,MAAM,aAAa,GAAG,uCAAuC,CAAC,aAAa,CAAC,CAAC;YAC7E,YAAK,CAAC,8CAA8C,aAAa,GAAG,CAAC,CAAA;YACrE,OAAO,kBAAK,CAAC;gBACX,2BAAc,CAAC,kBAAK,CAAC;oBACnB,sBAAS,CACP,kBAAK,CAAC,gBAAG,CAAC,wBAAwB,CAAC,EAAE;wBAEnC,iBAAI,CAAC,aAAa,CAAC;qBACpB,CAAC,EAAE,0BAAa,CAAC,qBAAqB,CAAC;iBAC3C,CAAC,CAAC;aACJ,CAAC,CAAC,IAAI,EAAC,OAAO,CAAC,CAAC;SAClB;IACH,CAAC,CAAA;AACH,CAAC","sourcesContent":["import {\n apply, branchAndMerge,\n chain,\n MergeStrategy, mergeWith,\n move,\n Rule,\n SchematicContext, SchematicsException,\n Tree,\n url\n} from \"@angular-devkit/schematics\";\nimport { MagicOptionScheme } from \"./magic-option.scheme\";\nimport {env, GEN_FOLDER, GEN_LAZY_LOAD_MODULES_ARRAY} from \"../env\";\nimport { LogLn } from \"../Util\";\nimport { Route, RouteTable, webModuleItem } from \"../../../types/interfaces/app\";\nimport {addModuleImportToModule, getSourceFile} from \"../../utils/ast\";\nimport { ModuleInfo } from \"../../../types/interfaces/env.interface\";\n\nimport {findNodes} from \"../../utils/devkit-utils/ast-utils\";\nimport * as ts from \"typescript\";\n//-------------------------------------------------------------------------------------------------\n// init generate module into env.modulesGen\n//-------------------------------------------------------------------------------------------------\nexport function initGenModules(options: MagicOptionScheme): Rule {\n return (tree: Tree, context: SchematicContext) => {\n let metadata = env.metadata;\n env.modulesGen = [];\n let web_modules:webModuleItem [] = metadata.config.web_modules;\n\n // Generate only one module from --module=xxxx\n if (options.module) {\n let moduleInfo : ModuleInfo = new ModuleInfo(options.module, options.loadOnDemand);\n env.modulesGen.push(moduleInfo)\n } else {\n\n // Generate list of components from config.json, properties web_modules.module_name\n for (let modulePath of web_modules) {\n //LogLn(` Web Module name: [${modulePath.module_name}] IsLoadOnDemand? [${modulePath.load_on_demand}]`);\n let moduleInfo : ModuleInfo = new ModuleInfo(modulePath.module_name, modulePath.load_on_demand);\n env.modulesGen.push(moduleInfo);\n }\n }\n LogLn(` Number of modules to be check for generate: ${web_modules.length}`);\n\n\n\n return tree;\n };\n}\n\n//-------------------------------------------------------------------------------------------------\n// overwrite the web module file name with the new content\n//-------------------------------------------------------------------------------------------------\nexport function overwriteWebModuleFileName(options: any, moduleNameFileName:string, content:string): Rule {\n return (tree: Tree, _context: SchematicContext) => {\n\n if(!tree.exists(moduleNameFileName)){\n LogLn(` [>Error] File cannot be overwrite, The file is not exist !!! : ${moduleNameFileName}`);\n }\n\n tree.overwrite(moduleNameFileName, content);\n return tree;\n };\n}\n\n//-------------------------------------------------------------------------------------------------\n// update the the web module file name with the new class name\n//-------------------------------------------------------------------------------------------------\nexport function updateWebModuleFileWithNewClassName(options: any, webModuleName:string): Rule {\n return (tree: Tree, context: SchematicContext) => {\n let rules:Rule[] = [];\n\n const origModuleFileName = getWebModuleFullFileName(webModuleName)\n\n // create new class name for \"web Module Name\"\n let newClassModuleName = getWebModuleClass(webModuleName );\n\n //read the exist module file name\n const text = tree.read(origModuleFileName);\n\n if (text === null) {\n throw new SchematicsException(`File ${origModuleFileName} does not exist.`);\n }\n let sourceText = text.toString('utf-8');\n\n if (sourceText !== \"\") {\n let newsourceText: string = sourceText.replace(`MagicGenLibModule`, newClassModuleName);\n rules.push(overwriteWebModuleFileName(options, origModuleFileName, newsourceText));\n\n }\n return chain(rules)(tree, context);\n };\n}\n\n//-------------------------------------------------------------------------------------------------\n// copy the two default files into the web module path\n//-------------------------------------------------------------------------------------------------\nfunction copyDefaultMagicFilesToWebModule(options:MagicOptionScheme, webModuleName:string): Rule {\n return (tree: Tree,context:SchematicContext) => {\n const webModulePath = getDestinationModulePathByWebModuleName(webModuleName);\n\n return chain([\n branchAndMerge(chain([\n mergeWith(\n apply(url(`./../mg-add/files/src/app/magic/`), [\n\n move(webModulePath)\n ]), MergeStrategy.AllowCreationConflict)\n ]))\n ])(tree,context);\n }\n}\n\n//-------------------------------------------------------------------------------------------------\n// get destination path according to the send webModuleName\n//-------------------------------------------------------------------------------------------------\n export function getDestinationModulePathByWebModuleName(webModuleName:string):string {\n const newDestModulePath = `${env.metadata.paths.rootMagicGenFolder}/${GEN_FOLDER}/${webModuleName}`;\n return newDestModulePath;\n}\n\n//-------------------------------------------------------------------------------------------------\n// get web module full file name according to the send webModuleName\n//-------------------------------------------------------------------------------------------------\nfunction getWebModuleFullFileName(webModuleName:string):string {\n// calc the path of new the module\n const newDestModulePath = getDestinationModulePathByWebModuleName(webModuleName);\n return `${newDestModulePath}/magic.gen.lib.module.ts`;\n}\n\n//-------------------------------------------------------------------------------------------------\n// get web module class according to the send webModuleName\n//-------------------------------------------------------------------------------------------------\nfunction getWebModuleClass(webModuleName:string):string {\n return `Magic` + webModuleName + `Module`;\n}\n\n\n//-------------------------------------------------------------------------------------------------\n// add magic module to app module\n//-------------------------------------------------------------------------------------------------\nfunction addMagicModuleToAppModule(options: MagicOptionScheme, modulePath:string, moduleName:string, srcModuleName:string) : Rule {\n return (tree: Tree , context : SchematicContext)=>{\n const project = env.project;\n\n LogLn(` [>] add New Web Module :[${moduleName}] `);\n LogLn(` [>] from :[${srcModuleName}]`);\n LogLn(` [>] To App Module :[${modulePath}]`);\n addModuleImportToModule(\n tree,\n modulePath, // for now we will update env.metadata.paths.magicGenLibModule\n moduleName, // 'MagicXXXModule',\n srcModuleName, // `./XXX/magic.gen.lib.module`\n );\n return tree;\n }\n}\n\n//-------------------------------------------------------------------------------------------------\n// create module\n//-------------------------------------------------------------------------------------------------\nexport function checkAndCreateModule(options: MagicOptionScheme, webModuleName:string, loadOnDemand: boolean ): Rule {\n return (tree: Tree, context: SchematicContext) => {\n\n let rules: Rule[] = [];\n const webModuleFullFileName = getWebModuleFullFileName(webModuleName);\n // only if not exist create the new 2 files magic.gen.lib.module.ts & component-list.g.ts\n if (!tree.exists(webModuleFullFileName)) {\n rules.push(copyDefaultMagicFilesToWebModule(options, webModuleName));\n rules.push(updateWebModuleFileWithNewClassName(tree, webModuleName));\n\n // for NON load on demand we need to update magic root module\n if (!loadOnDemand) {\n const newDestModulePath = `./${webModuleName}/magic.gen.lib.module`;\n const webModuleClass = getWebModuleClass(webModuleName);\n rules.push(addMagicModuleToAppModule(options, env.metadata.paths.magicGenLibModule, webModuleClass, newDestModulePath));\n }\n return chain(rules)(tree, context);\n }\n ;\n }\n}\n\n//-------------------------------------------------------------------------------------------------\n// check if module is exist, only if not exist create the web module\n//-------------------------------------------------------------------------------------------------\nexport function generateWebModule(options: MagicOptionScheme, webModuleName:string, loadOnDemand:boolean ): Rule {\n return (tree: Tree, context: SchematicContext) => {\n\n let rules:Rule[] = [];\n\n LogLn(` [>]Handling Web Module named: [${webModuleName}] isLoadOnDemand: [${loadOnDemand}]`);\n rules.push(checkAndCreateModule(options, webModuleName, loadOnDemand));\n rules.push(checkAndCreateRouteForModule(options, webModuleName, loadOnDemand));\n\n return chain(rules)(tree,context);\n };\n}\n\n\n//-------------------------------------------------------------------------------------------------\n// generate all the modules in env.modulesGen\n//-------------------------------------------------------------------------------------------------\nexport function generateWebModules(options: MagicOptionScheme): Rule {\n return (tree: Tree, context: SchematicContext) => {\n\n let rules:Rule[] = [];\n\n for (let webModuleInfo of env.modulesGen){\n if (webModuleInfo.moduleName !== undefined && webModuleInfo.moduleName !== \"\") {\n rules.push(generateWebModule(options, webModuleInfo.moduleName, webModuleInfo.loadOnDemand));\n }\n }\n\n return chain(rules)(tree,context);\n };\n}\n\n\n\n//-------------------------------------------------------------------------------------------------\n// check if module is exist, only if not exist create the web module\n//-------------------------------------------------------------------------------------------------\nexport function checkAndCreateRouteForModule(options: MagicOptionScheme, webModuleName:string, loadOnDemand :boolean): Rule {\n return (tree: Tree, context: SchematicContext) => {\n\n let rules:Rule[] = [];\n\n if (loadOnDemand) {\n const newDestRoutePathForModule = env.metadata.paths.getRoutePathForWebModule(webModuleName);\n\n // only if file not exist then copy the default route\n if (!tree.exists(newDestRoutePathForModule)) {\n rules.push(createRoute(options, webModuleName));\n }\n else{\n // if file exist then only update the magic.gen.lib.module.ts\n rules.push(addRouteFileToModuleFile(options, webModuleName));\n }\n }\n return chain(rules)(tree,context);\n };\n}\n\n\n\n//-------------------------------------------------------------------------------------------------\n// create route for module\n//-------------------------------------------------------------------------------------------------\nexport function createRoute(options: MagicOptionScheme, webModuleName:string): Rule {\n return (tree: Tree, context: SchematicContext) => {\n\n let rules:Rule[] = [];\n\n rules.push(copyDefaultRouteMagicFilesToWebModule(options, webModuleName));\n // --------------------------------------------------------\n // // generate the route for module /////\n // let routeItem : RouteTable = new RouteTable();\n // routeItem.module_name = webModuleName;\n //\n // let route:Route = new Route();\n // route.ModuleName = webModuleName;\n // route.OutletName=\"\";\n // route.RouteName=\"\";\n // route.children=null;\n //\n // routeItem.routesArray = [route];\n // rules.push(genRouteFile(options, routeItem ));\n // --------------------------------------------------------\n // update the new MagicRoutingModule in file magic.gen.lib.module.ts of the module\n\n\n rules.push(addRouteFileToModuleFile(options, webModuleName));\n\n return chain(rules)(tree,context);\n };\n}\n\n//-------------------------------------------------------------------------------------------------\n// create route for module\n//-------------------------------------------------------------------------------------------------\nexport function addRouteFileToModuleFile(options: MagicOptionScheme, webModuleName:string): Rule {\n return (tree: Tree, context: SchematicContext) => {\n\n let rules:Rule[] = [];\n\n const modulePath = getWebModuleFullFileName(webModuleName); // get the magic.gen.lib.module.ts according to the module name\n const moduleName = `MagicRoutingModule`;//for now it will be the same for all modules ... getWebModuleClass(webModuleName);\n const srcModuleName = `./app.routes`;\n\n rules.push(addMagicModuleToAppModule(options, modulePath, moduleName, srcModuleName));\n\n return chain(rules)(tree,context);\n };\n}\n//-------------------------------------------------------------------------------------------------\n// copy the two default files into the web module path\n//-------------------------------------------------------------------------------------------------\nfunction copyDefaultRouteMagicFilesToWebModule(options:MagicOptionScheme, webModuleName:string): Rule {\n return (tree: Tree,context:SchematicContext) => {\n const routeFileForWebModulePath = env.metadata.paths.getRoutePathForWebModule(webModuleName);\n\n\n if(tree.exists(routeFileForWebModulePath))\n {\n let rules:Rule[] = [];\n return chain(rules)(tree,context);\n }\n else\n {\n const webModulePath = getDestinationModulePathByWebModuleName(webModuleName);\n LogLn(`[ >] copy default Route file to webModule [${webModuleName}]`)\n return chain([\n branchAndMerge(chain([\n mergeWith(\n apply(url(`./../mg-add/webModule/`), [\n\n move(webModulePath)\n ]), MergeStrategy.AllowCreationConflict)\n ]))\n ])(tree,context);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"init-add-modules.rule.js","sourceRoot":"","sources":["init-add-modules.rule.ts"],"names":[],"mappings":";;;AAAA,2DASoC;AAEpC,gCAAoE;AACpE,kCAAgC;AAEhC,yCAAuE;AACvE,2EAAqE;AAIrE,mGAAmG;AACnG,2CAA2C;AAC3C,mGAAmG;AACnG,SAAgB,cAAc,CAAC,OAA0B;IACvD,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,IAAI,QAAQ,GAAG,SAAG,CAAC,QAAQ,CAAC;QAC5B,SAAG,CAAC,UAAU,GAAG,EAAE,CAAC;QACpB,IAAI,WAAW,GAAoB,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;QAE/D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AC,CAAC;YAC7E,IAAA,YAAK,EAAC,8CAA8C,aAAa,GAAG,CAAC,CAAA;YACrE,OAAO,IAAA,kBAAK,EAAC;gBACX,IAAA,2BAAc,EAAC,IAAA,kBAAK,EAAC;oBACnB,IAAA,sBAAS,EACP,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,wBAAwB,CAAC,EAAE;wBAEnC,IAAA,iBAAI,EAAC,aAAa,CAAC;qBACpB,CAAC,EAAE,0BAAa,CAAC,qBAAqB,CAAC;iBAC3C,CAAC,CAAC;aACJ,CAAC,CAAC,IAAI,EAAC,OAAO,CAAC,CAAC;SAClB;IACH,CAAC,CAAA;AACH,CAAC","sourcesContent":["import {\n apply, branchAndMerge,\n chain,\n MergeStrategy, mergeWith,\n move,\n Rule,\n SchematicContext, SchematicsException,\n Tree,\n url\n} from \"@angular-devkit/schematics\";\nimport { MagicOptionScheme } from \"./magic-option.scheme\";\nimport {env, GEN_FOLDER, GEN_LAZY_LOAD_MODULES_ARRAY} from \"../env\";\nimport { LogLn } from \"../Util\";\nimport { Route, RouteTable, webModuleItem } from \"../../../types/interfaces/app\";\nimport {addModuleImportToModule, getSourceFile} from \"../../utils/ast\";\nimport { ModuleInfo } from \"../../../types/interfaces/env.interface\";\n\nimport {findNodes} from \"../../utils/devkit-utils/ast-utils\";\nimport * as ts from \"typescript\";\n//-------------------------------------------------------------------------------------------------\n// init generate module into env.modulesGen\n//-------------------------------------------------------------------------------------------------\nexport function initGenModules(options: MagicOptionScheme): Rule {\n return (tree: Tree, context: SchematicContext) => {\n let metadata = env.metadata;\n env.modulesGen = [];\n let web_modules:webModuleItem [] = metadata.config.web_modules;\n\n // Generate only one module from --module=xxxx\n if (options.module) {\n let moduleInfo : ModuleInfo = new ModuleInfo(options.module, options.loadOnDemand);\n env.modulesGen.push(moduleInfo)\n } else {\n\n // Generate list of components from config.json, properties web_modules.module_name\n for (let modulePath of web_modules) {\n //LogLn(` Web Module name: [${modulePath.module_name}] IsLoadOnDemand? [${modulePath.load_on_demand}]`);\n let moduleInfo : ModuleInfo = new ModuleInfo(modulePath.module_name, modulePath.load_on_demand);\n env.modulesGen.push(moduleInfo);\n }\n }\n LogLn(` Number of modules to be check for generate: ${web_modules.length}`);\n\n\n\n return tree;\n };\n}\n\n//-------------------------------------------------------------------------------------------------\n// overwrite the web module file name with the new content\n//-------------------------------------------------------------------------------------------------\nexport function overwriteWebModuleFileName(options: any, moduleNameFileName:string, content:string): Rule {\n return (tree: Tree, _context: SchematicContext) => {\n\n if(!tree.exists(moduleNameFileName)){\n LogLn(` [>Error] File cannot be overwrite, The file is not exist !!! : ${moduleNameFileName}`);\n }\n\n tree.overwrite(moduleNameFileName, content);\n return tree;\n };\n}\n\n//-------------------------------------------------------------------------------------------------\n// update the the web module file name with the new class name\n//-------------------------------------------------------------------------------------------------\nexport function updateWebModuleFileWithNewClassName(options: any, webModuleName:string): Rule {\n return (tree: Tree, context: SchematicContext) => {\n let rules:Rule[] = [];\n\n const origModuleFileName = getWebModuleFullFileName(webModuleName)\n\n // create new class name for \"web Module Name\"\n let newClassModuleName = getWebModuleClass(webModuleName );\n\n //read the exist module file name\n const text = tree.read(origModuleFileName);\n\n if (text === null) {\n throw new SchematicsException(`File ${origModuleFileName} does not exist.`);\n }\n let sourceText = text.toString('utf-8');\n\n if (sourceText !== \"\") {\n let newsourceText: string = sourceText.replace(`MagicGenLibModule`, newClassModuleName);\n rules.push(overwriteWebModuleFileName(options, origModuleFileName, newsourceText));\n\n }\n return chain(rules)(tree, context);\n };\n}\n\n//-------------------------------------------------------------------------------------------------\n// copy the two default files into the web module path\n//-------------------------------------------------------------------------------------------------\nfunction copyDefaultMagicFilesToWebModule(options:MagicOptionScheme, webModuleName:string): Rule {\n return (tree: Tree,context:SchematicContext) => {\n const webModulePath = getDestinationModulePathByWebModuleName(webModuleName);\n\n return chain([\n branchAndMerge(chain([\n mergeWith(\n apply(url(`./../mg-add/files/src/app/magic/`), [\n\n move(webModulePath)\n ]), MergeStrategy.AllowCreationConflict)\n ]))\n ])(tree,context);\n }\n}\n\n\n//-------------------------------------------------------------------------------------------------\n// delete LazyLoadService for non root modules\n//-------------------------------------------------------------------------------------------------\nfunction deleteLazyLoadService( webModuleName:string): Rule {\n return (tree: Tree) => {\n const lazyLoaderServicePath = getDestinationModulePathByWebModuleName(webModuleName) + '/lazy-loader.service.ts';\n\n if(webModuleName != '') {\n if (!tree.exists(lazyLoaderServicePath)) {\n LogLn(` [>Error] File cannot be overwrite, The file is not exist !!! :lazyLoaderServicePath`);\n }\n\n tree.delete(lazyLoaderServicePath);\n return tree;\n }\n }\n}\n\n\n//-------------------------------------------------------------------------------------------------\n// get destination path according to the send webModuleName\n//-------------------------------------------------------------------------------------------------\n export function getDestinationModulePathByWebModuleName(webModuleName:string):string {\n const newDestModulePath = `${env.metadata.paths.rootMagicGenFolder}/${GEN_FOLDER}/${webModuleName}`;\n return newDestModulePath;\n}\n\n//-------------------------------------------------------------------------------------------------\n// get web module full file name according to the send webModuleName\n//-------------------------------------------------------------------------------------------------\nfunction getWebModuleFullFileName(webModuleName:string):string {\n// calc the path of new the module\n const newDestModulePath = getDestinationModulePathByWebModuleName(webModuleName);\n return `${newDestModulePath}/magic.gen.lib.module.ts`;\n}\n\n//-------------------------------------------------------------------------------------------------\n// get web module class according to the send webModuleName\n//-------------------------------------------------------------------------------------------------\nfunction getWebModuleClass(webModuleName:string):string {\n return `Magic` + webModuleName + `Module`;\n}\n\n\n//-------------------------------------------------------------------------------------------------\n// add magic module to app module\n//-------------------------------------------------------------------------------------------------\nfunction addMagicModuleToAppModule(options: MagicOptionScheme, modulePath:string, moduleName:string, srcModuleName:string) : Rule {\n return (tree: Tree , context : SchematicContext)=>{\n const project = env.project;\n\n LogLn(` [>] add New Web Module :[${moduleName}] `);\n LogLn(` [>] from :[${srcModuleName}]`);\n LogLn(` [>] To App Module :[${modulePath}]`);\n addModuleImportToModule(\n tree,\n modulePath, // for now we will update env.metadata.paths.magicGenLibModule\n moduleName, // 'MagicXXXModule',\n srcModuleName, // `./XXX/magic.gen.lib.module`\n );\n return tree;\n }\n}\n\n//-------------------------------------------------------------------------------------------------\n// create module\n//-------------------------------------------------------------------------------------------------\nexport function checkAndCreateModule(options: MagicOptionScheme, webModuleName:string, loadOnDemand: boolean ): Rule {\n return (tree: Tree, context: SchematicContext) => {\n\n let rules: Rule[] = [];\n const webModuleFullFileName = getWebModuleFullFileName(webModuleName);\n // only if not exist create the new 2 files magic.gen.lib.module.ts & component-list.g.ts\n if (!tree.exists(webModuleFullFileName)) {\n rules.push(copyDefaultMagicFilesToWebModule(options, webModuleName));\n rules.push(updateWebModuleFileWithNewClassName(tree, webModuleName));\n rules.push(deleteLazyLoadService(webModuleName));\n // for NON load on demand we need to update magic root module\n if (!loadOnDemand) {\n const newDestModulePath = `./${webModuleName}/magic.gen.lib.module`;\n const webModuleClass = getWebModuleClass(webModuleName);\n rules.push(addMagicModuleToAppModule(options, env.metadata.paths.magicGenLibModule, webModuleClass, newDestModulePath));\n }\n return chain(rules)(tree, context);\n }\n ;\n }\n}\n\n//-------------------------------------------------------------------------------------------------\n// check if module is exist, only if not exist create the web module\n//-------------------------------------------------------------------------------------------------\nexport function generateWebModule(options: MagicOptionScheme, webModuleName:string, loadOnDemand:boolean ): Rule {\n return (tree: Tree, context: SchematicContext) => {\n\n let rules:Rule[] = [];\n\n LogLn(` [>]Handling Web Module named: [${webModuleName}] isLoadOnDemand: [${loadOnDemand}]`);\n rules.push(checkAndCreateModule(options, webModuleName, loadOnDemand));\n rules.push(checkAndCreateRouteForModule(options, webModuleName, loadOnDemand));\n\n return chain(rules)(tree,context);\n };\n}\n\n\n//-------------------------------------------------------------------------------------------------\n// generate all the modules in env.modulesGen\n//-------------------------------------------------------------------------------------------------\nexport function generateWebModules(options: MagicOptionScheme): Rule {\n return (tree: Tree, context: SchematicContext) => {\n\n let rules:Rule[] = [];\n\n for (let webModuleInfo of env.modulesGen){\n if (webModuleInfo.moduleName !== undefined && webModuleInfo.moduleName !== \"\") {\n rules.push(generateWebModule(options, webModuleInfo.moduleName, webModuleInfo.loadOnDemand));\n }\n }\n\n return chain(rules)(tree,context);\n };\n}\n\n\n\n//-------------------------------------------------------------------------------------------------\n// check if module is exist, only if not exist create the web module\n//-------------------------------------------------------------------------------------------------\nexport function checkAndCreateRouteForModule(options: MagicOptionScheme, webModuleName:string, loadOnDemand :boolean): Rule {\n return (tree: Tree, context: SchematicContext) => {\n\n let rules:Rule[] = [];\n\n if (loadOnDemand) {\n const newDestRoutePathForModule = env.metadata.paths.getRoutePathForWebModule(webModuleName);\n\n // only if file not exist then copy the default route\n if (!tree.exists(newDestRoutePathForModule)) {\n rules.push(createRoute(options, webModuleName));\n }\n else{\n // if file exist then only update the magic.gen.lib.module.ts\n rules.push(addRouteFileToModuleFile(options, webModuleName));\n }\n }\n return chain(rules)(tree,context);\n };\n}\n\n\n\n//-------------------------------------------------------------------------------------------------\n// create route for module\n//-------------------------------------------------------------------------------------------------\nexport function createRoute(options: MagicOptionScheme, webModuleName:string): Rule {\n return (tree: Tree, context: SchematicContext) => {\n\n let rules:Rule[] = [];\n\n rules.push(copyDefaultRouteMagicFilesToWebModule(options, webModuleName));\n // --------------------------------------------------------\n // // generate the route for module /////\n // let routeItem : RouteTable = new RouteTable();\n // routeItem.module_name = webModuleName;\n //\n // let route:Route = new Route();\n // route.ModuleName = webModuleName;\n // route.OutletName=\"\";\n // route.RouteName=\"\";\n // route.children=null;\n //\n // routeItem.routesArray = [route];\n // rules.push(genRouteFile(options, routeItem ));\n // --------------------------------------------------------\n // update the new MagicRoutingModule in file magic.gen.lib.module.ts of the module\n\n\n rules.push(addRouteFileToModuleFile(options, webModuleName));\n\n return chain(rules)(tree,context);\n };\n}\n\n//-------------------------------------------------------------------------------------------------\n// create route for module\n//-------------------------------------------------------------------------------------------------\nexport function addRouteFileToModuleFile(options: MagicOptionScheme, webModuleName:string): Rule {\n return (tree: Tree, context: SchematicContext) => {\n\n let rules:Rule[] = [];\n\n const modulePath = getWebModuleFullFileName(webModuleName); // get the magic.gen.lib.module.ts according to the module name\n const moduleName = `MagicRoutingModule`;//for now it will be the same for all modules ... getWebModuleClass(webModuleName);\n const srcModuleName = `./app.routes`;\n\n rules.push(addMagicModuleToAppModule(options, modulePath, moduleName, srcModuleName));\n\n return chain(rules)(tree,context);\n };\n}\n//-------------------------------------------------------------------------------------------------\n// copy the two default files into the web module path\n//-------------------------------------------------------------------------------------------------\nfunction copyDefaultRouteMagicFilesToWebModule(options:MagicOptionScheme, webModuleName:string): Rule {\n return (tree: Tree,context:SchematicContext) => {\n const routeFileForWebModulePath = env.metadata.paths.getRoutePathForWebModule(webModuleName);\n\n\n if(tree.exists(routeFileForWebModulePath))\n {\n let rules:Rule[] = [];\n return chain(rules)(tree,context);\n }\n else\n {\n const webModulePath = getDestinationModulePathByWebModuleName(webModuleName);\n LogLn(`[ >] copy default Route file to webModule [${webModuleName}]`)\n return chain([\n branchAndMerge(chain([\n mergeWith(\n apply(url(`./../mg-add/webModule/`), [\n\n move(webModulePath)\n ]), MergeStrategy.AllowCreationConflict)\n ]))\n ])(tree,context);\n }\n }\n}\n"]}
|
|
@@ -110,6 +110,26 @@ function copyDefaultMagicFilesToWebModule(options:MagicOptionScheme, webModuleNa
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
|
|
114
|
+
//-------------------------------------------------------------------------------------------------
|
|
115
|
+
// delete LazyLoadService for non root modules
|
|
116
|
+
//-------------------------------------------------------------------------------------------------
|
|
117
|
+
function deleteLazyLoadService( webModuleName:string): Rule {
|
|
118
|
+
return (tree: Tree) => {
|
|
119
|
+
const lazyLoaderServicePath = getDestinationModulePathByWebModuleName(webModuleName) + '/lazy-loader.service.ts';
|
|
120
|
+
|
|
121
|
+
if(webModuleName != '') {
|
|
122
|
+
if (!tree.exists(lazyLoaderServicePath)) {
|
|
123
|
+
LogLn(` [>Error] File cannot be overwrite, The file is not exist !!! :lazyLoaderServicePath`);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
tree.delete(lazyLoaderServicePath);
|
|
127
|
+
return tree;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
113
133
|
//-------------------------------------------------------------------------------------------------
|
|
114
134
|
// get destination path according to the send webModuleName
|
|
115
135
|
//-------------------------------------------------------------------------------------------------
|
|
@@ -167,7 +187,7 @@ export function checkAndCreateModule(options: MagicOptionScheme, webModuleName:s
|
|
|
167
187
|
if (!tree.exists(webModuleFullFileName)) {
|
|
168
188
|
rules.push(copyDefaultMagicFilesToWebModule(options, webModuleName));
|
|
169
189
|
rules.push(updateWebModuleFileWithNewClassName(tree, webModuleName));
|
|
170
|
-
|
|
190
|
+
rules.push(deleteLazyLoadService(webModuleName));
|
|
171
191
|
// for NON load on demand we need to update magic root module
|
|
172
192
|
if (!loadOnDemand) {
|
|
173
193
|
const newDestModulePath = `./${webModuleName}/magic.gen.lib.module`;
|
|
@@ -13,23 +13,23 @@ function initAndGenComponentsForModule(options, shouldBuildAndUpdateModule) {
|
|
|
13
13
|
let metadata = env_1.env.metadata;
|
|
14
14
|
env_1.env.componentsGen = [];
|
|
15
15
|
let rules = [];
|
|
16
|
-
rules.push(utils_1.displayMessge(options, " ********************************* START GENERATE *********************************"));
|
|
16
|
+
rules.push((0, utils_1.displayMessge)(options, " ********************************* START GENERATE *********************************"));
|
|
17
17
|
// if we need to build and update module , first generate(if needed) the modules
|
|
18
18
|
if (shouldBuildAndUpdateModule) {
|
|
19
|
-
rules.push(init_add_modules_rule_1.initGenModules(options));
|
|
20
|
-
rules.push(init_add_modules_rule_1.generateWebModules(options));
|
|
19
|
+
rules.push((0, init_add_modules_rule_1.initGenModules)(options));
|
|
20
|
+
rules.push((0, init_add_modules_rule_1.generateWebModules)(options));
|
|
21
21
|
}
|
|
22
22
|
for (let moduleJsonPath of metadata.config.web_modules) {
|
|
23
|
-
rules.push(utils_1.displayMessge(options, ` ****** Start Web Module name : [${moduleJsonPath.module_name}] *******`));
|
|
23
|
+
rules.push((0, utils_1.displayMessge)(options, ` ****** Start Web Module name : [${moduleJsonPath.module_name}] *******`));
|
|
24
24
|
rules.push(initGenComponentsFromList(options, moduleJsonPath.module_name, options.component, moduleJsonPath.form_files));
|
|
25
|
-
rules.push(load_views_gen_rule_1.loadViewsToGen(options));
|
|
25
|
+
rules.push((0, load_views_gen_rule_1.loadViewsToGen)(options));
|
|
26
26
|
if (shouldBuildAndUpdateModule) {
|
|
27
|
-
rules.push(build_view_rule_1.buildViews(options, moduleJsonPath.module_name));
|
|
28
|
-
rules.push(component_list_rule_1.componentlistGen(options, moduleJsonPath.module_name, moduleJsonPath.load_on_demand));
|
|
27
|
+
rules.push((0, build_view_rule_1.buildViews)(options, moduleJsonPath.module_name));
|
|
28
|
+
rules.push((0, component_list_rule_1.componentlistGen)(options, moduleJsonPath.module_name, moduleJsonPath.load_on_demand));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
rules.push(utils_1.displayMessge(options, " ********************************* E N D GENERATE *********************************"));
|
|
32
|
-
return schematics_1.chain(rules)(tree, context);
|
|
31
|
+
rules.push((0, utils_1.displayMessge)(options, " ********************************* E N D GENERATE *********************************"));
|
|
32
|
+
return (0, schematics_1.chain)(rules)(tree, context);
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
exports.initAndGenComponentsForModule = initAndGenComponentsForModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-gen-components.rule.js","sourceRoot":"","sources":["init-gen-components.rule.ts"],"names":[],"mappings":";;;AAAA,2DAAiF;AAEjF,gCAA6B;AAC7B,+DAAuD;AACvD,uDAA+C;AAC/C,+DAAyD;AACzD,mEAA6E;AAC7E,oCAAyC;AAGzC,SAAgB,6BAA6B,CAAC,OAA0B,EAAE,0BAAmC;IAC3G,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,IAAI,QAAQ,GAAG,SAAG,CAAC,QAAQ,C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EpC,IAAI,0BAA0B,EAAE;gBAC9B,KAAK,CAAC,IAAI,CAAC,IAAA,4BAAU,EAAC,OAAO,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;gBAC5D,KAAK,CAAC,IAAI,CAAC,IAAA,sCAAgB,EAAC,OAAO,EAAE,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC;aAClG;SACF;QACD,KAAK,CAAC,IAAI,CAAC,IAAA,qBAAa,EAAC,OAAO,EAAE,wFAAwF,CAAC,CAAC,CAAA;QAC5H,OAAO,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC,CAAC;AACJ,CAAC;AA5BD,sEA4BC;AAGD,SAAgB,yBAAyB,CAAC,OAA0B,EAAE,WAAkB,EAAE,SAAiB,EAAE,UAAoB;IAC/H,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,IAAI,QAAQ,GAAG,SAAG,CAAC,QAAQ,CAAC;QAC5B,SAAG,CAAC,aAAa,GAAG,EAAE,CAAC;QAEvB,oDAAoD;QACpD,IAAI,SAAS,EAAE;YACb,SAAG,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;SAClC;aAAM;YAEL,uEAAuE;YACvE,KAAK,IAAI,WAAW,IAAI,UAAU,EAAE;gBAElC,IAAI,gBAAgB,GAAG,SAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,mCAAmC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;gBAExG,SAAG,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aAC1C;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AApBD,8DAoBC","sourcesContent":["import { chain, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\r\nimport { MagicOptionScheme } from \"./magic-option.scheme\";\r\nimport { env } from \"../env\";\r\nimport { loadViewsToGen } from \"./load-views-gen.rule\";\r\nimport { buildViews } from \"./build-view.rule\";\r\nimport { componentlistGen } from \"./component-list.rule\";\r\nimport { generateWebModules, initGenModules } from \"./init-add-modules.rule\";\r\nimport { displayMessge } from \"../utils\";\r\n\r\n\r\nexport function initAndGenComponentsForModule(options: MagicOptionScheme, shouldBuildAndUpdateModule: boolean): Rule {\r\n return (tree: Tree, context: SchematicContext) => {\r\n let metadata = env.metadata;\r\n env.componentsGen = [];\r\n let rules:Rule[] = [];\r\n\r\n rules.push(displayMessge(options, \" ********************************* START GENERATE *********************************\"))\r\n // if we need to build and update module , first generate(if needed) the modules\r\n if (shouldBuildAndUpdateModule) {\r\n rules.push(initGenModules (options));\r\n rules.push(generateWebModules(options));\r\n }\r\n\r\n for (let moduleJsonPath of metadata.config.web_modules) {\r\n\r\n rules.push(displayMessge(options, ` ****** Start Web Module name : [${moduleJsonPath.module_name}] *******`))\r\n\r\n rules.push(initGenComponentsFromList(options, moduleJsonPath.module_name, options.component, moduleJsonPath.form_files));\r\n rules.push(loadViewsToGen(options));\r\n\r\n if (shouldBuildAndUpdateModule) {\r\n rules.push(buildViews(options, moduleJsonPath.module_name));\r\n rules.push(componentlistGen(options, moduleJsonPath.module_name, moduleJsonPath.load_on_demand));\r\n }\r\n }\r\n rules.push(displayMessge(options, \" ********************************* E N D GENERATE *********************************\"))\r\n return chain(rules)(tree, context);\r\n };\r\n}\r\n\r\n\r\nexport function initGenComponentsFromList(options: MagicOptionScheme, module_name:string, component: string, form_files: string[]): Rule {\r\n return (host: Tree, context: SchematicContext) => {\r\n let metadata = env.metadata;\r\n env.componentsGen = [];\r\n\r\n // Generate only one component from --component=xxxx\r\n if (component) {\r\n env.componentsGen.push(component)\r\n } else {\r\n\r\n // Generate list of components from config.json, properties form_views.\r\n for (let cmpJsonPath of form_files) {\r\n\r\n let JsonRelativePath = env.metadata.paths.getRelativePathForComponentInModule(module_name, cmpJsonPath);\r\n\r\n env.componentsGen.push(JsonRelativePath);\r\n }\r\n }\r\n return host;\r\n };\r\n}\r\n"]}
|
|
@@ -7,8 +7,8 @@ const config_1 = require("../../utils/devkit-utils/config");
|
|
|
7
7
|
function initMagicMetadata(options) {
|
|
8
8
|
return (host, context) => {
|
|
9
9
|
if (!env_1.env.metadata) {
|
|
10
|
-
env_1.env.workspace = config_1.getWorkspace(host);
|
|
11
|
-
env_1.env.project = config_1.getProjectFromWorkspace(env_1.env.workspace, options.project);
|
|
10
|
+
env_1.env.workspace = (0, config_1.getWorkspace)(host);
|
|
11
|
+
env_1.env.project = (0, config_1.getProjectFromWorkspace)(env_1.env.workspace, options.project);
|
|
12
12
|
env_1.env.metadata = new metadata_class_1.MagicMetadata(host, context, options);
|
|
13
13
|
}
|
|
14
14
|
return host;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-magic-metadata.rule.js","sourceRoot":"","sources":["init-magic-metadata.rule.ts"],"names":[],"mappings":";;;AACA,sDAAkD;AAClD,gCAA6B;AAC7B,4DAAwF;AAIxF,SAAgB,iBAAiB,CAAC,OAAyB;IACzD,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAC,EAAE;QAC9C,IAAI,CAAC,SAAG,CAAC,QAAQ,EAAG;YAClB,SAAG,CAAC,SAAS,GAAG,qBAAY,
|
|
1
|
+
{"version":3,"file":"init-magic-metadata.rule.js","sourceRoot":"","sources":["init-magic-metadata.rule.ts"],"names":[],"mappings":";;;AACA,sDAAkD;AAClD,gCAA6B;AAC7B,4DAAwF;AAIxF,SAAgB,iBAAiB,CAAC,OAAyB;IACzD,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAC,EAAE;QAC9C,IAAI,CAAC,SAAG,CAAC,QAAQ,EAAG;YAClB,SAAG,CAAC,SAAS,GAAG,IAAA,qBAAY,EAAC,IAAI,CAAC,CAAC;YACnC,SAAG,CAAC,OAAO,GAAK,IAAA,gCAAuB,EAAC,SAAG,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YACxE,SAAG,CAAC,QAAQ,GAAI,IAAI,8BAAa,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC3D;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAA;AACH,CAAC;AATD,8CASC","sourcesContent":["import { Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { MagicMetadata } from \"../metadata.class\";\nimport { env } from \"../env\";\nimport { getProjectFromWorkspace, getWorkspace } from \"../../utils/devkit-utils/config\";\nimport { MagicOptionScheme } from \"./magic-option.scheme\";\n\n\nexport function initMagicMetadata(options:MagicOptionScheme) : Rule {\n return (host: Tree, context: SchematicContext)=>{\n if( !env.metadata ) {\n env.workspace = getWorkspace(host);\n env.project = getProjectFromWorkspace(env.workspace, options.project);\n env.metadata = new MagicMetadata(host, context, options);\n }\n return host;\n }\n}\n\n"]}
|
|
@@ -13,15 +13,15 @@ function loadViewsToGen(options) {
|
|
|
13
13
|
suffix: "mga",
|
|
14
14
|
views: []
|
|
15
15
|
};
|
|
16
|
-
Util_1.LogLn(`*** Step 1: Loading JSON files ***`);
|
|
16
|
+
(0, Util_1.LogLn)(`*** Step 1: Loading JSON files ***`);
|
|
17
17
|
env_1.env.componentsGen.forEach(cmpJsonPath => {
|
|
18
18
|
cmpJsonPath = env_1.env.metadata.paths.getJsonPathForComponent(cmpJsonPath);
|
|
19
|
-
Util_1.LogLn(`[>] Loading JSON file ${cmpJsonPath}`);
|
|
20
|
-
let view = utils_1.readJson(host, cmpJsonPath);
|
|
19
|
+
(0, Util_1.LogLn)(`[>] Loading JSON file ${cmpJsonPath}`);
|
|
20
|
+
let view = (0, utils_1.readJson)(host, cmpJsonPath);
|
|
21
21
|
env_1.env.app.views.push(view);
|
|
22
22
|
});
|
|
23
|
-
Util_1.LogLn(`*** Step 2: Processing JSON files - (${env_1.env.app.views.length} components) ***`);
|
|
24
|
-
env_1.env.app = process_json_1.processJson(env_1.env.app);
|
|
23
|
+
(0, Util_1.LogLn)(`*** Step 2: Processing JSON files - (${env_1.env.app.views.length} components) ***`);
|
|
24
|
+
env_1.env.app = (0, process_json_1.processJson)(env_1.env.app);
|
|
25
25
|
//console.log(`Number of app.views to generate: ${env.app.views.length}`);
|
|
26
26
|
return host;
|
|
27
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-views-gen.rule.js","sourceRoot":"","sources":["load-views-gen.rule.ts"],"names":[],"mappings":";;;AACA,oCAAoC;AACpC,gCAA6B;AAC7B,kCAAqC;AAErC,kDAA8C;AAG9C,SAAgB,cAAc,CAAC,OAA0B;IACvD,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,MAAM,QAAQ,GAAG,SAAG,CAAC,QAAQ,CAAC;QAE9B,SAAG,CAAC,GAAG,GAAG;YACR,IAAI,EAAE,OAAO,CAAC,OAAO;YACrB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,EAAE;SACV,CAAC;QAEF,YAAK,
|
|
1
|
+
{"version":3,"file":"load-views-gen.rule.js","sourceRoot":"","sources":["load-views-gen.rule.ts"],"names":[],"mappings":";;;AACA,oCAAoC;AACpC,gCAA6B;AAC7B,kCAAqC;AAErC,kDAA8C;AAG9C,SAAgB,cAAc,CAAC,OAA0B;IACvD,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,MAAM,QAAQ,GAAG,SAAG,CAAC,QAAQ,CAAC;QAE9B,SAAG,CAAC,GAAG,GAAG;YACR,IAAI,EAAE,OAAO,CAAC,OAAO;YACrB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,EAAE;SACV,CAAC;QAEF,IAAA,YAAK,EAAC,oCAAoC,CAAC,CAAC;QAC5C,SAAG,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YACtC,WAAW,GAAG,SAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;YACtE,IAAA,YAAK,EAAC,yBAAyB,WAAW,EAAE,CAAC,CAAC;YAC9C,IAAI,IAAI,GAAG,IAAA,gBAAQ,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YACvC,SAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,IAAA,YAAK,EAAC,yCAAyC,SAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,kBAAkB,CAAC,CAAC;QACvF,SAAG,CAAC,GAAG,GAAG,IAAA,0BAAW,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,0EAA0E;QAC1E,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAtBD,wCAsBC","sourcesContent":["import { Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\r\nimport { readJson } from \"../utils\";\r\nimport { env } from \"../env\";\r\nimport { Log, LogLn } from \"../Util\";\r\nimport { MagicOptionScheme } from \"./magic-option.scheme\";\r\nimport { processJson } from \"../process-json\";\r\n\r\n\r\nexport function loadViewsToGen(options: MagicOptionScheme): Rule {\r\n return (host: Tree, context: SchematicContext) => {\r\n const metadata = env.metadata;\r\n\r\n env.app = {\r\n name: options.project,\r\n suffix: \"mga\",\r\n views: []\r\n };\r\n\r\n LogLn(`*** Step 1: Loading JSON files ***`);\r\n env.componentsGen.forEach(cmpJsonPath => {\r\n cmpJsonPath = env.metadata.paths.getJsonPathForComponent(cmpJsonPath);\r\n LogLn(`[>] Loading JSON file ${cmpJsonPath}`);\r\n let view = readJson(host, cmpJsonPath);\r\n env.app.views.push(view);\r\n });\r\n LogLn(`*** Step 2: Processing JSON files - (${env.app.views.length} components) ***`);\r\n env.app = processJson(env.app);\r\n //console.log(`Number of app.views to generate: ${env.app.views.length}`);\r\n return host;\r\n };\r\n}\r\n"]}
|
|
@@ -9,7 +9,7 @@ const ast_1 = require("../utils/ast");
|
|
|
9
9
|
const Util_1 = require("./Util");
|
|
10
10
|
function displayMessge(options, message) {
|
|
11
11
|
return (host, context) => {
|
|
12
|
-
Util_1.LogLn(`[>] ${message}`);
|
|
12
|
+
(0, Util_1.LogLn)(`[>] ${message}`);
|
|
13
13
|
return host;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
@@ -17,13 +17,13 @@ exports.displayMessge = displayMessge;
|
|
|
17
17
|
function copyMagicFiles(options) {
|
|
18
18
|
return (host, context) => {
|
|
19
19
|
const project = getProject(host, options.project);
|
|
20
|
-
return schematics_1.chain([
|
|
21
|
-
schematics_1.branchAndMerge(schematics_1.chain([
|
|
22
|
-
schematics_1.mergeWith(schematics_1.apply(schematics_1.url('./files'), [
|
|
23
|
-
schematics_1.template({
|
|
20
|
+
return (0, schematics_1.chain)([
|
|
21
|
+
(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
|
|
22
|
+
(0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
23
|
+
(0, schematics_1.template)({
|
|
24
24
|
skipHelp: options.skipHelp,
|
|
25
25
|
}),
|
|
26
|
-
schematics_1.move(project.root)
|
|
26
|
+
(0, schematics_1.move)(project.root)
|
|
27
27
|
]), schematics_1.MergeStrategy.AllowCreationConflict)
|
|
28
28
|
]))
|
|
29
29
|
])(host, context);
|
|
@@ -77,8 +77,8 @@ function deleteMagicMetadataFolder(option) {
|
|
|
77
77
|
}
|
|
78
78
|
exports.deleteMagicMetadataFolder = deleteMagicMetadataFolder;
|
|
79
79
|
function getProject(host, projectName) {
|
|
80
|
-
const workspace = config_1.getWorkspace(host);
|
|
81
|
-
const project = config_1.getProjectFromWorkspace(workspace, projectName);
|
|
80
|
+
const workspace = (0, config_1.getWorkspace)(host);
|
|
81
|
+
const project = (0, config_1.getProjectFromWorkspace)(workspace, projectName);
|
|
82
82
|
return project;
|
|
83
83
|
}
|
|
84
84
|
exports.getProject = getProject;
|
|
@@ -105,9 +105,9 @@ function getMagicConfig(host, project) {
|
|
|
105
105
|
exports.getMagicConfig = getMagicConfig;
|
|
106
106
|
function addImportTSModule(path, name, from) {
|
|
107
107
|
return (host, context) => {
|
|
108
|
-
let moduleSource = ast_1.getSourceFile(host, path);
|
|
108
|
+
let moduleSource = (0, ast_1.getSourceFile)(host, path);
|
|
109
109
|
const recorder = host.beginUpdate(path);
|
|
110
|
-
const routesChange = route_utils_1.insertImport(moduleSource, path, name, from);
|
|
110
|
+
const routesChange = (0, route_utils_1.insertImport)(moduleSource, path, name, from);
|
|
111
111
|
if (routesChange.toAdd) {
|
|
112
112
|
recorder.insertLeft(routesChange.pos, routesChange.toAdd);
|
|
113
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":";;;AAAA,yDAA8F;AAC9F,2DAWoC;AACpC,+BAA0C;AAE1C,mEAAiE;AACjE,sCAA6C;AAG7C,iCAA+B;AAE/B,SAAgB,aAAa,CAAC,OAAyB,EAAE,OAAc;IACrE,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAC,EAAE;QAE9C,YAAK,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":";;;AAAA,yDAA8F;AAC9F,2DAWoC;AACpC,+BAA0C;AAE1C,mEAAiE;AACjE,sCAA6C;AAG7C,iCAA+B;AAE/B,SAAgB,aAAa,CAAC,OAAyB,EAAE,OAAc;IACrE,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAC,EAAE;QAE9C,IAAA,YAAK,EAAC,OAAO,OAAO,EAAE,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC,CAAA;AACH,CAAC;AAND,sCAMC;AAGD,SAAgB,cAAc,CAAC,OAAyB;IACtD,OAAO,CAAC,IAAU,EAAC,OAAwB,EAAE,EAAE;QAC7C,MAAM,OAAO,GAAK,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACpD,OAAO,IAAA,kBAAK,EAAC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CAAC;AARD,4BAQC;AACD,SAAgB,cAAc,CAAC,IAAU,EAAE,OAAgB;IACzD,IAAI,IAAI,GAAG,GAAG,OAAO,CAAC,IAAI,IAAI,kBAAY,cAAc,CAAC;IACzD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE;QAAE,OAAO;KAAE;IAExB,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAEtC,OAAO,MAAM,CAAC;AAChB,CAAC;AATD,wCASC;AAED,SAAgB,iBAAiB,CAAC,IAAW,EAAC,IAAW,EAAC,IAAW;IACnE,OAAO,CAAC,IAAU,EAAE,OAAwB,EAAE,EAAE;QAE9C,IAAI,YAAY,GAAG,IAAA,mBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAE7C,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAExC,MAAM,YAAY,GAAE,IAAA,0BAAY,EAAC,YAAY,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,CAAiB,CAAC;QAChF,IAAI,YAAY,CAAC,KAAK,EAAE;YACtB,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;SAC3D;QACD,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC,CAAA;AACH,CAAC;AAbD,8CAaC","sourcesContent":["import { getProjectFromWorkspace, getWorkspace, Project } from \"../utils/devkit-utils/config\";\nimport {\n apply,\n branchAndMerge,\n chain,\n MergeStrategy,\n mergeWith,\n move,\n Rule,\n SchematicContext, template,\n Tree,\n url\n} from \"@angular-devkit/schematics\";\nimport { env, METADATA_DIR } from \"./env\";\nimport { MagicOptionScheme } from \"./rules/magic-option.scheme\";\nimport { insertImport } from \"../utils/devkit-utils/route-utils\";\nimport { getSourceFile } from \"../utils/ast\";\nimport { InsertChange } from \"../utils/devkit-utils/change\";\nimport { MagicMetadata } from \"./metadata.class\";\nimport { LogLn } from \"./Util\";\n\nexport function displayMessge(options:MagicOptionScheme, message:string) : Rule {\n return (host: Tree, context: SchematicContext)=>{\n\n LogLn(`[>] ${message}`);\n return host;\n }\n}\n\n\nexport function copyMagicFiles(options:MagicOptionScheme): Rule {\n return (host: Tree,context:SchematicContext) => {\n const project = getProject(host, options.project);\n return chain([\n branchAndMerge(chain([\n mergeWith(\n apply(url('./files'), [\n template({\n skipHelp: options.skipHelp,\n }),\n move(project.root)\n ]), MergeStrategy.AllowCreationConflict)\n ]))\n ])(host,context);\n }\n}\nexport function deleteMagicFiles(option:MagicOptionScheme): Rule {\n return (host: Tree) => {\n const metadta = env.metadata;\n let files = [\n metadta.paths.appComponentPath,\n metadta.paths.appRoutesPath,\n metadta.paths.executionPath,\n metadta.paths.magicStylePath,\n\n // Magic Generate folder\n metadta.paths.rootMagicComponentListPath,\n metadta.paths.magicGenLibModule,\n metadta.paths.favIconPath\n ];\n for (let file of files)\t{\n if (host.exists(file)) {\n host.delete(file);\n }\n }\n return host;\n };\n\n}\nexport function deleteMagicFolder(option:MagicOptionScheme): Rule {\n return (host: Tree) => {\n const metadta = env.metadata;\n const path = metadta.paths.magicGenFolderPath;\n //rimraf(path);\n host.getDir(path).visit( filePath => {\n host.delete(filePath);\n });\n return host;\n };\n\n}\nexport function deleteMagicMetadataFolder(option:MagicOptionScheme): Rule {\n return (host: Tree) => {\n const metadta = env.metadata;\n const path = metadta.paths.metadataFolderPath;\n\n //rimraf(path);\n host.getDir(path).visit( filePath => {\n host.delete(filePath);\n });\n return host;\n };\n\n}\n\nexport function getProject(host: Tree, projectName: string): Project {\n const workspace = getWorkspace(host);\n const project = getProjectFromWorkspace(workspace, projectName);\n return project;\n}\nexport function readJson(host:Tree,path:string) {\n const source = host.read(path);\n let file = null;\n if (source) {\n const sourceText = source.toString(\"utf-8\");\n file = JSON.parse(sourceText);\n }\n return file;\n}\nexport function getMagicConfig(host: Tree, project: Project) {\n let path = `${project.root}/${METADATA_DIR}/config.json`;\n const source = host.read(path);\n if (!source) { return; }\n\n const sourceText = source.toString(\"utf-8\");\n const config = JSON.parse(sourceText);\n\n return config;\n}\n\nexport function addImportTSModule(path:string,name:string,from:string) : Rule {\n return (host: Tree, context:SchematicContext) => {\n\n let moduleSource = getSourceFile(host, path);\n\n const recorder = host.beginUpdate(path);\n\n const routesChange =insertImport(moduleSource, path, name,from) as InsertChange;\n if (routesChange.toAdd) {\n recorder.insertLeft(routesChange.pos, routesChange.toAdd);\n }\n host.commitUpdate(recorder);\n }\n}\n"]}
|
|
@@ -7,8 +7,8 @@ const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
|
7
7
|
const env_1 = require("../magic-utils/env");
|
|
8
8
|
const package_1 = require("../utils/package");
|
|
9
9
|
function mgInstallPrerequisites(options) {
|
|
10
|
-
return schematics_1.chain([
|
|
11
|
-
init_magic_metadata_rule_1.initMagicMetadata(options),
|
|
10
|
+
return (0, schematics_1.chain)([
|
|
11
|
+
(0, init_magic_metadata_rule_1.initMagicMetadata)(options),
|
|
12
12
|
installPrerequisitesSaveDev(options)
|
|
13
13
|
]);
|
|
14
14
|
}
|
|
@@ -17,7 +17,7 @@ function installPrerequisitesSaveDev(option) {
|
|
|
17
17
|
return (host, context) => {
|
|
18
18
|
for (let dep of env_1.devDependencies) {
|
|
19
19
|
context.logger.info(`[>] Add devDependencies ${dep.name}`);
|
|
20
|
-
package_1.addPackageToPackageJson(host, 'devDependencies', dep.name, dep.version);
|
|
20
|
+
(0, package_1.addPackageToPackageJson)(host, 'devDependencies', dep.name, dep.version);
|
|
21
21
|
}
|
|
22
22
|
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
23
23
|
return host;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,2DAAiF;AACjF,4FAAmF;AACnF,4DAA0E;AAC1E,4CAAmE;AACnE,8CAA2D;AAG3D,SAAgB,sBAAsB,CAAC,OAAyB;IAC9D,OAAO,kBAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,2DAAiF;AACjF,4FAAmF;AACnF,4DAA0E;AAC1E,4CAAmE;AACnE,8CAA2D;AAG3D,SAAgB,sBAAsB,CAAC,OAAyB;IAC9D,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAa,OAAO,CAAC;QACtC,2BAA2B,CAAG,OAAO,CAAC;KACvC,CAAC,CAAC;AACL,CAAC;AALD,wDAKC;AAGD,SAAS,2BAA2B,CAAC,MAAwB;IAC3D,OAAO,CAAC,IAAU,EAAE,OAAwB,EAAE,EAAE;QAC5C,KAAK,IAAI,GAAG,IAAI,qBAAe,EAAC;YAC9B,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YAC3D,IAAA,iCAAuB,EAAC,IAAI,EAAE,iBAAiB,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;SACzE;QAED,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;QAEhD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { chain, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\nimport { NodePackageInstallTask } from \"@angular-devkit/schematics/tasks\";\nimport { dependencies, devDependencies } from \"../magic-utils/env\";\nimport { addPackageToPackageJson } from \"../utils/package\";\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\n\nexport function mgInstallPrerequisites(options:MagicOptionScheme): Rule {\n return chain([\n initMagicMetadata (options),\n installPrerequisitesSaveDev (options)\n ]);\n}\n\n\nfunction installPrerequisitesSaveDev(option:MagicOptionScheme): Rule {\n return (host: Tree, context:SchematicContext) => {\n for (let dep of devDependencies){\n context.logger.info(`[>] Add devDependencies ${dep.name}`);\n addPackageToPackageJson(host, 'devDependencies', dep.name, dep.version);\n }\n\n context.addTask(new NodePackageInstallTask());\n\n return host;\n };\n}\n\n\n\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { MagicLazyLoaderService } from '@magic-xpa/angular';
|
|
3
|
+
|
|
4
|
+
@Injectable()
|
|
5
|
+
|
|
6
|
+
export class LazyLoaderService extends MagicLazyLoaderService {
|
|
7
|
+
Load(path: string): Promise<any> {
|
|
8
|
+
return import( './' + path + '/magic.gen.lib.module');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -26,6 +26,7 @@ import {MatNativeDateModule} from "@angular/material/core";
|
|
|
26
26
|
import {MatTabsModule} from "@angular/material/tabs";
|
|
27
27
|
import {MatTooltipModule} from "@angular/material/tooltip";
|
|
28
28
|
import {MatButtonModule} from "@angular/material/button";
|
|
29
|
+
import {MatAutocompleteModule} from "@angular/material/autocomplete";
|
|
29
30
|
import {CurrencyMaskInputMode, NgxCurrencyModule } from "ngx-currency";
|
|
30
31
|
|
|
31
32
|
export const customCurrencyMaskConfig = {
|
|
@@ -80,7 +81,8 @@ export const customCurrencyMaskConfig = {
|
|
|
80
81
|
MatDatepickerModule,
|
|
81
82
|
MatNativeDateModule,
|
|
82
83
|
MatFormFieldModule,
|
|
83
|
-
MagicAngularMaterialModule
|
|
84
|
+
MagicAngularMaterialModule,
|
|
85
|
+
MatAutocompleteModule
|
|
84
86
|
],
|
|
85
87
|
providers: [ExitMagicService],
|
|
86
88
|
})
|