create-sitecore-jss 22.2.0-canary.9 → 22.2.1-canary.1

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 (313) hide show
  1. package/dist/bin.js +28 -70
  2. package/dist/common/index.js +3 -5
  3. package/dist/common/processes/install.js +2 -9
  4. package/dist/common/processes/next.js +3 -3
  5. package/dist/common/processes/transform.js +14 -29
  6. package/dist/common/prompts/base.js +12 -0
  7. package/dist/common/utils/helpers.js +43 -28
  8. package/dist/init-runner.js +11 -16
  9. package/dist/initializers/angular/index.js +0 -13
  10. package/dist/initializers/angular/prompts.js +1 -22
  11. package/dist/initializers/nextjs/index.js +2 -2
  12. package/dist/initializers/nextjs/prompts.js +0 -2
  13. package/dist/initializers/nextjs/remove-dev-dependencies.js +2 -2
  14. package/dist/initializers/nextjs-multisite/index.js +1 -1
  15. package/dist/initializers/nextjs-styleguide/index.js +1 -1
  16. package/dist/initializers/nextjs-styleguide-tracking/index.js +1 -1
  17. package/dist/initializers/nextjs-sxa/index.js +1 -1
  18. package/dist/initializers/nextjs-xmcloud/index.js +1 -1
  19. package/dist/initializers/react/index.js +3 -3
  20. package/dist/initializers/react/prompts.js +1 -1
  21. package/dist/initializers/react-native/prompts.js +0 -1
  22. package/dist/initializers/vue/prompts.js +1 -1
  23. package/dist/templates/angular/.env +3 -5
  24. package/dist/templates/angular/README.md +45 -5
  25. package/dist/templates/angular/angular.json +6 -1
  26. package/dist/templates/angular/package.json +20 -10
  27. package/dist/templates/angular/proxy.conf.js +23 -5
  28. package/dist/templates/angular/scripts/bootstrap.ts +24 -5
  29. package/dist/templates/angular/scripts/generate-config.ts +73 -53
  30. package/dist/templates/angular/scripts/update-graphql-fragment-data.ts +2 -4
  31. package/dist/templates/angular/server.bundle.ts +1 -19
  32. package/dist/templates/angular/src/app/app.module.ts +2 -0
  33. package/dist/templates/angular/src/app/components/app-components.shared.module.ts +19 -4
  34. package/dist/templates/angular/src/app/jss-context.server-side.service.ts +2 -0
  35. package/dist/templates/{angular-sxp → angular}/src/app/jss-data-fetcher.service.ts +1 -3
  36. package/dist/templates/angular/src/app/lib/dictionary-service-factory.ts +13 -21
  37. package/dist/templates/angular/src/app/lib/layout-service-factory.ts +12 -20
  38. package/dist/templates/angular/src/app/routing/layout/layout.component.html +1 -1
  39. package/dist/templates/angular/src/app/routing/layout/layout.component.ts +2 -1
  40. package/dist/templates/angular/src/app/routing/navigation/navigation.component.html +6 -5
  41. package/dist/templates/angular/src/app/routing/navigation/navigation.component.ts +2 -1
  42. package/dist/templates/angular/src/app/routing/routing.module.ts +21 -14
  43. package/dist/templates/{angular-sxp/src/app/routing/scripts → angular/src/app/routing}/visitor-identification/visitor-identification.component.ts +3 -9
  44. package/dist/templates/angular/src/graphql-fragment-types.ts +95 -0
  45. package/dist/templates/angular/tsconfig.json +2 -7
  46. package/dist/templates/nextjs/package.json +5 -5
  47. package/dist/templates/nextjs/src/lib/page-props-factory/plugins/component-props.ts +2 -1
  48. package/dist/templates/nextjs-styleguide/package.json +1 -1
  49. package/dist/templates/nextjs-sxa/src/components/Container.tsx +6 -14
  50. package/dist/templates/nextjs-xmcloud/package.json +3 -2
  51. package/dist/templates/nextjs-xmcloud/src/Bootstrap.tsx +25 -10
  52. package/dist/templates/nextjs-xmcloud/src/byoc/{index.ts → index.tsx} +25 -8
  53. package/dist/templates/nextjs-xmcloud/src/components/CdpPageView.tsx +9 -14
  54. package/dist/templates/nextjs-xmcloud/src/lib/middleware/plugins/personalize.ts +0 -1
  55. package/dist/templates/nextjs-xmcloud/src/lib/page-props-factory/plugins/component-themes.ts +2 -1
  56. package/dist/templates/nextjs-xmcloud/src/lib/page-props-factory/plugins/preview-mode.ts +2 -1
  57. package/dist/templates/node-headless-ssr-experience-edge/package.json +2 -2
  58. package/dist/templates/node-headless-ssr-proxy/package.json +3 -3
  59. package/dist/templates/react/package.json +5 -5
  60. package/dist/templates/react-native/package.json +4 -4
  61. package/dist/templates/vue/package.json +4 -4
  62. package/package.json +2 -2
  63. package/dist/common/prompts/sxp.js +0 -20
  64. package/dist/initializers/angular-sxp/index.js +0 -62
  65. package/dist/initializers/angular-xmcloud/index.js +0 -66
  66. package/dist/initializers/node-xmcloud-proxy/index.js +0 -32
  67. package/dist/templates/angular/scripts/config/index.ts +0 -28
  68. package/dist/templates/angular/scripts/config/plugins/computed.ts +0 -21
  69. package/dist/templates/angular/scripts/config/plugins/fallback.ts +0 -23
  70. package/dist/templates/angular/scripts/config/plugins/package-json.ts +0 -22
  71. package/dist/templates/angular/scripts/config/plugins/scjssconfig.ts +0 -29
  72. package/dist/templates/angular/scripts/generate-plugins.ts +0 -28
  73. package/dist/templates/angular/scripts/temp/gitignore +0 -2
  74. package/dist/templates/angular/src/app/lib/config.ts +0 -16
  75. package/dist/templates/angular/src/app/routing/scripts/scripts.component.html +0 -1
  76. package/dist/templates/angular/src/app/routing/scripts/scripts.component.ts +0 -7
  77. package/dist/templates/angular/src/app/routing/scripts/scripts.module.ts +0 -8
  78. package/dist/templates/angular-sxp/package.json +0 -12
  79. package/dist/templates/angular-sxp/proxy.conf.js +0 -43
  80. package/dist/templates/angular-sxp/scripts/config/plugins/disconnected.ts +0 -27
  81. package/dist/templates/angular-sxp/src/app/components/app-components.shared.module.ts +0 -35
  82. package/dist/templates/angular-sxp/src/app/routing/navigation/navigation.component.html +0 -23
  83. package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.component.html +0 -3
  84. package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.module.ts +0 -9
  85. package/dist/templates/angular-sxp/src/graphql-fragment-types.ts +0 -219
  86. package/dist/templates/angular-xmcloud/.env +0 -8
  87. package/dist/templates/angular-xmcloud/angular.json +0 -34
  88. package/dist/templates/angular-xmcloud/package.json +0 -15
  89. package/dist/templates/angular-xmcloud/scripts/config/plugins/xmcloud.ts +0 -23
  90. package/dist/templates/angular-xmcloud/scripts/proxy-build.ts +0 -15
  91. package/dist/templates/angular-xmcloud/src/app/components/container/container.component.html +0 -15
  92. package/dist/templates/angular-xmcloud/src/app/components/container/container.component.ts +0 -30
  93. package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.html +0 -13
  94. package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.ts +0 -16
  95. package/dist/templates/angular-xmcloud/src/app/components/sxa.component.ts +0 -15
  96. package/dist/templates/angular-xmcloud/src/app/lib/config.ts +0 -15
  97. package/dist/templates/angular-xmcloud/src/app/lib/graphql-client-factory.ts +0 -44
  98. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_component.scss +0 -48
  99. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_container.scss +0 -64
  100. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_fonts.scss +0 -3
  101. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_footer.scss +0 -31
  102. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_header.scss +0 -49
  103. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_navigation.scss +0 -150
  104. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_promo.scss +0 -58
  105. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_rich-text.scss +0 -11
  106. package/dist/templates/angular-xmcloud/src/assets/styles/basic/_variables.scss +0 -10
  107. package/dist/templates/angular-xmcloud/src/assets/styles/basic/main.scss +0 -8
  108. package/dist/templates/angular-xmcloud/src/assets/styles/main.scss +0 -4
  109. package/dist/templates/angular-xmcloud/src/assets/styles/sass/_app.scss +0 -103
  110. package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_functions.scss +0 -8
  111. package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_mixins.scss +0 -121
  112. package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_vars.scss +0 -3
  113. package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_colors.scss +0 -283
  114. package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_fontSizes.scss +0 -16
  115. package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_margins.scss +0 -11
  116. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/fonts/_fonts.scss +0 -1
  117. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/fonts/index.scss +0 -1
  118. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/index.scss +0 -3
  119. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/links/_link-button.scss +0 -26
  120. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/links/index.scss +0 -1
  121. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_inputs.scss +0 -58
  122. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_links.scss +0 -14
  123. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_ui-datepicker.scss +0 -7
  124. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/_richtext-files-icons.scss +0 -86
  125. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/_richtext.scss +0 -101
  126. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/index.scss +0 -2
  127. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/typehead/_typehead.scss +0 -95
  128. package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/typehead/index.scss +0 -1
  129. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-column-splitter.scss +0 -14
  130. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-container.scss +0 -27
  131. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-image.scss +0 -18
  132. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-navigation.scss +0 -51
  133. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-promo.scss +0 -42
  134. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-richtext-content.scss +0 -19
  135. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_alignment.scss +0 -26
  136. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_boxed.scss +0 -16
  137. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_clearfix.scss +0 -11
  138. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_highlighted.scss +0 -63
  139. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_link-button.scss +0 -16
  140. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_promoted-box.scss +0 -3
  141. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/index.scss +0 -6
  142. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/_bordered.scss +0 -24
  143. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/_title-row-box.scss +0 -66
  144. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/index.scss +0 -1
  145. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image/_image-default-size.scss +0 -6
  146. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image/index.scss +0 -1
  147. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image-alignment/_image-left.scss +0 -3
  148. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image-alignment/_image-right.scss +0 -3
  149. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/index.scss +0 -17
  150. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/_acaindent.scss +0 -5
  151. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/_background.scss +0 -27
  152. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/index.scss +0 -1
  153. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/_component-link-list.scss +0 -45
  154. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/_list-vertical.scss +0 -20
  155. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/index.scss +0 -2
  156. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-fat.scss +0 -58
  157. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-main-horizontal-vertical.scss +0 -176
  158. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-mobile.scss +0 -85
  159. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-sidebar.scss +0 -29
  160. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_sitemap-navigation.scss +0 -20
  161. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/index.scss +0 -5
  162. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_absolute-bottom-link.scss +0 -8
  163. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_promo-hero.scss +0 -40
  164. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_promo-shadow.scss +0 -42
  165. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/index.scss +0 -3
  166. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/rich-text/_rich-text-lists.scss +0 -63
  167. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/rich-text/index.scss +0 -1
  168. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/_background-colors.scss +0 -14
  169. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/_indent.scss +0 -13
  170. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/index.scss +0 -2
  171. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/title/_component-title.scss +0 -30
  172. package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/title/index.scss +0 -1
  173. package/dist/templates/angular-xmcloud/src/assets/styles/sass/main.scss +0 -4
  174. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/index.scss +0 -6
  175. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/link-list/index.scss +0 -0
  176. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/navigation/index.scss +0 -0
  177. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/page-content/index.scss +0 -0
  178. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/promo/index.scss +0 -0
  179. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/rich-text/index.scss +0 -0
  180. package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/title/index.scss +0 -0
  181. package/dist/templates/nextjs-xmcloud/src/lib/context/index.ts +0 -22
  182. package/dist/templates/nextjs-xmcloud/src/lib/context/sdk/events.ts +0 -26
  183. package/dist/templates/node-xmcloud-proxy/.env +0 -8
  184. package/dist/templates/node-xmcloud-proxy/README.md +0 -36
  185. package/dist/templates/node-xmcloud-proxy/package.json +0 -25
  186. package/dist/templates/node-xmcloud-proxy/src/config.ts +0 -19
  187. package/dist/templates/node-xmcloud-proxy/src/index.ts +0 -161
  188. package/dist/templates/node-xmcloud-proxy/src/types.ts +0 -59
  189. package/dist/templates/node-xmcloud-proxy/tsconfig.json +0 -22
  190. /package/dist/templates/{angular-sxp → angular}/data/component-content/Styleguide/ContentReuse/LoremIpsumContentBlock/en.yml +0 -0
  191. /package/dist/templates/{angular-sxp → angular}/data/component-content/gitignore +0 -0
  192. /package/dist/templates/{angular-sxp → angular}/data/content/Styleguide/ContentListField/Item1/en.yml +0 -0
  193. /package/dist/templates/{angular-sxp → angular}/data/content/Styleguide/ContentListField/Item2/en.yml +0 -0
  194. /package/dist/templates/{angular-sxp → angular}/data/content/Styleguide/EditFrameDemo/Item1/en.yml +0 -0
  195. /package/dist/templates/{angular-sxp → angular}/data/content/Styleguide/EditFrameDemo/Item2/en.yml +0 -0
  196. /package/dist/templates/{angular-sxp → angular}/data/content/Styleguide/ItemLinkField/Item1/en.yml +0 -0
  197. /package/dist/templates/{angular-sxp → angular}/data/content/Styleguide/ItemLinkField/Item2/en.yml +0 -0
  198. /package/dist/templates/{angular-sxp → angular}/data/content/gitignore +0 -0
  199. /package/dist/templates/{angular-sxp → angular}/data/dictionary/en.yml +0 -0
  200. /package/dist/templates/{angular-sxp → angular}/data/dictionary/{{language}}.yml +0 -0
  201. /package/dist/templates/{angular-sxp → angular}/data/media/files/jss.pdf +0 -0
  202. /package/dist/templates/{angular-sxp → angular}/data/media/img/jss_logo.png +0 -0
  203. /package/dist/templates/{angular-sxp → angular}/data/media/img/sc_logo.png +0 -0
  204. /package/dist/templates/{angular-sxp → angular}/data/routes/en.yml +0 -0
  205. /package/dist/templates/{angular-sxp → angular}/data/routes/graphql/en.yml +0 -0
  206. /package/dist/templates/{angular-sxp → angular}/data/routes/graphql/sample-1/en.yml +0 -0
  207. /package/dist/templates/{angular-sxp → angular}/data/routes/graphql/sample-2/en.yml +0 -0
  208. /package/dist/templates/{angular-sxp → angular}/data/routes/styleguide/custom-route-type/en.yml +0 -0
  209. /package/dist/templates/{angular-sxp → angular}/data/routes/styleguide/en.yml +0 -0
  210. /package/dist/templates/{angular-sxp → angular}/data/routes/styleguide/{{language}}.yml +0 -0
  211. /package/dist/templates/{angular-sxp → angular}/data/routes/{{language}}.yml +0 -0
  212. /package/dist/templates/{angular-sxp → angular}/scripts/disconnected-mode-proxy.ts +0 -0
  213. /package/dist/templates/{angular-sxp → angular}/scripts/lint-yml.ts +0 -0
  214. /package/dist/templates/{angular-sxp → angular}/sitecore/config/{{appName}}.config +0 -0
  215. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/component-content.sitecore.ts +0 -0
  216. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/Styleguide-Layout-Reuse.sitecore.ts +0 -0
  217. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/Styleguide-Layout-Tabs-Tab.sitecore.ts +0 -0
  218. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/Styleguide-Layout-Tabs.sitecore.ts +0 -0
  219. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/Styleguide-Layout.sitecore.ts +0 -0
  220. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/Styleguide-Multilingual.sitecore.ts +0 -0
  221. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/Styleguide-Section.sitecore.ts +0 -0
  222. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/content-block.sitecore.ts +0 -0
  223. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/graph-ql-connected-demo.sitecore.ts +0 -0
  224. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/graph-ql-integrated-demo.sitecore.graphql +0 -0
  225. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/graph-ql-integrated-demo.sitecore.ts +0 -0
  226. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/graph-ql-layout.sitecore.ts +0 -0
  227. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-angular-lazy-loading.sitecore.ts +0 -0
  228. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-component-params.sitecore.ts +0 -0
  229. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-custom-route-type.sitecore.ts +0 -0
  230. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-edit-frame.sitecore.ts +0 -0
  231. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-checkbox.sitecore.ts +0 -0
  232. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-content-list.sitecore.ts +0 -0
  233. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-custom.sitecore.ts +0 -0
  234. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-date.sitecore.ts +0 -0
  235. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-file.sitecore.ts +0 -0
  236. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-image.sitecore.ts +0 -0
  237. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-item-link.sitecore.ts +0 -0
  238. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-link.sitecore.ts +0 -0
  239. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-number.sitecore.ts +0 -0
  240. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-rich-text.sitecore.ts +0 -0
  241. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-text.sitecore.ts +0 -0
  242. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-route-fields.sitecore.ts +0 -0
  243. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-sitecore-context.sitecore.ts +0 -0
  244. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-tracking.sitecore.ts +0 -0
  245. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/config.js +0 -0
  246. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/content.sitecore.ts +0 -0
  247. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/dictionary.sitecore.ts +0 -0
  248. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/placeholders.sitecore.ts +0 -0
  249. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/routes.sitecore.ts +0 -0
  250. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/templates/Styleguide-Explanatory-Component.sitecore.ts +0 -0
  251. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/templates/styleguide-content-list-template.sitecore.ts +0 -0
  252. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/templates/styleguide-edit-frame-list-item-template.sitecore.ts +0 -0
  253. /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/templates/styleguide-item-link-template.sitecore.ts +0 -0
  254. /package/dist/templates/{angular-sxp → angular}/sitecore/gitignore +0 -0
  255. /package/dist/templates/{angular-sxp → angular}/sitecore/pipelines/example.patch.ts +0 -0
  256. /package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.graphql +0 -0
  257. /package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.html +0 -0
  258. /package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.ts +0 -0
  259. /package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.html +0 -0
  260. /package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.ts +0 -0
  261. /package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-layout/graph-ql-layout.component.html +0 -0
  262. /package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-layout/graph-ql-layout.component.ts +0 -0
  263. /package/dist/templates/{angular-sxp → angular}/src/app/components/shared/styleguide-specimen/styleguide-specimen.component.ts +0 -0
  264. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.html +0 -0
  265. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.ts +0 -0
  266. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.module.ts +0 -0
  267. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-component-params/styleguide-component-params.component.html +0 -0
  268. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-component-params/styleguide-component-params.component.ts +0 -0
  269. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.html +0 -0
  270. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.ts +0 -0
  271. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.html +0 -0
  272. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.ts +0 -0
  273. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.html +0 -0
  274. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.ts +0 -0
  275. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.html +0 -0
  276. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.ts +0 -0
  277. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.html +0 -0
  278. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.ts +0 -0
  279. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.html +0 -0
  280. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.ts +0 -0
  281. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.html +0 -0
  282. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.ts +0 -0
  283. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.html +0 -0
  284. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.ts +0 -0
  285. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.html +0 -0
  286. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.ts +0 -0
  287. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.html +0 -0
  288. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.ts +0 -0
  289. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.html +0 -0
  290. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.ts +0 -0
  291. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.html +0 -0
  292. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.ts +0 -0
  293. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.html +0 -0
  294. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.ts +0 -0
  295. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout/styleguide-layout.component.html +0 -0
  296. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout/styleguide-layout.component.ts +0 -0
  297. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.html +0 -0
  298. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.ts +0 -0
  299. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.html +0 -0
  300. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.ts +0 -0
  301. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.html +0 -0
  302. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.ts +0 -0
  303. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-multilingual/styleguide-multilingual.component.html +0 -0
  304. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-multilingual/styleguide-multilingual.component.ts +0 -0
  305. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-route-fields/styleguide-route-fields.component.html +0 -0
  306. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-route-fields/styleguide-route-fields.component.ts +0 -0
  307. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-section/styleguide-section.component.html +0 -0
  308. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-section/styleguide-section.component.ts +0 -0
  309. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.html +0 -0
  310. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.ts +0 -0
  311. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-tracking/styleguide-tracking.component.html +0 -0
  312. /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-tracking/styleguide-tracking.component.ts +0 -0
  313. /package/dist/templates/angular/src/app/lib/{graphql-client-factory.ts → client-factory.ts} +0 -0
