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,22 @@
|
|
|
1
|
+
import { JssConfig } from 'lib/config';
|
|
2
|
+
import { ConfigPlugin } from '..';
|
|
3
|
+
import packageConfig from 'package.json';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This plugin will set config props based on package.json.
|
|
7
|
+
*/
|
|
8
|
+
class PackageJsonPlugin implements ConfigPlugin {
|
|
9
|
+
order = 1;
|
|
10
|
+
|
|
11
|
+
async exec(config: JssConfig) {
|
|
12
|
+
if (!packageConfig.config) return config;
|
|
13
|
+
|
|
14
|
+
return Object.assign({}, config, {
|
|
15
|
+
sitecoreSiteName: config.sitecoreSiteName || packageConfig.config.appName,
|
|
16
|
+
graphQLEndpointPath: config.graphQLEndpointPath || packageConfig.config.graphQLEndpointPath,
|
|
17
|
+
defaultLanguage: config.defaultLanguage || packageConfig.config.language,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const packageJsonPlugin = new PackageJsonPlugin();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { JssConfig } from 'lib/config';
|
|
2
|
+
import { ConfigPlugin } from '..';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This plugin will set config props based on scjssconfig.json.
|
|
6
|
+
* scjssconfig.json may not exist if you've never run `jss setup` (development)
|
|
7
|
+
* or are depending on environment variables instead (production).
|
|
8
|
+
*/
|
|
9
|
+
class ScJssConfigPlugin implements ConfigPlugin {
|
|
10
|
+
order = 1;
|
|
11
|
+
|
|
12
|
+
async exec(config: JssConfig) {
|
|
13
|
+
let scJssConfig;
|
|
14
|
+
try {
|
|
15
|
+
scJssConfig = require('scjssconfig.json');
|
|
16
|
+
} catch (e) {
|
|
17
|
+
return config;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!scJssConfig) return config;
|
|
21
|
+
|
|
22
|
+
return Object.assign({}, config, {
|
|
23
|
+
sitecoreApiKey: config.sitecoreApiKey || scJssConfig.sitecore?.apiKey,
|
|
24
|
+
sitecoreApiHost: config.sitecoreApiHost || scJssConfig.sitecore?.layoutServiceHost,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const scjssconfigPlugin = new ScJssConfigPlugin();
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const plugins = require('scripts/temp/generate-component-factory-plugins');
|
|
2
|
+
import { PackageDefinition } from '@sitecore-jss/sitecore-jss-dev-tools';
|
|
3
|
+
|
|
4
|
+
export interface ComponentFactoryPluginConfig {
|
|
5
|
+
watch?: boolean;
|
|
6
|
+
packages: PackageDefinition[];
|
|
7
|
+
components: string[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ComponentFactoryPlugin {
|
|
11
|
+
/**
|
|
12
|
+
* Detect order when the plugin should be called, e.g. 0 - will be called first (can be a plugin which data is required for other plugins)
|
|
13
|
+
*/
|
|
14
|
+
order: number;
|
|
15
|
+
/**
|
|
16
|
+
* A function which will be called during component factory generation
|
|
17
|
+
* @param {JssConfig} config Current (accumulated) config
|
|
18
|
+
*/
|
|
19
|
+
exec(config: ComponentFactoryPluginConfig): ComponentFactoryPluginConfig;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
COMPONENT FACTORY GENERATION
|
|
24
|
+
Generates the /src/app/components/app-components.module.ts file which maps Angular components
|
|
25
|
+
to JSS components.
|
|
26
|
+
|
|
27
|
+
The component factory module defines a mapping between a string component name and a Angular component instance.
|
|
28
|
+
When the Sitecore Layout service returns a layout definition, it returns named components.
|
|
29
|
+
This mapping is used to construct the component hierarchy for the layout.
|
|
30
|
+
|
|
31
|
+
NOTE: this script can run in two modes. The default mode, the component factory file is written once.
|
|
32
|
+
But if `--watch` is a process argument, the component factory source folder will be watched,
|
|
33
|
+
and the componentFactory.js rewritten on added or deleted files.
|
|
34
|
+
This is used during `jss start` to pick up new or removed components at runtime.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
const defaultConfig: ComponentFactoryPluginConfig = {
|
|
38
|
+
watch: process.argv.some(arg => arg === '--watch'),
|
|
39
|
+
packages: [],
|
|
40
|
+
components: [],
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
(Object.values(plugins) as ComponentFactoryPlugin[])
|
|
44
|
+
.sort((p1, p2) => p1.order - p2.order)
|
|
45
|
+
.reduce((config, plugin) => plugin.exec(config), defaultConfig);
|
package/dist/templates/angular/scripts/generate-component-factory/plugins/component-factory.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import chokidar from 'chokidar';
|
|
5
|
+
import { componentFactoryTemplate } from '../template';
|
|
6
|
+
import {
|
|
7
|
+
ComponentFactoryPluginConfig,
|
|
8
|
+
ComponentFactoryPlugin as ComponentFactoryPluginType,
|
|
9
|
+
} from '..';
|
|
10
|
+
|
|
11
|
+
export interface PackageDefinition {
|
|
12
|
+
name: string;
|
|
13
|
+
components: {
|
|
14
|
+
moduleName: string;
|
|
15
|
+
componentName: string;
|
|
16
|
+
}[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const componentFactoryPath = path.resolve('src/app/components/app-components.module.ts');
|
|
20
|
+
const componentRootPath = 'src/app/components';
|
|
21
|
+
|
|
22
|
+
function watchComponentFactory(config: ComponentFactoryPluginConfig) {
|
|
23
|
+
console.log(`Watching for changes to component factory sources in ${componentRootPath}...`);
|
|
24
|
+
|
|
25
|
+
chokidar
|
|
26
|
+
.watch(componentRootPath, { ignoreInitial: true, awaitWriteFinish: true })
|
|
27
|
+
.on('add', writeComponentFactory.bind(null, config))
|
|
28
|
+
.on('unlink', writeComponentFactory.bind(null, config));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function writeComponentFactory(config: ComponentFactoryPluginConfig) {
|
|
32
|
+
const componentFactory = generateComponentFactory(config);
|
|
33
|
+
|
|
34
|
+
console.log(`Writing component factory to ${componentFactoryPath}`);
|
|
35
|
+
|
|
36
|
+
fs.writeFileSync(componentFactoryPath, componentFactory, { encoding: 'utf8' });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function generateComponentFactory(config: ComponentFactoryPluginConfig) {
|
|
40
|
+
// By convention, we expect to find Angular components
|
|
41
|
+
// under /src/app/components/component-name/component-name.component.ts
|
|
42
|
+
// If a component-name.module.ts file exists, we will treat it as lazy loaded.
|
|
43
|
+
// If you'd like to use your own convention, encode it below.
|
|
44
|
+
// NOTE: generating the component factory module is also totally optional,
|
|
45
|
+
// and it can be maintained manually if preferred.
|
|
46
|
+
|
|
47
|
+
const imports: string[] = [];
|
|
48
|
+
const registrations: string[] = [];
|
|
49
|
+
const lazyRegistrations: string[] = [];
|
|
50
|
+
const declarations: string[] = [];
|
|
51
|
+
|
|
52
|
+
config.packages.forEach((p) => {
|
|
53
|
+
const variables = p.components
|
|
54
|
+
.map((c) => {
|
|
55
|
+
registrations.push(`{ name: '${c.componentName}', type: ${c.moduleName} },`);
|
|
56
|
+
config.components.push(c.componentName);
|
|
57
|
+
|
|
58
|
+
return c.moduleName;
|
|
59
|
+
})
|
|
60
|
+
.join(', ');
|
|
61
|
+
imports.push(`import { ${variables} } from '${p.name}'`);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
fs.readdirSync(componentRootPath).forEach((componentFolder) => {
|
|
65
|
+
// ignore ts files in component root folder
|
|
66
|
+
if (componentFolder.endsWith('.ts') || componentFolder === '.gitignore') {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const componentFilePath = path.join(
|
|
71
|
+
componentRootPath,
|
|
72
|
+
componentFolder,
|
|
73
|
+
`${componentFolder}.component.ts`
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
if (!fs.existsSync(componentFilePath)) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const componentFileContents = fs.readFileSync(componentFilePath, 'utf8');
|
|
81
|
+
|
|
82
|
+
// ASSUMPTION: your component should export a class directly that follows Angular conventions,
|
|
83
|
+
// i.e. `export class FooComponent` - so we can detect the component's name for auto registration.
|
|
84
|
+
const componentClassMatch = /export class (.+?)Component\b/g.exec(componentFileContents);
|
|
85
|
+
|
|
86
|
+
if (componentClassMatch === null) {
|
|
87
|
+
console.debug(
|
|
88
|
+
`Component ${componentFilePath} did not seem to export a component class. It will be skipped.`
|
|
89
|
+
);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const componentName = componentClassMatch[1];
|
|
94
|
+
const importVarName = `${componentName}Component`;
|
|
95
|
+
|
|
96
|
+
config.components.push(componentName);
|
|
97
|
+
|
|
98
|
+
// check for lazy loading needs
|
|
99
|
+
const moduleFilePath = path.join(
|
|
100
|
+
componentRootPath,
|
|
101
|
+
componentFolder,
|
|
102
|
+
`${componentFolder}.module.ts`
|
|
103
|
+
);
|
|
104
|
+
const isLazyLoaded = fs.existsSync(moduleFilePath);
|
|
105
|
+
|
|
106
|
+
if (isLazyLoaded) {
|
|
107
|
+
console.debug(`Registering JSS component (lazy) ${componentName}`);
|
|
108
|
+
lazyRegistrations.push(
|
|
109
|
+
`{ path: '${componentName}', loadChildren: () => import('./${componentFolder}/${componentFolder}.module').then(m => m.${componentName}Module) },`
|
|
110
|
+
);
|
|
111
|
+
} else {
|
|
112
|
+
console.debug(`Registering JSS component ${componentName}`);
|
|
113
|
+
imports.push(
|
|
114
|
+
`import { ${importVarName} } from './${componentFolder}/${componentFolder}.component';`
|
|
115
|
+
);
|
|
116
|
+
registrations.push(`{ name: '${componentName}', type: ${importVarName} },`);
|
|
117
|
+
declarations.push(`${importVarName},`);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
return componentFactoryTemplate({
|
|
122
|
+
imports,
|
|
123
|
+
components: config.components,
|
|
124
|
+
registrations,
|
|
125
|
+
lazyRegistrations,
|
|
126
|
+
declarations,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Generates the component factory file.
|
|
132
|
+
*/
|
|
133
|
+
class ComponentFactoryPlugin implements ComponentFactoryPluginType {
|
|
134
|
+
order = 9999;
|
|
135
|
+
|
|
136
|
+
exec(config: ComponentFactoryPluginConfig) {
|
|
137
|
+
if (config.watch) {
|
|
138
|
+
watchComponentFactory(config);
|
|
139
|
+
} else {
|
|
140
|
+
writeComponentFactory(config);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return config;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export const componentFactoryPlugin = new ComponentFactoryPlugin();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentFactoryPlugin, ComponentFactoryPluginConfig } from '..';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Provides custom components configuration
|
|
5
|
+
*/
|
|
6
|
+
class ComponentsPlugin implements ComponentFactoryPlugin {
|
|
7
|
+
order = 0;
|
|
8
|
+
|
|
9
|
+
exec(config: ComponentFactoryPluginConfig) {
|
|
10
|
+
/**
|
|
11
|
+
* You can specify components which you want to import using custom path
|
|
12
|
+
*/
|
|
13
|
+
config.components = [];
|
|
14
|
+
|
|
15
|
+
return config;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const componentsPlugin = new ComponentsPlugin();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ComponentFactoryPlugin, ComponentFactoryPluginConfig } from '..';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Provides custom packages configuration
|
|
5
|
+
*/
|
|
6
|
+
class PackagesPlugin implements ComponentFactoryPlugin {
|
|
7
|
+
order = 0;
|
|
8
|
+
|
|
9
|
+
exec(config: ComponentFactoryPluginConfig) {
|
|
10
|
+
/**
|
|
11
|
+
* You can specify components which you want to import from external/internal packages
|
|
12
|
+
* in format:
|
|
13
|
+
* {
|
|
14
|
+
* name: 'package name',
|
|
15
|
+
* components: [
|
|
16
|
+
* {
|
|
17
|
+
* componentName: 'component name', // component rendering name,
|
|
18
|
+
* moduleName: 'module name' // component name to import from the package
|
|
19
|
+
* }
|
|
20
|
+
* ]
|
|
21
|
+
* }
|
|
22
|
+
*/
|
|
23
|
+
config.packages = [];
|
|
24
|
+
|
|
25
|
+
return config;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const packagesPlugin = new PackagesPlugin();
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export const componentFactoryTemplate = ({
|
|
2
|
+
imports,
|
|
3
|
+
components,
|
|
4
|
+
registrations,
|
|
5
|
+
lazyRegistrations,
|
|
6
|
+
declarations,
|
|
7
|
+
}: {
|
|
8
|
+
imports: string[];
|
|
9
|
+
components: string[];
|
|
10
|
+
registrations: string[];
|
|
11
|
+
lazyRegistrations: string[];
|
|
12
|
+
declarations: string[];
|
|
13
|
+
}) => `// Do not edit this file, it is auto-generated at build time!
|
|
14
|
+
// See scripts/generate-component-factory/index.ts to modify the generation of this file.
|
|
15
|
+
// Use app-components.shared.module.ts to modify the imports, etc of this module.
|
|
16
|
+
// Note: code-generation is optional! See ./.gitignore for directions to remove it,
|
|
17
|
+
// if you do not want it.
|
|
18
|
+
|
|
19
|
+
import { NgModule } from '@angular/core';
|
|
20
|
+
import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
|
|
21
|
+
import { AppComponentsSharedModule } from './app-components.shared.module';
|
|
22
|
+
${imports.join('\n')}
|
|
23
|
+
|
|
24
|
+
export const components = [
|
|
25
|
+
${components.map((c) => `'${c}'`).join(',\n ')}
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
@NgModule({
|
|
29
|
+
imports: [
|
|
30
|
+
AppComponentsSharedModule,
|
|
31
|
+
JssModule.withComponents([
|
|
32
|
+
${registrations.join('\n ')}
|
|
33
|
+
], [
|
|
34
|
+
${lazyRegistrations.join('\n ')}
|
|
35
|
+
]),
|
|
36
|
+
],
|
|
37
|
+
exports: [
|
|
38
|
+
JssModule,
|
|
39
|
+
AppComponentsSharedModule,
|
|
40
|
+
],
|
|
41
|
+
declarations: [
|
|
42
|
+
${declarations.join('\n ')}
|
|
43
|
+
],
|
|
44
|
+
})
|
|
45
|
+
export class AppComponentsModule { }
|
|
46
|
+
`;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import 'dotenv/config';
|
|
1
2
|
import * as fs from 'fs';
|
|
2
3
|
import * as path from 'path';
|
|
3
4
|
import { constantCase } from 'constant-case';
|
|
4
|
-
|
|
5
|
+
import { jssConfigFactory } from './config';
|
|
6
|
+
import { JssConfig } from 'lib/config';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Generate config
|
|
@@ -10,91 +12,88 @@ const packageConfig = require('../package.json');
|
|
|
10
12
|
* settings as variables into the JSS app.
|
|
11
13
|
* NOTE! Any configs returned here will be written into the client-side JS bundle. DO NOT PUT SECRETS HERE.
|
|
12
14
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
const defaultConfigValue: JssConfig = {
|
|
17
|
+
production: false,
|
|
18
|
+
sitecoreApiKey: process.env[`${constantCase('sitecoreApiKey')}`],
|
|
19
|
+
sitecoreApiHost: process.env[`${constantCase('sitecoreApiHost')}`],
|
|
20
|
+
sitecoreSiteName: process.env[`${constantCase('sitecoreSiteName')}`],
|
|
21
|
+
defaultLanguage: process.env[`${constantCase('defaultLanguage')}`],
|
|
22
|
+
graphQLEndpoint: process.env[`${constantCase('graphQLEndpoint')}`],
|
|
23
|
+
graphQLEndpointPath: process.env[`${constantCase('graphQLEndpointPath')}`],
|
|
24
|
+
defaultServerRoute: '/',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
async function main() {
|
|
28
|
+
await generateConfig('src/environments/environment.js', defaultConfigValue, {
|
|
15
29
|
production: false,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
defaultServerRoute: '/',
|
|
22
|
-
layoutServiceConfigurationName: 'default',
|
|
23
|
-
};
|
|
30
|
+
});
|
|
31
|
+
await generateConfig('src/environments/environment.prod.js', defaultConfigValue, {
|
|
32
|
+
production: true,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
24
35
|
|
|
25
|
-
|
|
26
|
-
outputPath = 'src/environments/environment.js';
|
|
27
|
-
}
|
|
36
|
+
main();
|
|
28
37
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Generates the JSS config based on config plugins (under ./config/plugins)
|
|
40
|
+
* and then writes the config to disk.
|
|
41
|
+
* @param {string} outputPath the output path of the generated config.
|
|
42
|
+
* @param {JssConfig} [defaultConfig] Default configuration.
|
|
43
|
+
* @param {[key: string]:unknown} [configOverrides] configuration values that override the generated ones.
|
|
44
|
+
*/
|
|
45
|
+
export function generateConfig(
|
|
46
|
+
outputPath: string,
|
|
47
|
+
defaultConfig: JssConfig = defaultConfigValue,
|
|
48
|
+
configOverrides?: { [key: string]: unknown }
|
|
49
|
+
) {
|
|
50
|
+
// Handle undefined values
|
|
51
|
+
defaultConfig = Object.keys(defaultConfig).reduce((acc, key) => {
|
|
52
|
+
return {
|
|
53
|
+
...acc,
|
|
54
|
+
[key]: defaultConfig[key] || '',
|
|
55
|
+
};
|
|
56
|
+
}, {});
|
|
32
57
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
58
|
+
return jssConfigFactory
|
|
59
|
+
.create(defaultConfig)
|
|
60
|
+
.then((config) => {
|
|
61
|
+
writeConfig(Object.assign(config, configOverrides), outputPath);
|
|
62
|
+
})
|
|
63
|
+
.catch((e) => {
|
|
64
|
+
console.error('Error generating config');
|
|
65
|
+
console.error(e);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
40
69
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Writes the config object to disk with support for environment variables.
|
|
72
|
+
* @param {JssConfig} config JSS configuration to write.
|
|
73
|
+
* @param {string} outputPath the outputh path of the generated config.
|
|
74
|
+
*/
|
|
75
|
+
export function writeConfig(config: JssConfig, outputPath?: string) {
|
|
76
|
+
if (!outputPath) {
|
|
77
|
+
outputPath = 'src/environments/environment.js';
|
|
78
|
+
}
|
|
45
79
|
|
|
46
80
|
let configText = `/* eslint-disable */
|
|
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`;
|
|
81
|
+
// Do not edit this file, it is auto-generated at build time!
|
|
82
|
+
// See scripts/bootstrap.ts to modify the generation of this file.
|
|
83
|
+
const config = {};\n`;
|
|
50
84
|
|
|
51
85
|
// Set base configuration values, allowing override with environment variables
|
|
52
86
|
Object.keys(config).forEach((prop) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
computedConfig[prop]?.toString().trim()
|
|
59
|
-
};\n`;
|
|
87
|
+
// Handle undefined values
|
|
88
|
+
const value = config[prop] || '';
|
|
89
|
+
configText += `config.${prop} = process.env.${constantCase(
|
|
90
|
+
prop
|
|
91
|
+
)} || "${value.toString().trim()}";\n`;
|
|
60
92
|
});
|
|
93
|
+
|
|
61
94
|
configText += `module.exports.environment = config;`;
|
|
62
95
|
|
|
63
96
|
const configPath = path.resolve(outputPath);
|
|
64
97
|
console.log(`Writing runtime config to ${configPath}`);
|
|
65
98
|
fs.writeFileSync(configPath, configText, { encoding: 'utf8' });
|
|
66
99
|
}
|
|
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
|
-
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
generatePlugins,
|
|
3
|
+
ModuleType,
|
|
4
|
+
PluginDefinition,
|
|
5
|
+
} from '@sitecore-jss/sitecore-jss-dev-tools';
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
PLUGINS GENERATION
|
|
9
|
+
NOTE: pluginName: the name of the plugin in the src/lib folder
|
|
10
|
+
Generates the `/src/temp/{pluginName}-plugins.ts` file, which exports list of plugins
|
|
11
|
+
|
|
12
|
+
Generating the plugins is optional, and it can be maintained manually if preferred.
|
|
13
|
+
|
|
14
|
+
The default convention uses the plugin's filename (without the extension) as the first part of the component
|
|
15
|
+
name. For example, the file `/lib/page-props-factory/plugins/exampleName.ts` would map to plugin `exampleNamePlugin`.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const pluginDefinitions: PluginDefinition[] = [
|
|
19
|
+
{
|
|
20
|
+
distPath: 'scripts/temp/config-plugins.ts',
|
|
21
|
+
rootPath: 'scripts/config/plugins',
|
|
22
|
+
moduleType: ModuleType.ESM,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
distPath: 'scripts/temp/generate-component-factory-plugins.ts',
|
|
26
|
+
rootPath: 'scripts/generate-component-factory/plugins',
|
|
27
|
+
moduleType: ModuleType.ESM,
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
pluginDefinitions.forEach((definition) => {
|
|
32
|
+
generatePlugins(definition);
|
|
33
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as fetch from 'isomorphic-fetch';
|
|
2
1
|
import * as fs from 'fs';
|
|
3
|
-
import
|
|
2
|
+
import clientFactory from 'lib/graphql-client-factory';
|
|
3
|
+
import { getGraphQLClientFactoryConfig } from 'lib/graphql-client-factory/config';
|
|
4
4
|
|
|
5
5
|
// Apollo Client supports caching GraphQL responses, which can greatly reduce network traffic needs.
|
|
6
6
|
// In order to work correctly with interfaces in GraphQL, it needs to know some basic information about
|
|
@@ -9,28 +9,23 @@ 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
|
-
|
|
12
|
+
import './generate-config';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const clientFactoryConfig = getGraphQLClientFactoryConfig();
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
jssConfig = require('../src/environments/environment').environment;
|
|
18
|
-
} catch (e) {
|
|
19
|
-
console.error(
|
|
20
|
-
'Unable to require JSS config. Ensure `jss setup` has been run, and the app has been started at least once after setup.'
|
|
21
|
-
);
|
|
22
|
-
console.error(e);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
16
|
+
console.log(`Updating GraphQL fragment type data from ${clientFactoryConfig.endpoint}...`);
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
clientFactory()
|
|
19
|
+
.request<{
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
__schema: {
|
|
22
|
+
kind: string;
|
|
23
|
+
name: string;
|
|
24
|
+
types: { possibleTypes?: { name: string } }[];
|
|
25
|
+
};
|
|
26
|
+
}>(
|
|
27
|
+
`
|
|
28
|
+
{
|
|
34
29
|
__schema {
|
|
35
30
|
types {
|
|
36
31
|
kind
|
|
@@ -41,20 +36,18 @@ fetch(jssConfig.graphQLEndpoint, {
|
|
|
41
36
|
}
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})
|
|
47
|
-
.then((result) => result.json())
|
|
39
|
+
`
|
|
40
|
+
)
|
|
48
41
|
.then((result) => {
|
|
49
42
|
// here we're filtering out any type information unrelated to unions or interfaces
|
|
50
|
-
const filteredData = result.
|
|
43
|
+
const filteredData = result.__schema.types.filter((type) => type.possibleTypes !== null);
|
|
51
44
|
|
|
52
45
|
const filteredResult = { ...result };
|
|
53
|
-
filteredResult.
|
|
46
|
+
filteredResult.__schema.types = filteredData;
|
|
54
47
|
|
|
55
48
|
fs.writeFile(
|
|
56
49
|
'./src/graphql-fragment-types.ts',
|
|
57
|
-
`export default ${JSON.stringify(filteredResult
|
|
50
|
+
`export default ${JSON.stringify(filteredResult, null, 2)}`,
|
|
58
51
|
(err) => {
|
|
59
52
|
if (err) {
|
|
60
53
|
console.error('Error writing GraphQLFragmentTypes file', err);
|
|
@@ -4,11 +4,12 @@ import { join } from 'path';
|
|
|
4
4
|
import 'reflect-metadata';
|
|
5
5
|
import 'zone.js';
|
|
6
6
|
import { JssRouteBuilderService } from './src/app/routing/jss-route-builder.service';
|
|
7
|
-
import { environment } from './src/environments/environment';
|
|
8
7
|
import { AppServerModule, renderModule } from './src/main.server';
|
|
9
8
|
|
|
10
9
|
export * from './src/main.server';
|
|
11
10
|
|
|
11
|
+
export * from './server.exports';
|
|
12
|
+
|
|
12
13
|
const http = require('http');
|
|
13
14
|
const https = require('https');
|
|
14
15
|
|
|
@@ -97,7 +98,4 @@ function parseRouteUrl(url: string) {
|
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
const siteName = environment.sitecoreSiteName;
|
|
102
|
-
|
|
103
|
-
export { renderView, parseRouteUrl, setUpDefaultAgents, apiKey, siteName };
|
|
101
|
+
export { renderView, parseRouteUrl, setUpDefaultAgents };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { environment } from './src/environments/environment';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Define the required configuration values to be exported from the server.bundle.ts.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const apiKey = environment.sitecoreApiKey;
|
|
8
|
+
const siteName = environment.sitecoreSiteName;
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
apiKey,
|
|
12
|
+
siteName,
|
|
13
|
+
};
|