create-sitecore-jss 20.0.0-canary.78
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/LICENSE.MD +202 -0
- package/dist/InitializerFactory.js +49 -0
- package/dist/common/Initializer.js +2 -0
- package/dist/common/args/base.js +2 -0
- package/dist/common/args/styleguide.js +2 -0
- package/dist/common/prompts/base.js +40 -0
- package/dist/common/prompts/styleguide.js +28 -0
- package/dist/common/steps/index.js +13 -0
- package/dist/common/steps/install.js +46 -0
- package/dist/common/steps/next.js +60 -0
- package/dist/common/steps/transform.js +185 -0
- package/dist/common/utils/cmd.js +39 -0
- package/dist/common/utils/helpers.js +92 -0
- package/dist/index.js +91 -0
- package/dist/init-runner.js +50 -0
- package/dist/initializers/nextjs/args.js +2 -0
- package/dist/initializers/nextjs/index.js +65 -0
- package/dist/initializers/nextjs/prompts.js +19 -0
- package/dist/initializers/nextjs/remove-dev-dependencies.js +24 -0
- package/dist/initializers/nextjs-styleguide/index.js +49 -0
- package/dist/templates/nextjs/.env +49 -0
- package/dist/templates/nextjs/.eslintrc +25 -0
- package/dist/templates/nextjs/.gitattributes +11 -0
- package/dist/templates/nextjs/.gitignore +33 -0
- package/dist/templates/nextjs/.graphql-let.yml +10 -0
- package/dist/templates/nextjs/.prettierignore +1 -0
- package/dist/templates/nextjs/.prettierrc +8 -0
- package/dist/templates/nextjs/LICENSE.txt +202 -0
- package/dist/templates/nextjs/README.md +3 -0
- package/dist/templates/nextjs/next-env.d.ts +6 -0
- package/dist/templates/nextjs/next.config.js +56 -0
- package/dist/templates/nextjs/package.json +88 -0
- package/dist/templates/nextjs/public/favicon.ico +0 -0
- package/dist/templates/nextjs/public/sc_logo.svg +20 -0
- package/dist/templates/nextjs/scripts/bootstrap.ts +40 -0
- package/dist/templates/nextjs/scripts/fetch-graphql-introspection-data.ts +49 -0
- package/dist/templates/nextjs/scripts/generate-component-factory.ts +95 -0
- package/dist/templates/nextjs/scripts/generate-config.ts +85 -0
- package/dist/templates/nextjs/scripts/generate-plugins.ts +103 -0
- package/dist/templates/nextjs/scripts/scaffold-component.ts +89 -0
- package/dist/templates/nextjs/scripts/templates/component-factory.ts +119 -0
- package/dist/templates/nextjs/scripts/templates/component-src.ts +27 -0
- package/dist/templates/nextjs/scripts/utils.ts +59 -0
- package/dist/templates/nextjs/sitecore/config/{{appName}}.config +151 -0
- package/dist/templates/nextjs/src/Layout.tsx +53 -0
- package/dist/templates/nextjs/src/Navigation.tsx +27 -0
- package/dist/templates/nextjs/src/NotFound.tsx +19 -0
- package/dist/templates/nextjs/src/assets/app.css +28 -0
- package/dist/templates/nextjs/src/components/ContentBlock.tsx +24 -0
- package/dist/templates/nextjs/src/lib/component-props/index.ts +23 -0
- package/dist/templates/nextjs/src/lib/data-fetcher.ts +16 -0
- package/dist/templates/nextjs/src/lib/dictionary-service-factory.ts +30 -0
- package/dist/templates/nextjs/src/lib/layout-service-factory.ts +25 -0
- package/dist/templates/nextjs/src/lib/next-config/plugins/graphql.js +32 -0
- package/dist/templates/nextjs/src/lib/next-config/plugins/monorepo.js +27 -0
- package/dist/templates/nextjs/src/lib/page-props-factory/index.ts +50 -0
- package/dist/templates/nextjs/src/lib/page-props-factory/plugins/componentProps.ts +38 -0
- package/dist/templates/nextjs/src/lib/page-props-factory/plugins/normalMode.ts +75 -0
- package/dist/templates/nextjs/src/lib/page-props-factory/plugins/previewMode.ts +27 -0
- package/dist/templates/nextjs/src/lib/page-props.ts +16 -0
- package/dist/templates/nextjs/src/lib/sitemap-fetcher/index.ts +25 -0
- package/dist/templates/nextjs/src/lib/sitemap-fetcher/plugins/graphqlSitemapService.ts +36 -0
- package/dist/templates/nextjs/src/pages/404.tsx +5 -0
- package/dist/templates/nextjs/src/pages/[[...path]].tsx +91 -0
- package/dist/templates/nextjs/src/pages/_app.tsx +19 -0
- package/dist/templates/nextjs/src/pages/_error.tsx +35 -0
- package/dist/templates/nextjs/src/pages/api/editing/data/[key].ts +24 -0
- package/dist/templates/nextjs/src/pages/api/editing/render.ts +30 -0
- package/dist/templates/nextjs/src/temp/.gitignore +3 -0
- package/dist/templates/nextjs/src/temp/GraphQLIntrospectionResult.json +22216 -0
- package/dist/templates/nextjs/tsconfig.json +42 -0
- package/dist/templates/nextjs/tsconfig.scripts.json +6 -0
- package/dist/templates/nextjs-styleguide/data/component-content/.gitignore +0 -0
- package/dist/templates/nextjs-styleguide/data/component-content/Styleguide/ContentReuse/LoremIpsumContentBlock/en.yml +9 -0
- package/dist/templates/nextjs-styleguide/data/content/.gitignore +0 -0
- package/dist/templates/nextjs-styleguide/data/content/Styleguide/ContentListField/Item1/en.yml +6 -0
- package/dist/templates/nextjs-styleguide/data/content/Styleguide/ContentListField/Item2/en.yml +6 -0
- package/dist/templates/nextjs-styleguide/data/content/Styleguide/ItemLinkField/Item1/en.yml +6 -0
- package/dist/templates/nextjs-styleguide/data/content/Styleguide/ItemLinkField/Item2/en.yml +6 -0
- package/dist/templates/nextjs-styleguide/data/dictionary/en.yml +4 -0
- package/dist/templates/nextjs-styleguide/data/dictionary/{{language}}.yml +4 -0
- package/dist/templates/nextjs-styleguide/data/media/files/jss.pdf +0 -0
- package/dist/templates/nextjs-styleguide/data/media/img/jss_logo.png +0 -0
- package/dist/templates/nextjs-styleguide/data/media/img/sc_logo.png +0 -0
- package/dist/templates/nextjs-styleguide/data/routes/en.yml +63 -0
- package/dist/templates/nextjs-styleguide/data/routes/graphql/en.yml +27 -0
- package/dist/templates/nextjs-styleguide/data/routes/graphql/sample-1/en.yml +9 -0
- package/dist/templates/nextjs-styleguide/data/routes/graphql/sample-2/en.yml +9 -0
- package/dist/templates/nextjs-styleguide/data/routes/styleguide/custom-route-type/en.yml +12 -0
- package/dist/templates/nextjs-styleguide/data/routes/styleguide/en.yml +246 -0
- package/dist/templates/nextjs-styleguide/data/routes/styleguide/{{language}}.yml +25 -0
- package/dist/templates/nextjs-styleguide/data/routes/{{language}}.yml +4 -0
- package/dist/templates/nextjs-styleguide/package.json +13 -0
- package/dist/templates/nextjs-styleguide/scripts/disconnected-mode-proxy.ts +48 -0
- package/dist/templates/nextjs-styleguide/scripts/scaffold-component.ts +130 -0
- package/dist/templates/nextjs-styleguide/scripts/templates/component-manifest.ts +30 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/component-content.sitecore.ts +117 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/ContentBlock.sitecore.ts +19 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Checkbox.sitecore.ts +23 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-ContentList.sitecore.ts +32 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Custom.sitecore.ts +23 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Date.sitecore.ts +23 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-File.sitecore.ts +20 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Image.sitecore.ts +23 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-ItemLink.sitecore.ts +32 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Link.sitecore.ts +25 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Number.sitecore.ts +20 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-RichText.sitecore.ts +28 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Text.sitecore.ts +28 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/graphql/GraphQL-ConnectedDemo.sitecore.ts +18 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/graphql/GraphQL-IntegratedDemo.sitecore.graphql +71 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/graphql/GraphQL-IntegratedDemo.sitecore.ts +25 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/graphql/GraphQL-Layout.sitecore.ts +15 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-ComponentParams.sitecore.ts +20 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-CustomRouteType.sitecore.ts +31 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Layout-Reuse.sitecore.ts +20 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Layout-Tabs-Tab.sitecore.ts +23 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Layout-Tabs.sitecore.ts +20 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Layout.sitecore.ts +15 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Multilingual.sitecore.ts +26 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-RouteFields.sitecore.ts +22 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Section.sitecore.ts +16 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-SitecoreContext.sitecore.ts +19 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Tracking.sitecore.ts +19 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/config.js +5 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/content.sitecore.ts +117 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/dictionary.sitecore.ts +52 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/placeholders.sitecore.ts +21 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/routes.sitecore.ts +88 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/templates/Styleguide-ContentList-Template.sitecore.ts +12 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/templates/Styleguide-Explanatory-Component.sitecore.ts +20 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/templates/Styleguide-ItemLink-Template.sitecore.ts +13 -0
- package/dist/templates/nextjs-styleguide/src/Navigation.tsx +41 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Checkbox.tsx +52 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-ContentList.tsx +58 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Custom.tsx +25 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Date.tsx +55 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-File.tsx +30 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Image.tsx +58 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-ItemLink.tsx +50 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Link.tsx +46 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Number.tsx +34 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-RichText.tsx +35 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Text.tsx +43 -0
- package/dist/templates/nextjs-styleguide/src/components/graphql/GraphQL-ConnectedDemo.dynamic.graphql +69 -0
- package/dist/templates/nextjs-styleguide/src/components/graphql/GraphQL-ConnectedDemo.dynamic.tsx +148 -0
- package/dist/templates/nextjs-styleguide/src/components/graphql/GraphQL-IntegratedDemo.tsx +130 -0
- package/dist/templates/nextjs-styleguide/src/components/graphql/GraphQL-Layout.tsx +37 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-ComponentParams.tsx +47 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-CustomRouteType.tsx +37 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout-Reuse.tsx +45 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout-Tabs-Tab.tsx +41 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout-Tabs.tsx +111 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout.tsx +68 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Multilingual.tsx +50 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-RouteFields.tsx +37 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Section.tsx +22 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-SitecoreContext.tsx +25 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Specimen.tsx +41 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Tracking.tsx +341 -0
- package/dist/templates/nextjs-styleguide/src/lib/component-props/styleguide.ts +11 -0
- package/dist/templates/nextjs-styleguide/src/lib/next-config/plugins/disconnected.js +43 -0
- package/dist/templates/nextjs-styleguide/src/lib/next-config/plugins/styleguide.js +10 -0
- package/dist/templates/nextjs-styleguide/src/lib/sitemap-fetcher/plugins/disconnectedSitemapService.ts +46 -0
- package/dist/templates/nextjs-styleguide/src/pages/_app.tsx +33 -0
- package/package.json +61 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"paths": {
|
|
5
|
+
"components/*": ["src/components/*"],
|
|
6
|
+
"lib/*": ["src/lib/*"],
|
|
7
|
+
"temp/*": ["src/temp/*"],
|
|
8
|
+
"assets/*": ["src/assets/*"]
|
|
9
|
+
},
|
|
10
|
+
"target": "es5",
|
|
11
|
+
"lib": [
|
|
12
|
+
"dom",
|
|
13
|
+
"dom.iterable",
|
|
14
|
+
"esnext"
|
|
15
|
+
],
|
|
16
|
+
"allowJs": true,
|
|
17
|
+
"skipLibCheck": true,
|
|
18
|
+
"strict": true,
|
|
19
|
+
"strictFunctionTypes": false,
|
|
20
|
+
"forceConsistentCasingInFileNames": true,
|
|
21
|
+
"downlevelIteration": true,
|
|
22
|
+
"noEmit": true,
|
|
23
|
+
"esModuleInterop": true,
|
|
24
|
+
"module": "esnext",
|
|
25
|
+
"moduleResolution": "node",
|
|
26
|
+
"resolveJsonModule": true,
|
|
27
|
+
"isolatedModules": true,
|
|
28
|
+
"jsx": "preserve",
|
|
29
|
+
"allowSyntheticDefaultImports": true,
|
|
30
|
+
"noImplicitReturns": true,
|
|
31
|
+
"noUnusedLocals": true,
|
|
32
|
+
"noUnusedParameters": true
|
|
33
|
+
},
|
|
34
|
+
"include": [
|
|
35
|
+
"next-env.d.ts",
|
|
36
|
+
"**/*.ts",
|
|
37
|
+
"**/*.tsx",
|
|
38
|
+
],
|
|
39
|
+
"exclude": [
|
|
40
|
+
"node_modules"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# We can reuse this content definition in multiple places because it:
|
|
2
|
+
# - has an ID
|
|
3
|
+
# - is under component-content (normally) or content
|
|
4
|
+
# Reuse is accomplished by referencing the content by ID in a route definition.
|
|
5
|
+
id: lorem-ipsum-content-block
|
|
6
|
+
componentName: ContentBlock
|
|
7
|
+
displayName: Lorem Ipsum Dolor Sit Amet
|
|
8
|
+
fields:
|
|
9
|
+
content: <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque felis mauris, pretium id neque vitae, vulputate pellentesque tortor. Mauris hendrerit dolor et ipsum lobortis bibendum non finibus neque. Morbi volutpat aliquam magna id posuere. Duis commodo cursus dui, nec interdum velit congue nec. Aliquam erat volutpat. Aliquam facilisis, sapien quis fringilla tincidunt, magna nulla feugiat neque, a consectetur arcu orci eu augue.</p>
|
|
File without changes
|
package/dist/templates/nextjs-styleguide/data/content/Styleguide/ContentListField/Item1/en.yml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
id: styleguide-content-list-field-shared-1
|
|
2
|
+
displayName: Styleguide Content List Item 1 (Shared)
|
|
3
|
+
# Template defines the available fields. See /sitecore/definitions/templates/Styleguide-ContentList-Template.sitecore.js
|
|
4
|
+
template: <%- helper.getAppPrefix(appPrefix, appName) %>Styleguide-ContentList-Item-Template
|
|
5
|
+
fields:
|
|
6
|
+
textField: ContentList Demo (Shared) Item 1 Text Field
|
package/dist/templates/nextjs-styleguide/data/content/Styleguide/ContentListField/Item2/en.yml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
id: styleguide-content-list-field-shared-2
|
|
2
|
+
displayName: Styleguide Content List Item 2 (Shared)
|
|
3
|
+
# Template defines the available fields. See /sitecore/definitions/templates/Styleguide-ContentList-Template.sitecore.js
|
|
4
|
+
template: <%- helper.getAppPrefix(appPrefix, appName) %>Styleguide-ContentList-Item-Template
|
|
5
|
+
fields:
|
|
6
|
+
textField: ContentList Demo (Shared) Item 2 Text Field
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
id: styleguide-item-link-field-shared-1
|
|
2
|
+
displayName: Styleguide Item Link Item 1 (Shared)
|
|
3
|
+
# Template defines the available fields. See /sitecore/definitions/templates/Styleguide-ItemLink-Template.sitecore.js
|
|
4
|
+
template: <%- helper.getAppPrefix(appPrefix, appName) %>Styleguide-ItemLink-Item-Template
|
|
5
|
+
fields:
|
|
6
|
+
textField: ItemLink Demo (Shared) Item 1 Text Field
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
id: styleguide-item-link-field-shared-2
|
|
2
|
+
displayName: Styleguide Item Link Item 2 (Shared)
|
|
3
|
+
# Template defines the available fields. See /sitecore/definitions/templates/Styleguide-ItemLink-Template.sitecore.js
|
|
4
|
+
template: <%- helper.getAppPrefix(appPrefix, appName) %>Styleguide-ItemLink-Item-Template
|
|
5
|
+
fields:
|
|
6
|
+
textField: ItemLink Demo (Shared) Item 2 Text Field
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# This is a route layout definition.
|
|
2
|
+
# The route definition defines which Sitecore components are present on a route,
|
|
3
|
+
# what their content data is, and which _placeholder_ they are placed in.
|
|
4
|
+
|
|
5
|
+
# This particular route definition is for the home route - '/', so it defines the
|
|
6
|
+
# components shown on the initial page of the app.
|
|
7
|
+
|
|
8
|
+
# You may use equivalent JSON files instead of YAML if you prefer;
|
|
9
|
+
# however YAML is simpler to read and allows comments like this one :)
|
|
10
|
+
|
|
11
|
+
# Setting an ID is optional, but it will allow referring to this item in internal links
|
|
12
|
+
# the ID can be a app-wide-unique string, or a GUID value.
|
|
13
|
+
id: home-page
|
|
14
|
+
|
|
15
|
+
# Route-level fields are appropriate for page level data like <title> contents
|
|
16
|
+
# Define route level fields in /sitecore/definitions/routes.sitecore
|
|
17
|
+
fields:
|
|
18
|
+
pageTitle: Welcome to Sitecore JSS
|
|
19
|
+
# Define the page layout starting at the root placeholder - in this case, '<%- helper.getAppPrefix(appPrefix, appName) %>jss-main'
|
|
20
|
+
# root placeholder names are defined in the package.json config section (required for Sitecore deployment)
|
|
21
|
+
placeholders:
|
|
22
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-main:
|
|
23
|
+
- componentName: ContentBlock
|
|
24
|
+
fields:
|
|
25
|
+
heading: Welcome to Sitecore JSS
|
|
26
|
+
# to author content in YAML, use _multi-line values_ (prefixed with | + endline)
|
|
27
|
+
# as long as the same indent is preserved at the beginning of each line, no escaping
|
|
28
|
+
# is required at all in the value, making it easy to read
|
|
29
|
+
content: |
|
|
30
|
+
<p>Thanks for using JSS!! Here are some resources to get you started:</p>
|
|
31
|
+
|
|
32
|
+
<h3><a href="https://jss.sitecore.com" rel="noopener noreferrer">Documentation</a></h3>
|
|
33
|
+
<p>The official JSS documentation can help you with any JSS task from getting started to advanced techniques.</p>
|
|
34
|
+
|
|
35
|
+
<h3><a href="/styleguide">Styleguide</a></h3>
|
|
36
|
+
<p>The JSS styleguide is a living example of how to use JSS, hosted right in this app.
|
|
37
|
+
It demonstrates most of the common patterns that JSS implementations may need to use,
|
|
38
|
+
as well as useful architectural patterns.</p>
|
|
39
|
+
|
|
40
|
+
<h3><a href="/graphql">GraphQL</a></h3>
|
|
41
|
+
<p>JSS features integration with the Sitecore GraphQL API to enable fetching non-route data from Sitecore - or from other internal backends as an API aggregator or proxy.
|
|
42
|
+
This route is a living example of how to use an integrate with GraphQL data in a JSS app.</p>
|
|
43
|
+
|
|
44
|
+
<div class="alert alert-dark">
|
|
45
|
+
<h4>This app is a boilerplate</h4>
|
|
46
|
+
<p>The JSS samples are a boilerplate, not a library. That means that any code in this app is meant for you to own and customize to your own requirements.</p>
|
|
47
|
+
<p>Want to change the lint settings? Do it. Want to read manifest data from a MongoDB database? Go for it. This app is yours.</p>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div class="alert alert-dark">
|
|
51
|
+
<h4>How to start with an empty app</h4>
|
|
52
|
+
<p>To start with a fresh app with no boilerplate, run <code>jss create {name of your app} nextjs --empty</code>. Note, disconnected mode is not supported this way</p>
|
|
53
|
+
<p>To remove all of the default sample content (the Styleguide and GraphQL routes) and start out with an empty JSS app:</p>
|
|
54
|
+
<ol>
|
|
55
|
+
<li>Delete <code>/data/dictionary/*.yml</code></li>
|
|
56
|
+
<li>Delete <code>/data/routes/styleguide</code> and <code>/data/routes/graphql</code></li>
|
|
57
|
+
<li>Delete <code>/data/content/Styleguide</code></li>
|
|
58
|
+
<li>Delete <code>/data/component-content/Styleguide</code></li>
|
|
59
|
+
<li>Delete <code>/sitecore/definitions/components/Styleguide*</code>, <code>/sitecore/definitions/templates/Styleguide*</code>, and <code>/sitecore/definitions/components/GraphQL*</code></li>
|
|
60
|
+
<li>Delete <code>graphql-let</code> command from <code>bootstrap</code> npm command in <code>package.json</code> until you create <code>.graphql</code> files</li>
|
|
61
|
+
<li>Delete <code>/src/components/*</code></li>
|
|
62
|
+
</ol>
|
|
63
|
+
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
fields:
|
|
2
|
+
pageTitle: GraphQL | Sitecore JSS
|
|
3
|
+
placeholders:
|
|
4
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-main:
|
|
5
|
+
- componentName: ContentBlock
|
|
6
|
+
fields:
|
|
7
|
+
heading: Using GraphQL with JSS
|
|
8
|
+
content: |
|
|
9
|
+
<p>This is a live example of using Integrated GraphQL and Connected GraphQL with a JSS app.
|
|
10
|
+
For more information on GraphQL use in JSS, please see <a href="https://jss.sitecore.com" target="_blank" rel="noopener noreferrer">the documentation</a>.</p>
|
|
11
|
+
- componentName: GraphQL-Layout
|
|
12
|
+
placeholders:
|
|
13
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-graphql-layout:
|
|
14
|
+
- componentName: GraphQL-IntegratedDemo
|
|
15
|
+
fields:
|
|
16
|
+
sample1: Hello integrated GraphQL world!
|
|
17
|
+
sample2:
|
|
18
|
+
href: https://www.sitecore.com
|
|
19
|
+
target: _blank
|
|
20
|
+
text: GraphQL lets you get structured field data too
|
|
21
|
+
- componentName: GraphQL-ConnectedDemo
|
|
22
|
+
fields:
|
|
23
|
+
sample1: Hello connected GraphQL world!
|
|
24
|
+
sample2:
|
|
25
|
+
href: https://www.sitecore.com
|
|
26
|
+
target: _blank
|
|
27
|
+
text: GraphQL lets you get structured field data too
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
fields:
|
|
2
|
+
pageTitle: Sample 1 Page Title
|
|
3
|
+
placeholders:
|
|
4
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-main:
|
|
5
|
+
- componentName: ContentBlock
|
|
6
|
+
fields:
|
|
7
|
+
heading: GraphQL Sample 1
|
|
8
|
+
content: |
|
|
9
|
+
<p>A child route here to illustrate the power of GraphQL queries. <a href="/graphql">Back to GraphQL route</a></p>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
fields:
|
|
2
|
+
pageTitle: Sample 2 Page Title
|
|
3
|
+
placeholders:
|
|
4
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-main:
|
|
5
|
+
- componentName: ContentBlock
|
|
6
|
+
fields:
|
|
7
|
+
heading: GraphQL Sample 2
|
|
8
|
+
content: |
|
|
9
|
+
<p>A child route here to illustrate the power of GraphQL queries. <a href="/graphql">Back to GraphQL route</a></p>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Using a Custom Route Type enables adding more field data to the route level.
|
|
2
|
+
template: <%- helper.getAppPrefix(appPrefix, appName) %>ExampleCustomRouteType
|
|
3
|
+
fields:
|
|
4
|
+
# Note that custom route types inherit from the default route type automatically.
|
|
5
|
+
# This is what makes the `pageTitle` field available here, when it's not defined on the custom route type.
|
|
6
|
+
pageTitle: Custom Route Type | Sitecore JSS
|
|
7
|
+
headline: A Treatise on Route-Level Fields in JSS
|
|
8
|
+
author: Myrtle
|
|
9
|
+
content: <p>Custom route type fields are good for things like articles, where you may wish to have a filter UI on content fields, such as author or category. Route level fields are easy to query against, whereas component-level fields are not because it's possible to remove a component from a route. Note that route level fields <em>cannot be personalized</em> because you cannot conditionally swap out the route item for a different content item.</p>
|
|
10
|
+
placeholders:
|
|
11
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-main:
|
|
12
|
+
- componentName: Styleguide-CustomRouteType
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
fields:
|
|
2
|
+
pageTitle: Styleguide | Sitecore JSS
|
|
3
|
+
placeholders:
|
|
4
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-main:
|
|
5
|
+
- componentName: ContentBlock
|
|
6
|
+
fields:
|
|
7
|
+
heading: JSS Styleguide
|
|
8
|
+
content: |
|
|
9
|
+
<p>This is a live set of examples of how to use JSS. For more information on using JSS, please see <a href="https://jss.sitecore.com" target="_blank" rel="noopener noreferrer">the documentation</a>.</p>
|
|
10
|
+
<p>The content and layout of this page is defined in <code>/data/routes/styleguide/en.yml</code></p>
|
|
11
|
+
- componentName: Styleguide-Layout
|
|
12
|
+
placeholders:
|
|
13
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-styleguide-layout:
|
|
14
|
+
- componentName: Styleguide-Section
|
|
15
|
+
fields:
|
|
16
|
+
heading: Content Data
|
|
17
|
+
placeholders:
|
|
18
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-styleguide-section:
|
|
19
|
+
- componentName: Styleguide-FieldUsage-Text
|
|
20
|
+
fields:
|
|
21
|
+
heading: Single-Line Text
|
|
22
|
+
sample: This is a sample text field. <mark>HTML is encoded.</mark> In Sitecore, editors will see a <input type="text">.
|
|
23
|
+
sample2: This is another sample text field using rendering options. <mark>HTML supported with encode=false.</mark> Cannot edit because editable=false.
|
|
24
|
+
- componentName: Styleguide-FieldUsage-Text
|
|
25
|
+
fields:
|
|
26
|
+
heading: Multi-Line Text
|
|
27
|
+
description: '<small>Multi-line text tells Sitecore to use a <code>textarea</code> for editing; consumption in JSS is the same as single-line text.</small>'
|
|
28
|
+
sample: This is a sample multi-line text field. <mark>HTML is encoded.</mark> In Sitecore, editors will see a textarea.
|
|
29
|
+
sample2: This is another sample multi-line text field using rendering options. <mark>HTML supported with encode=false.</mark>
|
|
30
|
+
- componentName: Styleguide-FieldUsage-RichText
|
|
31
|
+
fields:
|
|
32
|
+
heading: Rich Text
|
|
33
|
+
sample: <p>This is a sample rich text field. <mark>HTML is always supported.</mark> In Sitecore, editors will see a WYSIWYG editor for these fields.</p>
|
|
34
|
+
# YAML can use multiline definitions (a pipe followed by an indented block) to make writing rich text content easier.
|
|
35
|
+
# As long as the indent remains consistent, no escaping is required.
|
|
36
|
+
sample2: |
|
|
37
|
+
<p>Another sample rich text field, using options. Keep markup entered in rich text fields as simple as possible - ideally bare tags only (no classes). Adding a wrapping class can help with styling within rich text blocks.</p>
|
|
38
|
+
<marquee>But you can use any valid HTML in a rich text field!</marquee>
|
|
39
|
+
- componentName: Styleguide-FieldUsage-Image
|
|
40
|
+
fields:
|
|
41
|
+
heading: Image
|
|
42
|
+
sample1:
|
|
43
|
+
src: /data/media/img/sc_logo.png
|
|
44
|
+
alt: Sitecore Logo
|
|
45
|
+
sample2:
|
|
46
|
+
src: /data/media/img/jss_logo.png
|
|
47
|
+
alt: Sitecore JSS Logo
|
|
48
|
+
- componentName: Styleguide-FieldUsage-File
|
|
49
|
+
fields:
|
|
50
|
+
heading: File
|
|
51
|
+
description: |
|
|
52
|
+
<small>Note: Sitecore does not support inline editing of File fields. The value must be edited in Experience Editor by using the edit rendering fields button (looks like a pencil) with the whole component selected.</small>
|
|
53
|
+
file:
|
|
54
|
+
src: /data/media/files/jss.pdf
|
|
55
|
+
title: Example File
|
|
56
|
+
description: This data will be added to the Sitecore Media Library on import
|
|
57
|
+
- componentName: Styleguide-FieldUsage-Number
|
|
58
|
+
fields:
|
|
59
|
+
heading: Number
|
|
60
|
+
description: '<small>Number tells Sitecore to use a number entry for editing.</small>'
|
|
61
|
+
sample: 1.21
|
|
62
|
+
- componentName: Styleguide-FieldUsage-Checkbox
|
|
63
|
+
fields:
|
|
64
|
+
heading: Checkbox
|
|
65
|
+
description: |
|
|
66
|
+
<small>Note: Sitecore does not support inline editing of Checkbox fields. The value must be edited in Experience Editor by using the edit rendering fields button (looks like a pencil) with the whole component selected.</small>
|
|
67
|
+
checkbox: true
|
|
68
|
+
checkbox2: false
|
|
69
|
+
- componentName: Styleguide-FieldUsage-Date
|
|
70
|
+
fields:
|
|
71
|
+
heading: Date
|
|
72
|
+
description: |
|
|
73
|
+
<p><small>Both <code>Date</code> and <code>DateTime</code> field types are available. Choosing <code>DateTime</code> will make Sitecore show editing UI for time; both types store complete date and time values internally. Date values in JSS are formatted using <a href="https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations" target="_blank">ISO 8601 formatted strings</a>, for example <code>2012-04-23T18:25:43.511Z</code>.</small></p>
|
|
74
|
+
<div class="alert alert-warning"><small>Note: this is a JavaScript date format (e.g. <code>new Date().toISOString()</code>), and is different from how Sitecore stores date field values internally. Sitecore-formatted dates will not work.</small></div>
|
|
75
|
+
date: '2012-05-04T00:00:00Z'
|
|
76
|
+
dateTime: '2018-03-14T15:00:00Z'
|
|
77
|
+
- componentName: Styleguide-FieldUsage-Link
|
|
78
|
+
fields:
|
|
79
|
+
heading: General Link
|
|
80
|
+
description: <p>A <em>General Link</em> is a field that represents an <code><a></code> tag.</p>
|
|
81
|
+
externalLink:
|
|
82
|
+
href: https://www.sitecore.com
|
|
83
|
+
text: Link to Sitecore
|
|
84
|
+
# absolute URLs to known routes are converted into 'internal links'
|
|
85
|
+
# when imported to Sitecore. Note: target route must have an explicitly specified ID value.
|
|
86
|
+
internalLink:
|
|
87
|
+
href: /
|
|
88
|
+
# 'text' is optional if the link is rendered with a custom body (e.g. child HTML)
|
|
89
|
+
|
|
90
|
+
# Will be linked to Sitecore media item on import
|
|
91
|
+
mediaLink:
|
|
92
|
+
href: /data/media/files/jss.pdf
|
|
93
|
+
text: Link to PDF
|
|
94
|
+
emailLink:
|
|
95
|
+
href: mailto:foo@bar.com
|
|
96
|
+
text: Send an Email
|
|
97
|
+
# All possible link parameters
|
|
98
|
+
paramsLink:
|
|
99
|
+
href: https://dev.sitecore.net
|
|
100
|
+
text: Sitecore Dev Site
|
|
101
|
+
target: _blank
|
|
102
|
+
class: font-weight-bold
|
|
103
|
+
title: <a> title attribute
|
|
104
|
+
- componentName: Styleguide-FieldUsage-ItemLink
|
|
105
|
+
fields:
|
|
106
|
+
heading: Item Link
|
|
107
|
+
description: |
|
|
108
|
+
<p>
|
|
109
|
+
<small>
|
|
110
|
+
Item Links are a way to reference another content item to use data from it.
|
|
111
|
+
Referenced items may be shared.
|
|
112
|
+
To reference multiple content items, use a <em>Content List</em> field.<br />
|
|
113
|
+
<strong>Note:</strong> Sitecore does not support inline editing of Item Link fields. The value must be edited in Experience Editor by using the edit rendering fields button (looks like a pencil) with the whole component selected.
|
|
114
|
+
</small>
|
|
115
|
+
</p>
|
|
116
|
+
# A shared item link gets its available items from a folder of shared content items.
|
|
117
|
+
# Common usages for such a field might be choosing from a controlled list of options,
|
|
118
|
+
# perhaps theme colors, alignment options, or switchable shared content blocks (author bios, for example)
|
|
119
|
+
sharedItemLink:
|
|
120
|
+
# see /data/content/Styleguide/ItemLinkField for definition of this IDs
|
|
121
|
+
id: styleguide-item-link-field-shared-1
|
|
122
|
+
localItemLink:
|
|
123
|
+
template: <%- helper.getAppPrefix(appPrefix, appName) %>Styleguide-ItemLink-Item-Template
|
|
124
|
+
fields:
|
|
125
|
+
textField: Referenced item textField
|
|
126
|
+
- componentName: Styleguide-FieldUsage-ContentList
|
|
127
|
+
fields:
|
|
128
|
+
heading: Content List
|
|
129
|
+
description: |
|
|
130
|
+
<p>
|
|
131
|
+
<small>
|
|
132
|
+
Content Lists are a way to reference zero or more other content items.
|
|
133
|
+
Referenced items may be shared.
|
|
134
|
+
To reference a single content item, use an <em>Item Link</em> field.<br />
|
|
135
|
+
<strong>Note:</strong> Sitecore does not support inline editing of Content List fields. The value must be edited in Experience Editor by using the edit rendering fields button (looks like a pencil) with the whole component selected.
|
|
136
|
+
</small>
|
|
137
|
+
</p>
|
|
138
|
+
# A shared content list gets its available items from a folder of shared content items.
|
|
139
|
+
# NOTE: items referenced here are only the _selected items_, not the whole corpus of available options.
|
|
140
|
+
# Common usages for such a field might be choosing data items for repeating structures like
|
|
141
|
+
# multicolumnar promos or tabs, or shared content pieces like linking one or more authors to an article.
|
|
142
|
+
sharedContentList:
|
|
143
|
+
# see /data/content/Styleguide/ContentListField for definitions of these IDs
|
|
144
|
+
- id: styleguide-content-list-field-shared-1
|
|
145
|
+
- id: styleguide-content-list-field-shared-2
|
|
146
|
+
localContentList:
|
|
147
|
+
# You can also define content lists using an _array of local item definitions_
|
|
148
|
+
# note that names are default auto-generated to be unique. Explicitly specified names must be unique.
|
|
149
|
+
# NOTE: local item definitions cannot be shared with other content list fields, and are
|
|
150
|
+
# generally not preferable compared to using shared definitions.
|
|
151
|
+
- template: <%- helper.getAppPrefix(appPrefix, appName) %>Styleguide-ContentList-Item-Template
|
|
152
|
+
fields:
|
|
153
|
+
textField: Hello World Item 1
|
|
154
|
+
- template: <%- helper.getAppPrefix(appPrefix, appName) %>Styleguide-ContentList-Item-Template
|
|
155
|
+
fields:
|
|
156
|
+
textField: Hello World Item 2
|
|
157
|
+
- componentName: Styleguide-FieldUsage-Custom
|
|
158
|
+
fields:
|
|
159
|
+
heading: Custom Fields
|
|
160
|
+
description: |
|
|
161
|
+
<p>
|
|
162
|
+
<small>
|
|
163
|
+
Any Sitecore field type can be consumed by JSS.
|
|
164
|
+
In this sample we consume the <em>Integer</em> field type.<br />
|
|
165
|
+
<strong>Note:</strong> For field types with complex data, custom <code>FieldSerializer</code>s may need to be implemented on the Sitecore side.
|
|
166
|
+
</small>
|
|
167
|
+
</p>
|
|
168
|
+
customIntField: 31337
|
|
169
|
+
- componentName: Styleguide-Section
|
|
170
|
+
fields:
|
|
171
|
+
heading: Layout Patterns
|
|
172
|
+
placeholders:
|
|
173
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-header:
|
|
174
|
+
- componentName: Styleguide-Layout-Reuse
|
|
175
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-styleguide-section:
|
|
176
|
+
- componentName: Styleguide-Layout-Reuse
|
|
177
|
+
fields:
|
|
178
|
+
heading: Reusing Content
|
|
179
|
+
description: <p>JSS provides powerful options to reuse content, whether it's sharing a common piece of text across pages or sketching out a site with repeating <em>lorem ipsum</em> content.</p>
|
|
180
|
+
placeholders:
|
|
181
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-reuse-example:
|
|
182
|
+
# Reference shared content using its ID (this is defined in /data/component/content/Styleguide/ContentReuse/LoremIpsumContentBlock/en.yml)
|
|
183
|
+
# Shared content is an 'edit once, reflected everywhere' operation for a content author.
|
|
184
|
+
- id: lorem-ipsum-content-block
|
|
185
|
+
- id: lorem-ipsum-content-block
|
|
186
|
+
# Referencing shared content with `copy: true` will cause it to be shared while disconnected, but _copied on import_.
|
|
187
|
+
# Use this for quickly comping layouts with FPO content that will not be shared once actual content is entered.
|
|
188
|
+
- id: lorem-ipsum-content-block
|
|
189
|
+
copy: true
|
|
190
|
+
- componentName: ContentBlock
|
|
191
|
+
fields:
|
|
192
|
+
content: <p>Mix and match reused and local content. Check out <code>/data/routes/styleguide/en.yml</code> to see how.</p>
|
|
193
|
+
- componentName: Styleguide-Layout-Tabs
|
|
194
|
+
fields:
|
|
195
|
+
heading: Tabs
|
|
196
|
+
description: <p>Creating hierarchical components like tabs is made simpler in JSS because it's easy to introspect the layout structure.</p>
|
|
197
|
+
placeholders:
|
|
198
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-tabs:
|
|
199
|
+
- componentName: Styleguide-Layout-Tabs-Tab
|
|
200
|
+
fields:
|
|
201
|
+
title: Tab 1
|
|
202
|
+
content: <p>Tab 1 contents!</p>
|
|
203
|
+
- componentName: Styleguide-Layout-Tabs-Tab
|
|
204
|
+
fields:
|
|
205
|
+
title: Tab 2
|
|
206
|
+
content: <p>Tab 2 contents!</p>
|
|
207
|
+
- componentName: Styleguide-Layout-Tabs-Tab
|
|
208
|
+
fields:
|
|
209
|
+
title: Tab 3
|
|
210
|
+
content: <p>Tab 3 contents!</p>
|
|
211
|
+
- componentName: Styleguide-Section
|
|
212
|
+
fields:
|
|
213
|
+
heading: Sitecore Patterns
|
|
214
|
+
placeholders:
|
|
215
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-styleguide-section:
|
|
216
|
+
- componentName: Styleguide-SitecoreContext
|
|
217
|
+
fields:
|
|
218
|
+
heading: Sitecore Context
|
|
219
|
+
description: <p><small>The Sitecore Context contains route-level data about the current context - for example, <code>pageState</code> enables conditionally executing code based on whether Sitecore is in Experience Editor or not.</small></p>
|
|
220
|
+
- componentName: Styleguide-RouteFields
|
|
221
|
+
fields:
|
|
222
|
+
heading: Route-level Fields
|
|
223
|
+
description: <p><small>Route-level content fields are defined on the <em>route</em> instead of on a <em>component</em>. This allows multiple components to share the field data on the same route - and querying is much easier on route level fields, making <em>custom route types</em> ideal for filterable/queryable data such as articles.</small></p>
|
|
224
|
+
- componentName: Styleguide-ComponentParams
|
|
225
|
+
fields:
|
|
226
|
+
heading: Component Params
|
|
227
|
+
description: <p><small>Component params (also called Rendering Parameters) allow storing non-content parameters for a component. These params should be used for more technical options such as CSS class names or structural settings.</small></p>
|
|
228
|
+
params:
|
|
229
|
+
cssClass: alert alert-success
|
|
230
|
+
# IMPORTANT: while params can be defined in the manifest as non-string types,
|
|
231
|
+
# they are always sent to the component as strings.
|
|
232
|
+
columns: 5
|
|
233
|
+
useCallToAction: true
|
|
234
|
+
- componentName: Styleguide-Tracking
|
|
235
|
+
fields:
|
|
236
|
+
heading: Tracking
|
|
237
|
+
description: <p><small>JSS supports tracking Sitecore analytics events from within apps. Give it a try with this handy interactive demo.</small></p>
|
|
238
|
+
- componentName: Styleguide-Section
|
|
239
|
+
fields:
|
|
240
|
+
heading: Multilingual Patterns
|
|
241
|
+
placeholders:
|
|
242
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-styleguide-section:
|
|
243
|
+
- componentName: Styleguide-Multilingual
|
|
244
|
+
fields:
|
|
245
|
+
heading: Translation Patterns
|
|
246
|
+
sample: This text can be translated in en.yml
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
fields:
|
|
2
|
+
pageTitle: Styleguide | Sitecore JSS
|
|
3
|
+
placeholders:
|
|
4
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-main:
|
|
5
|
+
- componentName: ContentBlock
|
|
6
|
+
fields:
|
|
7
|
+
heading: JSS Styleguide
|
|
8
|
+
content: |
|
|
9
|
+
<div class="alert alert-primary">
|
|
10
|
+
This is a partial <%- language %> translation of the JSS Styleguide to demonstrate translation functionality.
|
|
11
|
+
Use the <a href="/en/styleguide">English version</a> for full content.
|
|
12
|
+
</div>
|
|
13
|
+
<p>The content and layout of this page is defined in <code>/data/routes/styleguide/<%- language %>.yml</code></p>
|
|
14
|
+
- componentName: Styleguide-Layout
|
|
15
|
+
placeholders:
|
|
16
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-styleguide-layout:
|
|
17
|
+
- componentName: Styleguide-Section
|
|
18
|
+
fields:
|
|
19
|
+
heading: Multilingual Patterns
|
|
20
|
+
placeholders:
|
|
21
|
+
<%- helper.getAppPrefix(appPrefix, appName) %>jss-styleguide-section:
|
|
22
|
+
- componentName: Styleguide-Multilingual
|
|
23
|
+
fields:
|
|
24
|
+
heading: Translation Patterns
|
|
25
|
+
sample: This text can be translated in <%- language %>.yml
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dependencies": {
|
|
3
|
+
"bootstrap": "^4.3.1",
|
|
4
|
+
"nprogress": "~0.2.0"
|
|
5
|
+
},
|
|
6
|
+
"devDependencies": {
|
|
7
|
+
"@sitecore-jss/sitecore-jss-dev-tools": "^20.0.0-canary"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "cross-env-shell JSS_MODE=disconnected \"npm-run-all --serial bootstrap --parallel next:dev start:disconnected-proxy start:watch-components\"",
|
|
11
|
+
"start:disconnected-proxy": "ts-node --project tsconfig.scripts.json ./scripts/disconnected-mode-proxy.ts"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
When the app runs in disconnected mode, and Sitecore is not present, we need to give
|
|
3
|
+
the app copies of the Sitecore APIs it depends on (layout service, dictionary service, content service)
|
|
4
|
+
to talk to so that the app can run using the locally defined disconnected data.
|
|
5
|
+
|
|
6
|
+
This is accomplished by spinning up a small Express server that mocks the APIs, and then
|
|
7
|
+
telling the dev server to proxy requests to the API paths to this express instance.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/* eslint-disable no-console */
|
|
11
|
+
|
|
12
|
+
import fs from 'fs';
|
|
13
|
+
import path from 'path';
|
|
14
|
+
import { createDefaultDisconnectedServer } from '@sitecore-jss/sitecore-jss-dev-tools';
|
|
15
|
+
import { config } from '../package.json';
|
|
16
|
+
|
|
17
|
+
const touchToReloadFilePath = 'src/temp/config.js';
|
|
18
|
+
|
|
19
|
+
const serverOptions = {
|
|
20
|
+
appRoot: path.join(__dirname, '..'),
|
|
21
|
+
appName: config.appName,
|
|
22
|
+
// Prevent require of ./sitecore/definitions/config.js, because ts-node is running
|
|
23
|
+
requireArg: null,
|
|
24
|
+
watchPaths: ['./data'],
|
|
25
|
+
language: config.language,
|
|
26
|
+
port: Number(process.env.PROXY_PORT) || 3042,
|
|
27
|
+
onManifestUpdated: () => {
|
|
28
|
+
// if we can resolve the config file, we can alter it to force reloading the app automatically
|
|
29
|
+
// instead of waiting for a manual reload. We must materially alter the _contents_ of the file to trigger
|
|
30
|
+
// an actual reload, so we append "// reloadnow" to the file each time. This will not cause a problem,
|
|
31
|
+
// since every build regenerates the config file from scratch and it's ignored from source control.
|
|
32
|
+
if (fs.existsSync(touchToReloadFilePath)) {
|
|
33
|
+
const currentFileContents = fs.readFileSync(touchToReloadFilePath, 'utf8');
|
|
34
|
+
const newFileContents = `${currentFileContents}\n// reloadnow`;
|
|
35
|
+
fs.writeFileSync(touchToReloadFilePath, newFileContents, 'utf8');
|
|
36
|
+
|
|
37
|
+
console.log('Manifest data updated. Reloading the browser.');
|
|
38
|
+
} else {
|
|
39
|
+
console.log('Manifest data updated. Refresh the browser to see latest content!');
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Need to customize something that the proxy options don't support?
|
|
45
|
+
// createDefaultDisconnectedServer() is a boilerplate that you can copy from
|
|
46
|
+
// and customize the middleware registrations within as you see fit.
|
|
47
|
+
// See https://github.com/Sitecore/jss/blob/master/packages/sitecore-jss-dev-tools/src/disconnected-server/create-default-disconnected-server.ts
|
|
48
|
+
createDefaultDisconnectedServer(serverOptions);
|