@@ -52,7 +52,7 @@ class ReactInitializer {
52
52
  yield (0, common_1.transform)(templatePath, mergedArgs);
53
53
  const isDev = (0, common_1.isDevEnvironment)(args.destination);
54
54
  const pkgPath = path_1.default.resolve(`${args.destination}${path_1.sep}package.json`);
55
- const pkg = (0, common_1.openJsonFile)(pkgPath);
55
+ const pkg = (0, common_1.openPackageJson)(pkgPath);
56
56
  if (isDev) {
57
57
  Object.entries(pkg.scripts).forEach(([key, value]) => {
58
58
  // Can't rewire `eject` script
@@ -61,14 +61,14 @@ class ReactInitializer {
61
61
  // It's required to start each command using `react-app-rewired`, to solve duplicate `react` issue
62
62
  pkg.scripts[key] = value.replace('react-scripts', 'react-app-rewired');
63
63
  });
64
- (0, common_1.writeJsonFile)(pkg, pkgPath);
64
+ (0, common_1.writePackageJson)(pkg, pkgPath);
65
65
  }
66
66
  else {
67
67
  // Don't need to rewire anything if we are not in the dev env
68
68
  delete pkg.devDependencies['react-app-rewired'];
69
69
  // Remove webpack overrides
70
70
  (0, common_1.removeFile)(path_1.default.resolve(`${args.destination}${path_1.sep}config-overrides.js`));
71
- (0, common_1.writeJsonFile)(pkg, pkgPath);
71
+ (0, common_1.writePackageJson)(pkg, pkgPath);
72
72
  }
73
73
  const response = {
74
74
  nextSteps: [`* Connect to Sitecore with ${chalk_1.default.green('jss setup')} (optional)`],
@@ -2,4 +2,4 @@
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.sxpPrompts, ...common_1.styleguidePrompts];
5
+ exports.prompts = [...common_1.clientAppPrompts, ...common_1.styleguidePrompts];
@@ -4,6 +4,5 @@ exports.prompts = void 0;
4
4
  const common_1 = require("../../common");
5
5
  exports.prompts = [
6
6
  ...common_1.clientAppPrompts.filter((p) => p.name !== 'fetchWith'),
7
- ...common_1.sxpPrompts,
8
7
  ...common_1.styleguidePrompts,
9
8
  ];
@@ -2,4 +2,4 @@
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.sxpPrompts, ...common_1.styleguidePrompts];
5
+ exports.prompts = [...common_1.clientAppPrompts, ...common_1.styleguidePrompts];
@@ -21,14 +21,12 @@ GRAPH_QL_ENDPOINT=
21
21
  # Uses your `package.json` config `appName` if empty.
22
22
  SITECORE_SITE_NAME=
23
23
 
24
- <% if (!locals.xmcloud) { -%>
25
- # The way in which layout and dictionary data is fetched from Sitecore
26
- FETCH_WITH=<%- fetchWith %>
27
- <% } -%>
28
-
29
24
  # Your default app language.
30
25
  DEFAULT_LANGUAGE=
31
26
 
27
+ # The way in which layout and dictionary data is fetched from Sitecore
28
+ FETCH_WITH=<%- fetchWith %>
29
+
32
30
  # Sitecore JSS npm packages utilize the debug module for debug logging.
33
31
  # https://www.npmjs.com/package/debug
34
32
  # Set the DEBUG environment variable to 'sitecore-jss:*' to see all logs:
@@ -3,11 +3,51 @@
3
3
  <!---
4
4
  @TODO: Update to next version docs before release
5
5
  -->
6
-
7
6
  [Documentation (Experience Platform)](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/sitecore-javascript-rendering-sdk--jss--for-angular.html)
8
7
 
9
- <!---
10
- @TODO: Verify the link for angular xmcloud when documentation is ready
11
- -->
12
8
 
13
- [Documentation (XM Cloud)](https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-javascript-rendering-sdk--jss--for-angular.html)
9
+ ## App setup
10
+
11
+ 1. `npm install`
12
+ 1. `npm install -g @sitecore-jss/sitecore-jss-cli`
13
+ 1. `jss setup`
14
+
15
+ > This setup is optional to get started with development, as it assumes you have Sitecore installed.
16
+ >
17
+ > If you answer "yes", you would need to provide the path to your Sitecore installation's "Website" folder.
18
+
19
+ ## Development server
20
+
21
+ Run `jss start`.
22
+
23
+ The app will be built and webpack server will be started. So it's expected that the browser will open with `http://localhost:3000` and familiar default welcome content is rendered.
24
+
25
+ The app will automatically reload if you change any of the source files.
26
+
27
+ When running the development server, it automatically sets up a sitecore mock server configures a proxy that forwards all requests to `/sitecore` to that sitecore mock server. Check `proxy.conf.js` to see mock server and proxy implementation.
28
+
29
+ ### Congratulations!
30
+
31
+ The app is now running in dev mode sourcing data from local files and is not connected to Sitecore in any way.
32
+
33
+ ## App deployment
34
+
35
+ ### Pre-requisites
36
+
37
+ 1. Sitecore instance has JSS packages installed.
38
+ 1. Sitecore is configured for this JSS app.
39
+
40
+ ### Steps
41
+
42
+ Run `jss deploy package`.
43
+
44
+ This step will:
45
+
46
+ * Run the production bundle of your app.
47
+ * Generate the app manifest.
48
+ * Generate a package with the manifest and production bundle.
49
+ * Install the package over HTTP on your Sitecore instance.
50
+
51
+ ## Further help
52
+
53
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
@@ -49,7 +49,12 @@
49
49
  ],
