@magic-xpa/cli 4.1201.0-dev4121.254 → 4.1201.0-dev4121.263

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 (183) hide show
  1. package/README.md +28 -28
  2. package/index.js.map +1 -1
  3. package/index.ts +1 -1
  4. package/package.json +1 -1
  5. package/src/collection.json +75 -75
  6. package/src/public_api.js.map +1 -1
  7. package/src/public_api.ts +5 -5
  8. package/src/schematics/magic-utils/config.js.map +1 -1
  9. package/src/schematics/magic-utils/config.ts +68 -68
  10. package/src/schematics/magic-utils/env.js.map +1 -1
  11. package/src/schematics/magic-utils/env.ts +50 -50
  12. package/src/schematics/magic-utils/manifest.js.map +1 -1
  13. package/src/schematics/magic-utils/manifest.ts +46 -46
  14. package/src/schematics/magic-utils/metadata.class.js.map +1 -1
  15. package/src/schematics/magic-utils/metadata.class.ts +159 -159
  16. package/src/schematics/magic-utils/rules/generate.rule.js.map +1 -1
  17. package/src/schematics/magic-utils/rules/generate.rule.ts +61 -61
  18. package/src/schematics/magic-utils/rules/init-add-modules.rule.js.map +1 -1
  19. package/src/schematics/magic-utils/rules/init-add-modules.rule.ts +360 -360
  20. package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js.map +1 -1
  21. package/src/schematics/magic-utils/rules/init-magic-metadata.rule.ts +19 -19
  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 +24 -24
  24. package/src/schematics/magic-utils/utils.js.map +1 -1
  25. package/src/schematics/magic-utils/utils.ts +134 -134
  26. package/src/schematics/mg-Install-prerequisites/index.js.map +1 -1
  27. package/src/schematics/mg-Install-prerequisites/index.ts +30 -30
  28. package/src/schematics/mg-Install-prerequisites/schema.json +14 -14
  29. package/src/schematics/mg-add/files/src/app/app.component.html +17 -17
  30. package/src/schematics/mg-add/files/src/app/app.routes.ts +14 -14
  31. package/src/schematics/mg-add/files/src/app/magic/component-list.g.ts +9 -9
  32. package/src/schematics/mg-add/files/src/magic-styles.css +131 -131
  33. package/src/schematics/mg-add/schema.json +29 -29
  34. package/src/schematics/mg-add/utils/add-declaration-to-root-module.js.map +1 -1
  35. package/src/schematics/mg-add/utils/add-declaration-to-root-module.ts +12 -12
  36. package/src/schematics/mg-add/webModule/app.routes.ts +14 -14
  37. package/src/schematics/mg-add-tasks/index.js.map +1 -1
  38. package/src/schematics/mg-add-tasks/index.ts +53 -53
  39. package/src/schematics/mg-add-tasks/schema.json +41 -41
  40. package/src/schematics/mg-delete-files/index.js.map +1 -1
  41. package/src/schematics/mg-delete-files/index.ts +12 -12
  42. package/src/schematics/mg-delete-files/schema.json +14 -14
  43. package/src/schematics/mg-gen-module/index.js.map +1 -1
  44. package/src/schematics/mg-gen-module/index.ts +14 -14
  45. package/src/schematics/mg-gen-module/schema.json +24 -24
  46. package/src/schematics/mg-generate/index.js.map +1 -1
  47. package/src/schematics/mg-generate/index.ts +12 -12
  48. package/src/schematics/mg-generate/schema.json +34 -34
  49. package/src/schematics/mg-install/index.js.map +1 -1
  50. package/src/schematics/mg-install/index.ts +37 -37
  51. package/src/schematics/mg-install/schema.json +24 -24
  52. package/src/schematics/mg-routes/schema.json +14 -14
  53. package/src/schematics/mg-single-control/schema.json +24 -24
  54. package/src/schematics/utils/ast.js.map +1 -1
  55. package/src/schematics/utils/ast.ts +103 -103
  56. package/src/schematics/utils/devkit-utils/README.md +1 -1
  57. package/src/schematics/utils/devkit-utils/ast-utils.js.map +1 -1
  58. package/src/schematics/utils/devkit-utils/ast-utils.ts +570 -570
  59. package/src/schematics/utils/devkit-utils/ast-utils_old.js.map +1 -1
  60. package/src/schematics/utils/devkit-utils/ast-utils_old.ts +478 -478
  61. package/src/schematics/utils/devkit-utils/change.js.map +1 -1
  62. package/src/schematics/utils/devkit-utils/change.ts +127 -127
  63. package/src/schematics/utils/devkit-utils/component.js.map +1 -1
  64. package/src/schematics/utils/devkit-utils/component.ts +136 -136
  65. package/src/schematics/utils/devkit-utils/config.js.map +1 -1
  66. package/src/schematics/utils/devkit-utils/config.ts +120 -120
  67. package/src/schematics/utils/devkit-utils/find-module.js.map +1 -1
  68. package/src/schematics/utils/devkit-utils/find-module.ts +108 -108
  69. package/src/schematics/utils/devkit-utils/ng-ast-utils.js.map +1 -1
  70. package/src/schematics/utils/devkit-utils/ng-ast-utils.ts +84 -84
  71. package/src/schematics/utils/devkit-utils/parse-name.js.map +1 -1
  72. package/src/schematics/utils/devkit-utils/parse-name.ts +24 -24
  73. package/src/schematics/utils/devkit-utils/route-utils.js.map +1 -1
  74. package/src/schematics/utils/devkit-utils/route-utils.ts +180 -180
  75. package/src/schematics/utils/devkit-utils/validation.js +1 -1
  76. package/src/schematics/utils/devkit-utils/validation.js.map +1 -1
  77. package/src/schematics/utils/devkit-utils/validation.ts +16 -16
  78. package/src/schematics/utils/html.js.map +1 -1
  79. package/src/schematics/utils/html.ts +63 -63
  80. package/src/schematics/utils/lib-versions.js.map +1 -1
  81. package/src/schematics/utils/lib-versions.ts +3 -3
  82. package/src/schematics/utils/package.js.map +1 -1
  83. package/src/schematics/utils/package.ts +22 -22
  84. package/src/schematics/utils/testing.js.map +1 -1
  85. package/src/schematics/utils/testing.ts +25 -25
  86. package/src/types/enums/Enums.js.map +1 -1
  87. package/src/types/enums/Enums.ts +2063 -2063
  88. package/src/types/enums/generated-file-types.enum.js.map +1 -1
  89. package/src/types/enums/generated-file-types.enum.ts +6 -6
  90. package/src/types/enums/horizontal-alignments.enum.js.map +1 -1
  91. package/src/types/enums/horizontal-alignments.enum.ts +6 -6
  92. package/src/types/enums/themes.enum.js.map +1 -1
  93. package/src/types/enums/themes.enum.ts +6 -6
  94. package/src/types/index.js.map +1 -1
  95. package/src/types/index.ts +8 -8
  96. package/src/types/interfaces/app.js.map +1 -1
  97. package/src/types/interfaces/app.ts +89 -89
  98. package/src/types/interfaces/control.js.map +1 -1
  99. package/src/types/interfaces/control.ts +106 -106
  100. package/src/types/interfaces/template.config.js.map +1 -1
  101. package/src/types/interfaces/template.config.ts +11 -11
  102. package/templates/angular/src/app/app.component.html.ejs +17 -17
  103. package/templates/angular/src/app/cmp-array.ejs +3 -3
  104. package/templates/angular/src/app/cmp-hash.ejs +3 -3
  105. package/templates/angular/src/app/component-list.g.ts +21 -21
  106. package/templates/angular/src/app.component.ts +16 -16
  107. package/templates/angular/src/app.module.ts +70 -70
  108. package/templates/angular/src/app.routes.ts +73 -73
  109. package/templates/angular/src/styles/app.css +5 -5
  110. package/templates/attributes/button_attributes.ejs +2 -2
  111. package/templates/attributes/common/base/class.ejs +6 -6
  112. package/templates/attributes/common/base/control_type.ejs +53 -53
  113. package/templates/attributes/common/base/enabled.ejs +9 -9
  114. package/templates/attributes/common/base/imageFileName.ejs +3 -3
  115. package/templates/attributes/common/base/no_control_class.ejs +3 -3
  116. package/templates/attributes/common/base/rtol.ejs +3 -3
  117. package/templates/attributes/common/base/tabindex.ejs +11 -11
  118. package/templates/attributes/common/base/testingId.ejs +8 -8
  119. package/templates/attributes/common/base/tooltip.ejs +7 -7
  120. package/templates/attributes/common/base/visible.ejs +6 -6
  121. package/templates/attributes/common/base/wallpaper.ejs +3 -3
  122. package/templates/attributes/common/base_attributes.ejs +10 -10
  123. package/templates/attributes/common/container_attributes.ejs +6 -6
  124. package/templates/attributes/common/control_attributes.ejs +3 -3
  125. package/templates/attributes/common/format.ejs +5 -5
  126. package/templates/attributes/common/input/hint.ejs +13 -13
  127. package/templates/attributes/common/input/multiline_edit.ejs +3 -3
  128. package/templates/attributes/common/input/must_input.ejs +8 -8
  129. package/templates/attributes/common/input/password_edit.ejs +7 -7
  130. package/templates/attributes/common/input/row_editing_input_attributes.ejs +6 -6
  131. package/templates/attributes/common/input/validation.ejs +5 -5
  132. package/templates/attributes/common/input_attributes.ejs +4 -4
  133. package/templates/attributes/common/no_control_base_attributes.ejs +4 -4
  134. package/templates/attributes/common/row_editing_button_attributes.ejs +10 -10
  135. package/templates/component/view.component.html +14 -14
  136. package/templates/component/view.component.ts +136 -136
  137. package/templates/themes/basicHTML/Code/theme.module.ts +10 -10
  138. package/templates/themes/basicHTML/combobox.ejs +37 -37
  139. package/templates/themes/basicHTML/edit.ejs +169 -169
  140. package/templates/themes/basicHTML/form.ejs +4 -4
  141. package/templates/themes/basicHTML/group.ejs +4 -4
  142. package/templates/themes/basicHTML/image.ejs +6 -6
  143. package/templates/themes/basicHTML/label.ejs +11 -11
  144. package/templates/themes/basicHTML/listbox.ejs +21 -21
  145. package/templates/themes/basicHTML/push-button.ejs +28 -28
  146. package/templates/themes/basicHTML/radio.ejs +20 -20
  147. package/templates/themes/basicHTML/subform.ejs +6 -6
  148. package/templates/themes/basicHTML/tab.ejs +31 -31
  149. package/templates/themes/basicHTML/tabpage.ejs +5 -5
  150. package/templates/themes/basicHiddenHTML/Code/theme.module.ts +10 -10
  151. package/templates/themes/basicHiddenHTML/combobox.ejs +5 -5
  152. package/templates/themes/basicHiddenHTML/form.ejs +3 -3
  153. package/templates/themes/basicHiddenHTML/group.ejs +2 -2
  154. package/templates/themes/basicHiddenHTML/image.ejs +4 -4
  155. package/templates/themes/basicHiddenHTML/label.ejs +1 -1
  156. package/templates/themes/basicHiddenHTML/listbox.ejs +8 -8
  157. package/templates/themes/basicHiddenHTML/push-button.ejs +26 -26
  158. package/templates/themes/basicHiddenHTML/radio.ejs +17 -17
  159. package/templates/themes/basicHiddenHTML/tab.ejs +13 -13
  160. package/templates/themes/basicHiddenHTML/table.ejs +18 -18
  161. package/templates/themes/basicHiddenHTML/tabpage.ejs +2 -2
  162. package/templates/themes/container.ejs +26 -26
  163. package/templates/themes/control.ejs +52 -52
  164. package/templates/themes/editTypeSelector.ejs +1 -1
  165. package/templates/themes/material/Code/theme.module.ts +68 -68
  166. package/templates/themes/material/base_attributes_date.ejs +8 -8
  167. package/templates/themes/material/combobox.ejs +58 -58
  168. package/templates/themes/material/edit.ejs +204 -204
  169. package/templates/themes/material/group.ejs +3 -3
  170. package/templates/themes/material/listbox.ejs +22 -22
  171. package/templates/themes/material/push-button.ejs +28 -28
  172. package/templates/themes/material/radio.ejs +22 -22
  173. package/templates/themes/material/subform.ejs +8 -8
  174. package/templates/themes/material/tab.ejs +19 -19
  175. package/templates/themes/router_outlet.ejs +5 -5
  176. package/templates/themes/table/HTMLTable/table.ejs +37 -37
  177. package/templates/themes/table/grid/additionalComponentCode.ejs +26 -26
  178. package/templates/themes/table/grid/additionalIncludes.ejs +1 -1
  179. package/templates/themes/table/grid/table.ejs +37 -37
  180. package/templates/themes/table/repeatable/column.ejs +11 -11
  181. package/templates/themes/table/repeatable/table.ejs +28 -28
  182. package/templates/themes/tableTypeSelector.ejs +21 -21
  183. package/tsconfig.json +36 -36
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAKA,kCAQC;AAbD,2DAAyD;AACzD,4FAAmF;AAEnF,sFAAgG;AAEhG,SAAgB,WAAW,CAAC,OAAyB;IACnD,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAE,OAAO,CAAC;QAE3B,4CAA4C;QAC5C,IAAA,sCAAc,EAAE,OAAO,CAAC;QACxB,IAAA,0CAAkB,EAAC,OAAO,CAAC;KAC5B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { chain, Rule } from \"@angular-devkit/schematics\";\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\nimport { generateWebModules, initGenModules } from \"../magic-utils/rules/init-add-modules.rule\";\n\nexport function mgGenModule(options:MagicOptionScheme): Rule {\n return chain([\n initMagicMetadata (options),\n\n // ** generate the modules in the project **\n initGenModules (options),\n generateWebModules(options)\n ]);\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAKA,kCAQC;AAbD,2DAAyD;AACzD,4FAAmF;AAEnF,sFAAgG;AAEhG,SAAgB,WAAW,CAAC,OAAyB;IACnD,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAE,OAAO,CAAC;QAE3B,4CAA4C;QAC5C,IAAA,sCAAc,EAAE,OAAO,CAAC;QACxB,IAAA,0CAAkB,EAAC,OAAO,CAAC;KAC5B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { chain, Rule } 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 { generateWebModules, initGenModules } from \"../magic-utils/rules/init-add-modules.rule\";\r\n\r\nexport function mgGenModule(options:MagicOptionScheme): Rule {\r\n return chain([\r\n initMagicMetadata (options),\r\n\r\n // ** generate the modules in the project **\r\n initGenModules (options),\r\n generateWebModules(options)\r\n ]);\r\n}\r\n"]}
@@ -1,14 +1,14 @@
1
- import { chain, Rule } 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 { generateWebModules, initGenModules } from "../magic-utils/rules/init-add-modules.rule";
5
-
6
- export function mgGenModule(options:MagicOptionScheme): Rule {
7
- return chain([
8
- initMagicMetadata (options),
9
-
10
- // ** generate the modules in the project **
11
- initGenModules (options),
12
- generateWebModules(options)
13
- ]);
14
- }
1
+ import { chain, Rule } 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 { generateWebModules, initGenModules } from "../magic-utils/rules/init-add-modules.rule";
5
+
6
+ export function mgGenModule(options:MagicOptionScheme): Rule {
7
+ return chain([
8
+ initMagicMetadata (options),
9
+
10
+ // ** generate the modules in the project **
11
+ initGenModules (options),
12
+ generateWebModules(options)
13
+ ]);
14
+ }
@@ -1,24 +1,24 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "SchematicsMagicGenerate",
4
- "title": "Magic Options Schema",
5
- "type": "object",
6
- "properties": {
7
- "project":{
8
- "type": "string",
9
- "description": "The name of the project",
10
- "aliases" : ["p"]
11
- },
12
- "module":{
13
- "type": "string",
14
- "description": "The name of the module",
15
- "aliases" : [ "m"]
16
- },
17
- "loadOnDemand": {
18
- "type": "boolean",
19
- "default": false,
20
- "description": "Whether to create module as load on demand (e.g., --loadOnDemand)"
21
- }
22
- },
23
- "required": []
24
- }
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "SchematicsMagicGenerate",
4
+ "title": "Magic Options Schema",
5
+ "type": "object",
6
+ "properties": {
7
+ "project":{
8
+ "type": "string",
9
+ "description": "The name of the project",
10
+ "aliases" : ["p"]
11
+ },
12
+ "module":{
13
+ "type": "string",
14
+ "description": "The name of the module",
15
+ "aliases" : [ "m"]
16
+ },
17
+ "loadOnDemand": {
18
+ "type": "boolean",
19
+ "default": false,
20
+ "description": "Whether to create module as load on demand (e.g., --loadOnDemand)"
21
+ }
22
+ },
23
+ "required": []
24
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAMA,gCAKC;AAXD,2DAAiF;AAEjF,4FAAmF;AACnF,4FAA6F;AAG7F,SAAgB,UAAU,CAAC,OAAyB;IAClD,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAE,OAAO,CAAC;QAC3B,IAAA,wDAA6B,EAAE,OAAO,EAAE,IAAI,CAAC;KAC9C,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { chain, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\n\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\nimport { initAndGenComponentsForModule} from \"../magic-utils/rules/init-gen-components.rule\";\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\n\nexport function mgGenerate(options:MagicOptionScheme): Rule {\n return chain([\n initMagicMetadata (options),\n initAndGenComponentsForModule (options, true)\n ]);\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAMA,gCAKC;AAXD,2DAAiF;AAEjF,4FAAmF;AACnF,4FAA6F;AAG7F,SAAgB,UAAU,CAAC,OAAyB;IAClD,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAE,OAAO,CAAC;QAC3B,IAAA,wDAA6B,EAAE,OAAO,EAAE,IAAI,CAAC;KAC9C,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { chain, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\r\n\r\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\r\nimport { initAndGenComponentsForModule} from \"../magic-utils/rules/init-gen-components.rule\";\r\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\r\n\r\nexport function mgGenerate(options:MagicOptionScheme): Rule {\r\n return chain([\r\n initMagicMetadata (options),\r\n initAndGenComponentsForModule (options, true)\r\n ]);\r\n}\r\n"]}
@@ -1,12 +1,12 @@
1
- import { chain, Rule, SchematicContext, Tree } from "@angular-devkit/schematics";
2
-
3
- import { initMagicMetadata} from "../magic-utils/rules/init-magic-metadata.rule";
4
- import { initAndGenComponentsForModule} from "../magic-utils/rules/init-gen-components.rule";
5
- import { MagicOptionScheme } from "../magic-utils/rules/magic-option.scheme";
6
-
7
- export function mgGenerate(options:MagicOptionScheme): Rule {
8
- return chain([
9
- initMagicMetadata (options),
10
- initAndGenComponentsForModule (options, true)
11
- ]);
12
- }
1
+ import { chain, Rule, SchematicContext, Tree } from "@angular-devkit/schematics";
2
+
3
+ import { initMagicMetadata} from "../magic-utils/rules/init-magic-metadata.rule";
4
+ import { initAndGenComponentsForModule} from "../magic-utils/rules/init-gen-components.rule";
5
+ import { MagicOptionScheme } from "../magic-utils/rules/magic-option.scheme";
6
+
7
+ export function mgGenerate(options:MagicOptionScheme): Rule {
8
+ return chain([
9
+ initMagicMetadata (options),
10
+ initAndGenComponentsForModule (options, true)
11
+ ]);
12
+ }
@@ -1,34 +1,34 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "SchematicsMagicGenerate",
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
- "theme":{
28
- "type": "string",
29
- "description": "generate files with theme",
30
- "aliases" : ["t"]
31
- }
32
- },
33
- "required": []
34
- }
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "SchematicsMagicGenerate",
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
+ "theme":{
28
+ "type": "string",
29
+ "description": "generate files with theme",
30
+ "aliases" : ["t"]
31
+ }
32
+ },
33
+ "required": []
34
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAMA,8BA4BC;AAjCD,4DAA4F;AAC5F,8CAA2D;AAI3D,SAAgB,SAAS,CAAC,OAAyB;IACjD,OAAO,CAAC,IAAS,EAAE,OAAwB,EAAC,EAAE;QAE5C,iBAAiB;QACjB,sCAAsC;QACtC,+BAA+B;QAC/B,mFAAmF;QACnF,IAAI;QAEJ,IAAG,CAAC,OAAO,CAAC,eAAe,EAAC,CAAC;YAC3B,KAAK,IAAI,GAAG,IAAI,OAAO,CAAC,YAAY,EAAC,CAAC;gBACpC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBACvE,IAAA,iCAAuB,EAAC,IAAI,EAAE,cAAc,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YACvE,CAAC;YACD,KAAK,IAAI,GAAG,IAAI,OAAO,CAAC,eAAe,EAAC,CAAC;gBACvC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC1E,IAAA,iCAAuB,EAAC,IAAI,EAAE,iBAAiB,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;QAED,IAAG,CAAC,OAAO,CAAC,WAAW,EAAC,CAAC;YACvB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;YACjD,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,IAAI,CAAC;IAEd,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { Rule,Tree,SchematicContext } from \"@angular-devkit/schematics\";\nimport { NodePackageInstallTask, RunSchematicTask } from \"@angular-devkit/schematics/tasks\";\nimport { addPackageToPackageJson } from \"../utils/package\";\nimport { dependencies, devDependencies, Idependencies } from \"../magic-utils/env\";\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\n\nexport function mgInstall(options:MagicOptionScheme): Rule {\n return (host:Tree, context:SchematicContext)=>{\n\n // for debug only\n // if (options.dependencies == null) {\n // options.dependencies = [];\n // options.dependencies.push(new Idependencies(\"@magic-xpa/angular\", \"0.0.177\"));\n // }\n\n if(!options.skipPackageJson){\n for (let dep of options.dependencies){\n context.logger.info(`[>] Add dependencies ${dep.name} ${dep.version}`);\n addPackageToPackageJson(host, 'dependencies', dep.name, dep.version);\n }\n for (let dep of options.devDependencies){\n context.logger.info(`[>] Add devDependencies ${dep.name} ${dep.version}`);\n addPackageToPackageJson(host, 'devDependencies', dep.name, dep.version);\n }\n }\n\n if(!options.skipInstall){\n context.logger.info(`[>] Install dependencies.`);\n context.addTask(new NodePackageInstallTask());\n }\n\n return host;\n\n };\n}\n\n\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAMA,8BA4BC;AAjCD,4DAA4F;AAC5F,8CAA2D;AAI3D,SAAgB,SAAS,CAAC,OAAyB;IACjD,OAAO,CAAC,IAAS,EAAE,OAAwB,EAAC,EAAE;QAE5C,iBAAiB;QACjB,sCAAsC;QACtC,+BAA+B;QAC/B,mFAAmF;QACnF,IAAI;QAEJ,IAAG,CAAC,OAAO,CAAC,eAAe,EAAC,CAAC;YAC3B,KAAK,IAAI,GAAG,IAAI,OAAO,CAAC,YAAY,EAAC,CAAC;gBACpC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBACvE,IAAA,iCAAuB,EAAC,IAAI,EAAE,cAAc,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YACvE,CAAC;YACD,KAAK,IAAI,GAAG,IAAI,OAAO,CAAC,eAAe,EAAC,CAAC;gBACvC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC1E,IAAA,iCAAuB,EAAC,IAAI,EAAE,iBAAiB,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;QAED,IAAG,CAAC,OAAO,CAAC,WAAW,EAAC,CAAC;YACvB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;YACjD,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,IAAI,CAAC;IAEd,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { Rule,Tree,SchematicContext } from \"@angular-devkit/schematics\";\r\nimport { NodePackageInstallTask, RunSchematicTask } from \"@angular-devkit/schematics/tasks\";\r\nimport { addPackageToPackageJson } from \"../utils/package\";\r\nimport { dependencies, devDependencies, Idependencies } from \"../magic-utils/env\";\r\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\r\n\r\nexport function mgInstall(options:MagicOptionScheme): Rule {\r\n return (host:Tree, context:SchematicContext)=>{\r\n\r\n // for debug only\r\n // if (options.dependencies == null) {\r\n // options.dependencies = [];\r\n // options.dependencies.push(new Idependencies(\"@magic-xpa/angular\", \"0.0.177\"));\r\n // }\r\n\r\n if(!options.skipPackageJson){\r\n for (let dep of options.dependencies){\r\n context.logger.info(`[>] Add dependencies ${dep.name} ${dep.version}`);\r\n addPackageToPackageJson(host, 'dependencies', dep.name, dep.version);\r\n }\r\n for (let dep of options.devDependencies){\r\n context.logger.info(`[>] Add devDependencies ${dep.name} ${dep.version}`);\r\n addPackageToPackageJson(host, 'devDependencies', dep.name, dep.version);\r\n }\r\n }\r\n\r\n if(!options.skipInstall){\r\n context.logger.info(`[>] Install dependencies.`);\r\n context.addTask(new NodePackageInstallTask());\r\n }\r\n\r\n return host;\r\n\r\n };\r\n}\r\n\r\n\r\n"]}
@@ -1,37 +1,37 @@
1
- import { Rule,Tree,SchematicContext } from "@angular-devkit/schematics";
2
- import { NodePackageInstallTask, RunSchematicTask } from "@angular-devkit/schematics/tasks";
3
- import { addPackageToPackageJson } from "../utils/package";
4
- import { dependencies, devDependencies, Idependencies } from "../magic-utils/env";
5
- import { MagicOptionScheme } from "../magic-utils/rules/magic-option.scheme";
6
-
7
- export function mgInstall(options:MagicOptionScheme): Rule {
8
- return (host:Tree, context:SchematicContext)=>{
9
-
10
- // for debug only
11
- // if (options.dependencies == null) {
12
- // options.dependencies = [];
13
- // options.dependencies.push(new Idependencies("@magic-xpa/angular", "0.0.177"));
14
- // }
15
-
16
- if(!options.skipPackageJson){
17
- for (let dep of options.dependencies){
18
- context.logger.info(`[>] Add dependencies ${dep.name} ${dep.version}`);
19
- addPackageToPackageJson(host, 'dependencies', dep.name, dep.version);
20
- }
21
- for (let dep of options.devDependencies){
22
- context.logger.info(`[>] Add devDependencies ${dep.name} ${dep.version}`);
23
- addPackageToPackageJson(host, 'devDependencies', dep.name, dep.version);
24
- }
25
- }
26
-
27
- if(!options.skipInstall){
28
- context.logger.info(`[>] Install dependencies.`);
29
- context.addTask(new NodePackageInstallTask());
30
- }
31
-
32
- return host;
33
-
34
- };
35
- }
36
-
37
-
1
+ import { Rule,Tree,SchematicContext } from "@angular-devkit/schematics";
2
+ import { NodePackageInstallTask, RunSchematicTask } from "@angular-devkit/schematics/tasks";
3
+ import { addPackageToPackageJson } from "../utils/package";
4
+ import { dependencies, devDependencies, Idependencies } from "../magic-utils/env";
5
+ import { MagicOptionScheme } from "../magic-utils/rules/magic-option.scheme";
6
+
7
+ export function mgInstall(options:MagicOptionScheme): Rule {
8
+ return (host:Tree, context:SchematicContext)=>{
9
+
10
+ // for debug only
11
+ // if (options.dependencies == null) {
12
+ // options.dependencies = [];
13
+ // options.dependencies.push(new Idependencies("@magic-xpa/angular", "0.0.177"));
14
+ // }
15
+
16
+ if(!options.skipPackageJson){
17
+ for (let dep of options.dependencies){
18
+ context.logger.info(`[>] Add dependencies ${dep.name} ${dep.version}`);
19
+ addPackageToPackageJson(host, 'dependencies', dep.name, dep.version);
20
+ }
21
+ for (let dep of options.devDependencies){
22
+ context.logger.info(`[>] Add devDependencies ${dep.name} ${dep.version}`);
23
+ addPackageToPackageJson(host, 'devDependencies', dep.name, dep.version);
24
+ }
25
+ }
26
+
27
+ if(!options.skipInstall){
28
+ context.logger.info(`[>] Install dependencies.`);
29
+ context.addTask(new NodePackageInstallTask());
30
+ }
31
+
32
+ return host;
33
+
34
+ };
35
+ }
36
+
37
+
@@ -1,24 +1,24 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "SchematicsMagicInstallTasks",
4
- "title": "Magic Options Schema",
5
- "type": "object",
6
- "properties": {
7
- "skipInstall": {
8
- "type": "boolean",
9
- "default": false,
10
- "description": "Do not install the new packages (e.g., --skipInstall)"
11
- },
12
- "skipPackageJson": {
13
- "type": "boolean",
14
- "default": false,
15
- "description": "Do not add magic dependencies to package.json (e.g., --skipPackageJson)"
16
- },
17
- "project":{
18
- "type": "string",
19
- "description": "The name of the project",
20
- "aliases" : ["p"]
21
- }
22
- },
23
- "required": []
24
- }
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "SchematicsMagicInstallTasks",
4
+ "title": "Magic Options Schema",
5
+ "type": "object",
6
+ "properties": {
7
+ "skipInstall": {
8
+ "type": "boolean",
9
+ "default": false,
10
+ "description": "Do not install the new packages (e.g., --skipInstall)"
11
+ },
12
+ "skipPackageJson": {
13
+ "type": "boolean",
14
+ "default": false,
15
+ "description": "Do not add magic dependencies to package.json (e.g., --skipPackageJson)"
16
+ },
17
+ "project":{
18
+ "type": "string",
19
+ "description": "The name of the project",
20
+ "aliases" : ["p"]
21
+ }
22
+ },
23
+ "required": []
24
+ }
@@ -1,14 +1,14 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "SchematicsMagicRoute",
4
- "title": "Magic Options Schema",
5
- "type": "object",
6
- "properties": {
7
- "project":{
8
- "type": "string",
9
- "description": "The name of the project",
10
- "aliases" : ["p"]
11
- }
12
- },
13
- "required": []
14
- }
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "SchematicsMagicRoute",
4
+ "title": "Magic Options Schema",
5
+ "type": "object",
6
+ "properties": {
7
+ "project":{
8
+ "type": "string",
9
+ "description": "The name of the project",
10
+ "aliases" : ["p"]
11
+ }
12
+ },
13
+ "required": []
14
+ }
@@ -1,24 +1,24 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "SchematicsMagicRoute",
4
- "title": "Magic Options Schema",
5
- "type": "object",
6
- "properties": {
7
- "skipInstall": {
8
- "type": "boolean",
9
- "default": false,
10
- "description": "Do not install the new packages (e.g., --skipInstall)"
11
- },
12
- "skipPackageJson": {
13
- "type": "boolean",
14
- "default": false,
15
- "description": "Do not add magic dependencies to package.json (e.g., --skipPackageJson)"
16
- },
17
- "project":{
18
- "type": "string",
19
- "description": "The name of the project",
20
- "aliases" : ["p"]
21
- }
22
- },
23
- "required": []
24
- }
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "SchematicsMagicRoute",
4
+ "title": "Magic Options Schema",
5
+ "type": "object",
6
+ "properties": {
7
+ "skipInstall": {
8
+ "type": "boolean",
9
+ "default": false,
10
+ "description": "Do not install the new packages (e.g., --skipInstall)"
11
+ },
12
+ "skipPackageJson": {
13
+ "type": "boolean",
14
+ "default": false,
15
+ "description": "Do not add magic dependencies to package.json (e.g., --skipPackageJson)"
16
+ },
17
+ "project":{
18
+ "type": "string",
19
+ "description": "The name of the project",
20
+ "aliases" : ["p"]
21
+ }
22
+ },
23
+ "required": []
24
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ast.js","sourceRoot":"","sources":["ast.ts"],"names":[],"mappings":";;AAWA,sCAOC;AAGD,kEAGC;AASD,0DAkBC;AAGD,4CAQC;AAGD,sCAqBC;AAGD,sDAaC;AAtG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ACzB,OAAO,IAAA,gBAAS,EAAC,oBAAoB,CAAC,CAAC;QACzC,CAAC;QAED,mEAAmE;QACnE,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpE,IAAI,iBAAiB,EAAE,CAAC;YACtB,OAAO,IAAA,gBAAS,EAAC,iBAAiB,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,MAAM,IAAI,gCAAmB,CAAC,iEAAiE,CAAC,CAAC;AACnG,CAAC;AAED,gFAAgF;AAChF,SAAgB,qBAAqB,CAAC,IAAU,EAAE,OAAY;IAC5D,MAAM,SAAS,GAAG,IAAA,qBAAY,EAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpD,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,CAAC,IAAI,GAAG,IAAI,OAAO,CAAC,IAAI,UAAU,CAAC;IAC5C,CAAC;IAED,OAAO,IAAA,mCAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import {normalize} from '@angular-devkit/core';\nimport {SchematicsException, Tree} from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\nimport {addImportToModule} from './devkit-utils/ast-utils';\nimport {InsertChange} from './devkit-utils/change';\nimport {Project, getWorkspace} from './devkit-utils/config';\nimport {findBootstrapModulePath, getAppModulePath} from './devkit-utils/ng-ast-utils';\nimport {ModuleOptions, findModuleFromOptions as internalFindModule} from './devkit-utils/find-module';\n\n\n/** Reads file given path and returns TypeScript source file. */\nexport function getSourceFile(host: Tree, path: string): ts.SourceFile {\n const buffer = host.read(path);\n if (!buffer) {\n throw new SchematicsException(`Could not find file for path: ${path}`);\n }\n const content = buffer.toString();\n return ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);\n}\n\n/** Import and add module to root app module. */\nexport function addModuleImportToRootModule(host: Tree, moduleName: string, src: string, project: Project) {\n const modulePath = getAppModulePath(host, project.architect.build.options.browser);\n addModuleImportToModule(host, modulePath, moduleName, src);\n}\n\n/**\n * Import and add module to specific module path.\n * @param host the tree we are updating\n * @param modulePath src location of the module to import\n * @param moduleName name of module to import\n * @param src src location to import\n */\nexport function addModuleImportToModule(\n host: Tree, modulePath: string, moduleName: string, src: string) {\n const moduleSource = getSourceFile(host, modulePath);\n\n if (!moduleSource) {\n throw new SchematicsException(`Module not found: ${modulePath}`);\n }\n\n const changes = addImportToModule(moduleSource, modulePath, moduleName, src);\n const recorder = host.beginUpdate(modulePath);\n\n changes.forEach((change) => {\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n }\n });\n\n host.commitUpdate(recorder);\n}\n\n/** Gets the app index.html file */\nexport function getIndexHtmlPath(host: Tree, project: Project): string {\n const buildTarget = project.architect.build.options;\n\n if (buildTarget.index && buildTarget.index.endsWith('index.html')) {\n return buildTarget.index;\n }\n\n throw new SchematicsException('No index.html file was found.');\n}\n\n/** Get the root stylesheet file. */\nexport function getStylesPath(host: Tree, project: Project): string {\n const buildTarget = project.architect['build'];\n\n if (buildTarget.options && buildTarget.options.styles && buildTarget.options.styles.length) {\n const styles = buildTarget.options.styles.map(s => s.input);\n\n // First, see if any of the assets is called \"styles.(le|sc|c)ss\", which is the default\n // \"main\" style sheet.\n const defaultMainStylePath = styles.find(a => /styles\\.(c|le|sc)ss/.test(a));\n if (defaultMainStylePath) {\n return normalize(defaultMainStylePath);\n }\n\n // If there was no obvious default file, use the first style asset.\n const fallbackStylePath = styles.find(a => /\\.(c|le|sc)ss/.test(a));\n if (fallbackStylePath) {\n return normalize(fallbackStylePath);\n }\n }\n\n throw new SchematicsException('No style files could be found into which a theme could be added');\n}\n\n/** Wraps the internal find module from options with undefined path handling */\nexport function findModuleFromOptions(host: Tree, options: any) {\n const workspace = getWorkspace(host);\n if (!options.project) {\n options.project = Object.keys(workspace.projects)[0];\n }\n\n const project = workspace.projects[options.project];\n\n if (options.path === undefined) {\n options.path = `/${project.root}/src/app`;\n }\n\n return internalFindModule(host, options);\n}\n"]}
1
+ {"version":3,"file":"ast.js","sourceRoot":"","sources":["ast.ts"],"names":[],"mappings":";;AAWA,sCAOC;AAGD,kEAGC;AASD,0DAkBC;AAGD,4CAQC;AAGD,sCAqBC;AAGD,sDAaC;AAtGD,+CAA+C;AAC/C,2DAAqE;AACrE,iCAAiC;AACjC,wDAA2D;AAC3D,kDAAmD;AACnD,kDAA4D;AAC5D,8DAAsF;AACtF,4DAAsG;AAGtG,gEAAgE;AAChE,SAAgB,aAAa,CAAC,IAAU,EAAE,IAAY;IACpD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,gCAAmB,CAAC,iCAAiC,IAAI,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClC,OAAO,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC1E,CAAC;AAED,gDAAgD;AAChD,SAAgB,2BAA2B,CAAC,IAAU,EAAE,UAAkB,EAAE,GAAW,EAAE,OAAgB;IACvG,MAAM,UAAU,GAAG,IAAA,+BAAgB,EAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACnF,uBAAuB,CAAC,IAAI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AS,EAAE,CAAC;QAC/B,OAAO,CAAC,IAAI,GAAG,IAAI,OAAO,CAAC,IAAI,UAAU,CAAC;IAC5C,CAAC;IAED,OAAO,IAAA,mCAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import {normalize} from '@angular-devkit/core';\r\nimport {SchematicsException, Tree} from '@angular-devkit/schematics';\r\nimport * as ts from 'typescript';\r\nimport {addImportToModule} from './devkit-utils/ast-utils';\r\nimport {InsertChange} from './devkit-utils/change';\r\nimport {Project, getWorkspace} from './devkit-utils/config';\r\nimport {findBootstrapModulePath, getAppModulePath} from './devkit-utils/ng-ast-utils';\r\nimport {ModuleOptions, findModuleFromOptions as internalFindModule} from './devkit-utils/find-module';\r\n\r\n\r\n/** Reads file given path and returns TypeScript source file. */\r\nexport function getSourceFile(host: Tree, path: string): ts.SourceFile {\r\n const buffer = host.read(path);\r\n if (!buffer) {\r\n throw new SchematicsException(`Could not find file for path: ${path}`);\r\n }\r\n const content = buffer.toString();\r\n return ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);\r\n}\r\n\r\n/** Import and add module to root app module. */\r\nexport function addModuleImportToRootModule(host: Tree, moduleName: string, src: string, project: Project) {\r\n const modulePath = getAppModulePath(host, project.architect.build.options.browser);\r\n addModuleImportToModule(host, modulePath, moduleName, src);\r\n}\r\n\r\n/**\r\n * Import and add module to specific module path.\r\n * @param host the tree we are updating\r\n * @param modulePath src location of the module to import\r\n * @param moduleName name of module to import\r\n * @param src src location to import\r\n */\r\nexport function addModuleImportToModule(\r\n host: Tree, modulePath: string, moduleName: string, src: string) {\r\n const moduleSource = getSourceFile(host, modulePath);\r\n\r\n if (!moduleSource) {\r\n throw new SchematicsException(`Module not found: ${modulePath}`);\r\n }\r\n\r\n const changes = addImportToModule(moduleSource, modulePath, moduleName, src);\r\n const recorder = host.beginUpdate(modulePath);\r\n\r\n changes.forEach((change) => {\r\n if (change instanceof InsertChange) {\r\n recorder.insertLeft(change.pos, change.toAdd);\r\n }\r\n });\r\n\r\n host.commitUpdate(recorder);\r\n}\r\n\r\n/** Gets the app index.html file */\r\nexport function getIndexHtmlPath(host: Tree, project: Project): string {\r\n const buildTarget = project.architect.build.options;\r\n\r\n if (buildTarget.index && buildTarget.index.endsWith('index.html')) {\r\n return buildTarget.index;\r\n }\r\n\r\n throw new SchematicsException('No index.html file was found.');\r\n}\r\n\r\n/** Get the root stylesheet file. */\r\nexport function getStylesPath(host: Tree, project: Project): string {\r\n const buildTarget = project.architect['build'];\r\n\r\n if (buildTarget.options && buildTarget.options.styles && buildTarget.options.styles.length) {\r\n const styles = buildTarget.options.styles.map(s => s.input);\r\n\r\n // First, see if any of the assets is called \"styles.(le|sc|c)ss\", which is the default\r\n // \"main\" style sheet.\r\n const defaultMainStylePath = styles.find(a => /styles\\.(c|le|sc)ss/.test(a));\r\n if (defaultMainStylePath) {\r\n return normalize(defaultMainStylePath);\r\n }\r\n\r\n // If there was no obvious default file, use the first style asset.\r\n const fallbackStylePath = styles.find(a => /\\.(c|le|sc)ss/.test(a));\r\n if (fallbackStylePath) {\r\n return normalize(fallbackStylePath);\r\n }\r\n }\r\n\r\n throw new SchematicsException('No style files could be found into which a theme could be added');\r\n}\r\n\r\n/** Wraps the internal find module from options with undefined path handling */\r\nexport function findModuleFromOptions(host: Tree, options: any) {\r\n const workspace = getWorkspace(host);\r\n if (!options.project) {\r\n options.project = Object.keys(workspace.projects)[0];\r\n }\r\n\r\n const project = workspace.projects[options.project];\r\n\r\n if (options.path === undefined) {\r\n options.path = `/${project.root}/src/app`;\r\n }\r\n\r\n return internalFindModule(host, options);\r\n}\r\n"]}