create-sitecore-jss 22.2.0-canary.83 → 22.3.0-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.
- package/dist/bin.js +35 -19
- package/dist/common/index.js +5 -3
- package/dist/common/processes/install.js +9 -2
- package/dist/common/processes/next.js +6 -3
- package/dist/common/processes/transform.js +18 -13
- package/dist/common/prompts/base.js +0 -25
- package/dist/common/prompts/proxy.js +35 -0
- package/dist/common/prompts/sxp.js +34 -0
- package/dist/common/utils/helpers.js +29 -19
- package/dist/init-runner.js +16 -11
- package/dist/initializers/angular/index.js +13 -0
- package/dist/initializers/angular/prompts.js +22 -1
- package/dist/initializers/angular-sxp/index.js +62 -0
- package/dist/initializers/angular-xmcloud/index.js +80 -0
- package/dist/initializers/nextjs/index.js +2 -2
- package/dist/initializers/nextjs/prompts.js +2 -0
- package/dist/initializers/nextjs/remove-dev-dependencies.js +2 -2
- package/dist/initializers/nextjs-multisite/index.js +1 -1
- package/dist/initializers/nextjs-styleguide/index.js +1 -1
- package/dist/initializers/nextjs-styleguide-tracking/index.js +1 -1
- package/dist/initializers/nextjs-sxa/index.js +1 -1
- package/dist/initializers/nextjs-xmcloud/index.js +1 -1
- package/dist/initializers/node-xmcloud-proxy/index.js +33 -0
- package/dist/initializers/react/index.js +3 -3
- package/dist/initializers/react/prompts.js +1 -1
- package/dist/initializers/react-native/prompts.js +1 -0
- package/dist/initializers/vue/prompts.js +1 -1
- package/dist/templates/angular/.env +4 -3
- package/dist/templates/angular/.eslintrc +1 -0
- package/dist/templates/angular/README.md +5 -45
- package/dist/templates/angular/angular.json +1 -6
- package/dist/templates/angular/gitignore +5 -0
- package/dist/templates/angular/package.json +11 -23
- package/dist/templates/angular/proxy.conf.js +5 -23
- package/dist/templates/angular/scripts/bootstrap.ts +5 -24
- package/dist/templates/angular/scripts/config/index.ts +28 -0
- package/dist/templates/angular/scripts/config/plugins/computed.ts +21 -0
- package/dist/templates/angular/scripts/config/plugins/fallback.ts +22 -0
- package/dist/templates/angular/scripts/config/plugins/package-json.ts +22 -0
- package/dist/templates/angular/scripts/config/plugins/scjssconfig.ts +29 -0
- package/dist/templates/angular/scripts/generate-component-factory/index.ts +45 -0
- package/dist/templates/angular/scripts/generate-component-factory/plugins/component-factory.ts +147 -0
- package/dist/templates/angular/scripts/generate-component-factory/plugins/components.ts +19 -0
- package/dist/templates/angular/scripts/generate-component-factory/plugins/packages.ts +29 -0
- package/dist/templates/angular/scripts/generate-component-factory/template.ts +46 -0
- package/dist/templates/angular/scripts/generate-config.ts +71 -72
- package/dist/templates/angular/scripts/generate-plugins.ts +33 -0
- package/dist/templates/angular/scripts/temp/gitignore +2 -0
- package/dist/templates/angular/scripts/update-graphql-fragment-data.ts +21 -28
- package/dist/templates/angular/server.bundle.ts +3 -5
- package/dist/templates/angular/server.exports.ts +13 -0
- package/dist/templates/angular/src/app/JssState.ts +2 -9
- package/dist/templates/angular/src/app/app.module.ts +5 -6
- package/dist/templates/angular/src/app/app.server.module.ts +9 -6
- package/dist/templates/angular/src/app/components/app-components.shared.module.ts +4 -19
- package/dist/templates/angular/src/app/components/gitignore +1 -1
- package/dist/templates/angular/src/app/i18n/jss-translation-client-loader.service.ts +15 -7
- package/dist/templates/angular/src/app/i18n/jss-translation-server-loader.service.ts +14 -2
- package/dist/templates/angular/src/app/jss-context.server-side.service.ts +4 -4
- package/dist/templates/angular/src/app/jss-context.service.ts +14 -11
- package/dist/templates/angular/src/app/jss-graphql.service.ts +7 -7
- package/dist/templates/angular/src/app/layout/jss-layout.service.ts +2 -2
- package/dist/templates/angular/src/app/lib/config.ts +16 -0
- package/dist/templates/angular/src/app/lib/dictionary-service-factory.ts +24 -13
- package/dist/templates/angular/src/app/lib/graphql-client-factory/config.ts +21 -0
- package/dist/templates/angular/src/app/lib/graphql-client-factory/index.ts +16 -0
- package/dist/templates/angular/src/app/lib/layout-service-factory.ts +20 -12
- package/dist/templates/angular/src/app/routing/layout/layout.component.html +1 -1
- package/dist/templates/angular/src/app/routing/layout/layout.component.ts +11 -11
- package/dist/templates/angular/src/app/routing/navigation/navigation.component.html +5 -6
- package/dist/templates/angular/src/app/routing/navigation/navigation.component.ts +1 -2
- package/dist/templates/angular/src/app/routing/routing.module.ts +14 -21
- package/dist/templates/angular/src/app/routing/scripts/scripts.component.html +1 -0
- package/dist/templates/angular/src/app/routing/scripts/scripts.component.ts +7 -0
- package/dist/templates/angular/src/app/routing/scripts/scripts.module.ts +8 -0
- package/dist/templates/angular/src/environments/gitignore +2 -1
- package/dist/templates/angular/src/graphql-fragment-types.ts +0 -95
- package/dist/templates/angular/tsconfig.json +7 -2
- package/dist/templates/angular-sxp/.env +2 -0
- package/dist/templates/angular-sxp/package.json +12 -0
- package/dist/templates/angular-sxp/proxy.conf.js +43 -0
- package/dist/templates/angular-sxp/scripts/config/plugins/disconnected.ts +29 -0
- package/dist/templates/angular-sxp/src/app/components/app-components.shared.module.ts +35 -0
- package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-layout/graph-ql-layout.component.ts +1 -1
- package/dist/templates/{angular → angular-sxp}/src/app/jss-data-fetcher.service.ts +3 -1
- package/dist/templates/angular-sxp/src/app/routing/navigation/navigation.component.html +23 -0
- package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.component.html +3 -0
- package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.module.ts +9 -0
- package/dist/templates/{angular/src/app/routing → angular-sxp/src/app/routing/scripts}/visitor-identification/visitor-identification.component.ts +9 -3
- package/dist/templates/angular-sxp/src/graphql-fragment-types.ts +219 -0
- package/dist/templates/angular-xmcloud/.env +21 -0
- package/dist/templates/angular-xmcloud/angular.json +33 -0
- package/dist/templates/angular-xmcloud/package.json +17 -0
- package/dist/templates/angular-xmcloud/scripts/bootstrap.ts +28 -0
- package/dist/templates/angular-xmcloud/scripts/config/plugins/xmcloud.ts +39 -0
- package/dist/templates/angular-xmcloud/scripts/generate-component-factory/plugins/packages.ts +34 -0
- package/dist/templates/angular-xmcloud/scripts/generate-component-factory/template.ts +57 -0
- package/dist/templates/angular-xmcloud/scripts/generate-metadata.ts +25 -0
- package/dist/templates/angular-xmcloud/scripts/proxy-build.ts +15 -0
- package/dist/templates/angular-xmcloud/server.exports.ts +24 -0
- package/dist/templates/angular-xmcloud/src/app/components/app-components.shared.module.ts +21 -0
- package/dist/templates/angular-xmcloud/src/app/components/column-splitter/column-splitter.component.html +5 -0
- package/dist/templates/angular-xmcloud/src/app/components/column-splitter/column-splitter.component.ts +40 -0
- package/dist/templates/angular-xmcloud/src/app/components/container/container.component.html +14 -0
- package/dist/templates/angular-xmcloud/src/app/components/container/container.component.ts +30 -0
- package/dist/templates/angular-xmcloud/src/app/components/image/image.component.html +36 -0
- package/dist/templates/angular-xmcloud/src/app/components/image/image.component.ts +67 -0
- package/dist/templates/angular-xmcloud/src/app/components/link-list/link-list.component.html +15 -0
- package/dist/templates/angular-xmcloud/src/app/components/link-list/link-list.component.ts +41 -0
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation-item.component.html +23 -0
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation-item.component.ts +65 -0
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation.component.html +21 -0
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation.component.ts +49 -0
- package/dist/templates/angular-xmcloud/src/app/components/page-content/page-content.component.html +5 -0
- package/dist/templates/angular-xmcloud/src/app/components/page-content/page-content.component.ts +39 -0
- package/dist/templates/angular-xmcloud/src/app/components/partial-design-dynamic-placeholder/partial-design-dynamic-placeholder.component.html +1 -0
- package/dist/templates/angular-xmcloud/src/app/components/partial-design-dynamic-placeholder/partial-design-dynamic-placeholder.component.ts +15 -0
- package/dist/templates/angular-xmcloud/src/app/components/promo/promo.component.html +21 -0
- package/dist/templates/angular-xmcloud/src/app/components/promo/promo.component.ts +13 -0
- package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.html +8 -0
- package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.ts +21 -0
- package/dist/templates/angular-xmcloud/src/app/components/row-splitter/row-splitter.component.html +11 -0
- package/dist/templates/angular-xmcloud/src/app/components/row-splitter/row-splitter.component.ts +35 -0
- package/dist/templates/angular-xmcloud/src/app/components/sxa.component.ts +15 -0
- package/dist/templates/angular-xmcloud/src/app/components/title/title.component.html +10 -0
- package/dist/templates/angular-xmcloud/src/app/components/title/title.component.ts +56 -0
- package/dist/templates/angular-xmcloud/src/app/jss-link.service.ts +55 -0
- package/dist/templates/angular-xmcloud/src/app/lib/config.ts +17 -0
- package/dist/templates/angular-xmcloud/src/app/lib/graphql-client-factory/config.ts +58 -0
- package/dist/templates/angular-xmcloud/src/app/routing/layout/layout.component.html +38 -0
- package/dist/templates/angular-xmcloud/src/app/routing/layout/layout.component.ts +104 -0
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/cdp-page-view.component.ts +77 -0
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/cloud-sdk-init.component.ts +48 -0
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/scripts.component.html +5 -0
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/scripts.module.ts +12 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_component.scss +48 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_container.scss +64 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_fonts.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_footer.scss +31 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_header.scss +51 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_navigation.scss +150 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_promo.scss +58 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_rich-text.scss +11 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_variables.scss +10 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/main.scss +8 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/main.scss +14 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/_app.scss +103 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_functions.scss +8 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_mixins.scss +121 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_vars.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_colors.scss +283 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_fontSizes.scss +16 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_margins.scss +11 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/fonts/_fonts.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/fonts/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/index.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/links/_link-button.scss +26 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/links/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_inputs.scss +58 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_links.scss +14 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_ui-datepicker.scss +7 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/_richtext-files-icons.scss +86 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/_richtext.scss +101 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/index.scss +2 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/typehead/_typehead.scss +95 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/typehead/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-column-splitter.scss +14 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-container.scss +27 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-image.scss +18 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-navigation.scss +51 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-promo.scss +42 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-richtext-content.scss +19 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_alignment.scss +26 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_boxed.scss +16 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_clearfix.scss +11 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_highlighted.scss +63 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_link-button.scss +16 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_promoted-box.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/index.scss +6 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/_bordered.scss +24 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/_title-row-box.scss +66 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image/_image-default-size.scss +6 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image-alignment/_image-left.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image-alignment/_image-right.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/index.scss +17 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/_acaindent.scss +5 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/_background.scss +27 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/_component-link-list.scss +45 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/_list-vertical.scss +20 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/index.scss +2 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-fat.scss +58 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-main-horizontal-vertical.scss +176 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-mobile.scss +85 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-sidebar.scss +29 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_sitemap-navigation.scss +20 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/index.scss +5 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_absolute-bottom-link.scss +8 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_promo-hero.scss +40 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_promo-shadow.scss +42 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/index.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/rich-text/_rich-text-lists.scss +63 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/rich-text/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/_background-colors.scss +14 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/_indent.scss +13 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/index.scss +2 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/title/_component-title.scss +30 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/title/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/main.scss +4 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/index.scss +6 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/link-list/index.scss +0 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/navigation/index.scss +0 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/page-content/index.scss +0 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/promo/index.scss +0 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/rich-text/index.scss +0 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/title/index.scss +0 -0
- package/dist/templates/nextjs/package.json +4 -4
- package/dist/templates/nextjs/scripts/config/plugins/fallback.ts +0 -1
- package/dist/templates/nextjs/scripts/generate-config.ts +8 -1
- package/dist/templates/nextjs-styleguide/package.json +1 -1
- package/dist/templates/nextjs-styleguide/scripts/config/plugins/disconnected.ts +1 -0
- package/dist/templates/nextjs-sxa/src/assets/sass/components/common/_alignment.scss +34 -7
- package/dist/templates/node-headless-ssr-experience-edge/gitignore +19 -0
- package/dist/templates/node-headless-ssr-experience-edge/package.json +2 -2
- package/dist/templates/node-headless-ssr-proxy/gitignore +19 -0
- package/dist/templates/node-headless-ssr-proxy/package.json +3 -3
- package/dist/templates/node-headless-ssr-proxy/src/config.ts +3 -3
- package/dist/templates/node-headless-ssr-proxy/src/httpAgents.ts +2 -2
- package/dist/templates/node-headless-ssr-proxy/src/index.ts +9 -2
- package/dist/templates/node-xmcloud-proxy/.env +14 -0
- package/dist/templates/node-xmcloud-proxy/README.md +36 -0
- package/dist/templates/node-xmcloud-proxy/gitignore +33 -0
- package/dist/templates/node-xmcloud-proxy/package.json +26 -0
- package/dist/templates/node-xmcloud-proxy/src/config.ts +25 -0
- package/dist/templates/node-xmcloud-proxy/src/index.ts +210 -0
- package/dist/templates/node-xmcloud-proxy/src/types.ts +27 -0
- package/dist/templates/node-xmcloud-proxy/tsconfig.json +22 -0
- package/dist/templates/react/package.json +5 -5
- package/dist/templates/react/scripts/generate-config.js +10 -3
- package/dist/templates/react-native/package.json +4 -4
- package/dist/templates/vue/package.json +4 -4
- package/dist/templates/vue/scripts/generate-config.js +5 -0
- package/package.json +2 -2
- package/dist/templates/angular/scripts/generate-component-factory.ts +0 -166
- package/dist/templates/angular/src/app/lib/client-factory.ts +0 -28
- /package/dist/templates/{angular → angular-sxp}/data/component-content/Styleguide/ContentReuse/LoremIpsumContentBlock/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/component-content/gitignore +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ContentListField/Item1/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ContentListField/Item2/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/EditFrameDemo/Item1/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/EditFrameDemo/Item2/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ItemLinkField/Item1/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ItemLinkField/Item2/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/gitignore +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/dictionary/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/dictionary/{{language}}.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/media/files/jss.pdf +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/media/img/jss_logo.png +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/media/img/sc_logo.png +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/graphql/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/graphql/sample-1/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/graphql/sample-2/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/styleguide/custom-route-type/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/styleguide/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/styleguide/{{language}}.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/{{language}}.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/scripts/disconnected-mode-proxy.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/scripts/lint-yml.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/config/{{appName}}.config +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/component-content.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout-Reuse.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout-Tabs-Tab.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout-Tabs.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Multilingual.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Section.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/content-block.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-connected-demo.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-integrated-demo.sitecore.graphql +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-integrated-demo.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-layout.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-angular-lazy-loading.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-component-params.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-custom-route-type.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-edit-frame.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-checkbox.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-content-list.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-custom.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-date.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-file.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-image.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-item-link.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-link.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-number.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-rich-text.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-text.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-route-fields.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-sitecore-context.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-tracking.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/config.js +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/content.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/dictionary.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/placeholders.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/routes.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/Styleguide-Explanatory-Component.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/styleguide-content-list-template.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/styleguide-edit-frame-list-item-template.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/styleguide-item-link-template.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/gitignore +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/pipelines/example.patch.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.graphql +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-layout/graph-ql-layout.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/shared/styleguide-specimen/styleguide-specimen.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.module.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-component-params/styleguide-component-params.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-component-params/styleguide-component-params.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout/styleguide-layout.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout/styleguide-layout.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-multilingual/styleguide-multilingual.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-multilingual/styleguide-multilingual.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-route-fields/styleguide-route-fields.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-route-fields/styleguide-route-fields.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-section/styleguide-section.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-section/styleguide-section.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-tracking/styleguide-tracking.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-tracking/styleguide-tracking.component.ts +0 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import express, { Response } from 'express';
|
|
3
|
+
import compression from 'compression';
|
|
4
|
+
import { createProxyMiddleware } from 'http-proxy-middleware';
|
|
5
|
+
import { debug } from '@sitecore-jss/sitecore-jss';
|
|
6
|
+
import { editingRouter } from '@sitecore-jss/sitecore-jss-proxy';
|
|
7
|
+
import { healthCheck } from '@sitecore-jss/sitecore-jss-proxy';
|
|
8
|
+
import { config } from './config';
|
|
9
|
+
|
|
10
|
+
const server = express();
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
renderView,
|
|
14
|
+
parseRouteUrl,
|
|
15
|
+
dictionaryServiceFactory,
|
|
16
|
+
layoutServiceFactory,
|
|
17
|
+
} = config.serverBundle;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Required server bundle properties
|
|
21
|
+
*/
|
|
22
|
+
const requiredProperties = [
|
|
23
|
+
'renderView',
|
|
24
|
+
'parseRouteUrl',
|
|
25
|
+
'clientFactory',
|
|
26
|
+
'getClientFactoryConfig',
|
|
27
|
+
'defaultLanguage',
|
|
28
|
+
'layoutServiceFactory',
|
|
29
|
+
'dictionaryServiceFactory',
|
|
30
|
+
'components',
|
|
31
|
+
'metadata',
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const missingProperties = requiredProperties.filter((property) => !config.serverBundle[property]);
|
|
35
|
+
|
|
36
|
+
if (missingProperties.length > 0) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
`ERROR: The serverBundle should export the following properties: ${missingProperties.join(
|
|
39
|
+
', '
|
|
40
|
+
)}. Please check your server bundle.`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const layoutService = layoutServiceFactory.create();
|
|
45
|
+
|
|
46
|
+
const dictionaryService = dictionaryServiceFactory.create();
|
|
47
|
+
|
|
48
|
+
const clientFactoryConfig = config.serverBundle.getClientFactoryConfig();
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* GraphQL endpoint resolution to meet the requirements of the http-proxy-middleware
|
|
52
|
+
*/
|
|
53
|
+
const graphQLEndpoint = (() => {
|
|
54
|
+
try {
|
|
55
|
+
const graphQLEndpoint = new URL(clientFactoryConfig.endpoint);
|
|
56
|
+
// Browser request path to the proxy. Includes only the pathname.
|
|
57
|
+
const pathname = graphQLEndpoint.pathname;
|
|
58
|
+
// Target URL for the proxy. Can't include the query string.
|
|
59
|
+
const target = `${graphQLEndpoint.protocol}//${graphQLEndpoint.hostname}${pathname}`;
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
target,
|
|
63
|
+
path: pathname,
|
|
64
|
+
};
|
|
65
|
+
} catch (error) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
`ERROR: The serverBundle should export a getClientFactoryConfig function with valid GraphQL endpoint URL returned, current value is ${clientFactoryConfig.endpoint}. ` +
|
|
68
|
+
'Please check your server bundle.'
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
})();
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Parse requested url in order to detect current route and language
|
|
75
|
+
* @param {string} reqRoute requested route
|
|
76
|
+
*/
|
|
77
|
+
const getRouteParams = (reqRoute: string) => {
|
|
78
|
+
const routeParams = parseRouteUrl(reqRoute);
|
|
79
|
+
let lang;
|
|
80
|
+
let route;
|
|
81
|
+
|
|
82
|
+
if (routeParams) {
|
|
83
|
+
route = routeParams.sitecoreRoute || '/';
|
|
84
|
+
|
|
85
|
+
if (!route.startsWith('/')) {
|
|
86
|
+
route = `/${route}`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
lang = routeParams.lang || '';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return { route, lang };
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Handle unexpected error
|
|
97
|
+
* @param {Response} res server response
|
|
98
|
+
* @param {Error} err error
|
|
99
|
+
*/
|
|
100
|
+
const handleError = (res: Response, err: unknown) => {
|
|
101
|
+
debug.proxy('response error %o', err);
|
|
102
|
+
|
|
103
|
+
res.status(500).send('Internal Server Error');
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// enable gzip compression for appropriate file types
|
|
107
|
+
server.use(compression());
|
|
108
|
+
|
|
109
|
+
// turn off x-powered-by http header
|
|
110
|
+
server.settings['x-powered-by'] = false;
|
|
111
|
+
|
|
112
|
+
// Serve static app assets from local /dist folder
|
|
113
|
+
server.use(
|
|
114
|
+
'/dist',
|
|
115
|
+
express.static('dist', {
|
|
116
|
+
fallthrough: false, // force 404 for unknown assets under /dist
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Proxy browser GraphQL requests to the Sitecore GraphQL endpoint
|
|
122
|
+
*/
|
|
123
|
+
server.use(
|
|
124
|
+
graphQLEndpoint.path,
|
|
125
|
+
createProxyMiddleware({
|
|
126
|
+
target: graphQLEndpoint.target,
|
|
127
|
+
changeOrigin: true,
|
|
128
|
+
})
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The health check endpoint
|
|
133
|
+
*/
|
|
134
|
+
server.use(healthCheck());
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Proxy editing requests through the editing router
|
|
138
|
+
*/
|
|
139
|
+
server.use(
|
|
140
|
+
'/api/editing',
|
|
141
|
+
editingRouter({
|
|
142
|
+
config: {
|
|
143
|
+
components: config.serverBundle.components,
|
|
144
|
+
metadata: config.serverBundle.metadata,
|
|
145
|
+
},
|
|
146
|
+
render: {
|
|
147
|
+
clientFactory: config.serverBundle.clientFactory,
|
|
148
|
+
renderView,
|
|
149
|
+
},
|
|
150
|
+
})
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
server.use(async (req, res) => {
|
|
154
|
+
debug.proxy(`performing SSR for ${req.originalUrl}`);
|
|
155
|
+
|
|
156
|
+
try {
|
|
157
|
+
const { route, lang } = getRouteParams(req.originalUrl);
|
|
158
|
+
|
|
159
|
+
if (!route) {
|
|
160
|
+
debug.proxy('no route detected, returning 404');
|
|
161
|
+
|
|
162
|
+
res.sendStatus(404);
|
|
163
|
+
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Language is required. In case it's not specified in the requested URL, fallback to the default language from the app configuration.
|
|
168
|
+
const layoutData = await layoutService.fetchLayoutData(
|
|
169
|
+
route,
|
|
170
|
+
lang || config.serverBundle.defaultLanguage
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
const viewBag = { dictionary: {} };
|
|
174
|
+
|
|
175
|
+
viewBag.dictionary = await dictionaryService.fetchDictionaryData(
|
|
176
|
+
layoutData.sitecore.context.language || config.serverBundle.defaultLanguage
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
renderView(
|
|
180
|
+
(err, result) => {
|
|
181
|
+
if (err) {
|
|
182
|
+
handleError(res, err);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!result) {
|
|
187
|
+
debug.proxy('no result returned from renderView, returning 204');
|
|
188
|
+
|
|
189
|
+
res.status(204).send();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const statusCode = layoutData.sitecore.route ? 200 : 404;
|
|
194
|
+
|
|
195
|
+
debug.proxy('sending response with status %s', statusCode);
|
|
196
|
+
|
|
197
|
+
res.status(statusCode).send(result.html);
|
|
198
|
+
},
|
|
199
|
+
route,
|
|
200
|
+
layoutData,
|
|
201
|
+
viewBag
|
|
202
|
+
);
|
|
203
|
+
} catch (err) {
|
|
204
|
+
handleError(res, err);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
server.listen(config.port, () => {
|
|
209
|
+
console.log(`server listening on port ${config.port}!`);
|
|
210
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GraphQLRequestClientFactory,
|
|
3
|
+
GraphQLRequestClientFactoryConfig,
|
|
4
|
+
} from '@sitecore-jss/sitecore-jss';
|
|
5
|
+
import { DictionaryService } from '@sitecore-jss/sitecore-jss/i18n';
|
|
6
|
+
import { Metadata } from '@sitecore-jss/sitecore-jss/utils';
|
|
7
|
+
import { LayoutService } from '@sitecore-jss/sitecore-jss/layout';
|
|
8
|
+
import { AppRenderer, RouteUrlParser } from '@sitecore-jss/sitecore-jss-proxy';
|
|
9
|
+
|
|
10
|
+
export interface ServerBundle {
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
renderView: AppRenderer;
|
|
13
|
+
parseRouteUrl: RouteUrlParser;
|
|
14
|
+
clientFactory: GraphQLRequestClientFactory;
|
|
15
|
+
getClientFactoryConfig: () => GraphQLRequestClientFactoryConfig;
|
|
16
|
+
defaultLanguage: string;
|
|
17
|
+
layoutServiceFactory: { create: () => LayoutService };
|
|
18
|
+
dictionaryServiceFactory: { create: () => DictionaryService };
|
|
19
|
+
components: string[] | Map<string, unknown>;
|
|
20
|
+
metadata: Metadata;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface Config {
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
port: string | number;
|
|
26
|
+
serverBundle: ServerBundle;
|
|
27
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"newLine": "LF",
|
|
4
|
+
"emitDecoratorMetadata": true,
|
|
5
|
+
"experimentalDecorators": true,
|
|
6
|
+
"noFallthroughCasesInSwitch": true,
|
|
7
|
+
"rootDir": ".",
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noImplicitAny": true,
|
|
12
|
+
"noUnusedLocals": true,
|
|
13
|
+
"noUnusedParameters": true,
|
|
14
|
+
"noImplicitReturns": true,
|
|
15
|
+
"strictFunctionTypes": false,
|
|
16
|
+
"downlevelIteration": true,
|
|
17
|
+
"moduleResolution": "node",
|
|
18
|
+
"isolatedModules": true,
|
|
19
|
+
"allowSyntheticDefaultImports": true
|
|
20
|
+
},
|
|
21
|
+
"exclude": ["node_modules", "dist"]
|
|
22
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "<%- appName %>",
|
|
3
3
|
"description": "Application utilizing Sitecore JavaScript Services and React (create-react-app).",
|
|
4
|
-
"version": "22.
|
|
4
|
+
"version": "22.3.0-canary",
|
|
5
5
|
"private": true,
|
|
6
6
|
"config": {
|
|
7
7
|
"appName": "<%- appName %>",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@apollo/client": "^3.7.1",
|
|
31
|
-
"@sitecore-jss/sitecore-jss-react": "~22.
|
|
31
|
+
"@sitecore-jss/sitecore-jss-react": "~22.3.0-canary",
|
|
32
32
|
"axios": "^1.2.0",
|
|
33
33
|
"bootstrap": "^5.2.3",
|
|
34
34
|
"cross-fetch": "^3.1.5",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@babel/preset-env": "^7.20.2",
|
|
54
54
|
"@babel/preset-react": "^7.18.6",
|
|
55
55
|
"@babel/register": "~7.18.9",
|
|
56
|
-
"@sitecore-jss/sitecore-jss-cli": "~22.
|
|
57
|
-
"@sitecore-jss/sitecore-jss-dev-tools": "~22.
|
|
58
|
-
"@sitecore-jss/sitecore-jss-rendering-host": "~22.
|
|
56
|
+
"@sitecore-jss/sitecore-jss-cli": "~22.3.0-canary",
|
|
57
|
+
"@sitecore-jss/sitecore-jss-dev-tools": "~22.3.0-canary",
|
|
58
|
+
"@sitecore-jss/sitecore-jss-rendering-host": "~22.3.0-canary",
|
|
59
59
|
"babel-loader": "~9.1.0",
|
|
60
60
|
"babel-preset-react-app": "~10.0.1",
|
|
61
61
|
"chalk": "~4.1.2",
|
|
@@ -31,6 +31,11 @@ generateConfig();
|
|
|
31
31
|
* NOTE! Any configs returned here will be written into the client-side JS bundle. DO NOT PUT SECRETS HERE.
|
|
32
32
|
*/
|
|
33
33
|
function generateConfig() {
|
|
34
|
+
// Handle undefined values
|
|
35
|
+
Object.keys(defaultConfig).forEach((prop) => {
|
|
36
|
+
defaultConfig[prop] = defaultConfig[prop] || '';
|
|
37
|
+
});
|
|
38
|
+
|
|
34
39
|
try {
|
|
35
40
|
config = jssConfigFactory.create(defaultConfig);
|
|
36
41
|
} catch (error) {
|
|
@@ -50,9 +55,11 @@ const config = {};\n`;
|
|
|
50
55
|
|
|
51
56
|
// Set base configuration values, allowing override with environment variables
|
|
52
57
|
Object.keys(config).forEach(prop => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
58
|
+
// Handle undefined values
|
|
59
|
+
const value = config[prop] || '';
|
|
60
|
+
configText += `config.${prop} = process.env.REACT_APP_${constantCase(
|
|
61
|
+
prop
|
|
62
|
+
)} || "${value.trim()}";\n`;
|
|
56
63
|
});
|
|
57
64
|
configText += 'module.exports = config;';
|
|
58
65
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "<%- appName %>",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.3.0-canary",
|
|
4
4
|
"description": "A basic React Native app utilizing Sitecore JavaScript Services",
|
|
5
5
|
"config": {
|
|
6
6
|
"appName": "<%- appName %>",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@react-native-community/masked-view": "^0.1.10",
|
|
26
|
-
"@sitecore-jss/sitecore-jss-react-native": "~22.
|
|
26
|
+
"@sitecore-jss/sitecore-jss-react-native": "~22.3.0-canary",
|
|
27
27
|
"prop-types": "^15.6.0",
|
|
28
28
|
"react": "16.13.1",
|
|
29
29
|
"react-native": "^0.63.4",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"private": true,
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@sitecore-jss/sitecore-jss-cli": "~22.
|
|
41
|
-
"@sitecore-jss/sitecore-jss-dev-tools": "~22.
|
|
40
|
+
"@sitecore-jss/sitecore-jss-cli": "~22.3.0-canary",
|
|
41
|
+
"@sitecore-jss/sitecore-jss-dev-tools": "~22.3.0-canary",
|
|
42
42
|
"babel-core": "^6.26.0",
|
|
43
43
|
"babel-eslint": "^8.2.1",
|
|
44
44
|
"babel-plugin-inline-replace-variables": "^1.3.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "<%- appName %>",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.3.0-canary",
|
|
4
4
|
"description": "Application utilizing Sitecore JavaScript Services and Vue (vue-cli).",
|
|
5
5
|
"private": true,
|
|
6
6
|
"config": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@apollo/client": "^3.7.4",
|
|
47
47
|
"@panter/vue-i18next": "~0.15.2",
|
|
48
|
-
"@sitecore-jss/sitecore-jss-vue": "~22.
|
|
48
|
+
"@sitecore-jss/sitecore-jss-vue": "~22.3.0-canary",
|
|
49
49
|
"@vue/apollo-composable": "4.0.0-beta.2",
|
|
50
50
|
"@vue/apollo-option": "^4.0.0-alpha.20",
|
|
51
51
|
"@vue/apollo-ssr": "^4.0.0-alpha.18",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@babel/eslint-parser": "^7.19.1",
|
|
66
66
|
"@babel/register": "7.18.9",
|
|
67
|
-
"@sitecore-jss/sitecore-jss-cli": "~22.
|
|
68
|
-
"@sitecore-jss/sitecore-jss-dev-tools": "~22.
|
|
67
|
+
"@sitecore-jss/sitecore-jss-cli": "~22.3.0-canary",
|
|
68
|
+
"@sitecore-jss/sitecore-jss-dev-tools": "~22.3.0-canary",
|
|
69
69
|
"@vue/cli-plugin-babel": "~5.0.8",
|
|
70
70
|
"@vue/cli-plugin-eslint": "~5.0.8",
|
|
71
71
|
"@vue/cli-service": "~5.0.8",
|
|
@@ -33,6 +33,11 @@ module.exports = function generateConfig(configOverrides) {
|
|
|
33
33
|
// and finally config passed in the configOverrides param wins.
|
|
34
34
|
const config = Object.assign(defaultConfig, scjssConfig, packageJson, configOverrides);
|
|
35
35
|
|
|
36
|
+
// Handle undefined values
|
|
37
|
+
Object.keys(config).forEach((prop) => {
|
|
38
|
+
config[prop] = config[prop] || '';
|
|
39
|
+
});
|
|
40
|
+
|
|
36
41
|
// The GraphQL endpoint is an example of making a _computed_ config setting
|
|
37
42
|
// based on other config settings.
|
|
38
43
|
const computedConfig = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-sitecore-jss",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.3.0-canary.1",
|
|
4
4
|
"description": "Sitecore JSS initializer",
|
|
5
5
|
"bin": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"ts-node": "^10.9.1",
|
|
64
64
|
"typescript": "~4.9.5"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "204eb3427f26d4ba8c08f44cf9c772f19f2820a8"
|
|
67
67
|
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const chokidar = require('chokidar');
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
COMPONENT FACTORY GENERATION
|
|
7
|
-
Generates the /src/app/components/app-components.module.ts file which maps Angular components
|
|
8
|
-
to JSS components.
|
|
9
|
-
|
|
10
|
-
The component factory module defines a mapping between a string component name and a Angular component instance.
|
|
11
|
-
When the Sitecore Layout service returns a layout definition, it returns named components.
|
|
12
|
-
This mapping is used to construct the component hierarchy for the layout.
|
|
13
|
-
|
|
14
|
-
NOTE: this script can run in two modes. The default mode, the component factory file is written once.
|
|
15
|
-
But if `--watch` is a process argument, the component factory source folder will be watched,
|
|
16
|
-
and the componentFactory.js rewritten on added or deleted files.
|
|
17
|
-
This is used during `jss start` to pick up new or removed components at runtime.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export interface PackageDefinition {
|
|
21
|
-
name: string;
|
|
22
|
-
components: {
|
|
23
|
-
moduleName: string;
|
|
24
|
-
componentName: string;
|
|
25
|
-
}[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const componentFactoryPath = path.resolve('src/app/components/app-components.module.ts');
|
|
29
|
-
const componentRootPath = 'src/app/components';
|
|
30
|
-
|
|
31
|
-
const isWatch = process.argv.some((arg) => arg === '--watch');
|
|
32
|
-
|
|
33
|
-
if (isWatch) {
|
|
34
|
-
watchComponentFactory();
|
|
35
|
-
} else {
|
|
36
|
-
writeComponentFactory();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function watchComponentFactory() {
|
|
40
|
-
console.log(`Watching for changes to component factory sources in ${componentRootPath}...`);
|
|
41
|
-
|
|
42
|
-
chokidar
|
|
43
|
-
.watch(componentRootPath, { ignoreInitial: true, awaitWriteFinish: true })
|
|
44
|
-
.on('add', writeComponentFactory)
|
|
45
|
-
.on('unlink', writeComponentFactory);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function writeComponentFactory() {
|
|
49
|
-
const componentFactory = generateComponentFactory();
|
|
50
|
-
|
|
51
|
-
console.log(`Writing component factory to ${componentFactoryPath}`);
|
|
52
|
-
|
|
53
|
-
fs.writeFileSync(componentFactoryPath, componentFactory, { encoding: 'utf8' });
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function generateComponentFactory() {
|
|
57
|
-
// By convention, we expect to find Angular components
|
|
58
|
-
// under /src/app/components/component-name/component-name.component.ts
|
|
59
|
-
// If a component-name.module.ts file exists, we will treat it as lazy loaded.
|
|
60
|
-
// If you'd like to use your own convention, encode it below.
|
|
61
|
-
// NOTE: generating the component factory module is also totally optional,
|
|
62
|
-
// and it can be maintained manually if preferred.
|
|
63
|
-
|
|
64
|
-
const imports: string[] = [];
|
|
65
|
-
/**
|
|
66
|
-
* You can specify components which you want to import from external/internal packages
|
|
67
|
-
* in format:
|
|
68
|
-
* {
|
|
69
|
-
* name: 'package name',
|
|
70
|
-
* components: [
|
|
71
|
-
* {
|
|
72
|
-
* componentName: 'component name', // component rendering name,
|
|
73
|
-
* moduleName: 'module name' // component name to import from the package
|
|
74
|
-
* }
|
|
75
|
-
* ]
|
|
76
|
-
* }
|
|
77
|
-
*/
|
|
78
|
-
const packages: PackageDefinition[] = [];
|
|
79
|
-
const registrations: string[] = [];
|
|
80
|
-
const lazyRegistrations: string[] = [];
|
|
81
|
-
const declarations: string[] = [];
|
|
82
|
-
|
|
83
|
-
packages.forEach((p) => {
|
|
84
|
-
const variables = p.components
|
|
85
|
-
.map((c) => {
|
|
86
|
-
registrations.push(`{ name: '${c.componentName}', type: ${c.moduleName} },`);
|
|
87
|
-
declarations.push(`${c.moduleName},`);
|
|
88
|
-
|
|
89
|
-
return c.moduleName;
|
|
90
|
-
})
|
|
91
|
-
.join(', ');
|
|
92
|
-
imports.push(`import { ${variables} } from '${p.name}'`);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
fs.readdirSync(componentRootPath).forEach((componentFolder) => {
|
|
96
|
-
// ignore ts files in component root folder
|
|
97
|
-
if (componentFolder.endsWith('.ts') || componentFolder === '.gitignore') {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const componentFilePath = path.join(componentRootPath, componentFolder, `${componentFolder}.component.ts`);
|
|
102
|
-
|
|
103
|
-
if (!fs.existsSync(componentFilePath)) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const componentFileContents = fs.readFileSync(componentFilePath, 'utf8');
|
|
108
|
-
|
|
109
|
-
// ASSUMPTION: your component should export a class directly that follows Angular conventions,
|
|
110
|
-
// i.e. `export class FooComponent` - so we can detect the component's name for auto registration.
|
|
111
|
-
const componentClassMatch = /export class (.+?)Component\b/g.exec(componentFileContents);
|
|
112
|
-
|
|
113
|
-
if (componentClassMatch === null) {
|
|
114
|
-
console.debug(`Component ${componentFilePath} did not seem to export a component class. It will be skipped.`);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const componentName = componentClassMatch[1];
|
|
119
|
-
const importVarName = `${componentName}Component`;
|
|
120
|
-
|
|
121
|
-
// check for lazy loading needs
|
|
122
|
-
const moduleFilePath = path.join(componentRootPath, componentFolder, `${componentFolder}.module.ts`);
|
|
123
|
-
const isLazyLoaded = fs.existsSync(moduleFilePath);
|
|
124
|
-
|
|
125
|
-
if (isLazyLoaded) {
|
|
126
|
-
console.debug(`Registering JSS component (lazy) ${componentName}`);
|
|
127
|
-
lazyRegistrations.push(`{ path: '${componentName}', loadChildren: () => import('./${componentFolder}/${componentFolder}.module').then(m => m.${componentName}Module) },`);
|
|
128
|
-
} else {
|
|
129
|
-
console.debug(`Registering JSS component ${componentName}`);
|
|
130
|
-
imports.push(`import { ${importVarName} } from './${componentFolder}/${componentFolder}.component';`);
|
|
131
|
-
registrations.push(`{ name: '${componentName}', type: ${importVarName} },`);
|
|
132
|
-
declarations.push(`${importVarName},`);
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
return `// Do not edit this file, it is auto-generated at build time!
|
|
137
|
-
// See scripts/generate-component-factory.js to modify the generation of this file.
|
|
138
|
-
// Use app-components.shared.module.ts to modify the imports, etc of this module.
|
|
139
|
-
// Note: code-generation is optional! See ./.gitignore for directions to remove it,
|
|
140
|
-
// if you do not want it.
|
|
141
|
-
|
|
142
|
-
import { NgModule } from '@angular/core';
|
|
143
|
-
import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
|
|
144
|
-
import { AppComponentsSharedModule } from './app-components.shared.module';
|
|
145
|
-
${imports.join('\n')}
|
|
146
|
-
|
|
147
|
-
@NgModule({
|
|
148
|
-
imports: [
|
|
149
|
-
AppComponentsSharedModule,
|
|
150
|
-
JssModule.withComponents([
|
|
151
|
-
${registrations.join('\n ')}
|
|
152
|
-
], [
|
|
153
|
-
${lazyRegistrations.join('\n ')}
|
|
154
|
-
]),
|
|
155
|
-
],
|
|
156
|
-
exports: [
|
|
157
|
-
JssModule,
|
|
158
|
-
AppComponentsSharedModule,
|
|
159
|
-
],
|
|
160
|
-
declarations: [
|
|
161
|
-
${declarations.join('\n ')}
|
|
162
|
-
],
|
|
163
|
-
})
|
|
164
|
-
export class AppComponentsModule { }
|
|
165
|
-
`;
|
|
166
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GraphQLRequestClientFactoryConfig,
|
|
3
|
-
GraphQLRequestClient,
|
|
4
|
-
} from '@sitecore-jss/sitecore-jss-angular';
|
|
5
|
-
import { environment as env } from '../../environments/environment';
|
|
6
|
-
|
|
7
|
-
// The GraphQLRequestClientFactory serves as the central hub for executing GraphQL requests within the application
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Creates a new GraphQLRequestClientFactory instance
|
|
11
|
-
* @returns GraphQLRequestClientFactory instance
|
|
12
|
-
*/
|
|
13
|
-
export const createGraphQLClientFactory = () => {
|
|
14
|
-
let clientConfig: GraphQLRequestClientFactoryConfig;
|
|
15
|
-
|
|
16
|
-
if (env.graphQLEndpoint && env.sitecoreApiKey) {
|
|
17
|
-
clientConfig = {
|
|
18
|
-
endpoint: env.graphQLEndpoint,
|
|
19
|
-
apiKey: env.sitecoreApiKey,
|
|
20
|
-
};
|
|
21
|
-
} else {
|
|
22
|
-
throw new Error('Please configure your graphQLEndpoint and sitecoreApiKey.');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return GraphQLRequestClient.createClientFactory(clientConfig);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const clientFactory = createGraphQLClientFactory();
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/EditFrameDemo/Item1/en.yml
RENAMED
|
File without changes
|
/package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/EditFrameDemo/Item2/en.yml
RENAMED
|
File without changes
|
/package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ItemLinkField/Item1/en.yml
RENAMED
|
File without changes
|
/package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ItemLinkField/Item2/en.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/templates/{angular → angular-sxp}/data/routes/styleguide/custom-route-type/en.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/templates/{angular → angular-sxp}/sitecore/definitions/component-content.sitecore.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|