50
50
  "baseHref": "/",
51
51
  "aot": true,
52
- "optimization": true,
52
+ "//": [
53
+ "You might want to adjust the optimization entry to workaround a bug with bootstrap warnings caused by Angular",
54
+ "The warnings may occur during build and when running connected mode. Check below for possible fixes.",
55
+ "https://github.com/ng-bootstrap/ng-bootstrap/issues/4306"
56
+ ],
57
+ "optimization": "true",
53
58
  "outputHashing": "all",
54
59
  "sourceMap": false,
55
60
  "namedChunks": false,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "<%- appName %>",
3
- "version": "22.2.0-canary",
3
+ "version": "22.2.1-canary",
4
4
  "description": "Application utilizing Sitecore JavaScript Services and Angular (angular-cli).",
5
5
  "config": {
6
6
  "appName": "<%- appName %>",
@@ -15,15 +15,18 @@
15
15
  },
16
16
  "scripts": {
17
17
  "ng": "ng",
18
- "lint": "ng lint <%- appName %> --fix",
18
+ "lint:yml": "ts-node ./scripts/lint-yml.ts",
19
+ "lint": "ng lint <%- appName %> --fix && npm run lint:yml",
19
20
  "e2e": "ng e2e",
20
21
  "jss": "jss",
22
+ "start": "cross-env-shell JSS_MODE=disconnected \"npm-run-all --serial bootstrap --parallel start:angular start:proxy start:watch-components\"",
21
23
  "start:connected": "npm-run-all --serial bootstrap start:angular start:watch-components",
22
- "build": "npm-run-all --serial bootstrap build:client build:server",
23
- "scaffold": "ng generate @sitecore-jss/sitecore-jss-angular-schematics:jss-component --no-manifest",
24
+ "build": "npm-run-all --serial bootstrap --serial build:client build:server",
25
+ "scaffold": "ng generate @sitecore-jss/sitecore-jss-angular-schematics:jss-component",
24
26
  "start:angular": "ng serve -o",
27
+ "start:proxy": "ts-node --project src/tsconfig.webpack-server.json scripts/disconnected-mode-proxy.ts",
25
28
  "start:watch-components": "ts-node --project src/tsconfig.webpack-server.json scripts/generate-component-factory.ts --watch",
26
- "build:client": "cross-env-shell ng build --configuration=production --base-href $npm_package_config_sitecoreDistPath/browser/ --output-path=$npm_package_config_buildArtifactsPath/browser/",
29
+ "build:client": "cross-env-shell ng build --base-href $npm_package_config_sitecoreDistPath/browser/ --output-path=$npm_package_config_buildArtifactsPath/browser/",
27
30
  "build:server": "cross-env-shell ng run <%- appName %>:server:production --output-path=$npm_package_config_buildArtifactsPath",
28
31
  "postbuild:server": "move-cli ./dist/main.js ./dist/server.bundle.js",
29
32
  "bootstrap": "ts-node --project src/tsconfig.webpack-server.json scripts/bootstrap.ts",
@@ -57,12 +60,13 @@
57
60
  "@apollo/client": "^3.3.12",
58
61
  "@ngx-translate/core": "~15.0.0",
59
62
  "@ngx-translate/http-loader": "~8.0.0",
60
- "@sitecore-jss/sitecore-jss-angular": "~22.2.0-canary",
63
+ "@sitecore-jss/sitecore-jss-angular": "~22.2.1-canary",
61
64
  "apollo-angular": "~6.0.0",
62
65
  "bootstrap": "^5.3.3",
63
66
  "core-js": "~3.37.1",
64
67
  "graphql": "15.5.0",
65
68
  "graphql-tag": "~2.11.0",
69
+ "lodash": "^4.17.21",
66
70
  "rxjs": "~7.8.1",
67
71
  "tslib": "^2.6.3",
68
72
  "zone.js": "~0.14.7"
@@ -78,27 +82,32 @@
78
82
  "@angular/cli": "~17.3.8",
79
83
  "@angular/compiler-cli": "~17.3.11",
80
84
  "@angular/language-service": "~17.3.11",
81
- "@sitecore-jss/sitecore-jss-angular-schematics": "~22.2.0-canary",
82
- "@sitecore-jss/sitecore-jss-cli": "~22.2.0-canary",
83
- "@sitecore-jss/sitecore-jss-dev-tools": "~22.2.0-canary",
85
+ "@sitecore-jss/sitecore-jss-angular-schematics": "~22.2.1-canary",
86
+ "@sitecore-jss/sitecore-jss-cli": "~22.2.1-canary",
87
+ "@sitecore-jss/sitecore-jss-dev-tools": "~22.2.1-canary",
84
88
  "@types/isomorphic-fetch": "0.0.35",
85
89
  "@types/jasmine": "~3.6.7",
86
90
  "@types/jasminewd2": "~2.0.8",
87
91
  "@types/node": "~20.14.10",
88
92
  "@typescript-eslint/eslint-plugin": "^7.16.0",
89
93
  "@typescript-eslint/parser": "^7.16.0",
94
+ "body-parser": "~1.20.2",
90
95
  "chalk": "~4.1.0",
91
96
  "chokidar": "^3.5.2",
92
97
  "codelyzer": "~6.0.1",
93
98
  "constant-case": "^3.0.4",
99
+ "cookie-parser": "~1.4.5",
94
100
  "cross-env": "~7.0.3",
95
101
  "del-cli": "^5.0.0",
96
102
  "dotenv": "^16.0.0",
97
103
  "dotenv-webpack": "^7.1.0",
104
+ "enhanced-resolve": "5.7.0",
98
105
  "eslint": "^8.56.0",
99
106
  "eslint-plugin-import": "2.29.1",
100
107
  "eslint-plugin-jsdoc": "48.7.0",
101
108
  "eslint-plugin-prefer-arrow": "1.2.3",
109
+ "express": "~4.17.1",
110
+ "fs-extra": "~9.1.0",
102
111
  "isomorphic-fetch": "^3.0.0",
103
112
  "jasmine-core": "~3.7.1",
104
113
  "jasmine-spec-reporter": "~6.0.0",
@@ -112,6 +121,7 @@
112
121
  "npm-run-all": "~4.1.5",
113
122
  "protractor": "^7.0.0",
114
123
  "ts-node": "~10.9.2",
115
- "typescript": "~5.2.2"
124
+ "typescript": "~5.2.2",
125
+ "yaml-lint": "^1.2.4"
116
126
  }
