create-sitecore-jss 22.2.0-canary.1 → 22.2.0-canary.10

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 (300) hide show
  1. package/dist/bin.js +70 -28
  2. package/dist/common/index.js +5 -3
  3. package/dist/common/processes/install.js +9 -2
  4. package/dist/common/processes/next.js +3 -3
  5. package/dist/common/processes/transform.js +29 -14
  6. package/dist/common/prompts/base.js +0 -12
  7. package/dist/common/prompts/sxp.js +20 -0
  8. package/dist/common/utils/helpers.js +28 -43
  9. package/dist/init-runner.js +16 -11
  10. package/dist/initializers/angular/index.js +13 -0
  11. package/dist/initializers/angular/prompts.js +22 -1
  12. package/dist/initializers/angular-sxp/index.js +62 -0
  13. package/dist/initializers/angular-xmcloud/index.js +66 -0
  14. package/dist/initializers/nextjs/index.js +2 -2
  15. package/dist/initializers/nextjs/prompts.js +2 -0
  16. package/dist/initializers/nextjs/remove-dev-dependencies.js +2 -2
  17. package/dist/initializers/nextjs-multisite/index.js +1 -1
  18. package/dist/initializers/nextjs-styleguide/index.js +1 -1
  19. package/dist/initializers/nextjs-styleguide-tracking/index.js +1 -1
  20. package/dist/initializers/nextjs-sxa/index.js +1 -1
  21. package/dist/initializers/nextjs-xmcloud/index.js +1 -1
  22. package/dist/initializers/node-xmcloud-proxy/index.js +32 -0
  23. package/dist/initializers/react/index.js +3 -3
  24. package/dist/initializers/react/prompts.js +1 -1
  25. package/dist/initializers/react-native/prompts.js +1 -0
  26. package/dist/initializers/vue/prompts.js +1 -1
  27. package/dist/templates/angular/.env +5 -3
  28. package/dist/templates/angular/README.md +5 -45
  29. package/dist/templates/angular/angular.json +1 -6
  30. package/dist/templates/angular/package.json +5 -15
  31. package/dist/templates/angular/proxy.conf.js +5 -23
  32. package/dist/templates/angular/scripts/bootstrap.ts +5 -24
  33. package/dist/templates/angular/scripts/config/index.ts +28 -0
  34. package/dist/templates/angular/scripts/config/plugins/computed.ts +21 -0
  35. package/dist/templates/angular/scripts/config/plugins/fallback.ts +23 -0
  36. package/dist/templates/angular/scripts/config/plugins/package-json.ts +22 -0
  37. package/dist/templates/angular/scripts/config/plugins/scjssconfig.ts +29 -0
  38. package/dist/templates/angular/scripts/generate-config.ts +53 -73
  39. package/dist/templates/angular/scripts/generate-plugins.ts +28 -0
  40. package/dist/templates/angular/scripts/temp/gitignore +2 -0
  41. package/dist/templates/angular/scripts/update-graphql-fragment-data.ts +4 -2
  42. package/dist/templates/angular/server.bundle.ts +19 -1
  43. package/dist/templates/angular/src/app/JssState.ts +1 -4
  44. package/dist/templates/angular/src/app/app.module.ts +0 -2
  45. package/dist/templates/angular/src/app/components/app-components.shared.module.ts +4 -19
  46. package/dist/templates/angular/src/app/jss-context.server-side.service.ts +0 -2
  47. package/dist/templates/angular/src/app/lib/config.ts +16 -0
  48. package/dist/templates/angular/src/app/lib/dictionary-service-factory.ts +21 -13
  49. package/dist/templates/angular/src/app/lib/layout-service-factory.ts +20 -12
  50. package/dist/templates/angular/src/app/routing/layout/layout.component.html +1 -1
  51. package/dist/templates/angular/src/app/routing/layout/layout.component.ts +1 -2
  52. package/dist/templates/angular/src/app/routing/navigation/navigation.component.html +5 -6
  53. package/dist/templates/angular/src/app/routing/navigation/navigation.component.ts +1 -2
  54. package/dist/templates/angular/src/app/routing/routing.module.ts +14 -21
  55. package/dist/templates/angular/src/app/routing/scripts/scripts.component.html +1 -0
  56. package/dist/templates/angular/src/app/routing/scripts/scripts.component.ts +7 -0
  57. package/dist/templates/angular/src/app/routing/scripts/scripts.module.ts +8 -0
  58. package/dist/templates/angular/src/graphql-fragment-types.ts +0 -95
  59. package/dist/templates/angular/tsconfig.json +7 -2
  60. package/dist/templates/angular-sxp/package.json +12 -0
  61. package/dist/templates/angular-sxp/proxy.conf.js +43 -0
  62. package/dist/templates/angular-sxp/scripts/config/plugins/disconnected.ts +27 -0
  63. package/dist/templates/angular-sxp/src/app/components/app-components.shared.module.ts +35 -0
  64. package/dist/templates/{angular → angular-sxp}/src/app/jss-data-fetcher.service.ts +3 -1
  65. package/dist/templates/angular-sxp/src/app/routing/navigation/navigation.component.html +23 -0
  66. package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.component.html +3 -0
  67. package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.module.ts +9 -0
  68. package/dist/templates/{angular/src/app/routing → angular-sxp/src/app/routing/scripts}/visitor-identification/visitor-identification.component.ts +9 -3
  69. package/dist/templates/angular-sxp/src/graphql-fragment-types.ts +219 -0
  70. package/dist/templates/angular-xmcloud/.env +8 -0
  71. package/dist/templates/angular-xmcloud/angular.json +34 -0
  72. package/dist/templates/angular-xmcloud/package.json +15 -0
  73. package/dist/templates/angular-xmcloud/scripts/config/plugins/xmcloud.ts +23 -0
  74. package/dist/templates/angular-xmcloud/scripts/proxy-build.ts +15 -0
  75. package/dist/templates/angular-xmcloud/src/app/components/container/container.component.html +15 -0
  76. package/dist/templates/angular-xmcloud/src/app/components/container/container.component.ts +30 -0
  77. package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.html +13 -0
  78. package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.ts +16 -0
  79. package/dist/templates/angular-xmcloud/src/app/components/sxa.component.ts +15 -0
  80. package/dist/templates/angular-xmcloud/src/app/jss-link.service.ts +51 -0
  81. package/dist/templates/angular-xmcloud/src/app/lib/config.ts +15 -0
  82. package/dist/templates/angular-xmcloud/src/app/lib/graphql-client-factory.ts +44 -0
  83. package/dist/templates/angular-xmcloud/src/app/routing/layout/layout.component.html +39 -0
  84. package/dist/templates/angular-xmcloud/src/app/routing/layout/layout.component.ts +111 -0
  85. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_component.scss +48 -0
  86. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_container.scss +64 -0
  87. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_fonts.scss +3 -0
  88. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_footer.scss +31 -0
  89. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_header.scss +49 -0
  90. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_navigation.scss +150 -0
  91. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_promo.scss +58 -0
  92. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_rich-text.scss +11 -0
  93. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_variables.scss +10 -0
  94. package/dist/templates/angular-xmcloud/src/assets/styles/basic/main.scss +8 -0
  95. package/dist/templates/angular-xmcloud/src/assets/styles/main.scss +4 -0
  96. package/dist/templates/angular-xmcloud/src/assets/styles/sass/_app.scss +103 -0
  97. package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_functions.scss +8 -0
  98. package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_mixins.scss +121 -0
  99. package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_vars.scss +3 -0
  100. package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_colors.scss +283 -0
  101. package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_fontSizes.scss +16 -0
  102. package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_margins.scss +11 -0
  103. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/fonts/_fonts.scss +1 -0
  104. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/fonts/index.scss +1 -0
  105. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/index.scss +3 -0
  106. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/links/_link-button.scss +26 -0
  107. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/links/index.scss +1 -0
  108. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_inputs.scss +58 -0
  109. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_links.scss +14 -0
  110. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_ui-datepicker.scss +7 -0
  111. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/_richtext-files-icons.scss +86 -0
  112. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/_richtext.scss +101 -0
  113. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/index.scss +2 -0
  114. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/typehead/_typehead.scss +95 -0
  115. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/typehead/index.scss +1 -0
  116. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-column-splitter.scss +14 -0
  117. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-container.scss +27 -0
  118. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-image.scss +18 -0
  119. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-navigation.scss +51 -0
  120. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-promo.scss +42 -0
  121. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-richtext-content.scss +19 -0
  122. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_alignment.scss +26 -0
  123. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_boxed.scss +16 -0
  124. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_clearfix.scss +11 -0
  125. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_highlighted.scss +63 -0
  126. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_link-button.scss +16 -0
  127. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_promoted-box.scss +3 -0
  128. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/index.scss +6 -0
  129. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/_bordered.scss +24 -0
  130. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/_title-row-box.scss +66 -0
  131. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/index.scss +1 -0
  132. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image/_image-default-size.scss +6 -0
  133. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image/index.scss +1 -0
  134. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image-alignment/_image-left.scss +3 -0
  135. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image-alignment/_image-right.scss +3 -0
  136. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/index.scss +17 -0
  137. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/_acaindent.scss +5 -0
  138. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/_background.scss +27 -0
  139. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/index.scss +1 -0
  140. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/_component-link-list.scss +45 -0
  141. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/_list-vertical.scss +20 -0
  142. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/index.scss +2 -0
  143. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-fat.scss +58 -0
  144. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-main-horizontal-vertical.scss +176 -0
  145. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-mobile.scss +85 -0
  146. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-sidebar.scss +29 -0
  147. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_sitemap-navigation.scss +20 -0
  148. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/index.scss +5 -0
  149. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_absolute-bottom-link.scss +8 -0
  150. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_promo-hero.scss +40 -0
  151. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_promo-shadow.scss +42 -0
  152. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/index.scss +3 -0
  153. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/rich-text/_rich-text-lists.scss +63 -0
  154. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/rich-text/index.scss +1 -0
  155. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/_background-colors.scss +14 -0
  156. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/_indent.scss +13 -0
  157. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/index.scss +2 -0
  158. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/title/_component-title.scss +30 -0
  159. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/title/index.scss +1 -0
  160. package/dist/templates/angular-xmcloud/src/assets/styles/sass/main.scss +4 -0
  161. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/index.scss +6 -0
  162. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/link-list/index.scss +0 -0
  163. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/navigation/index.scss +0 -0
  164. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/page-content/index.scss +0 -0
  165. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/promo/index.scss +0 -0
  166. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/rich-text/index.scss +0 -0
  167. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/title/index.scss +0 -0
  168. package/dist/templates/nextjs-sxa/src/assets/sass/components/_component-image.scss +1 -1
  169. package/dist/templates/node-xmcloud-proxy/.env +8 -0
  170. package/dist/templates/node-xmcloud-proxy/README.md +36 -0
  171. package/dist/templates/node-xmcloud-proxy/package.json +25 -0
  172. package/dist/templates/node-xmcloud-proxy/src/config.ts +19 -0
  173. package/dist/templates/node-xmcloud-proxy/src/index.ts +161 -0
  174. package/dist/templates/node-xmcloud-proxy/src/types.ts +59 -0
  175. package/dist/templates/node-xmcloud-proxy/tsconfig.json +22 -0
  176. package/package.json +2 -2
  177. /package/dist/templates/angular/src/app/lib/{client-factory.ts → graphql-client-factory.ts} +0 -0
  178. /package/dist/templates/{angular → angular-sxp}/data/component-content/Styleguide/ContentReuse/LoremIpsumContentBlock/en.yml +0 -0
  179. /package/dist/templates/{angular → angular-sxp}/data/component-content/gitignore +0 -0
  180. /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ContentListField/Item1/en.yml +0 -0
  181. /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ContentListField/Item2/en.yml +0 -0
  182. /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/EditFrameDemo/Item1/en.yml +0 -0
  183. /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/EditFrameDemo/Item2/en.yml +0 -0
  184. /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ItemLinkField/Item1/en.yml +0 -0
  185. /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ItemLinkField/Item2/en.yml +0 -0
  186. /package/dist/templates/{angular → angular-sxp}/data/content/gitignore +0 -0
  187. /package/dist/templates/{angular → angular-sxp}/data/dictionary/en.yml +0 -0
  188. /package/dist/templates/{angular → angular-sxp}/data/dictionary/{{language}}.yml +0 -0
  189. /package/dist/templates/{angular → angular-sxp}/data/media/files/jss.pdf +0 -0
  190. /package/dist/templates/{angular → angular-sxp}/data/media/img/jss_logo.png +0 -0
  191. /package/dist/templates/{angular → angular-sxp}/data/media/img/sc_logo.png +0 -0
  192. /package/dist/templates/{angular → angular-sxp}/data/routes/en.yml +0 -0
  193. /package/dist/templates/{angular → angular-sxp}/data/routes/graphql/en.yml +0 -0
  194. /package/dist/templates/{angular → angular-sxp}/data/routes/graphql/sample-1/en.yml +0 -0
  195. /package/dist/templates/{angular → angular-sxp}/data/routes/graphql/sample-2/en.yml +0 -0
  196. /package/dist/templates/{angular → angular-sxp}/data/routes/styleguide/custom-route-type/en.yml +0 -0
  197. /package/dist/templates/{angular → angular-sxp}/data/routes/styleguide/en.yml +0 -0
  198. /package/dist/templates/{angular → angular-sxp}/data/routes/styleguide/{{language}}.yml +0 -0
  199. /package/dist/templates/{angular → angular-sxp}/data/routes/{{language}}.yml +0 -0
  200. /package/dist/templates/{angular → angular-sxp}/scripts/disconnected-mode-proxy.ts +0 -0
  201. /package/dist/templates/{angular → angular-sxp}/scripts/lint-yml.ts +0 -0
  202. /package/dist/templates/{angular → angular-sxp}/sitecore/config/{{appName}}.config +0 -0
  203. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/component-content.sitecore.ts +0 -0
  204. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout-Reuse.sitecore.ts +0 -0
  205. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout-Tabs-Tab.sitecore.ts +0 -0
  206. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout-Tabs.sitecore.ts +0 -0
  207. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout.sitecore.ts +0 -0
  208. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Multilingual.sitecore.ts +0 -0
  209. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Section.sitecore.ts +0 -0
  210. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/content-block.sitecore.ts +0 -0
  211. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-connected-demo.sitecore.ts +0 -0
  212. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-integrated-demo.sitecore.graphql +0 -0
  213. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-integrated-demo.sitecore.ts +0 -0
  214. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-layout.sitecore.ts +0 -0
  215. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-angular-lazy-loading.sitecore.ts +0 -0
  216. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-component-params.sitecore.ts +0 -0
  217. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-custom-route-type.sitecore.ts +0 -0
  218. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-edit-frame.sitecore.ts +0 -0
  219. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-checkbox.sitecore.ts +0 -0
  220. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-content-list.sitecore.ts +0 -0
  221. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-custom.sitecore.ts +0 -0
  222. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-date.sitecore.ts +0 -0
  223. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-file.sitecore.ts +0 -0
  224. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-image.sitecore.ts +0 -0
  225. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-item-link.sitecore.ts +0 -0
  226. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-link.sitecore.ts +0 -0
  227. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-number.sitecore.ts +0 -0
  228. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-rich-text.sitecore.ts +0 -0
  229. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-text.sitecore.ts +0 -0
  230. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-route-fields.sitecore.ts +0 -0
  231. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-sitecore-context.sitecore.ts +0 -0
  232. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-tracking.sitecore.ts +0 -0
  233. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/config.js +0 -0
  234. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/content.sitecore.ts +0 -0
  235. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/dictionary.sitecore.ts +0 -0
  236. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/placeholders.sitecore.ts +0 -0
  237. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/routes.sitecore.ts +0 -0
  238. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/Styleguide-Explanatory-Component.sitecore.ts +0 -0
  239. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/styleguide-content-list-template.sitecore.ts +0 -0
  240. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/styleguide-edit-frame-list-item-template.sitecore.ts +0 -0
  241. /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/styleguide-item-link-template.sitecore.ts +0 -0
  242. /package/dist/templates/{angular → angular-sxp}/sitecore/gitignore +0 -0
  243. /package/dist/templates/{angular → angular-sxp}/sitecore/pipelines/example.patch.ts +0 -0
  244. /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.graphql +0 -0
  245. /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.html +0 -0
  246. /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.ts +0 -0
  247. /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.html +0 -0
  248. /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.ts +0 -0
  249. /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-layout/graph-ql-layout.component.html +0 -0
  250. /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-layout/graph-ql-layout.component.ts +0 -0
  251. /package/dist/templates/{angular → angular-sxp}/src/app/components/shared/styleguide-specimen/styleguide-specimen.component.ts +0 -0
  252. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.html +0 -0
  253. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.ts +0 -0
  254. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.module.ts +0 -0
  255. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-component-params/styleguide-component-params.component.html +0 -0
  256. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-component-params/styleguide-component-params.component.ts +0 -0
  257. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.html +0 -0
  258. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.ts +0 -0
  259. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.html +0 -0
  260. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.ts +0 -0
  261. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.html +0 -0
  262. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.ts +0 -0
  263. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.html +0 -0
  264. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.ts +0 -0
  265. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.html +0 -0
  266. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.ts +0 -0
  267. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.html +0 -0
  268. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.ts +0 -0
  269. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.html +0 -0
  270. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.ts +0 -0
  271. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.html +0 -0
  272. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.ts +0 -0
  273. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.html +0 -0
  274. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.ts +0 -0
  275. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.html +0 -0
  276. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.ts +0 -0
  277. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.html +0 -0
  278. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.ts +0 -0
  279. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.html +0 -0
  280. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.ts +0 -0
  281. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.html +0 -0
  282. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.ts +0 -0
  283. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout/styleguide-layout.component.html +0 -0
  284. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout/styleguide-layout.component.ts +0 -0
  285. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.html +0 -0
  286. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.ts +0 -0
  287. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.html +0 -0
  288. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.ts +0 -0
  289. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.html +0 -0
  290. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.ts +0 -0
  291. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-multilingual/styleguide-multilingual.component.html +0 -0
  292. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-multilingual/styleguide-multilingual.component.ts +0 -0
  293. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-route-fields/styleguide-route-fields.component.html +0 -0
  294. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-route-fields/styleguide-route-fields.component.ts +0 -0
  295. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-section/styleguide-section.component.html +0 -0
  296. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-section/styleguide-section.component.ts +0 -0
  297. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.html +0 -0
  298. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.ts +0 -0
  299. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-tracking/styleguide-tracking.component.html +0 -0
  300. /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-tracking/styleguide-tracking.component.ts +0 -0
