@magic-xpa/cli 4.1000.0-dev4100.99 → 4.1000.410-0.428

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.
Files changed (32) hide show
  1. package/package.json +2 -2
  2. package/src/collection.json +7 -0
  3. package/src/schematics/magic-utils/env.js +8 -4
  4. package/src/schematics/magic-utils/env.js.map +1 -1
  5. package/src/schematics/magic-utils/env.ts +10 -4
  6. package/src/schematics/magic-utils/metadata.class.d.ts +4 -0
  7. package/src/schematics/magic-utils/metadata.class.js +10 -0
  8. package/src/schematics/magic-utils/metadata.class.js.map +1 -1
  9. package/src/schematics/magic-utils/metadata.class.ts +14 -0
  10. package/src/schematics/magic-utils/rules/init-add-modules.rule.d.ts +2 -2
  11. package/src/schematics/magic-utils/rules/init-add-modules.rule.js +34 -12
  12. package/src/schematics/magic-utils/rules/init-add-modules.rule.js.map +1 -1
  13. package/src/schematics/magic-utils/rules/init-add-modules.rule.ts +39 -22
  14. package/src/schematics/magic-utils/rules/init-gen-components.rule.d.ts +1 -1
  15. package/src/schematics/magic-utils/rules/init-gen-components.rule.js +20 -8
  16. package/src/schematics/magic-utils/rules/init-gen-components.rule.js.map +1 -1
  17. package/src/schematics/magic-utils/rules/init-gen-components.rule.ts +24 -12
  18. package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js +1 -0
  19. package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js.map +1 -1
  20. package/src/schematics/magic-utils/rules/init-magic-metadata.rule.ts +1 -0
  21. package/src/schematics/magic-utils/rules/magic-option.scheme.d.ts +1 -0
  22. package/src/schematics/magic-utils/rules/magic-option.scheme.js.map +1 -1
  23. package/src/schematics/magic-utils/rules/magic-option.scheme.ts +15 -14
  24. package/src/schematics/mg-generate-component/index.d.ts +3 -0
  25. package/src/schematics/mg-generate-component/index.js +36 -0
  26. package/src/schematics/mg-generate-component/index.js.map +1 -0
  27. package/src/schematics/mg-generate-component/index.ts +38 -0
  28. package/src/schematics/mg-generate-component/schema.json +34 -0
  29. package/src/types/interfaces/env.interface.d.ts +1 -0
  30. package/src/types/interfaces/env.interface.js.map +1 -1
  31. package/src/types/interfaces/env.interface.ts +1 -0
  32. package/templates/themes/table/HTMLTable/columnHeader.ejs +6 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic-xpa/cli",
3
- "version": "4.1000.0-dev4100.99",
3
+ "version": "4.1000.04100.428",
4
4
  "license": "SEE LICENSE IN EULA.pdf",
5
5
  "description": "Magic CLI for MagicWeb applications",
6
6
  "keywords": [
@@ -12,7 +12,7 @@
12
12
  "schematics": "./src/collection.json",
13
13
  "main": "index.js",
14
14
  "dependencies": {
15
- "ejs": "^2.6.1",
15
+ "ejs": "^3.1.9",
16
16
  "js-beautify": "^1.7.5"
17
17
  },
18
18
  "peerDependencies": {}
@@ -23,6 +23,13 @@
23
23
  "aliases": ["magic-mg-generate"],
24
24
  "hidden": true
25
25
  },