117
127
  }
@@ -1,10 +1,28 @@
1
1
  /*
2
- When the app runs in connected mode, some of the requests should be
2
+ When the app runs in disconnected mode, and Sitecore is not present, we need to give
3
+ the app copies of the Sitecore APIs it depends on (layout service, dictionary service, content service)
4
+ to talk to so that the app can run using the locally defined disconnected data.
5
+
6
+ When the app runs in connected mode, Sitecore is present and some of the requests should be
3
7
  proxied to the Sitecore API
8
+
9
+ This is accomplished by spinning up a small Express server that mocks the APIs, and then
10
+ telling angular-cli to proxy requests to the API paths to this express instance.
11
+
12
+ See /scripts/disconnected-mode-proxy.ts for the proxy API server configuration.
4
13
  */
14
+ const constants = require('@sitecore-jss/sitecore-jss-angular/cjs').constants;
5
15
  const environment = require('./src/environments/environment.js').environment;
6
16
 
7
- const PROXY_CONFIG = [
17
+ const port = 3043;
18
+
19
+ const PROXY_CONFIG = process.env.JSS_MODE === constants.JSS_MODE.DISCONNECTED ? [
20
+ {
21
+ context: ['/data', '/sitecore'],
22
+ target: `http://localhost:${port}`,
23
+ secure: false,
24
+ },
25
+ ] : [
8
26
  {
9
27
  context: [
10
28
  // API endpoints
@@ -12,12 +30,12 @@ const PROXY_CONFIG = [
12
30
  // media items
13
31
  '/-',
14
32
  // visitor identification
15
- '/layouts',
33
+ '/layouts'
16
34
  ],
17
35
  target: environment.sitecoreApiHost,
18
36
  secure: false,
19
- changeOrigin: true,
20
- },
37
+ changeOrigin: true
38
+ }
21
39
  ];
22
40
 
23
41
  module.exports = PROXY_CONFIG;
@@ -1,4 +1,8 @@
1
1
  import 'dotenv/config';
2
+ import { constants } from '@sitecore-jss/sitecore-jss-angular/cjs';
3
+ import { generateConfig } from './generate-config';
4
+ const projects = require('../angular.json').projects;
5
+ const chalk = require('chalk');
2
6
 
3
7
  /*
4
8
  BOOTSTRAPPING
@@ -7,15 +11,30 @@ import 'dotenv/config';
7
11
  and the global config module.
8
12
  */
9
13
 
10
- /*
11
- PLUGINS GENERATION
12
- */
13
- require('./generate-plugins');
14
+ const disconnected = process.env.JSS_MODE === constants.JSS_MODE.DISCONNECTED;
15
+
16
+ if (disconnected && process.env.FETCH_WITH === constants.FETCH_WITH.GRAPHQL) {
17
+ throw new Error(chalk.red("GraphQL requests to Dictionary and Layout services are not supported in disconnected mode."))
18
+ }
14
19
 
15
20
  /*
16
21
  CONFIG GENERATION
22
+ Generates the /src/environments/environment.js file which contains runtime configuration
23
+ that the app can import and use.
24
+
25
+ This is generated rather than using Angular environments because of the need to set config params
26
+ based on build arguments, which env files don't directly allow.
17
27
  */
18
- require('./generate-config');
28
+ function writeConfig(configOverride: { production: boolean, sitecoreApiHost?: string }, outputPath?: string) {
29
+ if (disconnected) {
30
+ configOverride.sitecoreApiHost = `http://localhost:${projects['<%- appName %>'].architect.serve.options.port}`;
31
+ }
32
+
33
+ generateConfig(configOverride, outputPath);
34
+ }
35
+
36
+ writeConfig({ production: false });
37
+ writeConfig({ production: true }, 'src/environments/environment.prod.js');
19
38
 
20
39
  /*
21
40
  COMPONENT FACTORY GENERATION
@@ -1,8 +1,7 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  import { constantCase } from 'constant-case';
4
- import { jssConfigFactory } from './config';
5
- import { JssConfig } from 'lib/config';
4
+ const packageConfig = require('../package.json');
6
5
 
7
6
  /**
8
7
  * Generate config
@@ -11,70 +10,91 @@ import { JssConfig } from 'lib/config';
11
10
  * settings as variables into the JSS app.
12
11
  * NOTE! Any configs returned here will be written into the client-side JS bundle. DO NOT PUT SECRETS HERE.
13
12
  */
13
+ export function generateConfig(configOverrides?: { [key: string]: unknown }, outputPath?: string) {
14
+ const defaultConfig = {
15
+ production: false,
16
+ sitecoreApiHost: '',
17
+ sitecoreApiKey: 'no-api-key-set',
18
+ sitecoreSiteName: process.env.SITECORE_SITE_NAME,
19
+ sitecoreLayoutServiceConfig: 'jss',
20
+ defaultLanguage: 'en',
21
+ defaultServerRoute: '/',
22
+ layoutServiceConfigurationName: 'default',
23
+ };
14
24
 
15
- const defaultConfigValue: JssConfig = {
16
- production: false,
17
- sitecoreApiKey: process.env[`${constantCase('sitecoreApiKey')}`],
18
- sitecoreApiHost: process.env[`${constantCase('sitecoreApiHost')}`],
19
- sitecoreSiteName: process.env[`${constantCase('sitecoreSiteName')}`],
20
- defaultLanguage: process.env[`${constantCase('defaultLanguage')}`],
21
- graphQLEndpoint: process.env[`${constantCase('graphQLEndpoint')}`],
22
- graphQLEndpointPath: process.env[`${constantCase('graphQLEndpointPath')}`],
23
- defaultServerRoute: '/',
24
- };
25
-
26
- generateConfig('src/environments/environment.js', defaultConfigValue, { production: false });
27
- generateConfig('src/environments/environment.prod.js', defaultConfigValue, { production: true });
28
-
29
- /**
30
- * Generates the JSS config based on config plugins (under ./config/plugins)
31
- * and then writes the config to disk.
32
- * @param {string} outputPath the output path of the generated config.
33
- * @param {JssConfig} [defaultConfig] Default configuration.
34
- * @param {[key: string]:unknown} [configOverrides] configuration values that override the generated ones.
35
- */
36
- export function generateConfig(
37
- outputPath: string,
38
- defaultConfig: JssConfig = defaultConfigValue,
39
- configOverrides?: { [key: string]: unknown }
40
- ) {
41
- jssConfigFactory
42
- .create(defaultConfig)
43
- .then((config) => {
44
- writeConfig(Object.assign(config, configOverrides), outputPath);
45
- })
46
- .catch((e) => {
47
- console.error('Error generating config');
48
- console.error(e);
49
- process.exit(1);
50
- });
51
- }
52
-
53
- /**
54
- * Writes the config object to disk with support for environment variables.
55
- * @param {JssConfig} config JSS configuration to write.
56
- * @param {string} outputPath the outputh path of the generated config.
57
- */
58
- export function writeConfig(config: JssConfig, outputPath?: string) {
59
25
  if (!outputPath) {
60
26
  outputPath = 'src/environments/environment.js';
61
27
  }
62
28
 
29
+ // require + combine config sources
30
+ const scjssConfig = transformScJssConfig();
31
+ const packageJson = transformPackageConfig();
32
+
33
+ // optional:
34
+ // do any other dynamic config source (e.g. environment-specific config files)
35
+ // Object.assign merges the objects in order, so the
36
+ // package.json config can override the calculated config,
37
+ // scjssconfig.json overrides it,
38
+ // and finally config passed in the configOverrides param wins.
39
+ const config = Object.assign(defaultConfig, scjssConfig, packageJson, configOverrides);
40
+
41
+ // The GraphQL endpoint is an example of making a _computed_ config setting
42
+ // based on other config settings.
43
+ const computedConfig: { [key: string]: string } = {};
44
+ computedConfig.graphQLEndpoint = '`${config.sitecoreApiHost}${config.graphQLEndpointPath}`';
45
+
63
46
  let configText = `/* eslint-disable */
64
- // Do not edit this file, it is auto-generated at build time!
65
- // See scripts/bootstrap.ts to modify the generation of this file.
66
- const config = {};\n`;
47
+ // Do not edit this file, it is auto-generated at build time!
48
+ // See scripts/bootstrap.ts to modify the generation of this file.
49
+ const config = {};\n`;
67
50
 
68
51
  // Set base configuration values, allowing override with environment variables
69
52
  Object.keys(config).forEach((prop) => {
70
- configText += `config.${prop} = process.env.${constantCase(prop)} || "${config[prop]
71
- ?.toString()
72
- .trim()}";\n`;
53
+ configText += `config.${prop} = process.env.${constantCase(prop)} || "${config[prop]?.toString().trim()}";\n`;
54
+ });
55
+ // Set computed values, allowing override with environment variables
56
+ Object.keys(computedConfig).forEach((prop) => {
57
+ configText += `config.${prop} = process.env.${constantCase(prop)} || ${
58
+ computedConfig[prop]?.toString().trim()
59
+ };\n`;
73
60
  });