package/dist/bin.js CHANGED
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.main = exports.parseArgs = void 0;
38
+ exports.main = exports.promptDestination = exports.getDestinations = exports.parseArgs = void 0;
39
39
  const fs_1 = __importDefault(require("fs"));
40
40
  const path_1 = __importStar(require("path"));
41
41
  const chalk_1 = __importDefault(require("chalk"));
@@ -43,13 +43,22 @@ const inquirer_1 = __importDefault(require("inquirer"));
43
43
  const init_runner_1 = require("./init-runner");
44
44
  const minimist_1 = __importDefault(require("minimist"));
45
45
  const common_1 = require("./common");
46
+ const helpers_1 = require("./common/utils/helpers");
46
47
  const parseArgs = () => {
47
48
  // parse any command line arguments passed into `init sitecore-jss`
48
49
  // to pass to the generator prompts and skip them.
49
50
  // useful for CI and testing purposes
50
51
  const options = {
51
52
  boolean: ['appPrefix', 'force', 'noInstall', 'yes', 'silent', 'prePushHook'],
52
- string: ['appName', 'destination', 'templates', 'hostName', 'fetchWith', 'language'],
53
+ string: [
54
+ 'appName',
55
+ 'destination',
56
+ 'proxyAppDestination',
57
+ 'templates',
58
+ 'hostName',
59
+ 'fetchWith',
60
+ 'language',
61
+ ],
53
62
  default: { prePushHook: null },
54
63
  };
55
64
  const args = (0, minimist_1.default)(process.argv.slice(2), options);
@@ -62,6 +71,51 @@ const parseArgs = () => {
62
71
  return args;
63
72
  };
64
73
  exports.parseArgs = parseArgs;
74
+ const getDestinations = (args, templates) => __awaiter(void 0, void 0, void 0, function* () {
75
+ if (templates.length === 0) {
76
+ throw new Error('Unable to get destinations, provided templates are empty');
77
+ }
78
+ // validate/gather destinations
79
+ const defaultBaseDestination = `${process.cwd()}${args.appName ? path_1.sep + args.appName : `${path_1.sep}${templates[0]}`}`;
80
+ let destination = args.destination;
81
+ if (!destination) {
82
+ destination = args.yes
83
+ ? defaultBaseDestination
84
+ : yield (0, exports.promptDestination)('Where would you like your new app created?', defaultBaseDestination);
85
+ }
86
+ // work with node-proxy destination if needed
87
+ const proxyApp = templates.find((template) => template.match(helpers_1.proxyAppMatcher));
88
+ if (proxyApp) {
89
+ // put the proxy alongside main app by default
90
+ const defaultProxyDestination = (0, helpers_1.getDefaultProxyDestination)(destination, proxyApp);
91
+ let proxyAppDestination = args.proxyAppDestination;
92
+ if (!proxyAppDestination) {
93
+ proxyAppDestination = args.yes
94
+ ? defaultProxyDestination
95
+ : yield (0, exports.promptDestination)('Where would you like your proxy app created?', defaultProxyDestination);
96
+ }
97
+ while (path_1.default.resolve(proxyAppDestination) === path_1.default.resolve(destination)) {
98
+ proxyAppDestination = yield (0, exports.promptDestination)('Proxy app and base app cannot be located in the same folder. Please input another path for proxy', defaultProxyDestination);
99
+ }
100
+ return {
101
+ destination,
102
+ proxyAppDestination,
103
+ };
104
+ }
105
+ return {
106
+ destination,
107
+ };
108
+ });
109
+ exports.getDestinations = getDestinations;
110
+ const promptDestination = (prompt, defaultDestination) => __awaiter(void 0, void 0, void 0, function* () {
111
+ return (yield inquirer_1.default.prompt({
112
+ type: 'input',
113
+ name: 'destination',
114
+ message: prompt,
115
+ default: () => defaultDestination,
116
+ })).destination;
117
+ });
118
+ exports.promptDestination = promptDestination;
65
119
  const main = (args) => __awaiter(void 0, void 0, void 0, function* () {
66
120
  let templates = [];
67
121
  // check if templates were provided
@@ -99,36 +153,24 @@ const main = (args) => __awaiter(void 0, void 0, void 0, function* () {
99
153
  });
100
154
  templates.push(answer.template);
101
155
  }
102
- // validate/gather destination
103
- const defaultDestination = `${process.cwd()}${args.appName ? path_1.sep + args.appName : `${path_1.sep}${templates[0]}`}`;
104
- let destination = args.destination;
105
- if (!destination) {
106
- if (args.yes) {
107
- destination = defaultDestination;
108
- }
109
- else {
156
+ const destinations = yield (0, exports.getDestinations)(args, templates);
157
+ for (const destination of [destinations.destination, destinations.proxyAppDestination]) {
158
+ if (!destination)
159
+ continue;
160
+ if (!args.force && fs_1.default.existsSync(destination) && fs_1.default.readdirSync(destination).length > 0) {
110
161
  const answer = yield inquirer_1.default.prompt({
111
- type: 'input',
112
- name: 'destination',
113
- message: 'Where would you like your new app created?',
114
- default: () => defaultDestination,
162
+ type: 'confirm',
163
+ name: 'continue',
164
+ message: `Directory '${destination}' not empty. Are you sure you want to continue?`,
115
165
  });
116
- destination = answer.destination;
166
+ if (!answer.continue) {
167
+ process.exit();
168
+ }
117
169
  }
118
- }
119
- if (!args.force && fs_1.default.existsSync(destination) && fs_1.default.readdirSync(destination).length > 0) {
120
- const answer = yield inquirer_1.default.prompt({
121
- type: 'confirm',
122
- name: 'continue',
123
- message: `Directory '${destination}' not empty. Are you sure you want to continue?`,
124
- });
125
- if (!answer.continue) {
126
- process.exit();
170
+ else {
171
+ args.force = true;
127
172
  }
128
173
  }
129
- else {
130
- args.force = true;
131
- }
132
174
  if (!args.yes) {
133
175
  if (args.prePushHook === null) {
134
176
  const answer = yield inquirer_1.default.prompt({
@@ -146,7 +188,7 @@ const main = (args) => __awaiter(void 0, void 0, void 0, function* () {
146
188
  }
147
189
  }
148
190
  try {
149
- yield (0, init_runner_1.initRunner)(templates.slice(), Object.assign(Object.assign({}, args), { destination, templates }));
191
+ yield (0, init_runner_1.initRunner)(templates.slice(), Object.assign(Object.assign(Object.assign({}, args), destinations), { templates }));
150
192
  }
151
193
  catch (error) {
152
194
  console.log(chalk_1.default.red('An error occurred: ', error));
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.installPrePushHook = exports.lintFix = exports.installPackages = exports.nextSteps = exports.transform = exports.removeFile = exports.saveConfiguration = exports.getBaseTemplates = exports.getAllTemplates = exports.writePackageJson = exports.openPackageJson = exports.isDevEnvironment = exports.styleguidePrompts = exports.missingAddonMsg = exports.incompatibleAddonsMsg = exports.DEFAULT_APPNAME = exports.clientAppPrompts = void 0;
3
+ exports.installPrePushHook = exports.lintFix = exports.installPackages = exports.nextSteps = exports.transform = exports.removeFile = exports.saveConfiguration = exports.getBaseTemplates = exports.getAllTemplates = exports.writeJsonFile = exports.openJsonFile = exports.isDevEnvironment = exports.sxpPrompts = exports.styleguidePrompts = exports.missingAddonMsg = exports.incompatibleAddonsMsg = exports.DEFAULT_APPNAME = exports.clientAppPrompts = void 0;
4
4
  var base_1 = require("./prompts/base");
5
5
  Object.defineProperty(exports, "clientAppPrompts", { enumerable: true, get: function () { return base_1.clientAppPrompts; } });
6
6
  Object.defineProperty(exports, "DEFAULT_APPNAME", { enumerable: true, get: function () { return base_1.DEFAULT_APPNAME; } });
@@ -8,10 +8,12 @@ Object.defineProperty(exports, "incompatibleAddonsMsg", { enumerable: true, get:
8
8
  Object.defineProperty(exports, "missingAddonMsg", { enumerable: true, get: function () { return base_1.missingAddonMsg; } });
9
9
  var styleguide_1 = require("./prompts/styleguide");
10
10
  Object.defineProperty(exports, "styleguidePrompts", { enumerable: true, get: function () { return styleguide_1.styleguidePrompts; } });
11
+ var sxp_1 = require("./prompts/sxp");
12
+ Object.defineProperty(exports, "sxpPrompts", { enumerable: true, get: function () { return sxp_1.sxpPrompts; } });
11
13
  var helpers_1 = require("./utils/helpers");
12
14
  Object.defineProperty(exports, "isDevEnvironment", { enumerable: true, get: function () { return helpers_1.isDevEnvironment; } });
13
- Object.defineProperty(exports, "openPackageJson", { enumerable: true, get: function () { return helpers_1.openPackageJson; } });
14
- Object.defineProperty(exports, "writePackageJson", { enumerable: true, get: function () { return helpers_1.writePackageJson; } });
15
+ Object.defineProperty(exports, "openJsonFile", { enumerable: true, get: function () { return helpers_1.openJsonFile; } });
16
+ Object.defineProperty(exports, "writeJsonFile", { enumerable: true, get: function () { return helpers_1.writeJsonFile; } });
15
17
  Object.defineProperty(exports, "getAllTemplates", { enumerable: true, get: function () { return helpers_1.getAllTemplates; } });
16
18
  Object.defineProperty(exports, "getBaseTemplates", { enumerable: true, get: function () { return helpers_1.getBaseTemplates; } });
17
19
  Object.defineProperty(exports, "saveConfiguration", { enumerable: true, get: function () { return helpers_1.saveConfiguration; } });
@@ -47,8 +47,7 @@ exports.installPackages = installPackages;
47
47
  */
48
48
  const lintFix = (projectFolder, silent) => {
49
49
  var _a;
50
- const packagePath = path_1.default.join(projectFolder, 'package.json');
51
- const pkg = (0, helpers_1.openPackageJson)(packagePath);
50
+ const pkg = getPackageJson(projectFolder);
52
51
  if (!((_a = pkg === null || pkg === void 0 ? void 0 : pkg.scripts) === null || _a === void 0 ? void 0 : _a.lint)) {
53
52
  return;
54
53
  }
@@ -65,6 +64,10 @@ exports.lintFix = lintFix;
65
64
  * @param {boolean} [silent] suppress logs
66
65
  */
67
66
  const installPrePushHook = (destination, silent) => __awaiter(void 0, void 0, void 0, function* () {
67
+ const pkg = getPackageJson(destination);
68
+ if (!(pkg === null || pkg === void 0 ? void 0 : pkg.scripts) || !pkg.scripts['install-pre-push-hook']) {
69
+ return;
70
+ }
68
71
  silent || console.log(chalk_1.default.cyan('Installing pre-push hook...'));
69
72
  yield new Promise((resolve, reject) => {
70
73
  (0, child_process_1.exec)(`cd ${destination} && git init && npm run install-pre-push-hook`, (err) => {
@@ -80,3 +83,7 @@ const installPrePushHook = (destination, silent) => __awaiter(void 0, void 0, vo
80
83
  });
81
84
  });
82
85
  exports.installPrePushHook = installPrePushHook;
86
+ const getPackageJson = (projectFolder) => {
87
+ const packagePath = path_1.default.join(projectFolder, 'package.json');
88
+ return (0, helpers_1.openJsonFile)(packagePath);
89
+ };
@@ -16,10 +16,10 @@ exports.nextSteps = void 0;
16
16
  const chalk_1 = __importDefault(require("chalk"));
17
17
  /**
18
18
  * Logs app creation completion message and next steps
19
- * @param {string} appName application name for the new app
19
+ * @param {string[]} appNames application name(s) for the new app
20
20
  * @param {string[]} nextStepsArr next steps to be performed after app is created
21
21
  */
22
- const nextSteps = (appName, nextStepsArr) => __awaiter(void 0, void 0, void 0, function* () {
22
+ const nextSteps = (appNames, nextStepsArr) => __awaiter(void 0, void 0, void 0, function* () {
23
23
  console.log(chalk_1.default.red(' -/oyhdmNNNNmdhyo/- '));
24
24
  console.log(chalk_1.default.red(' :sdMMMMMMMMMMMMMMMMMMMMds: '));
25
25
  console.log(chalk_1.default.red(' :yNMMMMMMMMMMMMMMMMMMMMMMMMMMNy: '));
@@ -51,7 +51,7 @@ const nextSteps = (appName, nextStepsArr) => __awaiter(void 0, void 0, void 0, f
51
51
  console.log(chalk_1.default.white(' / // /\\ \\_\\ \\ '));
52
52
  console.log(chalk_1.default.white(' \\___/___/___/'));
53
53
  console.log();
54
- console.log(`JSS application ${chalk_1.default.green(appName)} is ready!`);
54
+ console.log(`JSS application(s) ${chalk_1.default.green(appNames.join(', '))} is ready!`);
55
55
  console.log();
56
56
  console.log(chalk_1.default.yellow('Next steps:'));
57
57
  nextStepsArr.forEach((step) => {
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.transform = exports.diffAndWriteFiles = exports.diffFiles = exports.mergeEnv = exports.merge = exports.transformFilename = void 0;
38
+ exports.transform = exports.populateEjsData = exports.diffAndWriteFiles = exports.diffFiles = exports.mergeEnv = exports.merge = exports.transformFilename = void 0;
39
39
  const chalk_1 = __importDefault(require("chalk"));
40
40
  const fs_extra_1 = __importDefault(require("fs-extra"));
41
41
  const glob_1 = __importDefault(require("glob"));
@@ -180,6 +180,21 @@ const diffAndWriteFiles = ({ rendered, pathToNewFile, answers, }) => __awaiter(v
180
180
  }
181
181
  });
182
182
  exports.diffAndWriteFiles = diffAndWriteFiles;
183
+ const populateEjsData = (answers, destination) => {
184
+ // pass in helper to answers object
185
+ const ejsData = Object.assign(Object.assign({}, answers), { helper: {
186
+ isDev: (0, helpers_1.isDevEnvironment)(destination || answers.destination),
187
+ getPascalCaseName: helpers_1.getPascalCaseName,
188
+ getAppPrefix: helpers_1.getAppPrefix,
189
+ } });
190
+ // When SPA application and XM Cloud proxy is used we need to calculate relative path between SPA app and proxy to apply that in EJS template
191
+ // Absolute path can't be used across all the machines
192
+ if (answers.proxyAppDestination) {
193
+ ejsData.helper.relativeProxyAppDestination = `${path_1.default.relative(path_1.default.resolve(answers.destination), path_1.default.resolve(answers.proxyAppDestination))}${path_1.sep}`;
194
+ }
195
+ return ejsData;
196
+ };
197
+ exports.populateEjsData = populateEjsData;
183
198
  /**
184
199
  * Handles each template file and applies ejs renderer, also:
185
200
  * * determines files for copy
@@ -194,16 +209,16 @@ exports.diffAndWriteFiles = diffAndWriteFiles;
194
209
  */
195
210
  const transform = (templatePath, answers, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
196
211
  const { isFileForCopy, isFileForSkip, fileForCopyRegExp = FILE_FOR_COPY_REGEXP } = options;
197
- const destinationPath = path_1.default.resolve(answers.destination);
212
+ let destination = undefined;
213
+ // allow proxy app to be installed separately alongside base app
214
+ if (templatePath.match(/.*node-.+-proxy$/g) && answers.proxyAppDestination) {
215
+ destination = answers.proxyAppDestination;
216
+ }
217
+ const destinationPath = path_1.default.resolve(destination || answers.destination);
198
218
  if (!answers.appPrefix) {
199
219
  answers.appPrefix = false;
200
220
  }
201
- // pass in helper to answers object
202
- const ejsData = Object.assign(Object.assign({}, answers), { helper: {
203
- isDev: (0, helpers_1.isDevEnvironment)(answers.destination),
204
- getPascalCaseName: helpers_1.getPascalCaseName,
205
- getAppPrefix: helpers_1.getAppPrefix,
206
- } });
221
+ const ejsData = (0, exports.populateEjsData)(answers, destination);
207
222
  // the templates to be run through ejs render or copied directly
208
223
  const files = glob_1.default.sync('**/*', { cwd: templatePath, dot: true, nodir: true });
209
224
  for (const file of files) {
@@ -228,13 +243,13 @@ const transform = (templatePath, answers, options = {}) => __awaiter(void 0, voi
228
243
  fs_extra_1.default.copySync(pathToTemplate, pathToNewFile);
229
244
  continue;
230
245
  }
231
- if (file.endsWith('package.json') && fs_extra_1.default.existsSync(pathToNewFile)) {
232
- // we treat package.json a bit differently
233
- // read the current package.json and the template package.json (rendered with ejs)
234
- const currentPkg = (0, helpers_1.openPackageJson)(pathToNewFile);
235
- const templatePkg = JSON.parse(yield (0, ejs_1.renderFile)(path_1.default.resolve(pathToTemplate), ejsData));
246
+ if (file.endsWith('.json') && fs_extra_1.default.existsSync(pathToNewFile)) {
247
+ // we treat a .json a bit differently
248
+ // read the current .json and the template .json (rendered with ejs)
249
+ const currentJson = (0, helpers_1.openJsonFile)(pathToNewFile);
250
+ const templateJson = JSON.parse(yield (0, ejs_1.renderFile)(path_1.default.resolve(pathToTemplate), ejsData));
236
251
  // merge them and set the result to str which will then go through diff
237
- const merged = (0, exports.merge)(currentPkg, templatePkg);
252
+ const merged = (0, exports.merge)(currentJson, templateJson);
238
253
  str = JSON.stringify(merged, null, 2);
239
254
  }
240
255
  if (file.endsWith('.env') && fs_extra_1.default.existsSync(pathToNewFile)) {
@@ -38,18 +38,6 @@ exports.clientAppPrompts = [
38
38
  return !answers.appName;
39
39
  },
40
40
  },
41
- {
42
- type: 'input',
43
- name: 'hostName',
44
- message: 'What is your Sitecore hostname (used if deployed to Sitecore)?',
45
- default: (answers) => `${answers.appName}.dev.local`,
46
- when: (answers) => {
47
- if (answers.yes && !answers.hostName) {
48
- answers.hostName = `${answers.appName}.dev.local`;
49
- }
50
- return !answers.hostName;
51
- },
52
- },
53
41
  {
54
42
  type: 'list',
55
43
  name: 'fetchWith',
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sxpPrompts = void 0;
4
+ /**
5
+ * Set of CLI prompts for an SXP app
6
+ */
7
+ exports.sxpPrompts = [
8
+ {
9
+ type: 'input',
10
+ name: 'hostName',
11
+ message: 'What is your Sitecore hostname (used if deployed to Sitecore)?',
12
+ default: (answers) => `${answers.appName}.dev.local`,
13
+ when: (answers) => {
14
+ if (answers.yes && !answers.hostName) {
15
+ answers.hostName = `${answers.appName}.dev.local`;
16
+ }
17
+ return !answers.hostName;
18
+ },
19
+ },
20
+ ];
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,11 +12,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
13
  };
37
14
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.removeFile = exports.writeFileToPath = exports.getAppPrefix = exports.getBaseTemplates = exports.getAllTemplates = exports.sortKeys = exports.saveConfiguration = exports.writePackageJson = exports.openPackageJson = exports.getPascalCaseName = exports.isDevEnvironment = void 0;
15
+ exports.removeFile = exports.writeFileToPath = exports.getAppPrefix = exports.getBaseTemplates = exports.getAllTemplates = exports.sortKeys = exports.saveConfiguration = exports.writeJsonFile = exports.openJsonFile = exports.getPascalCaseName = exports.isDevEnvironment = exports.getDefaultProxyDestination = exports.proxyAppMatcher = void 0;
39
16
  const chalk_1 = __importDefault(require("chalk"));
40
17
  const fs_1 = __importDefault(require("fs"));
41
- const path_1 = __importStar(require("path"));
18
+ const path_1 = __importDefault(require("path"));
42
19
  const InitializerFactory_1 = require("../../InitializerFactory");
20
+ // matched for proxy templates
21
+ exports.proxyAppMatcher = /node-headless.+|node-xmcloud.+/g;
22
+ /**
23
+ * Returns the default path for proxy app initialized alongside main JSS tempalates.
24
+ * @param {string} mainAppDestination target destination for main app
25
+ * @param {string} proxyName name of for the proxy app folder
26
+ * @returns {string} target path for proxy app
27
+ */
28
+ const getDefaultProxyDestination = (mainAppDestination, proxyName) => path_1.default.join(mainAppDestination, '..', proxyName);
29
+ exports.getDefaultProxyDestination = getDefaultProxyDestination;
43
30
  /**
44
31
  * Determines whether you are in a dev environment.
45
32
  * It's `true` if you are inside the monorepo
@@ -61,46 +48,44 @@ const getPascalCaseName = (name) => {
61
48
  };
62
49
  exports.getPascalCaseName = getPascalCaseName;
63
50
  /**
64
- * Provides `package.json` data
65
- * @param {string} [pkgPath] path to `package.json`. Default is './package.json'.
66
- * @returns `package.json` data
51
+ * Provides json data from a file
52
+ * @param {string} jsonFilePath path to the .json file.
53
+ * @returns json data
67
54
  */
68
- const openPackageJson = (pkgPath) => {
69
- const filePath = path_1.default.resolve(pkgPath !== null && pkgPath !== void 0 ? pkgPath : `.${path_1.sep}package.json`);
55
+ const openJsonFile = (jsonFilePath) => {
70
56
  try {
71
- const data = fs_1.default.readFileSync(filePath, 'utf8');
57
+ const data = fs_1.default.readFileSync(jsonFilePath, 'utf8');
72
58
  return data ? JSON.parse(data) : undefined;
73
59
  }
74
60
  catch (error) {
75
- console.log(chalk_1.default.red(`The following error occurred while trying to read ${filePath}:`));
61
+ console.log(chalk_1.default.red(`The following error occurred while trying to read ${jsonFilePath}:`));
76
62
  console.log(chalk_1.default.red(error));
77
63
  }
78
64
  };
79
- exports.openPackageJson = openPackageJson;
65
+ exports.openJsonFile = openJsonFile;
80
66
  /**
81
- * Creates `package.json` file and inserts provided data
82
- * @param {Object} data data to be written into package.json
83
- * @param {string} [pkgPath] a path to a file. Default is './package.json'.
67
+ * Creates a .json file and inserts provided data
68
+ * @param {Object} data data to be written into the .json file
69
+ * @param {string} jsonFilePath a path to a file.
84
70
  */
85
- const writePackageJson = (data, pkgPath) => {
86
- const filePath = path_1.default.resolve(pkgPath !== null && pkgPath !== void 0 ? pkgPath : `.${path_1.sep}package.json`);
71
+ const writeJsonFile = (data, jsonFilePath) => {
87
72
  try {
88
- fs_1.default.writeFileSync(filePath, JSON.stringify(data, null, 2), { encoding: 'utf8' });
73
+ fs_1.default.writeFileSync(jsonFilePath, JSON.stringify(data, null, 2), { encoding: 'utf8' });
89
74
  }
90
75
  catch (error) {
91
- console.log(chalk_1.default.red(`The following error occurred while trying to write ${filePath}:`));
76
+ console.log(chalk_1.default.red(`The following error occurred while trying to write ${jsonFilePath}:`));
92
77
  console.log(chalk_1.default.red(error));
93
78
  }
94
79
  };
95
- exports.writePackageJson = writePackageJson;
80
+ exports.writeJsonFile = writeJsonFile;
96
81
  /**
97
82
  * Save configuration params to the package.json
98
83
  * @param {string[]} templates templates applied to the sample
99
84
  * @param {string} [pkgPath] path to the package.json
100
85
  */
101
86
  const saveConfiguration = (templates, pkgPath) => {
102
- const pkg = (0, exports.openPackageJson)(pkgPath);
103
- (0, exports.writePackageJson)(Object.assign(Object.assign({}, pkg), { config: Object.assign(Object.assign({}, pkg.config), { templates }) }), pkgPath);
87
+ const pkg = (0, exports.openJsonFile)(pkgPath);
88
+ (0, exports.writeJsonFile)(Object.assign(Object.assign({}, pkg), { config: Object.assign(Object.assign({}, pkg.config), { templates }) }), pkgPath);
104
89
  };
105
90
  exports.saveConfiguration = saveConfiguration;
106
91
  const sortKeys = (obj) => {
@@ -42,7 +42,7 @@ const common_1 = require("./common");
42
42
  const InitializerFactory_1 = require("./InitializerFactory");
43
43
  const initRunner = (initializers, args) => __awaiter(void 0, void 0, void 0, function* () {
44
44
  let nextStepsArr = [];
45
- let appName;
45
+ const appNames = new Set([]);
46
46
  const initFactory = new InitializerFactory_1.InitializerFactory();
47
47
  const runner = (inits) => __awaiter(void 0, void 0, void 0, function* () {
48
48
  var _a;
@@ -53,7 +53,8 @@ const initRunner = (initializers, args) => __awaiter(void 0, void 0, void 0, fun
53
53
  }
54
54
  args.silent || console.log(chalk_1.default.cyan(`Initializing '${init}'...`));
55
55
  const response = yield initializer.init(args);
56
- appName = response.appName;
56
+ // App names can be multiple if the base template requires to setup additional standalone app (e.g. XM Cloud proxy)
57
+ appNames.add(response.appName);
57
58
  nextStepsArr = [...nextStepsArr, ...((_a = response.nextSteps) !== null && _a !== void 0 ? _a : [])];
58
59
  // process any returned initializers
59
60
  if (response.initializers && response.initializers.length > 0) {
@@ -67,17 +68,21 @@ const initRunner = (initializers, args) => __awaiter(void 0, void 0, void 0, fun
67
68
  });
68
69
  yield runner(initializers);
69
70
  (0, common_1.saveConfiguration)(args.templates, path_1.default.resolve(`${args.destination}${path_1.sep}package.json`));
70
- // final steps (install, lint, etc)
71
- if (!args.noInstall) {
72
- (0, common_1.installPackages)(args.destination, args.silent);
73
- (0, common_1.lintFix)(args.destination, args.silent);
74
- }
75
- // install pre-push hook if user opts-in
76
- if (args.prePushHook) {
77
- yield (0, common_1.installPrePushHook)(args.destination, args.silent);
71
+ for (const destination of [args.destination, args.proxyAppDestination]) {
72
+ if (!destination)
73
+ continue;
74
+ // final steps (install, lint, etc)
75
+ if (!args.noInstall) {
76
+ (0, common_1.installPackages)(destination, args.silent);
77
+ (0, common_1.lintFix)(destination, args.silent);
78
+ }
79
+ // install pre-push hook if user opts-in
80
+ if (args.prePushHook) {
81
+ yield (0, common_1.installPrePushHook)(destination, args.silent);
82
+ }
78
83
  }
79
84
  if (!args.silent) {
80
- (0, common_1.nextSteps)(appName || '', nextStepsArr);
85
+ (0, common_1.nextSteps)([...appNames], nextStepsArr);
81
86
  }
82
87
  });
83
88
  exports.initRunner = initRunner;
@@ -27,9 +27,22 @@ class AngularInitializer {
27
27
  const mergedArgs = Object.assign(Object.assign({}, args), answers);
28
28
  const templatePath = path_1.default.resolve(__dirname, '../../templates/angular');
29
29
  yield (0, common_1.transform)(templatePath, mergedArgs);
30
+ const addInitializers = [];
31
+ if (answers.xmcloud) {
32
+ if (!args.templates.includes('angular-xmcloud')) {
33
+ addInitializers.push('angular-xmcloud');
34
+ }
35
+ }
36
+ else {
37
+ // invoke default non-XMC init
38
+ if (!args.templates.includes('angular-sxp') && !args.templates.includes('angular-xmcloud')) {
39
+ addInitializers.push('angular-sxp');
40
+ }
41
+ }
30
42
  const response = {
31
43
  nextSteps: [`* Connect to Sitecore with ${chalk_1.default.green('jss setup')} (optional)`],
32
44
  appName: answers.appName,
45
+ initializers: addInitializers,
33
46
  };
34
47
  return response;
35
48
  });
@@ -2,4 +2,25 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.prompts = void 0;
4
4
  const common_1 = require("../../common");
5
- exports.prompts = [...common_1.clientAppPrompts, ...common_1.styleguidePrompts];
5
+ exports.prompts = [
6
+ // XMCloud answer defines init behavior. Prompt must go first
7
+ {
8
+ type: 'confirm',
9
+ name: 'xmcloud',
10
+ message: 'Are you building for Sitecore XM Cloud?',
11
+ default: false,
12
+ when: (answers) => {
13
+ // don't prompt if --yes or angular-xmcloud template was specified
14
+ if (answers.yes) {
15
+ return false;
16
+ }
17
+ else if (answers.templates.includes('angular-xmcloud') &&
18
+ !answers.templates.includes('angular-sxp')) {
19
+ answers.xmcloud = true;
20
+ return false;
21
+ }
22
+ return true;
23
+ },
24
+ },
25
+ ...common_1.clientAppPrompts,
26
+ ];
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const path_1 = __importStar(require("path"));
39
+ const common_1 = require("../../common");
40
+ const inquirer_1 = __importDefault(require("inquirer"));
41
+ class AngularSxpInitializer {
42
+ get isBase() {
43
+ return false;
44
+ }
45
+ init(args) {
46
+ var _a, _b;
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const pkg = (0, common_1.openJsonFile)(`${args.destination}${path_1.sep}package.json`);
49
+ const answers = yield inquirer_1.default.prompt(common_1.sxpPrompts, args);
50
+ const styleguideAnswers = yield inquirer_1.default.prompt(common_1.styleguidePrompts, args);
51
+ const mergedArgs = Object.assign(Object.assign(Object.assign(Object.assign({}, args), { appName: args.appName || ((_a = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _a === void 0 ? void 0 : _a.appName) || common_1.DEFAULT_APPNAME, appPrefix: args.appPrefix || ((_b = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _b === void 0 ? void 0 : _b.prefix) || false }), answers), styleguideAnswers);
52
+ const templatePath = path_1.default.resolve(__dirname, '../../templates/angular-sxp');
53
+ yield (0, common_1.transform)(templatePath, mergedArgs);
54
+ const response = {
55
+ nextSteps: [],
56
+ appName: mergedArgs.appName,
57
+ };
58
+ return response;
59
+ });
60
+ }
61
+ }
62
+ exports.default = AngularSxpInitializer;