26
+ "generate-component": {
27
+ "description": "generate component to the application through command line interface",
28
+ "factory": "./schematics/mg-generate-component/index#mgGenerateComponent",
29
+ "schema" : "./schematics/mg-generate-component/schema.json",
30
+ "aliases": ["magic-mg-generate-component"],
31
+ "hidden": true
32
+ },
26
33
  "routes": {
27
34
  "description": "generate routes to the application",
28
35
  "factory": "./schematics/mg-routes/index#mgGenerateRoutes",
@@ -18,16 +18,20 @@ class Idependencies {
18
18
  exports.Idependencies = Idependencies;
19
19
  exports.dependencies = [
20
20
  // material dependencies
21
- { name: "@angular/material", version: '^13.0.0' },
22
- { name: "@angular/cdk", version: '^13.0.0' },
23
- { name: "@angular/animations", version: '^13.0.0' },
21
+ { name: "@angular/material", version: '^14.0.0' },
22
+ { name: "@angular/cdk", version: '^14.0.0' },
23
+ { name: "@angular/animations", version: '^15.2.2' },
24
24
  { name: "font-awesome", version: '^4.7.0' },
25
25
  { name: "hammerjs", version: '^2.0.8' },
26
26
  { name: "ngx-infinite-scroll", version: '^10.0.0' },
27
27
  { name: "ng-dynamic-component", version: '~10.1.0' },
28
28
  { name: "rxjs-compat", version: "^6.6.0" },
29
29
  { name: "ngx-currency", version: "^2.5.2" },
30
- { name: "ngx-mask", version: "^13.1.15" }
30
+ { name: "ngx-mask", version: "^13.1.15" },
31
+ // Time masking dependencies (hh:mm, hh:mm:ss, hh:mm:ss:mss)
32
+ { name: "@maskito/angular", version: "^1.4.0" },
33
+ { name: "@maskito/core", version: "^1.4.0" },
34
+ { name: "@maskito/kit", version: "^1.4.0" }
31
35
  ];
32
36
  exports.devDependencies = [
33
37
  { name: "@types/stacktrace-js", version: '^0.0.32' }
@@ -1 +1 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["env.ts"],"names":[],"mappings":";;;AAKa,QAAA,YAAY,GAAW,gBAAgB,CAAC;AACxC,QAAA,oBAAoB,GAAG,oBAAoB,CAAC;AAC5C,QAAA,mBAAmB,GAAI,kBAAkB,CAAC;AAC1C,QAAA,UAAU,GAAa,OAAO,CAAC;AAC/B,QAAA,gBAAgB,GAAO,+BAA+B,CAAC;AACvD,QAAA,2BAA2B,GAAI,oBAAoB,CAAC;AACpD,QAAA,aAAa,GAAI,KAAK,oBAAY,gBAAgB,CAAC;AACnD,QAAA,WAAW,GAAM,KAAK,oBAAY,cAAc,CAAC;AAE9D,MAAa,aAAa;IACxB,YAAY,OAAc,EAAE,UAAiB;QAC3C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;IAC5B,CAAC;CAGF;AAPD,sCAOC;AAEU,QAAA,YAAY,GAAG;IAExB,wBAAwB;IACxB,EAAC,IAAI,EAAE,mBAAmB,EAAI,OAAO,EAAE,SAAS,EAAC;IACjD,EAAC,IAAI,EAAE,cAAc,EAAS,OAAO,EAAE,SAAS,EAAC;IACjD,EAAC,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,SAAS,EAAC;IACjD,EAAC,IAAI,EAAE,cAAc,EAAS,OAAO,EAAE,QAAQ,EAAC;IAChD,EAAC,IAAI,EAAE,UAAU,EAAa,OAAO,EAAE,QAAQ,EAAC;IAEhD,EAAC,IAAI,EAAE,qBAAqB,EAAG,OAAO,EAAE,SAAS,EAAC;IAClD,EAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,SAAS,EAAC;IAClD,EAAC,IAAI,EAAE,aAAa,EAAW,OAAO,EAAE,QAAQ,EAAC;IACjD,EAAC,IAAI,EAAE,cAAc,EAAU,OAAO,EAAE,QAAQ,EAAC;IACjD,EAAC,IAAI,EAAE,UAAU,EAAc,OAAO,EAAE,UAAU,EAAC;CACpD,CAAC;AAEW,QAAA,eAAe,GAAG;IAC7B,EAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,SAAS,EAAC;CACnD,CAAC;AACW,QAAA,GAAG,GAAU,EAAS,CAAC","sourcesContent":["// TODO(PK): hard-code for now, will query npm repo\n// to get this info in the future\nimport { MagicMetadata } from \"./metadata.class\";\nimport { IEnv } from \"../../types/interfaces/env.interface\";\n\nexport const METADATA_DIR = `magic-metadata`;\nexport const GEN_COMPONENTS_ARRAY = 'magicGenComponents';\nexport const GEN_COMPONENTS_HASH = 'magicGenCmpsHash';\nexport const GEN_FOLDER = 'magic';\nexport const MAGIC_CLI_FOLDER = './node_modules/@magic-xpa/cli';\nexport const GEN_LAZY_LOAD_MODULES_ARRAY = 'LazyLoadModulesMap';\nexport const manifest_path = `./${METADATA_DIR}/manifest.json`;\nexport const config_path = `./${METADATA_DIR}/config.json`;\n\nexport class Idependencies {\n constructor(setName:string, setVersion:string){\n this.name = setName;\n this.version = setVersion;\n }\n name:string;\n version:string;\n}\n\nexport var dependencies = [\n\n // material dependencies\n {name: \"@angular/material\" , version: '^13.0.0'},\n {name: \"@angular/cdk\" , version: '^13.0.0'},\n {name: \"@angular/animations\", version: '^13.0.0'},\n {name: \"font-awesome\" , version: '^4.7.0'},\n {name: \"hammerjs\" , version: '^2.0.8'},\n\n {name: \"ngx-infinite-scroll\" , version: '^10.0.0'},\n {name: \"ng-dynamic-component\", version: '~10.1.0'},\n {name: \"rxjs-compat\" , version: \"^6.6.0\"},\n {name: \"ngx-currency\" , version: \"^2.5.2\"},\n {name: \"ngx-mask\" , version: \"^13.1.15\"}\n];\n\nexport const devDependencies = [\n {name: \"@types/stacktrace-js\", version: '^0.0.32'}\n];\nexport const env : IEnv = {} as any;\n\n"]}
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["env.ts"],"names":[],"mappings":";;;AAKa,QAAA,YAAY,GAAW,gBAAgB,CAAC;AACxC,QAAA,oBAAoB,GAAG,oBAAoB,CAAC;AAC5C,QAAA,mBAAmB,GAAI,kBAAkB,CAAC;AAC1C,QAAA,UAAU,GAAa,OAAO,CAAC;AAC/B,QAAA,gBAAgB,GAAO,+BAA+B,CAAC;AACvD,QAAA,2BAA2B,GAAI,oBAAoB,CAAC;AACpD,QAAA,aAAa,GAAI,KAAK,oBAAY,gBAAgB,CAAC;AACnD,QAAA,WAAW,GAAM,KAAK,oBAAY,cAAc,CAAC;AAE9D,MAAa,aAAa;IACxB,YAAY,OAAc,EAAE,UAAiB;QAC3C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;IAC5B,CAAC;CAGF;AAPD,sCAOC;AAEU,QAAA,YAAY,GAAG;IAExB,wBAAwB;IACxB,EAAC,IAAI,EAAE,mBAAmB,EAAI,OAAO,EAAE,SAAS,EAAC;IACjD,EAAC,IAAI,EAAE,cAAc,EAAS,OAAO,EAAE,SAAS,EAAC;IACjD,EAAC,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,SAAS,EAAC;IACjD,EAAC,IAAI,EAAE,cAAc,EAAS,OAAO,EAAE,QAAQ,EAAC;IAChD,EAAC,IAAI,EAAE,UAAU,EAAa,OAAO,EAAE,QAAQ,EAAC;IAEhD,EAAC,IAAI,EAAE,qBAAqB,EAAG,OAAO,EAAE,SAAS,EAAC;IAClD,EAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,SAAS,EAAC;IAClD,EAAC,IAAI,EAAE,aAAa,EAAW,OAAO,EAAE,QAAQ,EAAC;IACjD,EAAC,IAAI,EAAE,cAAc,EAAU,OAAO,EAAE,QAAQ,EAAC;IACjD,EAAC,IAAI,EAAE,UAAU,EAAc,OAAO,EAAE,UAAU,EAAC;IAEnD,4DAA4D;IAC5D,EAAC,IAAI,EAAE,kBAAkB,EAAO,OAAO,EAAE,QAAQ,EAAC;IAClD,EAAC,IAAI,EAAE,eAAe,EAAU,OAAO,EAAE,QAAQ,EAAC;IAClD,EAAC,IAAI,EAAE,cAAc,EAAW,OAAO,EAAE,QAAQ,EAAC;CAEnD,CAAC;AAEW,QAAA,eAAe,GAAG;IAC7B,EAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,SAAS,EAAC;CACnD,CAAC;AACW,QAAA,GAAG,GAAU,EAAS,CAAC","sourcesContent":["// TODO(PK): hard-code for now, will query npm repo\n// to get this info in the future\nimport { MagicMetadata } from \"./metadata.class\";\nimport { IEnv } from \"../../types/interfaces/env.interface\";\n\nexport const METADATA_DIR = `magic-metadata`;\nexport const GEN_COMPONENTS_ARRAY = 'magicGenComponents';\nexport const GEN_COMPONENTS_HASH = 'magicGenCmpsHash';\nexport const GEN_FOLDER = 'magic';\nexport const MAGIC_CLI_FOLDER = './node_modules/@magic-xpa/cli';\nexport const GEN_LAZY_LOAD_MODULES_ARRAY = 'LazyLoadModulesMap';\nexport const manifest_path = `./${METADATA_DIR}/manifest.json`;\nexport const config_path = `./${METADATA_DIR}/config.json`;\n\nexport class Idependencies {\n constructor(setName:string, setVersion:string){\n this.name = setName;\n this.version = setVersion;\n }\n name:string;\n version:string;\n}\n\nexport var dependencies = [\n\n // material dependencies\n {name: \"@angular/material\" , version: '^14.0.0'},\n {name: \"@angular/cdk\" , version: '^14.0.0'},\n {name: \"@angular/animations\", version: '^15.2.2'},\n {name: \"font-awesome\" , version: '^4.7.0'},\n {name: \"hammerjs\" , version: '^2.0.8'},\n\n {name: \"ngx-infinite-scroll\" , version: '^10.0.0'},\n {name: \"ng-dynamic-component\", version: '~10.1.0'},\n {name: \"rxjs-compat\" , version: \"^6.6.0\"},\n {name: \"ngx-currency\" , version: \"^2.5.2\"},\n {name: \"ngx-mask\" , version: \"^13.1.15\"},\n\n // Time masking dependencies (hh:mm, hh:mm:ss, hh:mm:ss:mss)\n {name: \"@maskito/angular\" , version: \"^1.4.0\"},\n {name: \"@maskito/core\" , version: \"^1.4.0\"},\n {name: \"@maskito/kit\" , version: \"^1.4.0\"}\n\n];\n\nexport const devDependencies = [\n {name: \"@types/stacktrace-js\", version: '^0.0.32'}\n];\nexport const env : IEnv = {} as any;\n\n"]}
@@ -24,9 +24,9 @@ export class Idependencies {
24
24
  export var dependencies = [
25
25
 
26
26
  // material dependencies
27
- {name: "@angular/material" , version: '^13.0.0'},
28
- {name: "@angular/cdk" , version: '^13.0.0'},
29
- {name: "@angular/animations", version: '^13.0.0'},
27
+ {name: "@angular/material" , version: '^14.0.0'},
28
+ {name: "@angular/cdk" , version: '^14.0.0'},
29
+ {name: "@angular/animations", version: '^15.2.2'},
30
30
  {name: "font-awesome" , version: '^4.7.0'},
31
31
  {name: "hammerjs" , version: '^2.0.8'},
32
32
 
@@ -34,7 +34,13 @@ export var dependencies = [
34
34
  {name: "ng-dynamic-component", version: '~10.1.0'},
35
35
  {name: "rxjs-compat" , version: "^6.6.0"},
36
36
  {name: "ngx-currency" , version: "^2.5.2"},
37
- {name: "ngx-mask" , version: "^13.1.15"}
37
+ {name: "ngx-mask" , version: "^13.1.15"},
38
+
39
+ // Time masking dependencies (hh:mm, hh:mm:ss, hh:mm:ss:mss)
40
+ {name: "@maskito/angular" , version: "^1.4.0"},
41
+ {name: "@maskito/core" , version: "^1.4.0"},
42
+ {name: "@maskito/kit" , version: "^1.4.0"}
43
+
38
44
  ];
39
45
 
40
46
  export const devDependencies = [
@@ -27,6 +27,7 @@ export declare class MagicPaths {
27
27
  get metadataFolderPath(): string;
28
28
  get manifestPath(): string;
29
29
  get configPath(): string;
30
+ get programListPath(): string;
30
31
  get routesPath(): string;
31
32
  constructor(project: Project);
32
33
  }
@@ -36,12 +37,15 @@ export declare class MagicMetadata {
36
37
  options: MagicOptionScheme;
37
38
  private _config;
38
39
  private _routesTable;
40
+ private _programListContents;
39
41
  paths: MagicPaths;
40
42
  get theme(): string;
41
43
  get allow_testing(): boolean;
42
44
  get config(): AppConfig;
45
+ get programListContents(): any;
43
46
  get routesTable(): RouteTable[];
44
47
  constructor(host: Tree, context: SchematicContext, options: MagicOptionScheme);
45
48
  loadConfig(): AppConfig;
49
+ loadProgramList(): any;
46
50
  loadRoutes(): RouteTable[];
47
51
  }
@@ -67,6 +67,7 @@ class MagicPaths {
67
67
  get metadataFolderPath() { return `./${this.project.root}/${env_1.METADATA_DIR}`; }
68
68
  get manifestPath() { return `./${this.project.root}/${env_1.METADATA_DIR}/manifest.json`; }
69
69
  get configPath() { return `./${this.project.root}/${env_1.METADATA_DIR}/config.json`; }
70
+ get programListPath() { return `./${this.project.root}/${env_1.METADATA_DIR}/ProgramsList.json`; }
70
71
  get routesPath() { return `./${this.project.root}/${env_1.METADATA_DIR}/routes.json`; }
71
72
  constructor(project) {
72
73
  this.project = project;
@@ -91,6 +92,11 @@ class MagicMetadata {
91
92
  return this._config;
92
93
  return this.loadConfig();
93
94
  }
95
+ get programListContents() {
96
+ if (this._programListContents)
97
+ return this._programListContents;
98
+ return this.loadProgramList();
99
+ }
94
100
  get routesTable() {
95
101
  if (this._routesTable)
96
102
  return this._routesTable;
@@ -106,6 +112,10 @@ class MagicMetadata {
106
112
  this._config = (0, utils_1.readJson)(this.host, this.paths.configPath);
107
113
  return this._config;
108
114
  }
115
+ loadProgramList() {
116
+ this._programListContents = (0, utils_1.readJson)(this.host, this.paths.programListPath);
117
+ return this._programListContents;
118
+ }
109
119
  loadRoutes() {
110
120
  this._routesTable = (0, utils_1.readJson)(this.host, this.paths.routesPath);
111
121
  return this._routesTable;
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.class.js","sourceRoot":"","sources":["metadata.class.ts"],"names":[],"mappings":";;;AAIA,+BAAsD;AAEtD,mCAA+C;AAG/C,MAAa,UAAU;IAErB,iCAAiC;IACjC,8EAA8E;IAC/E,iBAAiB,CAAC,WAAkB;QACjC,IAAI,WAAW,KAAK,EAAE,EAAE;YACtB,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,gBAAU,IAAI,WAAW,EAAE,CAAC;SAClE;QAED,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,gBAAU,EAAE,CAAC;IAGpD,CAAC;IAED,uDAAuD;IACvD,kHAAkH;IAClH,uBAAuB,CAAC,WAAkB,EAAE,aAAoB;QAC5D,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,aAAa,EAAE,CAAC;IACrE,CAAC;IAED,uBAAuB,CAAC,WAAkB;QACxC,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,WAAW,OAAO,CAAC;IAC1D,CAAC;IAED,mCAAmC,CAAC,WAAkB,EAAE,WAAkB;QACxE,IAAI,gCAAgC,GAAG,GAAG,WAAW,EAAE,CAAC;QACxD,IAAI,WAAW,KAAK,EAAE;YACpB,gCAAgC,GAAG,GAAG,WAAW,IAAI,WAAW,EAAE,CAAC;QAErE,OAAO,gCAAgC,CAAC;IAC1C,CAAC;IAED,wBAAwB,CAAC,WAAkB;QAEzC,IAAI,WAAW,IAAI,EAAE;YACnB,OAAO,IAAI,CAAC,aAAa,CAAC;QAE5B,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,gBAAU,IAAI,WAAW,gBAAgB,CAAC;IACjF,CAAC;IACD,IAAI,kBAAkB,KAAI,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC;IACpE,IAAI,gBAAgB,KAAM,OAAO,KAAK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,CAAC,UAAU,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;CACF;AAzCD,sCAyCC","sourcesContent":["import { SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { AppConfig, ComponentId, Route, RouteTable } from \"../../types/interfaces/app\";\nimport { MagicOptionScheme } from \"./rules/magic-option.scheme\";\nimport { Project } from \"../utils/devkit-utils/config\";\nimport { env, GEN_FOLDER, METADATA_DIR } from \"./env\";\nimport { Manifest } from \"./manifest\";\nimport { getProject, readJson } from \"./utils\";\n\n\nexport class MagicPaths {\n\n // return the current module path\n // for example : for module \"WebModule1\" it returns 'src/app/magic/WebModule1'\n currentModulePath(module_name:string) {\n if (module_name !== \"\") {\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}`;\n }\n\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}`;\n\n\n }\n\n // return the destanation path for create the component\n // for example : for module \"WebModule1\" component \"WebModule1/folder1/bb/cc/it returns 'src/app/magic/WebModule1'\n getDestPathForComponent(module_name:string, componentPath:string) {\n return `${this.currentModulePath(module_name)}/${componentPath}`;\n }\n\n getJsonPathForComponent(cmpJsonPath:string) {\n return `${this.metadataFolderPath}/${cmpJsonPath}.json`;\n }\n\n getRelativePathForComponentInModule(module_name:string, cmpJsonPath:string) {\n let relativePathForComponentInModule = `${cmpJsonPath}`;\n if (module_name !== \"\")\n relativePathForComponentInModule = `${module_name}/${cmpJsonPath}`;\n\n return relativePathForComponentInModule;\n }\n\n getRoutePathForWebModule(module_name:string) {\n\n if (module_name == \"\")\n return this.appRoutesPath;\n\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}/app.routes.ts`;\n }\n get rootMagicGenFolder(){ return `./${this.project.root}/src/app`; }\n get appComponentPath(){ return `./${this.project.root}/src/app/app.component.html`}\n get appRoutesPath(){ return `./${this.project.root}/src/app/app.routes.ts`}\n get appModulePath(){ return `./${this.project.root}/src/app/app.module.ts`}\n get executionPath(){ return `./${this.project.root}/src/assets/execution.properties`}\n get magicStylePath(){ return `./${this.project.root}/src/magic-styles.css`}\n get angularJsonPath(){ return `./angular.json`}\n get tsConfigAppJsonPath(){ return `./${this.project.root}/tsconfig.app.json`}\n\n // get the relative path of module to be used in LazyLoadMap\n magicGenLibModulePath (moduleName){\n\n let rootPath = this.project.root == '' ? this.project.root: this.project.root + '/';\n let modulepath = rootPath+`src/app/${GEN_FOLDER}`;\n if (moduleName !== \"\") {\n return `${modulepath}/${moduleName}/magic.gen.lib.module`;\n }\n return `${modulepath}/magic.gen.lib.module`;\n }\n\n // Files under gen folder\n get magicGenFolderPath (){ return `./${this.project.root}/src/app/${GEN_FOLDER}`}\n\n componentListPathForCurrentModuleName (module_name:string):string{\n return `./${this.project.root}/src/app/${GEN_FOLDER}/${module_name}/component-list.g.ts`\n }\n componentListPath (module_name:string):string{\n\n if (module_name !== \"\"){\n return this.componentListPathForCurrentModuleName(module_name);\n }\n return this.rootMagicComponentListPath;\n }\n\n get rootMagicComponentListPath (){\n\n return `./${this.project.root}/src/app/${GEN_FOLDER}/component-list.g.ts`\n }\n\n get magicGenLibModule (){ return `./${this.project.root}/src/app/${GEN_FOLDER}/magic.gen.lib.module.ts`}\n\n get favIconPath(){ return `./${this.project.root}/src/favicon.ico`; }\n\n get metadataFolderPath(){ return `./${this.project.root}/${METADATA_DIR}`; }\n get manifestPath (){ return `./${this.project.root}/${METADATA_DIR}/manifest.json`; }\n get configPath (){ return `./${this.project.root}/${METADATA_DIR}/config.json`; }\n get routesPath (){ return `./${this.project.root}/${METADATA_DIR}/routes.json`; }\n\n constructor(protected project:Project){\n }\n}\n\n\nexport class MagicMetadata {\n\n private _config: AppConfig;\n private _routesTable: RouteTable[];\n\n paths: MagicPaths;\n\n get theme() {\n if (!this.options.theme) {\n this.options.theme = env.metadata.config ?env.metadata.config.theme : 'basicHTML';\n }\n return this.options.theme;\n }\n\n get allow_testing() {\n if (!this.options.allowTesting) {\n this.options.allowTesting = env.metadata.config ?env.metadata.config.allow_testing: false;\n }\n return this.options.allowTesting;\n }\n get config() {\n if (this._config) return this._config;\n return this.loadConfig();\n }\n get routesTable(){\n if (this._routesTable) return this._routesTable;\n return this.loadRoutes();\n }\n\n constructor(public host: Tree, public context: SchematicContext, public options: MagicOptionScheme) {\n this.paths = new MagicPaths(getProject(host, options.project));\n }\n\n loadConfig() {\n this._config = readJson(this.host, this.paths.configPath);\n return this._config;\n }\n loadRoutes() {\n this._routesTable = readJson(this.host, this.paths.routesPath);\n return this._routesTable;\n }\n}\n\n\n"]}
1
+ {"version":3,"file":"metadata.class.js","sourceRoot":"","sources":["metadata.class.ts"],"names":[],"mappings":";;;AAIA,+BAAsD;AAEtD,mCAA+C;AAG/C,MAAa,UAAU;IAErB,iCAAiC;IACjC,8EAA8E;IAC/E,iBAAiB,CAAC,WAAkB;QACjC,IAAI,WAAW,KAAK,EAAE,EAAE;YACtB,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,gBAAU,IAAI,WAAW,EAAE,CAAC;SAClE;QAED,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,gBAAU,EAAE,CAAC;IAGpD,CAAC;IAED,uDAAuD;IACvD,kHAAkH;IAClH,uBAAuB,CAAC,WAAkB,EAAE,aAAoB;QAC5D,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,aAAa,EAAE,CAAC;IACrE,CAAC;IAED,uBAAuB,CAAC,WAAkB;QACxC,OAAO,GAAG,IAAI,CAAC,kBAAkB,IAAI,WAAW,OAAO,CAAC;IAC1D,CAAC;IAED,mCAAmC,CAAC,WAAkB,EAAE,WAAkB;QACxE,IAAI,gCAAgC,GAAG,GAAG,WAAW,EAAE,CAAC;QACxD,IAAI,WAAW,KAAK,EAAE;YACpB,gCAAgC,GAAG,GAAG,WAAW,IAAI,WAAW,EAAE,CAAC;QAErE,OAAO,gCAAgC,CAAC;IAC1C,CAAC;IAED,wBAAwB,CAAC,WAAkB;QAEz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mB,IAAU,EAAS,OAAyB,EAAS,OAA0B;QAA/E,SAAI,GAAJ,IAAI,CAAM;QAAS,YAAO,GAAP,OAAO,CAAkB;QAAS,YAAO,GAAP,OAAO,CAAmB;QAChG,IAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,IAAA,kBAAU,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,UAAU;QACR,IAAI,CAAC,OAAO,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,eAAe;QACX,IAAI,CAAC,oBAAoB,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAED,UAAU;QACR,IAAI,CAAC,YAAY,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;CACF;AAtDD,sCAsDC","sourcesContent":["import { SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { AppConfig, ComponentId, Route, RouteTable } from \"../../types/interfaces/app\";\nimport { MagicOptionScheme } from \"./rules/magic-option.scheme\";\nimport { Project } from \"../utils/devkit-utils/config\";\nimport { env, GEN_FOLDER, METADATA_DIR } from \"./env\";\nimport { Manifest } from \"./manifest\";\nimport { getProject, readJson } from \"./utils\";\n\n\nexport class MagicPaths {\n\n // return the current module path\n // for example : for module \"WebModule1\" it returns 'src/app/magic/WebModule1'\n currentModulePath(module_name:string) {\n if (module_name !== \"\") {\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}`;\n }\n\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}`;\n\n\n }\n\n // return the destanation path for create the component\n // for example : for module \"WebModule1\" component \"WebModule1/folder1/bb/cc/it returns 'src/app/magic/WebModule1'\n getDestPathForComponent(module_name:string, componentPath:string) {\n return `${this.currentModulePath(module_name)}/${componentPath}`;\n }\n\n getJsonPathForComponent(cmpJsonPath:string) {\n return `${this.metadataFolderPath}/${cmpJsonPath}.json`;\n }\n\n getRelativePathForComponentInModule(module_name:string, cmpJsonPath:string) {\n let relativePathForComponentInModule = `${cmpJsonPath}`;\n if (module_name !== \"\")\n relativePathForComponentInModule = `${module_name}/${cmpJsonPath}`;\n\n return relativePathForComponentInModule;\n }\n\n getRoutePathForWebModule(module_name:string) {\n\n if (module_name == \"\")\n return this.appRoutesPath;\n\n return `${this.rootMagicGenFolder}/${GEN_FOLDER}/${module_name}/app.routes.ts`;\n }\n get rootMagicGenFolder(){ return `./${this.project.root}/src/app`; }\n get appComponentPath(){ return `./${this.project.root}/src/app/app.component.html`}\n get appRoutesPath(){ return `./${this.project.root}/src/app/app.routes.ts`}\n get appModulePath(){ return `./${this.project.root}/src/app/app.module.ts`}\n get executionPath(){ return `./${this.project.root}/src/assets/execution.properties`}\n get magicStylePath(){ return `./${this.project.root}/src/magic-styles.css`}\n get angularJsonPath(){ return `./angular.json`}\n get tsConfigAppJsonPath(){ return `./${this.project.root}/tsconfig.app.json`}\n\n // get the relative path of module to be used in LazyLoadMap\n magicGenLibModulePath (moduleName){\n\n let rootPath = this.project.root == '' ? this.project.root: this.project.root + '/';\n let modulepath = rootPath+`src/app/${GEN_FOLDER}`;\n if (moduleName !== \"\") {\n return `${modulepath}/${moduleName}/magic.gen.lib.module`;\n }\n return `${modulepath}/magic.gen.lib.module`;\n }\n\n // Files under gen folder\n get magicGenFolderPath (){ return `./${this.project.root}/src/app/${GEN_FOLDER}`}\n\n componentListPathForCurrentModuleName (module_name:string):string{\n return `./${this.project.root}/src/app/${GEN_FOLDER}/${module_name}/component-list.g.ts`\n }\n componentListPath (module_name:string):string{\n\n if (module_name !== \"\"){\n return this.componentListPathForCurrentModuleName(module_name);\n }\n return this.rootMagicComponentListPath;\n }\n\n get rootMagicComponentListPath (){\n\n return `./${this.project.root}/src/app/${GEN_FOLDER}/component-list.g.ts`\n }\n\n get magicGenLibModule (){ return `./${this.project.root}/src/app/${GEN_FOLDER}/magic.gen.lib.module.ts`}\n\n get favIconPath(){ return `./${this.project.root}/src/favicon.ico`; }\n\n get metadataFolderPath(){ return `./${this.project.root}/${METADATA_DIR}`; }\n get manifestPath (){ return `./${this.project.root}/${METADATA_DIR}/manifest.json`; }\n get configPath (){ return `./${this.project.root}/${METADATA_DIR}/config.json`; }\n get programListPath (){return `./${this.project.root}/${METADATA_DIR}/ProgramsList.json`; }\n get routesPath (){ return `./${this.project.root}/${METADATA_DIR}/routes.json`; }\n\n constructor(protected project:Project){\n }\n}\n\n\nexport class MagicMetadata {\n\n private _config: AppConfig;\n private _routesTable: RouteTable[];\n private _programListContents: any;\n\n paths: MagicPaths;\n\n get theme() {\n if (!this.options.theme) {\n this.options.theme = env.metadata.config ?env.metadata.config.theme : 'basicHTML';\n }\n return this.options.theme;\n }\n\n get allow_testing() {\n if (!this.options.allowTesting) {\n this.options.allowTesting = env.metadata.config ?env.metadata.config.allow_testing: false;\n }\n return this.options.allowTesting;\n }\n get config() {\n if (this._config) return this._config;\n return this.loadConfig();\n }\n\n get programListContents(){\n if(this._programListContents) return this._programListContents;\n return this.loadProgramList();\n }\n\n get routesTable(){\n if (this._routesTable) return this._routesTable;\n return this.loadRoutes();\n }\n\n constructor(public host: Tree, public context: SchematicContext, public options: MagicOptionScheme) {\n this.paths = new MagicPaths(getProject(host, options.project));\n }\n\n loadConfig() {\n this._config = readJson(this.host, this.paths.configPath);\n return this._config;\n }\n\n loadProgramList(){\n this._programListContents = readJson(this.host, this.paths.programListPath);\n return this._programListContents;\n }\n\n loadRoutes() {\n this._routesTable = readJson(this.host, this.paths.routesPath);\n return this._routesTable;\n }\n}\n\n\n"]}
@@ -92,6 +92,7 @@ export class MagicPaths {
92
92
  get metadataFolderPath(){ return `./${this.project.root}/${METADATA_DIR}`; }
93
93
  get manifestPath (){ return `./${this.project.root}/${METADATA_DIR}/manifest.json`; }
94
94
  get configPath (){ return `./${this.project.root}/${METADATA_DIR}/config.json`; }
95
+ get programListPath (){return `./${this.project.root}/${METADATA_DIR}/ProgramsList.json`; }
95
96
  get routesPath (){ return `./${this.project.root}/${METADATA_DIR}/routes.json`; }
96
97
 
97
98
  constructor(protected project:Project){
@@ -103,6 +104,7 @@ export class MagicMetadata {
103
104
 
104
105
  private _config: AppConfig;
105
106
  private _routesTable: RouteTable[];
107
+ private _programListContents: any;
106
108
 
107
109
  paths: MagicPaths;
108
110
 
@@ -123,6 +125,12 @@ export class MagicMetadata {
123
125
  if (this._config) return this._config;
124
126
  return this.loadConfig();
125
127
  }
128
+
129
+ get programListContents(){
130
+ if(this._programListContents) return this._programListContents;
131
+ return this.loadProgramList();
132
+ }
133
+
126
134
  get routesTable(){
127
135
  if (this._routesTable) return this._routesTable;
128
136
  return this.loadRoutes();
@@ -136,6 +144,12 @@ export class MagicMetadata {
136
144
  this._config = readJson(this.host, this.paths.configPath);
137
145
  return this._config;
138
146
  }
147
+
148
+ loadProgramList(){
149
+ this._programListContents = readJson(this.host, this.paths.programListPath);
150
+ return this._programListContents;
151
+ }
152
+
139
153
  loadRoutes() {
140
154
  this._routesTable = readJson(this.host, this.paths.routesPath);
141
155
  return this._routesTable;
@@ -1,12 +1,12 @@
1
1
  import { Rule } from "@angular-devkit/schematics";
2
2
  import { MagicOptionScheme } from "./magic-option.scheme";
3
- export declare function initGenModules(options: MagicOptionScheme): Rule;
3
+ export declare function initGenModules(options: MagicOptionScheme, generateViaCLI?: boolean): Rule;
4
4
  export declare function overwriteWebModuleFileName(options: any, moduleNameFileName: string, content: string): Rule;
5
5
  export declare function updateWebModuleFileWithNewClassName(options: any, webModuleName: string): Rule;
6
6
  export declare function getDestinationModulePathByWebModuleName(webModuleName: string): string;
7
7
  export declare function checkAndCreateModule(options: MagicOptionScheme, webModuleName: string, loadOnDemand: boolean): Rule;
8
8
  export declare function generateWebModule(options: MagicOptionScheme, webModuleName: string, loadOnDemand: boolean): Rule;
9
- export declare function generateWebModules(options: MagicOptionScheme): Rule;
9
+ export declare function generateWebModules(options: MagicOptionScheme, generateViaCLI?: boolean): Rule;
10
10
  export declare function checkAndCreateRouteForModule(options: MagicOptionScheme, webModuleName: string, loadOnDemand: boolean): Rule;
11
11
  export declare function createRoute(options: MagicOptionScheme, webModuleName: string): Rule;
12
12
  export declare function addRouteFileToModuleFile(options: MagicOptionScheme, webModuleName: string): Rule;
@@ -9,25 +9,40 @@ const env_interface_1 = require("../../../types/interfaces/env.interface");
9
9
  //-------------------------------------------------------------------------------------------------
10
10
  // init generate module into env.modulesGen
11
11
  //-------------------------------------------------------------------------------------------------
12
- function initGenModules(options) {
12
+ function initGenModules(options, generateViaCLI = false) {
13
13
  return (tree, context) => {
14
14
  let metadata = env_1.env.metadata;
15
+ let programList = env_1.env.programList;
15
16
  env_1.env.modulesGen = [];
16
17
  let web_modules = metadata.config.web_modules;
17
- // Generate only one module from --module=xxxx
18
- if (options.module) {
19
- let moduleInfo = new env_interface_1.ModuleInfo(options.module, options.loadOnDemand);
20
- env_1.env.modulesGen.push(moduleInfo);
18
+ if (generateViaCLI) {
19
+ let programListString = JSON.stringify(programList.programListContents);
20
+ // Validate whether the component is valid
21
+ if (programListString.includes(options.component)) {
22
+ let moduleInfo = new env_interface_1.ModuleInfo(options.module, options.loadOnDemand);
23
+ env_1.env.modulesGen.push(moduleInfo);
24
+ }
25
+ else {
26
+ (0, Util_1.LogLn)(`Invalid component ${options.component} to generate.`);
27
+ }
21
28
  }
22
29
  else {
23
- // Generate list of components from config.json, properties web_modules.module_name
24
- for (let modulePath of web_modules) {
25
- //LogLn(` Web Module name: [${modulePath.module_name}] IsLoadOnDemand? [${modulePath.load_on_demand}]`);
26
- let moduleInfo = new env_interface_1.ModuleInfo(modulePath.module_name, modulePath.load_on_demand);
30
+ // Generate only one module from --module=xxxx
31
+ if (options.module) {
32
+ let moduleInfo = new env_interface_1.ModuleInfo(options.module, options.loadOnDemand);
27
33
  env_1.env.modulesGen.push(moduleInfo);
28
34
  }
35
+ else {
36
+ // Generate list of components from config.json, properties web_modules.module_name
37
+ for (let modulePath of web_modules) {
38
+ //LogLn(` Web Module name: [${modulePath.module_name}] IsLoadOnDemand? [${modulePath.load_on_demand}]`);
39
+ let moduleInfo = new env_interface_1.ModuleInfo(modulePath.module_name, modulePath.load_on_demand);
40
+ env_1.env.modulesGen.push(moduleInfo);
41
+ }
42
+ }
29
43
  }
30
- (0, Util_1.LogLn)(` Number of modules to be check for generate: ${web_modules.length}`);
44
+ if (!generateViaCLI)
45
+ (0, Util_1.LogLn)(` Number of modules to be check for generate: ${web_modules.length}`);
31
46
  return tree;
32
47
  };
33
48
  }
@@ -175,12 +190,19 @@ exports.generateWebModule = generateWebModule;
175
190
  //-------------------------------------------------------------------------------------------------
176
191
  // generate all the modules in env.modulesGen
177
192
  //-------------------------------------------------------------------------------------------------
178
- function generateWebModules(options) {
193
+ function generateWebModules(options, generateViaCLI = false) {
179
194
  return (tree, context) => {
180
195
  let rules = [];
181
196
  for (let webModuleInfo of env_1.env.modulesGen) {
182
197
  if (webModuleInfo.moduleName !== undefined && webModuleInfo.moduleName !== "") {
183
- rules.push(generateWebModule(options, webModuleInfo.moduleName, webModuleInfo.loadOnDemand));
198
+ if (generateViaCLI) {
199
+ if (webModuleInfo.moduleName === options.module) {
200
+ rules.push(generateWebModule(options, webModuleInfo.moduleName, webModuleInfo.loadOnDemand));
201
+ }
202
+ }
203
+ else {
204
+ rules.push(generateWebModule(options, webModuleInfo.moduleName, webModuleInfo.loadOnDemand));
205
+ }
184
206
  }
185
207
  }
186
208
  return (0, schematics_1.chain)(rules)(tree, context);
@@ -1 +1 @@
1
- {"version":3,"file":"init-add-modules.rule.js","sourceRoot":"","sources":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,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,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC,IAAI,EAAC,OAAO,CAAC,CAAC;SACnC;aAED;YACE,MAAM,aAAa,GAAG,uCAAuC,CAAC,aAAa,CAAC,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"]}
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,yCA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AAc,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, generateViaCLI:boolean = false): Rule {\n return (tree: Tree, context: SchematicContext) => {\n let metadata = env.metadata;\n let programList = env.programList;\n env.modulesGen = [];\n let web_modules:webModuleItem [] = metadata.config.web_modules;\n\n if(generateViaCLI){\n let programListString = JSON.stringify(programList.programListContents);\n\n // Validate whether the component is valid\n if(programListString.includes(options.component)){\n let moduleInfo: ModuleInfo = new ModuleInfo(options.module, options.loadOnDemand);\n env.modulesGen.push(moduleInfo)\n }else{\n LogLn(`Invalid component ${options.component} to generate.`);\n }\n }else{\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 }\n if(!generateViaCLI)\n LogLn(` Number of modules to be check for generate: ${web_modules.length}`);\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//-------------------------------------------------------------------------------------------------\nexport 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, generateViaCLI:boolean = false): 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 if (generateViaCLI) {\n if (webModuleInfo.moduleName === options.module) {\n rules.push(generateWebModule(options, webModuleInfo.moduleName, webModuleInfo.loadOnDemand));\n }\n }else{\n rules.push(generateWebModule(options, webModuleInfo.moduleName, webModuleInfo.loadOnDemand));\n }\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"]}
@@ -20,29 +20,40 @@ import * as ts from "typescript";
20
20
  //-------------------------------------------------------------------------------------------------
21
21
  // init generate module into env.modulesGen
22
22
  //-------------------------------------------------------------------------------------------------
23
- export function initGenModules(options: MagicOptionScheme): Rule {
23
+ export function initGenModules(options: MagicOptionScheme, generateViaCLI:boolean = false): Rule {
24
24
  return (tree: Tree, context: SchematicContext) => {
25
25
  let metadata = env.metadata;
26
+ let programList = env.programList;
26
27
  env.modulesGen = [];
27
28
  let web_modules:webModuleItem [] = metadata.config.web_modules;
28
29
 
29
- // Generate only one module from --module=xxxx
30
- if (options.module) {
31
- let moduleInfo : ModuleInfo = new ModuleInfo(options.module, options.loadOnDemand);
32
- env.modulesGen.push(moduleInfo)
33
- } else {
34
-
35
- // Generate list of components from config.json, properties web_modules.module_name
36
- for (let modulePath of web_modules) {
37
- //LogLn(` Web Module name: [${modulePath.module_name}] IsLoadOnDemand? [${modulePath.load_on_demand}]`);
38
- let moduleInfo : ModuleInfo = new ModuleInfo(modulePath.module_name, modulePath.load_on_demand);
39
- env.modulesGen.push(moduleInfo);
30
+ if(generateViaCLI){
31
+ let programListString = JSON.stringify(programList.programListContents);
32
+
33
+ // Validate whether the component is valid
34
+ if(programListString.includes(options.component)){
35
+ let moduleInfo: ModuleInfo = new ModuleInfo(options.module, options.loadOnDemand);
36
+ env.modulesGen.push(moduleInfo)
37
+ }else{
38
+ LogLn(`Invalid component ${options.component} to generate.`);
39
+ }
40
+ }else{
41
+ // Generate only one module from --module=xxxx
42
+ if (options.module) {
43
+ let moduleInfo : ModuleInfo = new ModuleInfo(options.module, options.loadOnDemand);
44
+ env.modulesGen.push(moduleInfo)
45
+ } else {
46
+
47
+ // Generate list of components from config.json, properties web_modules.module_name
48
+ for (let modulePath of web_modules) {
49
+ //LogLn(` Web Module name: [${modulePath.module_name}] IsLoadOnDemand? [${modulePath.load_on_demand}]`);
50
+ let moduleInfo : ModuleInfo = new ModuleInfo(modulePath.module_name, modulePath.load_on_demand);
51
+ env.modulesGen.push(moduleInfo);
52
+ }
40
53
  }
41
54
  }
42
- LogLn(` Number of modules to be check for generate: ${web_modules.length}`);
43
-
44
-
45
-
55
+ if(!generateViaCLI)
56
+ LogLn(` Number of modules to be check for generate: ${web_modules.length}`);
46
57
  return tree;
47
58
  };
48
59
  }
@@ -133,7 +144,7 @@ function deleteLazyLoadService( webModuleName:string): Rule {
133
144
  //-------------------------------------------------------------------------------------------------
134
145
  // get destination path according to the send webModuleName
135
146
  //-------------------------------------------------------------------------------------------------
136
- export function getDestinationModulePathByWebModuleName(webModuleName:string):string {
147
+ export function getDestinationModulePathByWebModuleName(webModuleName:string):string {
137
148
  const newDestModulePath = `${env.metadata.paths.rootMagicGenFolder}/${GEN_FOLDER}/${webModuleName}`;
138
149
  return newDestModulePath;
139
150
  }
@@ -170,7 +181,7 @@ function addMagicModuleToAppModule(options: MagicOptionScheme, modulePath:string
170
181
  modulePath, // for now we will update env.metadata.paths.magicGenLibModule
171
182
  moduleName, // 'MagicXXXModule',
172
183
  srcModuleName, // `./XXX/magic.gen.lib.module`
173
- );
184
+ );
174
185
  return tree;
175
186
  }
176
187
  }
@@ -220,14 +231,20 @@ export function generateWebModule(options: MagicOptionScheme, webModuleName:stri
220
231
  //-------------------------------------------------------------------------------------------------
221
232
  // generate all the modules in env.modulesGen
222
233
  //-------------------------------------------------------------------------------------------------
223
- export function generateWebModules(options: MagicOptionScheme): Rule {
234
+ export function generateWebModules(options: MagicOptionScheme, generateViaCLI:boolean = false): Rule {
224
235
  return (tree: Tree, context: SchematicContext) => {
225
236
 
226
237
  let rules:Rule[] = [];
227
238
 
228
239
  for (let webModuleInfo of env.modulesGen){
229
240
  if (webModuleInfo.moduleName !== undefined && webModuleInfo.moduleName !== "") {
230
- rules.push(generateWebModule(options, webModuleInfo.moduleName, webModuleInfo.loadOnDemand));
241
+ if (generateViaCLI) {
242
+ if (webModuleInfo.moduleName === options.module) {
243
+ rules.push(generateWebModule(options, webModuleInfo.moduleName, webModuleInfo.loadOnDemand));
244
+ }
245
+ }else{
246
+ rules.push(generateWebModule(options, webModuleInfo.moduleName, webModuleInfo.loadOnDemand));
247
+ }
231
248
  }
232
249
  }
233
250
 
@@ -271,7 +288,7 @@ export function createRoute(options: MagicOptionScheme, webModuleName:string): R
271
288
 
272
289
  let rules:Rule[] = [];
273
290
 
274
- rules.push(copyDefaultRouteMagicFilesToWebModule(options, webModuleName));
291
+ rules.push(copyDefaultRouteMagicFilesToWebModule(options, webModuleName));
275
292
  // --------------------------------------------------------
276
293
  // // generate the route for module /////
277
294
  // let routeItem : RouteTable = new RouteTable();
@@ -289,7 +306,7 @@ export function createRoute(options: MagicOptionScheme, webModuleName:string): R
289
306
  // update the new MagicRoutingModule in file magic.gen.lib.module.ts of the module
290
307
 
291
308
 
292
- rules.push(addRouteFileToModuleFile(options, webModuleName));
309
+ rules.push(addRouteFileToModuleFile(options, webModuleName));
293
310
 
294
311
  return chain(rules)(tree,context);
295
312
  };
@@ -1,4 +1,4 @@
1
1
  import { Rule } from "@angular-devkit/schematics";
2
2
  import { MagicOptionScheme } from "./magic-option.scheme";
3
- export declare function initAndGenComponentsForModule(options: MagicOptionScheme, shouldBuildAndUpdateModule: boolean): Rule;
3
+ export declare function initAndGenComponentsForModule(options: MagicOptionScheme, shouldBuildAndUpdateModule: boolean, generateViaCLI?: boolean): Rule;
4
4
  export declare function initGenComponentsFromList(options: MagicOptionScheme, module_name: string, component: string, form_files: string[]): Rule;
@@ -8,7 +8,7 @@ const build_view_rule_1 = require("./build-view.rule");
8
8
  const component_list_rule_1 = require("./component-list.rule");
9
9
  const init_add_modules_rule_1 = require("./init-add-modules.rule");
10
10
  const utils_1 = require("../utils");
11
- function initAndGenComponentsForModule(options, shouldBuildAndUpdateModule) {
11
+ function initAndGenComponentsForModule(options, shouldBuildAndUpdateModule, generateViaCLI = false) {
12
12
  return (tree, context) => {
13
13
  let metadata = env_1.env.metadata;
14
14
  env_1.env.componentsGen = [];
@@ -16,16 +16,28 @@ function initAndGenComponentsForModule(options, shouldBuildAndUpdateModule) {
16
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((0, init_add_modules_rule_1.initGenModules)(options));
20
- rules.push((0, init_add_modules_rule_1.generateWebModules)(options));
19
+ rules.push((0, init_add_modules_rule_1.initGenModules)(options, generateViaCLI));
20
+ rules.push((0, init_add_modules_rule_1.generateWebModules)(options, generateViaCLI));
21
21
  }
22
- for (let moduleJsonPath of metadata.config.web_modules) {
23
- rules.push((0, utils_1.displayMessge)(options, ` ****** Start Web Module name : [${moduleJsonPath.module_name}] *******`));
24
- rules.push(initGenComponentsFromList(options, moduleJsonPath.module_name, options.component, moduleJsonPath.form_files));
22
+ // TO DO: Following code can be simplified.
23
+ if (generateViaCLI) {
24
+ const componentsArray = [options.component];
25
+ rules.push(initGenComponentsFromList(options, options.module, options.component, componentsArray));
25
26
  rules.push((0, load_views_gen_rule_1.loadViewsToGen)(options));
26
27
  if (shouldBuildAndUpdateModule) {
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));
28
+ rules.push((0, build_view_rule_1.buildViews)(options, options.module));
29
+ rules.push((0, component_list_rule_1.componentlistGen)(options, options.module, options.loadOnDemand));
30
+ }
31
+ }
32
+ else {
33
+ for (let moduleJsonPath of metadata.config.web_modules) {
34
+ rules.push((0, utils_1.displayMessge)(options, ` ****** Start Web Module name : [${moduleJsonPath.module_name}] *******`));
35
+ rules.push(initGenComponentsFromList(options, moduleJsonPath.module_name, options.component, moduleJsonPath.form_files));
36
+ rules.push((0, load_views_gen_rule_1.loadViewsToGen)(options));
37
+ if (shouldBuildAndUpdateModule) {
38
+ rules.push((0, build_view_rule_1.buildViews)(options, moduleJsonPath.module_name));
39
+ rules.push((0, component_list_rule_1.componentlistGen)(options, moduleJsonPath.module_name, moduleJsonPath.load_on_demand));
40
+ }
29
41
  }
30
42
  }
31
43
  rules.push((0, utils_1.displayMessge)(options, " ********************************* E N D GENERATE *********************************"));
@@ -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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AAK,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"]}
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,EAA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AC,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\nimport {LogLn} from \"../Util\";\r\n\r\nexport function initAndGenComponentsForModule(options: MagicOptionScheme, shouldBuildAndUpdateModule: boolean, generateViaCLI: boolean = false): 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, generateViaCLI));\r\n rules.push(generateWebModules(options, generateViaCLI));\r\n }\r\n\r\n // TO DO: Following code can be simplified.\r\n if(generateViaCLI){\r\n const componentsArray = [options.component];\r\n rules.push(initGenComponentsFromList(options, options.module, options.component, componentsArray));\r\n rules.push(loadViewsToGen(options));\r\n\r\n if (shouldBuildAndUpdateModule) {\r\n rules.push(buildViews(options, options.module));\r\n rules.push(componentlistGen(options, options.module, options.loadOnDemand));\r\n }\r\n }else{\r\n for (let moduleJsonPath of metadata.config.web_modules) {\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 }\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"]}
@@ -6,9 +6,9 @@ import { buildViews } from "./build-view.rule";
6
6
  import { componentlistGen } from "./component-list.rule";
7
7
  import { generateWebModules, initGenModules } from "./init-add-modules.rule";
8
8
  import { displayMessge } from "../utils";
9
+ import {LogLn} from "../Util";
9
10
 
10
-
11
- export function initAndGenComponentsForModule(options: MagicOptionScheme, shouldBuildAndUpdateModule: boolean): Rule {
11
+ export function initAndGenComponentsForModule(options: MagicOptionScheme, shouldBuildAndUpdateModule: boolean, generateViaCLI: boolean = false): Rule {
12
12
  return (tree: Tree, context: SchematicContext) => {
13
13
  let metadata = env.metadata;
14
14
  env.componentsGen = [];
@@ -17,23 +17,35 @@ export function initAndGenComponentsForModule(options: MagicOptionScheme, should
17
17
  rules.push(displayMessge(options, " ********************************* START GENERATE *********************************"))
18
18
  // if we need to build and update module , first generate(if needed) the modules
19
19
  if (shouldBuildAndUpdateModule) {
20
- rules.push(initGenModules (options));
21
- rules.push(generateWebModules(options));
20
+ rules.push(initGenModules (options, generateViaCLI));
21
+ rules.push(generateWebModules(options, generateViaCLI));
22
22
  }
23
23
 
24
- for (let moduleJsonPath of metadata.config.web_modules) {
25
-
26
- rules.push(displayMessge(options, ` ****** Start Web Module name : [${moduleJsonPath.module_name}] *******`))
27
-
28
- rules.push(initGenComponentsFromList(options, moduleJsonPath.module_name, options.component, moduleJsonPath.form_files));
24
+ // TO DO: Following code can be simplified.
25
+ if(generateViaCLI){
26
+ const componentsArray = [options.component];
27
+ rules.push(initGenComponentsFromList(options, options.module, options.component, componentsArray));
29
28
  rules.push(loadViewsToGen(options));
30
29
 
31
30
  if (shouldBuildAndUpdateModule) {
32
- rules.push(buildViews(options, moduleJsonPath.module_name));
33
- rules.push(componentlistGen(options, moduleJsonPath.module_name, moduleJsonPath.load_on_demand));
31
+ rules.push(buildViews(options, options.module));
32
+ rules.push(componentlistGen(options, options.module, options.loadOnDemand));
33
+ }
34
+ }else{
35
+ for (let moduleJsonPath of metadata.config.web_modules) {
36
+ rules.push(displayMessge(options, ` ****** Start Web Module name : [${moduleJsonPath.module_name}] *******`))
37
+
38
+ rules.push(initGenComponentsFromList(options, moduleJsonPath.module_name, options.component, moduleJsonPath.form_files));
39
+ rules.push(loadViewsToGen(options));
40
+
41
+ if (shouldBuildAndUpdateModule) {
42
+ rules.push(buildViews(options, moduleJsonPath.module_name));
43
+ rules.push(componentlistGen(options, moduleJsonPath.module_name, moduleJsonPath.load_on_demand));
44
+ }
34
45
  }
35
46
  }
36
- rules.push(displayMessge(options, " ********************************* E N D GENERATE *********************************"))
47
+
48
+ rules.push(displayMessge(options, " ********************************* E N D GENERATE *********************************"))
37
49
  return chain(rules)(tree, context);
38
50
  };
39
51
  }
@@ -10,6 +10,7 @@ function initMagicMetadata(options) {
10
10
  env_1.env.workspace = (0, config_1.getWorkspace)(host);
11
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
+ env_1.env.programList = new metadata_class_1.MagicMetadata(host, context, options);
13
14
  }
14
15
  return host;
15
16
  };
@@ -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,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"]}
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;YAC1D,SAAG,CAAC,WAAW,GAAG,IAAI,8BAAa,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAA;AACH,CAAC;AAVD,8CAUC","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 env.programList = new MagicMetadata(host, context, options);\n }\n return host;\n }\n}\n\n"]}
@@ -11,6 +11,7 @@ export function initMagicMetadata(options:MagicOptionScheme) : Rule {
11
11
  env.workspace = getWorkspace(host);
12
12
  env.project = getProjectFromWorkspace(env.workspace, options.project);
13
13
  env.metadata = new MagicMetadata(host, context, options);
14
+ env.programList = new MagicMetadata(host, context, options);
14
15
  }
15
16
  return host;
16
17
  }
@@ -9,6 +9,7 @@ export interface MagicOptionScheme {
9
9
  component?: string;
10
10
  module?: string;
11
11
  loadOnDemand?: boolean;
12
+ containertype?: string;
12
13
  skipHelp?: boolean;
13
14
  project?: string;
14
15
  dependencies?: dependency[];
@@ -1 +1 @@
1
- {"version":3,"file":"magic-option.scheme.js","sourceRoot":"","sources":["magic-option.scheme.ts"],"names":[],"mappings":"","sourcesContent":["export interface dependency{\n name : string;\n version : string;\n}\nexport interface MagicOptionScheme {\n // Magic properties\n path? : string;\n allowTesting? : boolean;\n theme? : string;\n component? : string;\n module? : string;\n loadOnDemand? : boolean;\n skipHelp? : boolean;\n // Angular Properties\n project? : string;\n dependencies? : dependency[];\n devDependencies?: dependency[];\n skipInstall? : boolean;\n skipPackageJson?: boolean;\n cliVersion? : string;\n angularVersion? : string;\n}\n"]}
1
+ {"version":3,"file":"magic-option.scheme.js","sourceRoot":"","sources":["magic-option.scheme.ts"],"names":[],"mappings":"","sourcesContent":["export interface dependency{\n name : string;\n version : string;\n}\nexport interface MagicOptionScheme {\n // Magic properties\n path? : string;\n allowTesting? : boolean;\n theme? : string;\n component? : string;\n module? : string;\n loadOnDemand? : boolean;\n containertype? : string;\n skipHelp? : boolean;\n // Angular Properties\n project? : string;\n dependencies? : dependency[];\n devDependencies? : dependency[];\n skipInstall? : boolean;\n skipPackageJson? : boolean;\n cliVersion? : string;\n angularVersion? : string;\n}\n"]}
@@ -4,19 +4,20 @@ export interface dependency{
4
4
  }
5
5
  export interface MagicOptionScheme {
6
6
  // Magic properties
7
- path? : string;
8
- allowTesting? : boolean;
9
- theme? : string;
10
- component? : string;
11
- module? : string;
12
- loadOnDemand? : boolean;
13
- skipHelp? : boolean;
7
+ path? : string;
8
+ allowTesting? : boolean;
9
+ theme? : string;
10
+ component? : string;
11
+ module? : string;
12
+ loadOnDemand? : boolean;
13
+ containertype? : string;
14
+ skipHelp? : boolean;
14
15
  // Angular Properties
15
- project? : string;
16
- dependencies? : dependency[];
17
- devDependencies?: dependency[];
18
- skipInstall? : boolean;
19
- skipPackageJson?: boolean;
20
- cliVersion? : string;
21
- angularVersion? : string;
16
+ project? : string;
17
+ dependencies? : dependency[];
18
+ devDependencies? : dependency[];
19
+ skipInstall? : boolean;
20
+ skipPackageJson? : boolean;
21
+ cliVersion? : string;
22
+ angularVersion? : string;
22
23
  }
@@ -0,0 +1,3 @@
1
+ import { Rule } from "@angular-devkit/schematics";
2
+ import { MagicOptionScheme } from "../magic-utils/rules/magic-option.scheme";
3
+ export declare function mgGenerateComponent(options: MagicOptionScheme): Rule;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mgGenerateComponent = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const init_magic_metadata_rule_1 = require("../magic-utils/rules/init-magic-metadata.rule");
6
+ const Util_1 = require("../magic-utils/Util");
7
+ const init_gen_components_rule_1 = require("../magic-utils/rules/init-gen-components.rule");
8
+ function mgGenerateComponent(options) {
9
+ if (options.component == '') {
10
+ (0, Util_1.LogLn)('Component name should not be empty.');
11
+ return (0, schematics_1.chain)([]);
12
+ }
13
+ options.module = getModuleName(options);
14
+ options.loadOnDemand = getLoadOnDemandFlagForModule(options);
15
+ return (0, schematics_1.chain)([
16
+ (0, init_magic_metadata_rule_1.initMagicMetadata)(options),
17
+ (0, init_gen_components_rule_1.initAndGenComponentsForModule)(options, true, true)
18
+ ]);
19
+ }
20
+ exports.mgGenerateComponent = mgGenerateComponent;
21
+ // To get the module name from the FormId
22
+ // In the case of containertype="Directory", consider root module.
23
+ // In all other cases gets the first string value till separator(/) from the formId.
24
+ function getModuleName(options) {
25
+ let moduleName = "";
26
+ if (options.containertype && options.containertype !== "Directory")
27
+ moduleName = options.component.split('/')[0];
28
+ return moduleName;
29
+ }
30
+ // To get loadOnDemand flag for the module
31
+ // In the case of containertype == "LoadOnDemandModule", consider it as true
32
+ // In all other cases, consider it as false
33
+ function getLoadOnDemandFlagForModule(options) {
34
+ return options.containertype === "LoadOnDemandModule";
35
+ }
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,2DAAiF;AACjF,4FAAmF;AAEnF,8CAA0C;AAC1C,4FAA4F;AAE5F,SAAgB,mBAAmB,CAAC,OAAyB;IAE3D,IAAG,OAAO,CAAC,SAAS,IAAI,EAAE,EAAC;QACzB,IAAA,YAAK,EAAC,qCAAqC,CAAC,CAAC;QAC7C,OAAO,IAAA,kBAAK,EAAC,EAAE,CAAC,CAAC;KAClB;IAED,OAAO,CAAC,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,CAAC,YAAY,GAAG,4BAA4B,CAAC,OAAO,CAAC,CAAC;IAE7D,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAE,OAAO,CAAC;QAC3B,IAAA,wDAA6B,EAAC,OAAO,EAAE,IAAI,EAAC,IAAI,CAAC;KAClD,CAAC,CAAC;AACL,CAAC;AAdD,kDAcC;AAED,yCAAyC;AACzC,kEAAkE;AAClE,oFAAoF;AACpF,SAAS,aAAa,CAAC,OAA0B;IAC/C,IAAI,UAAU,GAAU,EAAE,CAAC;IAC3B,IAAG,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,aAAa,KAAK,WAAW;QAC/D,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,0CAA0C;AAC1C,4EAA4E;AAC5E,2CAA2C;AAC3C,SAAS,4BAA4B,CAAC,OAA0B;IAC7D,OAAO,OAAO,CAAC,aAAa,KAAK,oBAAoB,CAAC;AACzD,CAAC","sourcesContent":["import { chain, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\r\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\r\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\r\nimport {LogLn} from \"../magic-utils/Util\";\r\nimport {initAndGenComponentsForModule} from \"../magic-utils/rules/init-gen-components.rule\";\r\n\r\nexport function mgGenerateComponent(options:MagicOptionScheme): Rule {\r\n\r\n if(options.component == ''){\r\n LogLn('Component name should not be empty.');\r\n return chain([]);\r\n }\r\n\r\n options.module = getModuleName(options);\r\n options.loadOnDemand = getLoadOnDemandFlagForModule(options);\r\n\r\n return chain([\r\n initMagicMetadata (options),\r\n initAndGenComponentsForModule(options, true,true)\r\n ]);\r\n}\r\n\r\n// To get the module name from the FormId\r\n// In the case of containertype=\"Directory\", consider root module.\r\n// In all other cases gets the first string value till separator(/) from the formId.\r\nfunction getModuleName(options: MagicOptionScheme){\r\n let moduleName:string = \"\";\r\n if(options.containertype && options.containertype !== \"Directory\")\r\n moduleName = options.component.split('/')[0];\r\n return moduleName;\r\n}\r\n\r\n// To get loadOnDemand flag for the module\r\n// In the case of containertype == \"LoadOnDemandModule\", consider it as true\r\n// In all other cases, consider it as false\r\nfunction getLoadOnDemandFlagForModule(options: MagicOptionScheme){\r\n return options.containertype === \"LoadOnDemandModule\";\r\n}\r\n"]}
@@ -0,0 +1,38 @@
1
+ import { chain, Rule, SchematicContext, Tree } from "@angular-devkit/schematics";
2
+ import { initMagicMetadata} from "../magic-utils/rules/init-magic-metadata.rule";
3
+ import { MagicOptionScheme } from "../magic-utils/rules/magic-option.scheme";
4
+ import {LogLn} from "../magic-utils/Util";
5
+ import {initAndGenComponentsForModule} from "../magic-utils/rules/init-gen-components.rule";
6
+
7
+ export function mgGenerateComponent(options:MagicOptionScheme): Rule {
8
+
9
+ if(options.component == ''){
10
+ LogLn('Component name should not be empty.');
11
+ return chain([]);
12
+ }
13
+
14
+ options.module = getModuleName(options);
15
+ options.loadOnDemand = getLoadOnDemandFlagForModule(options);
16
+
17
+ return chain([
18
+ initMagicMetadata (options),
19
+ initAndGenComponentsForModule(options, true,true)
20
+ ]);
21
+ }
22
+
23
+ // To get the module name from the FormId
24
+ // In the case of containertype="Directory", consider root module.
25
+ // In all other cases gets the first string value till separator(/) from the formId.
26
+ function getModuleName(options: MagicOptionScheme){
27
+ let moduleName:string = "";
28
+ if(options.containertype && options.containertype !== "Directory")
29
+ moduleName = options.component.split('/')[0];
30
+ return moduleName;
31
+ }
32
+
33
+ // To get loadOnDemand flag for the module
34
+ // In the case of containertype == "LoadOnDemandModule", consider it as true
35
+ // In all other cases, consider it as false
36
+ function getLoadOnDemandFlagForModule(options: MagicOptionScheme){
37
+ return options.containertype === "LoadOnDemandModule";
38
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "SchematicsMagicGenerateComponent",
4
+ "title": "Magic Options Schema",
5
+ "type": "object",
6
+ "properties": {
7
+ "skipPackageJson": {
8
+ "type": "boolean",
9
+ "default": false,
10
+ "description": "Do not generate magic component from json (e.g., --skipPackageJson)"
11
+ },
12
+ "project":{
13
+ "type": "string",
14
+ "description": "The name of the project",
15
+ "aliases" : ["p"]
16
+ },
17
+ "component":{
18
+ "type": "string",
19
+ "description": "The name of the component",
20
+ "aliases" : [ "c"]
21
+ },
22
+ "allowTesting":{
23
+ "type": "boolean",
24
+ "description": "is allow testing ",
25
+ "aliases" : ["a"]
26
+ },
27
+ "containertype": {
28
+ "type": "string",
29
+ "description": "The value of container type (EagerModule, Directory, LoadOnDemandModule, '')",
30
+ "aliases" : ["ct"]
31
+ }
32
+ },
33
+ "required": []
34
+ }
@@ -10,6 +10,7 @@ export interface IEnv {
10
10
  workspace: Workspace;
11
11
  project: Project;
12
12
  metadata: MagicMetadata;
13
+ programList: MagicMetadata;
13
14
  componentsGen: string[];
14
15
  modulesGen: ModuleInfo[];
15
16
  app: AppJson;
@@ -1 +1 @@
1
- {"version":3,"file":"env.interface.js","sourceRoot":"","sources":["env.interface.ts"],"names":[],"mappings":";;;AAMA,MAAa,UAAU;IAIrB,YAAY,UAAiB,EAAE,YAAoB;QACjD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AARD,gCAQC","sourcesContent":["import { MagicMetadata, MagicPaths } from \"../../schematics/magic-utils/metadata.class\";\r\nimport { AppJson } from \"../index\";\r\nimport { Project, Workspace } from \"../../schematics/utils/devkit-utils/config\";\r\n\r\n\r\n\r\nexport class ModuleInfo {\r\n moduleName: string;\r\n loadOnDemand: boolean;\r\n\r\n constructor(moduleName:string, loadOnDemand:boolean){\r\n this.moduleName = moduleName;\r\n this.loadOnDemand = loadOnDemand;\r\n }\r\n}\r\n\r\n\r\nexport interface IEnv{\r\n workspace : Workspace,\r\n project : Project,\r\n metadata : MagicMetadata;\r\n componentsGen: string[];\r\n modulesGen : ModuleInfo[];\r\n app : AppJson;\r\n paths? : MagicPaths;\r\n prevent_log : boolean;\r\n}\r\n"]}
1
+ {"version":3,"file":"env.interface.js","sourceRoot":"","sources":["env.interface.ts"],"names":[],"mappings":";;;AAMA,MAAa,UAAU;IAIrB,YAAY,UAAiB,EAAE,YAAoB;QACjD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AARD,gCAQC","sourcesContent":["import { MagicMetadata, MagicPaths } from \"../../schematics/magic-utils/metadata.class\";\r\nimport { AppJson } from \"../index\";\r\nimport { Project, Workspace } from \"../../schematics/utils/devkit-utils/config\";\r\n\r\n\r\n\r\nexport class ModuleInfo {\r\n moduleName: string;\r\n loadOnDemand: boolean;\r\n\r\n constructor(moduleName:string, loadOnDemand:boolean){\r\n this.moduleName = moduleName;\r\n this.loadOnDemand = loadOnDemand;\r\n }\r\n}\r\n\r\n\r\nexport interface IEnv{\r\n workspace : Workspace,\r\n project : Project,\r\n metadata : MagicMetadata;\r\n programList : MagicMetadata;\r\n componentsGen: string[];\r\n modulesGen : ModuleInfo[];\r\n app : AppJson;\r\n paths? : MagicPaths;\r\n prevent_log : boolean;\r\n}\r\n"]}
@@ -19,6 +19,7 @@ export interface IEnv{
19
19
  workspace : Workspace,
20
20
  project : Project,
21
21
  metadata : MagicMetadata;
22
+ programList : MagicMetadata;
22
23
  componentsGen: string[];
23
24
  modulesGen : ModuleInfo[];
24
25
  app : AppJson;
@@ -1,6 +1,11 @@
1
+ <%- include(`../../helperProperties`, {ctrl: ctrl}) %>
1
2
  <th <%- include('../../../attributes/common/base/visible', {ctrl : ctrl}) %>
2
3
  >
3
4
  <label>
4
- <%=ctrl.props.column_title%>
5
+ <%if(ctrl.props.column_title && ctrl.props.column_title.has_exp) { %>
6
+ {{mg.getText(<%= ctrl.props.enum_id %>)}}
7
+ <% } else {%>
8
+ <%=ctrl.props.column_title%>
9
+ <%}%>
5
10
  </label>
6
11
  </th>