74
-
75
61
  configText += `module.exports.environment = config;`;
76
62
 
77
63
  const configPath = path.resolve(outputPath);
78
64
  console.log(`Writing runtime config to ${configPath}`);
79
65
  fs.writeFileSync(configPath, configText, { encoding: 'utf8' });
80
66
  }
67
+
68
+ function transformScJssConfig() {
69
+ // scjssconfig.json may not exist if you've never run setup
70
+ // so if it doesn't we substitute a fake object
71
+ let config;
72
+ try {
73
+ config = require('../scjssconfig.json');
74
+ } catch (e) {
75
+ return {};
76
+ }
77
+
78
+ if (!config) {
79
+ return {};
80
+ }
81
+
82
+ return {
83
+ sitecoreApiKey: config.sitecore.apiKey,
84
+ sitecoreApiHost: config.sitecore.layoutServiceHost,
85
+ };
86
+ }
87
+
88
+ function transformPackageConfig() {
89
+ const packageAny = packageConfig;
90
+
91
+ if (!packageAny.config) {
92
+ return {};
93
+ }
94
+
95
+ return {
96
+ sitecoreSiteName: packageAny.config.appName,
97
+ defaultLanguage: packageAny.config.language || 'en',
98
+ graphQLEndpointPath: packageAny.config.graphQLEndpointPath || null,
99
+ };
100
+ }
@@ -9,7 +9,7 @@ import { generateConfig } from './generate-config';
9
9
  //
10
10
  // The `jss graphql:update` command should be executed when Sitecore templates related to the site are altered.
11
11
 
12
- generateConfig('src/environments/environment.js');
12
+ generateConfig();
13
13
 
14
14
  let jssConfig;
15
15
 
@@ -47,9 +47,7 @@ fetch(jssConfig.graphQLEndpoint, {
47
47
  .then((result) => result.json())
48
48
  .then((result) => {
49
49
  // here we're filtering out any type information unrelated to unions or interfaces
50
- const filteredData = result.data.__schema.types.filter(
51
- (type: { possibleTypes: Array<string> }) => type.possibleTypes !== null
52
- );
50
+ const filteredData = result.data.__schema.types.filter((type: { possibleTypes: Array<string>; }) => type.possibleTypes !== null);
53
51
 
54
52
  const filteredResult = { ...result };
55
53
  filteredResult.data.__schema.types = filteredData;
@@ -6,9 +6,6 @@ import 'zone.js';
6
6
  import { JssRouteBuilderService } from './src/app/routing/jss-route-builder.service';
7
7
  import { environment } from './src/environments/environment';
8
8
  import { AppServerModule, renderModule } from './src/main.server';
9
- import { clientFactory } from './src/app/lib/graphql-client-factory';
10
- import { dictionaryServiceFactory } from './src/app/lib/dictionary-service-factory';
11
- import { layoutServiceFactory } from './src/app/lib/layout-service-factory';
12
9
 
13
10
  export * from './src/main.server';
14
11
 
@@ -102,20 +99,5 @@ function parseRouteUrl(url: string) {
102
99
 
103
100
  const apiKey = environment.sitecoreApiKey;
104
101
  const siteName = environment.sitecoreSiteName;
105
- const defaultLanguage = environment.defaultLanguage;
106
- const graphQLEndpointPath = environment.graphQLEndpointPath;
107
- const graphQLEndpoint = environment.graphQLEndpoint;
108
102
 
109
- export {
110
- renderView,
111
- parseRouteUrl,
112
- setUpDefaultAgents,
113
- apiKey,
114
- siteName,
115
- clientFactory,
116
- dictionaryServiceFactory,
117
- layoutServiceFactory,
118
- defaultLanguage,
119
- graphQLEndpointPath,
120
- graphQLEndpoint,
121
- };
103
+ export { renderView, parseRouteUrl, setUpDefaultAgents, apiKey, siteName };
@@ -10,6 +10,7 @@ import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
10
10
  import { JssTranslationClientLoaderService } from './i18n/jss-translation-client-loader.service';
11
11
  import { JssTranslationLoaderService } from './i18n/jss-translation-loader.service';
12
12
  import { GraphQLModule } from './jss-graphql.module';
13
+ import { JssDataFetcherService } from './jss-data-fetcher.service';
13
14
  import { JssMetaService } from './jss-meta.service';
14
15
 
15
16
  @NgModule({
@@ -30,6 +31,7 @@ import { JssMetaService } from './jss-meta.service';
30
31
  // The token is needed in cases when multiple applications are bootstrapped on a page
31
32
  { provide: APP_ID, useValue: 'my-app' },
32
33
  JssContextService,
34
+ JssDataFetcherService,
33
35
  JssLayoutService,
34
36
  JssMetaService,
35
37
  // IMPORTANT: you must set the base href with this token, not a <base> tag in the HTML.
@@ -3,6 +3,7 @@ import { CommonModule } from '@angular/common';
3
3
  import { FormsModule } from '@angular/forms';
4
4
  import { TranslateModule } from '@ngx-translate/core';
5
5
  import { RouterModule } from '@angular/router';
6
+ import { StyleguideSpecimenComponent } from './shared/styleguide-specimen/styleguide-specimen.component';
6
7
  import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
7
8
 
8
9
  /*
@@ -13,8 +14,22 @@ import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
13
14
  Don't want code generation? See ./.gitignore for instructions to turn it off.
14
15
  */
15
16
  @NgModule({
16
- imports: [CommonModule, TranslateModule, RouterModule, JssModule, FormsModule],
17
- exports: [CommonModule, TranslateModule, RouterModule, FormsModule],
18
- declarations: [],
17
+ imports: [
18
+ CommonModule,
19
+ TranslateModule,
20
+ RouterModule,
21
+ JssModule,
22
+ FormsModule,
23
+ ],
24
+ exports: [
25
+ CommonModule,
26
+ TranslateModule,
27
+ RouterModule,
28
+ FormsModule,
29
+ StyleguideSpecimenComponent
30
+ ],
31
+ declarations: [
32
+ StyleguideSpecimenComponent
33
+ ],
19
34
  })
20
- export class AppComponentsSharedModule {}
35
+ export class AppComponentsSharedModule { }
@@ -2,6 +2,7 @@ import { Injectable, Inject, TransferState } from '@angular/core';
2
2
  import { JssContextService, jssKey } from './jss-context.service';
3
3
  import { JssState } from './JssState';
4
4
  import { Observable, of as observableOf } from 'rxjs';
5
+ import { JssDataFetcherService } from './jss-data-fetcher.service';
5
6
  import { JssLayoutService } from './layout/jss-layout.service';
6
7
 
7
8
  /**
@@ -14,6 +15,7 @@ export class JssContextServerSideService extends JssContextService {
14
15
  constructor(
15
16
  protected transferState: TransferState,
16
17
  protected layoutService: JssLayoutService,
18
+ protected dataFetcher: JssDataFetcherService,
17
19
  // this initial state from sitecore is injected by server.bundle for "integrated" mode
18
20
  @Inject('JSS_SERVER_LAYOUT_DATA') private serverToSsrState: JssState
19
21
  ) {
@@ -3,9 +3,7 @@ import { HttpClient, HttpErrorResponse } from '@angular/common/http';
3
3
  import { HttpResponse } from '@sitecore-jss/sitecore-jss-angular';
4
4
  import { Observable, lastValueFrom } from 'rxjs';
5
5
 
6
- @Injectable({
7
- providedIn: 'root'
8
- })
6
+ @Injectable()
9
7
  export class JssDataFetcherService {
10
8
  constructor(
11
9
  private readonly httpClient: HttpClient,
@@ -1,38 +1,30 @@
1
1
  import {
2
2
  DictionaryService,
3
3
  GraphQLDictionaryService,
4
- <% if (!locals.xmcloud) { -%>
5
4
  RestDictionaryService,
6
5
  constants,
7
- <% } -%>
8
6
  } from '@sitecore-jss/sitecore-jss-angular';
9
7
  import { environment as env } from '../../environments/environment';
10
- import { clientFactory } from './graphql-client-factory';
8
+ import { clientFactory } from './client-factory';
11
9
 
12
10
  export class DictionaryServiceFactory {
13
11
  create(): DictionaryService {
14
- const service =
15
- <% if (!locals.xmcloud) { -%>
16
- process.env.FETCH_WITH === constants.FETCH_WITH.REST
17
- ? new RestDictionaryService({
18
- apiHost: env.sitecoreApiHost,
19
- apiKey: env.sitecoreApiKey,
20
- siteName: env.sitecoreSiteName,
21
- })
22
- :
23
- <% } -%>
24
- new GraphQLDictionaryService({
12
+ return process.env.FETCH_WITH === constants.FETCH_WITH.GRAPHQL
13
+ ? new GraphQLDictionaryService({
25
14
  clientFactory,
26
15
  siteName: env.sitecoreSiteName,
27
16
  /*
28
- The Dictionary Service needs a root item ID in order to fetch dictionary phrases for the current
29
- app. If your Sitecore instance only has 1 JSS App, you can specify the root item ID here;
30
- otherwise, the service will attempt to figure out the root item for the current JSS App using GraphQL and app name.
31
- rootItemId: '{GUID}'
32
- */
17
+ The Dictionary Service needs a root item ID in order to fetch dictionary phrases for the current
18
+ app. If your Sitecore instance only has 1 JSS App, you can specify the root item ID here;
19
+ otherwise, the service will attempt to figure out the root item for the current JSS App using GraphQL and app name.
20
+ rootItemId: '{GUID}'
21
+ */
22
+ })
23
+ : new RestDictionaryService({
24
+ apiHost: env.sitecoreApiHost,
25
+ apiKey: env.sitecoreApiKey,
26
+ siteName: env.sitecoreSiteName,
33
27
  });
34
-
35
- return service;
36
28
  }
37
29
  }
38
30