create-content-sdk-app 2.0.0 → 2.0.2-canary.0
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 -202
- package/dist/templates/nextjs/.agents/skills/content-sdk-component-data-strategy/SKILL.md +37 -0
- package/dist/templates/nextjs/.agents/skills/content-sdk-component-registration/SKILL.md +36 -0
- package/dist/templates/nextjs/.agents/skills/content-sdk-component-scaffold/SKILL.md +34 -0
- package/dist/templates/nextjs/.agents/skills/content-sdk-component-variants/SKILL.md +36 -0
- package/dist/templates/nextjs/.agents/skills/content-sdk-dictionary-and-i18n/SKILL.md +35 -0
- package/dist/templates/nextjs/.agents/skills/content-sdk-editing-safe-rendering/SKILL.md +37 -0
- package/dist/templates/nextjs/.agents/skills/content-sdk-field-usage-image-link-text/SKILL.md +36 -0
- package/dist/templates/nextjs/.agents/skills/content-sdk-graphql-data-fetching/SKILL.md +38 -0
- package/dist/templates/nextjs/.agents/skills/content-sdk-multisite-management/SKILL.md +37 -0
- package/dist/templates/nextjs/.agents/skills/content-sdk-route-configuration/SKILL.md +38 -0
- package/dist/templates/nextjs/.agents/skills/content-sdk-site-setup-and-env/SKILL.md +36 -0
- package/dist/templates/nextjs/.agents/skills/content-sdk-sitemap-robots/SKILL.md +37 -0
- package/dist/templates/nextjs/.agents/skills/content-sdk-troubleshoot-editing/SKILL.md +39 -0
- package/dist/templates/nextjs/.agents/skills/content-sdk-upgrade-assistant/SKILL.md +36 -0
- package/dist/templates/nextjs/.cursor/rules/general.mdc +81 -81
- package/dist/templates/nextjs/.cursor/rules/javascript.mdc +112 -112
- package/dist/templates/nextjs/.cursor/rules/project-setup.mdc +100 -100
- package/dist/templates/nextjs/.cursor/rules/sitecore.mdc +150 -150
- package/dist/templates/nextjs/.env.container.example +27 -27
- package/dist/templates/nextjs/.env.remote.example +51 -51
- package/dist/templates/nextjs/.gitattributes +11 -11
- package/dist/templates/nextjs/.prettierrc +8 -8
- package/dist/templates/nextjs/.vscode/extensions.json +8 -8
- package/dist/templates/nextjs/.vscode/launch.json +15 -15
- package/dist/templates/nextjs/.windsurfrules +186 -186
- package/dist/templates/nextjs/AGENTS.md +1 -0
- package/dist/templates/nextjs/CLAUDE.md +6 -170
- package/dist/templates/nextjs/LICENSE.txt +202 -202
- package/dist/templates/nextjs/Skills.md +79 -0
- package/dist/templates/nextjs/eslint.config.mjs +81 -81
- package/dist/templates/nextjs/gitignore +28 -28
- package/dist/templates/nextjs/package.json +68 -68
- package/dist/templates/nextjs/sitecore.config.ts.example +40 -40
- package/dist/templates/nextjs/src/Bootstrap.tsx +20 -13
- package/dist/templates/nextjs/src/byoc/index.tsx +1 -1
- package/dist/templates/nextjs/src/components/content-sdk/CdpPageView.tsx +1 -1
- package/dist/templates/nextjs/tsconfig.json +40 -40
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-component-data-strategy/SKILL.md +37 -0
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-component-registration/SKILL.md +38 -0
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-component-scaffold/SKILL.md +38 -0
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-component-variants/SKILL.md +36 -0
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-dictionary-and-i18n/SKILL.md +37 -0
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-editing-safe-rendering/SKILL.md +37 -0
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-field-usage-image-link-text/SKILL.md +36 -0
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-graphql-data-fetching/SKILL.md +37 -0
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-multisite-management/SKILL.md +37 -0
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-route-configuration/SKILL.md +38 -0
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-site-setup-and-env/SKILL.md +36 -0
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-sitemap-robots/SKILL.md +37 -0
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-troubleshoot-editing/SKILL.md +39 -0
- package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-upgrade-assistant/SKILL.md +36 -0
- package/dist/templates/nextjs-app-router/.cursor/rules/app-router-setup.mdc +116 -116
- package/dist/templates/nextjs-app-router/.cursor/rules/general.mdc +80 -80
- package/dist/templates/nextjs-app-router/.cursor/rules/javascript.mdc +112 -112
- package/dist/templates/nextjs-app-router/.cursor/rules/sitecore.mdc +174 -174
- package/dist/templates/nextjs-app-router/.env.container.example +27 -27
- package/dist/templates/nextjs-app-router/.env.remote.example +51 -51
- package/dist/templates/nextjs-app-router/.gitattributes +11 -11
- package/dist/templates/nextjs-app-router/.sitecore/import-map.server.ts +2 -2
- package/dist/templates/nextjs-app-router/.windsurfrules +290 -290
- package/dist/templates/nextjs-app-router/AGENTS.md +6 -6
- package/dist/templates/nextjs-app-router/CLAUDE.md +6 -271
- package/dist/templates/nextjs-app-router/README.md +0 -36
- package/dist/templates/nextjs-app-router/Skills.md +79 -0
- package/dist/templates/nextjs-app-router/eslint.config.mjs +29 -29
- package/dist/templates/nextjs-app-router/gitignore +31 -31
- package/dist/templates/nextjs-app-router/package.json +55 -54
- package/dist/templates/nextjs-app-router/postcss.config.mjs +5 -5
- package/dist/templates/nextjs-app-router/sitecore.config.ts.example +40 -40
- package/dist/templates/nextjs-app-router/src/Bootstrap.tsx +20 -12
- package/dist/templates/nextjs-app-router/src/app/[site]/[locale]/[[...path]]/layout.tsx +19 -0
- package/dist/templates/nextjs-app-router/src/app/[site]/[locale]/[[...path]]/not-found.tsx +3 -28
- package/dist/templates/nextjs-app-router/src/app/[site]/[locale]/[[...path]]/page.tsx +6 -21
- package/dist/templates/nextjs-app-router/src/app/[site]/layout.tsx +5 -21
- package/dist/templates/nextjs-app-router/src/app/globals.css +1 -1
- package/dist/templates/nextjs-app-router/src/app/not-found.tsx +1 -23
- package/dist/templates/nextjs-app-router/src/byoc/index.tsx +1 -1
- package/dist/templates/nextjs-app-router/src/components/content-sdk/CdpPageView.tsx +1 -1
- package/dist/templates/nextjs-app-router/tsconfig.json +48 -48
- package/package.json +2 -2
- package/dist/initializers/angular/args.js +0 -2
- package/dist/initializers/angular/index.js +0 -30
- package/dist/initializers/angular/prompts.js +0 -20
- package/dist/templates/angular/.postcssrc.json +0 -5
- package/dist/templates/angular/.vscode/extensions.json +0 -4
- package/dist/templates/angular/README.md +0 -3
- package/dist/templates/angular/angular.json +0 -79
- package/dist/templates/angular/package.json +0 -58
- package/dist/templates/angular/public/favicon.ico +0 -0
- package/dist/templates/angular/src/app/app.config.server.ts +0 -12
- package/dist/templates/angular/src/app/app.config.ts +0 -31
- package/dist/templates/angular/src/app/app.css +0 -0
- package/dist/templates/angular/src/app/app.html +0 -1
- package/dist/templates/angular/src/app/app.routes.server.ts +0 -15
- package/dist/templates/angular/src/app/app.routes.ts +0 -28
- package/dist/templates/angular/src/app/app.ts +0 -12
- package/dist/templates/angular/src/app/loaders/error.loader.ts +0 -12
- package/dist/templates/angular/src/app/loaders/index.ts +0 -14
- package/dist/templates/angular/src/app/loaders/not-found.loader.ts +0 -12
- package/dist/templates/angular/src/app/loaders/page.loader.ts +0 -15
- package/dist/templates/angular/src/app/loaders/stub-utils.ts +0 -83
- package/dist/templates/angular/src/app/pages/error.component.ts +0 -124
- package/dist/templates/angular/src/app/pages/not-found.component.ts +0 -85
- package/dist/templates/angular/src/app/pages/page.component.ts +0 -58
- package/dist/templates/angular/src/app/shared/layout.component.ts +0 -106
- package/dist/templates/angular/src/index.html +0 -13
- package/dist/templates/angular/src/main.server.ts +0 -8
- package/dist/templates/angular/src/main.ts +0 -6
- package/dist/templates/angular/src/server.ts +0 -65
- package/dist/templates/angular/src/styles.css +0 -3
- package/dist/templates/angular/tsconfig.json +0 -38
- package/dist/templates/angular/tsconfig.spec.json +0 -10
- package/dist/templates/nextjs/LLMs.txt +0 -179
- package/dist/templates/nextjs-app-router/LLMs.txt +0 -236
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
// packages/create-content-sdk-app/src/templates/nextjs/eslint.config.mjs
|
|
2
|
-
import { defineConfig } from 'eslint/config'
|
|
3
|
-
import js from '@eslint/js'
|
|
4
|
-
import * as nextEslintPlugin from '@next/eslint-plugin-next'
|
|
5
|
-
import tsParser from '@typescript-eslint/parser'
|
|
6
|
-
import * as tsEslintPlugin from '@typescript-eslint/eslint-plugin'
|
|
7
|
-
import * as importEslintPlugin from 'eslint-plugin-import'
|
|
8
|
-
import * as reactHooksEslintPlugin from 'eslint-plugin-react-hooks'
|
|
9
|
-
import globals from 'globals'
|
|
10
|
-
|
|
11
|
-
// Normalize ESM/CJS shapes to plugin objects
|
|
12
|
-
const nextPlugin = nextEslintPlugin.default ?? nextEslintPlugin
|
|
13
|
-
const tsPlugin = tsEslintPlugin.default ?? tsEslintPlugin
|
|
14
|
-
const importPlugin = importEslintPlugin.default ?? importEslintPlugin
|
|
15
|
-
const reactHooksPlugin = reactHooksEslintPlugin.default ?? reactHooksEslintPlugin
|
|
16
|
-
|
|
17
|
-
export default defineConfig([
|
|
18
|
-
// ignores
|
|
19
|
-
{ ignores: ['node_modules/**', '.next/**', 'dist/**', 'build/**', 'coverage/**'] },
|
|
20
|
-
|
|
21
|
-
// core ESLint recommended
|
|
22
|
-
js.configs.recommended,
|
|
23
|
-
|
|
24
|
-
// register plugins (applies to all files)
|
|
25
|
-
{
|
|
26
|
-
plugins: {
|
|
27
|
-
'@next/next': nextPlugin,
|
|
28
|
-
'@typescript-eslint': tsPlugin,
|
|
29
|
-
import: importPlugin,
|
|
30
|
-
'react-hooks': reactHooksPlugin,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
// project rules
|
|
35
|
-
{
|
|
36
|
-
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
37
|
-
languageOptions: {
|
|
38
|
-
parser: tsParser,
|
|
39
|
-
parserOptions: {
|
|
40
|
-
ecmaVersion: 2021,
|
|
41
|
-
sourceType: 'module',
|
|
42
|
-
ecmaFeatures: { jsx: true },
|
|
43
|
-
},
|
|
44
|
-
globals: {
|
|
45
|
-
...(globals.node ?? {}),
|
|
46
|
-
...(globals.browser ?? {}),
|
|
47
|
-
...(globals.es2021 ?? {}), // guarded to avoid "Cannot convert undefined or null to object"
|
|
48
|
-
URL: 'readonly',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
settings: {
|
|
52
|
-
'import/resolver': { typescript: {} },
|
|
53
|
-
},
|
|
54
|
-
rules: {
|
|
55
|
-
// Next.js
|
|
56
|
-
...(nextPlugin.configs?.recommended?.rules ?? {}),
|
|
57
|
-
...(nextPlugin.configs?.['core-web-vitals']?.rules ?? {}),
|
|
58
|
-
'@next/next/no-html-link-for-pages': 'off',
|
|
59
|
-
'@next/next/no-img-element': 'off',
|
|
60
|
-
'@next/next/no-sync-scripts': 'off',
|
|
61
|
-
'@next/next/no-assign-module-variable': 'off',
|
|
62
|
-
|
|
63
|
-
// TypeScript
|
|
64
|
-
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
65
|
-
'no-unused-vars': 'off',
|
|
66
|
-
'no-undef': 'off',
|
|
67
|
-
|
|
68
|
-
// Plugins
|
|
69
|
-
'import/no-anonymous-default-export': 'error',
|
|
70
|
-
'react-hooks/exhaustive-deps': 'warn',
|
|
71
|
-
'react-hooks/rules-of-hooks': 'error',
|
|
72
|
-
|
|
73
|
-
// Preferences
|
|
74
|
-
'prefer-const': 'error',
|
|
75
|
-
'no-var': 'error',
|
|
76
|
-
|
|
77
|
-
// Temporary: ignore escapes in strings/regex to align with new-starter components
|
|
78
|
-
'no-useless-escape': 'off',
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
])
|
|
1
|
+
// packages/create-content-sdk-app/src/templates/nextjs/eslint.config.mjs
|
|
2
|
+
import { defineConfig } from 'eslint/config'
|
|
3
|
+
import js from '@eslint/js'
|
|
4
|
+
import * as nextEslintPlugin from '@next/eslint-plugin-next'
|
|
5
|
+
import tsParser from '@typescript-eslint/parser'
|
|
6
|
+
import * as tsEslintPlugin from '@typescript-eslint/eslint-plugin'
|
|
7
|
+
import * as importEslintPlugin from 'eslint-plugin-import'
|
|
8
|
+
import * as reactHooksEslintPlugin from 'eslint-plugin-react-hooks'
|
|
9
|
+
import globals from 'globals'
|
|
10
|
+
|
|
11
|
+
// Normalize ESM/CJS shapes to plugin objects
|
|
12
|
+
const nextPlugin = nextEslintPlugin.default ?? nextEslintPlugin
|
|
13
|
+
const tsPlugin = tsEslintPlugin.default ?? tsEslintPlugin
|
|
14
|
+
const importPlugin = importEslintPlugin.default ?? importEslintPlugin
|
|
15
|
+
const reactHooksPlugin = reactHooksEslintPlugin.default ?? reactHooksEslintPlugin
|
|
16
|
+
|
|
17
|
+
export default defineConfig([
|
|
18
|
+
// ignores
|
|
19
|
+
{ ignores: ['node_modules/**', '.next/**', 'dist/**', 'build/**', 'coverage/**'] },
|
|
20
|
+
|
|
21
|
+
// core ESLint recommended
|
|
22
|
+
js.configs.recommended,
|
|
23
|
+
|
|
24
|
+
// register plugins (applies to all files)
|
|
25
|
+
{
|
|
26
|
+
plugins: {
|
|
27
|
+
'@next/next': nextPlugin,
|
|
28
|
+
'@typescript-eslint': tsPlugin,
|
|
29
|
+
import: importPlugin,
|
|
30
|
+
'react-hooks': reactHooksPlugin,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
// project rules
|
|
35
|
+
{
|
|
36
|
+
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
37
|
+
languageOptions: {
|
|
38
|
+
parser: tsParser,
|
|
39
|
+
parserOptions: {
|
|
40
|
+
ecmaVersion: 2021,
|
|
41
|
+
sourceType: 'module',
|
|
42
|
+
ecmaFeatures: { jsx: true },
|
|
43
|
+
},
|
|
44
|
+
globals: {
|
|
45
|
+
...(globals.node ?? {}),
|
|
46
|
+
...(globals.browser ?? {}),
|
|
47
|
+
...(globals.es2021 ?? {}), // guarded to avoid "Cannot convert undefined or null to object"
|
|
48
|
+
URL: 'readonly',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
settings: {
|
|
52
|
+
'import/resolver': { typescript: {} },
|
|
53
|
+
},
|
|
54
|
+
rules: {
|
|
55
|
+
// Next.js
|
|
56
|
+
...(nextPlugin.configs?.recommended?.rules ?? {}),
|
|
57
|
+
...(nextPlugin.configs?.['core-web-vitals']?.rules ?? {}),
|
|
58
|
+
'@next/next/no-html-link-for-pages': 'off',
|
|
59
|
+
'@next/next/no-img-element': 'off',
|
|
60
|
+
'@next/next/no-sync-scripts': 'off',
|
|
61
|
+
'@next/next/no-assign-module-variable': 'off',
|
|
62
|
+
|
|
63
|
+
// TypeScript
|
|
64
|
+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
65
|
+
'no-unused-vars': 'off',
|
|
66
|
+
'no-undef': 'off',
|
|
67
|
+
|
|
68
|
+
// Plugins
|
|
69
|
+
'import/no-anonymous-default-export': 'error',
|
|
70
|
+
'react-hooks/exhaustive-deps': 'warn',
|
|
71
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
72
|
+
|
|
73
|
+
// Preferences
|
|
74
|
+
'prefer-const': 'error',
|
|
75
|
+
'no-var': 'error',
|
|
76
|
+
|
|
77
|
+
// Temporary: ignore escapes in strings/regex to align with new-starter components
|
|
78
|
+
'no-useless-escape': 'off',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
])
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
|
2
|
-
|
|
3
|
-
# dependencies
|
|
4
|
-
/node_modules
|
|
5
|
-
|
|
6
|
-
# next.js
|
|
7
|
-
/.next*/
|
|
8
|
-
/out/
|
|
9
|
-
|
|
10
|
-
# misc
|
|
11
|
-
.DS_Store
|
|
12
|
-
|
|
13
|
-
# local env files
|
|
14
|
-
.env.local
|
|
15
|
-
.env.*.local
|
|
16
|
-
.env
|
|
17
|
-
|
|
18
|
-
# Log files
|
|
19
|
-
*.log*
|
|
20
|
-
|
|
21
|
-
# vercel
|
|
22
|
-
.vercel
|
|
23
|
-
|
|
24
|
-
# sitecore temp files
|
|
25
|
-
.sitecore/*
|
|
26
|
-
# except for component-map
|
|
27
|
-
!.sitecore/component-map.ts
|
|
28
|
-
!.sitecore/import-map.ts
|
|
1
|
+
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
# dependencies
|
|
4
|
+
/node_modules
|
|
5
|
+
|
|
6
|
+
# next.js
|
|
7
|
+
/.next*/
|
|
8
|
+
/out/
|
|
9
|
+
|
|
10
|
+
# misc
|
|
11
|
+
.DS_Store
|
|
12
|
+
|
|
13
|
+
# local env files
|
|
14
|
+
.env.local
|
|
15
|
+
.env.*.local
|
|
16
|
+
.env
|
|
17
|
+
|
|
18
|
+
# Log files
|
|
19
|
+
*.log*
|
|
20
|
+
|
|
21
|
+
# vercel
|
|
22
|
+
.vercel
|
|
23
|
+
|
|
24
|
+
# sitecore temp files
|
|
25
|
+
.sitecore/*
|
|
26
|
+
# except for component-map
|
|
27
|
+
!.sitecore/component-map.ts
|
|
28
|
+
!.sitecore/import-map.ts
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "content-sdk-nextjs",
|
|
3
|
-
"description": "Application utilizing Content SDK and Next.js",
|
|
4
|
-
"version": "0.1.0",
|
|
5
|
-
"private": true,
|
|
6
|
-
"config": {
|
|
7
|
-
"appName": "content-sdk-nextjs",
|
|
8
|
-
"graphQLEndpointPath": "/sitecore/api/graph/edge",
|
|
9
|
-
"language": "en",
|
|
10
|
-
"template": "nextjs"
|
|
11
|
-
},
|
|
12
|
-
"author": {
|
|
13
|
-
"name": "Sitecore Corporation",
|
|
14
|
-
"url": "https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html"
|
|
15
|
-
},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/sitecore/content-sdk.git"
|
|
19
|
-
},
|
|
20
|
-
"bugs": {
|
|
21
|
-
"url": "https://github.com/sitecore/content-sdk/issues"
|
|
22
|
-
},
|
|
23
|
-
"license": "Apache-2.0",
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@sitecore-
|
|
26
|
-
"@sitecore-
|
|
27
|
-
"@sitecore-content-sdk/
|
|
28
|
-
"@sitecore-feaas/clientside": "^0.6.0",
|
|
29
|
-
"@sitecore/components": "~2.1.0",
|
|
30
|
-
"next": "^16.1.1",
|
|
31
|
-
"next-localization": "^0.12.0",
|
|
32
|
-
"react": "^19.2.1",
|
|
33
|
-
"react-dom": "^19.2.1"
|
|
34
|
-
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@sitecore-content-sdk/cli": "<%- version %>",
|
|
37
|
-
"@types/node": "^24.10.4",
|
|
38
|
-
"@types/react": "^19.2.7",
|
|
39
|
-
"@types/react-dom": "^19.2.3",
|
|
40
|
-
"@stylistic/eslint-plugin": "^5.2.2",
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "8.39.0",
|
|
42
|
-
"@typescript-eslint/parser": "8.39.0",
|
|
43
|
-
"cross-env": "~7.0.3",
|
|
44
|
-
"eslint": "^9.32.0",
|
|
45
|
-
"eslint-config-next": "15.5.3",
|
|
46
|
-
"eslint-config-prettier": "^10.1.8",
|
|
47
|
-
"eslint-plugin-import": "2.32.0",
|
|
48
|
-
"eslint-plugin-jsdoc": "52.0.3",
|
|
49
|
-
"eslint-plugin-prettier": "^5.5.3",
|
|
50
|
-
"eslint-plugin-react": "7.37.5",
|
|
51
|
-
"eslint-plugin-react-hooks": "5.2.0",
|
|
52
|
-
"npm-run-all2": "~8.0.1",
|
|
53
|
-
"prettier": "^3.6.2",
|
|
54
|
-
"typescript": "~5.8.3"
|
|
55
|
-
},
|
|
56
|
-
"scripts": {
|
|
57
|
-
"build": "cross-env NODE_ENV=production npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build next:build",
|
|
58
|
-
"lint": "eslint ./src/**/*.tsx ./src/**/*.ts",
|
|
59
|
-
"next:build": "next build",
|
|
60
|
-
"next:dev": "cross-env NODE_OPTIONS='--inspect' next dev",
|
|
61
|
-
"next:start": "next start",
|
|
62
|
-
"sitecore-tools:generate-map": "sitecore-tools project component generate-map",
|
|
63
|
-
"sitecore-tools:generate-map:watch": "sitecore-tools project component generate-map --watch",
|
|
64
|
-
"sitecore-tools:build": "sitecore-tools project build",
|
|
65
|
-
"dev": "cross-env NODE_ENV=development npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build --parallel next:dev sitecore-tools:generate-map:watch",
|
|
66
|
-
"start": "cross-env-shell NODE_ENV=production npm-run-all --serial build next:start"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "content-sdk-nextjs",
|
|
3
|
+
"description": "Application utilizing Content SDK and Next.js",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"config": {
|
|
7
|
+
"appName": "content-sdk-nextjs",
|
|
8
|
+
"graphQLEndpointPath": "/sitecore/api/graph/edge",
|
|
9
|
+
"language": "en",
|
|
10
|
+
"template": "nextjs"
|
|
11
|
+
},
|
|
12
|
+
"author": {
|
|
13
|
+
"name": "Sitecore Corporation",
|
|
14
|
+
"url": "https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/sitecore/content-sdk.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/sitecore/content-sdk/issues"
|
|
22
|
+
},
|
|
23
|
+
"license": "Apache-2.0",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@sitecore-content-sdk/nextjs": "<%- version %>",
|
|
26
|
+
"@sitecore-content-sdk/analytics-core": "<%- version %>",
|
|
27
|
+
"@sitecore-content-sdk/events": "<%- version %>",
|
|
28
|
+
"@sitecore-feaas/clientside": "^0.6.0",
|
|
29
|
+
"@sitecore/components": "~2.1.0",
|
|
30
|
+
"next": "^16.1.1",
|
|
31
|
+
"next-localization": "^0.12.0",
|
|
32
|
+
"react": "^19.2.1",
|
|
33
|
+
"react-dom": "^19.2.1"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@sitecore-content-sdk/cli": "<%- version %>",
|
|
37
|
+
"@types/node": "^24.10.4",
|
|
38
|
+
"@types/react": "^19.2.7",
|
|
39
|
+
"@types/react-dom": "^19.2.3",
|
|
40
|
+
"@stylistic/eslint-plugin": "^5.2.2",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "8.39.0",
|
|
42
|
+
"@typescript-eslint/parser": "8.39.0",
|
|
43
|
+
"cross-env": "~7.0.3",
|
|
44
|
+
"eslint": "^9.32.0",
|
|
45
|
+
"eslint-config-next": "15.5.3",
|
|
46
|
+
"eslint-config-prettier": "^10.1.8",
|
|
47
|
+
"eslint-plugin-import": "2.32.0",
|
|
48
|
+
"eslint-plugin-jsdoc": "52.0.3",
|
|
49
|
+
"eslint-plugin-prettier": "^5.5.3",
|
|
50
|
+
"eslint-plugin-react": "7.37.5",
|
|
51
|
+
"eslint-plugin-react-hooks": "5.2.0",
|
|
52
|
+
"npm-run-all2": "~8.0.1",
|
|
53
|
+
"prettier": "^3.6.2",
|
|
54
|
+
"typescript": "~5.8.3"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "cross-env NODE_ENV=production npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build next:build",
|
|
58
|
+
"lint": "eslint ./src/**/*.tsx ./src/**/*.ts",
|
|
59
|
+
"next:build": "next build",
|
|
60
|
+
"next:dev": "cross-env NODE_OPTIONS='--inspect' next dev",
|
|
61
|
+
"next:start": "next start",
|
|
62
|
+
"sitecore-tools:generate-map": "sitecore-tools project component generate-map",
|
|
63
|
+
"sitecore-tools:generate-map:watch": "sitecore-tools project component generate-map --watch",
|
|
64
|
+
"sitecore-tools:build": "sitecore-tools project build",
|
|
65
|
+
"dev": "cross-env NODE_ENV=development npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build --parallel next:dev sitecore-tools:generate-map:watch",
|
|
66
|
+
"start": "cross-env-shell NODE_ENV=production npm-run-all --serial build next:start"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { defineConfig } from '@sitecore-content-sdk/nextjs/config';
|
|
2
|
-
/**
|
|
3
|
-
* @type {import('@sitecore-content-sdk/nextjs/config').SitecoreConfig}
|
|
4
|
-
* See the documentation for `defineConfig`:
|
|
5
|
-
* https://doc.sitecore.com/xmc/en/developers/content-sdk/the-sitecore-configuration-file.html
|
|
6
|
-
*/
|
|
7
|
-
export default defineConfig({
|
|
8
|
-
api: {
|
|
9
|
-
edge: {
|
|
10
|
-
contextId:
|
|
11
|
-
process.env.SITECORE_EDGE_CONTEXT_ID ||
|
|
12
|
-
process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID ||
|
|
13
|
-
'',
|
|
14
|
-
clientContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID,
|
|
15
|
-
edgeUrl:
|
|
16
|
-
process.env.NEXT_PUBLIC_SITECORE_EDGE_PLATFORM_HOSTNAME ||
|
|
17
|
-
process.env.SITECORE_EDGE_PLATFORM_HOSTNAME,
|
|
18
|
-
},
|
|
19
|
-
local: {
|
|
20
|
-
apiKey: process.env.NEXT_PUBLIC_SITECORE_API_KEY || '',
|
|
21
|
-
apiHost: process.env.NEXT_PUBLIC_SITECORE_API_HOST || '',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
defaultSite: process.env.NEXT_PUBLIC_DEFAULT_SITE_NAME,
|
|
25
|
-
defaultLanguage: process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE || 'en',
|
|
26
|
-
editingSecret: process.env.SITECORE_EDITING_SECRET,
|
|
27
|
-
redirects: {
|
|
28
|
-
enabled: true,
|
|
29
|
-
locales: ['en'],
|
|
30
|
-
},
|
|
31
|
-
multisite: {
|
|
32
|
-
enabled: true,
|
|
33
|
-
useCookieResolution: () => process.env.VERCEL_ENV === 'preview',
|
|
34
|
-
},
|
|
35
|
-
personalize: {
|
|
36
|
-
scope: process.env.NEXT_PUBLIC_PERSONALIZE_SCOPE,
|
|
37
|
-
edgeTimeout: parseInt(process.env.PERSONALIZE_PROXY_EDGE_TIMEOUT!, 10),
|
|
38
|
-
cdpTimeout: parseInt(process.env.PERSONALIZE_PROXY_EDGE_TIMEOUT!, 10),
|
|
39
|
-
},
|
|
40
|
-
});
|
|
1
|
+
import { defineConfig } from '@sitecore-content-sdk/nextjs/config';
|
|
2
|
+
/**
|
|
3
|
+
* @type {import('@sitecore-content-sdk/nextjs/config').SitecoreConfig}
|
|
4
|
+
* See the documentation for `defineConfig`:
|
|
5
|
+
* https://doc.sitecore.com/xmc/en/developers/content-sdk/the-sitecore-configuration-file.html
|
|
6
|
+
*/
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
api: {
|
|
9
|
+
edge: {
|
|
10
|
+
contextId:
|
|
11
|
+
process.env.SITECORE_EDGE_CONTEXT_ID ||
|
|
12
|
+
process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID ||
|
|
13
|
+
'',
|
|
14
|
+
clientContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID,
|
|
15
|
+
edgeUrl:
|
|
16
|
+
process.env.NEXT_PUBLIC_SITECORE_EDGE_PLATFORM_HOSTNAME ||
|
|
17
|
+
process.env.SITECORE_EDGE_PLATFORM_HOSTNAME,
|
|
18
|
+
},
|
|
19
|
+
local: {
|
|
20
|
+
apiKey: process.env.NEXT_PUBLIC_SITECORE_API_KEY || '',
|
|
21
|
+
apiHost: process.env.NEXT_PUBLIC_SITECORE_API_HOST || '',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultSite: process.env.NEXT_PUBLIC_DEFAULT_SITE_NAME,
|
|
25
|
+
defaultLanguage: process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE || 'en',
|
|
26
|
+
editingSecret: process.env.SITECORE_EDITING_SECRET,
|
|
27
|
+
redirects: {
|
|
28
|
+
enabled: true,
|
|
29
|
+
locales: ['en'],
|
|
30
|
+
},
|
|
31
|
+
multisite: {
|
|
32
|
+
enabled: true,
|
|
33
|
+
useCookieResolution: () => process.env.VERCEL_ENV === 'preview',
|
|
34
|
+
},
|
|
35
|
+
personalize: {
|
|
36
|
+
scope: process.env.NEXT_PUBLIC_PERSONALIZE_SCOPE,
|
|
37
|
+
edgeTimeout: parseInt(process.env.PERSONALIZE_PROXY_EDGE_TIMEOUT!, 10),
|
|
38
|
+
cdpTimeout: parseInt(process.env.PERSONALIZE_PROXY_EDGE_TIMEOUT!, 10),
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useEffect, JSX } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { SitecorePageProps } from '@sitecore-content-sdk/nextjs';
|
|
4
|
-
import '@sitecore-cloudsdk/events/browser';
|
|
2
|
+
import { SitecorePageProps, initContentSdk } from '@sitecore-content-sdk/nextjs';
|
|
5
3
|
import config from 'sitecore.config';
|
|
4
|
+
import { eventsPlugin } from '@sitecore-content-sdk/events';
|
|
5
|
+
import { analyticsBrowserAdapter, analyticsPlugin } from '@sitecore-content-sdk/analytics-core';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The Bootstrap component is the entry point for performing any initialization logic
|
|
@@ -26,16 +26,23 @@ const Bootstrap = (props: SitecorePageProps): JSX.Element | null => {
|
|
|
26
26
|
console.debug('Browser Events SDK is not initialized in edit and preview modes');
|
|
27
27
|
} else {
|
|
28
28
|
if (config.api.edge?.clientContextId) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
initContentSdk({
|
|
30
|
+
config: {
|
|
31
|
+
contextId: config.api.edge.clientContextId,
|
|
32
|
+
edgeUrl: config.api.edge.edgeUrl,
|
|
33
|
+
siteName: page.siteName || config.defaultSite,
|
|
34
|
+
},
|
|
35
|
+
plugins: [
|
|
36
|
+
analyticsPlugin({
|
|
37
|
+
options: {
|
|
38
|
+
enableCookie: true,
|
|
39
|
+
cookieDomain: window.location.hostname.replace(/^www\./, ''),
|
|
40
|
+
},
|
|
41
|
+
adapter: analyticsBrowserAdapter(),
|
|
42
|
+
}),
|
|
43
|
+
eventsPlugin(),
|
|
44
|
+
],
|
|
45
|
+
});
|
|
39
46
|
} else {
|
|
40
47
|
console.error('Client Edge API settings missing from configuration');
|
|
41
48
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { JSX } from 'react';
|
|
2
2
|
import * as FEAAS from '@sitecore-feaas/clientside/react';
|
|
3
|
-
import * as Events from '@sitecore-
|
|
3
|
+
import * as Events from '@sitecore-content-sdk/events';
|
|
4
4
|
import { LayoutServicePageState, SitecoreProviderReactContext } from '@sitecore-content-sdk/nextjs';
|
|
5
5
|
import '@sitecore/components/context';
|
|
6
6
|
import dynamic from 'next/dynamic';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CdpHelper, useSitecore } from '@sitecore-content-sdk/nextjs';
|
|
2
2
|
import { useEffect, JSX } from 'react';
|
|
3
|
-
import { pageView } from '@sitecore-
|
|
3
|
+
import { pageView } from '@sitecore-content-sdk/events';
|
|
4
4
|
import config from 'sitecore.config';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
4
|
-
"paths": {
|
|
5
|
-
"components/*": ["src/components/*"],
|
|
6
|
-
"lib/*": ["src/lib/*"],
|
|
7
|
-
"temp/*": ["src/temp/*"],
|
|
8
|
-
"assets/*": ["src/assets/*"],
|
|
9
|
-
<%_ if (helper.isDev) { _%>
|
|
10
|
-
"react": ["node_modules/react"],
|
|
11
|
-
"next/*": ["node_modules/next/*"],
|
|
12
|
-
<%_ } _%>
|
|
13
|
-
},
|
|
14
|
-
"target": "es5",
|
|
15
|
-
"types": ["node"],
|
|
16
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
17
|
-
"allowJs": true,
|
|
18
|
-
"skipLibCheck": true,
|
|
19
|
-
"strict": true,
|
|
20
|
-
"strictFunctionTypes": false,
|
|
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
|
-
"noImplicitAny": true,
|
|
32
|
-
"noImplicitThis": true,
|
|
33
|
-
"noUnusedLocals": true,
|
|
34
|
-
"noUnusedParameters": true,
|
|
35
|
-
"incremental": true,
|
|
36
|
-
"forceConsistentCasingInFileNames": false
|
|
37
|
-
},
|
|
38
|
-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
|
39
|
-
"exclude": ["node_modules"]
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"paths": {
|
|
5
|
+
"components/*": ["src/components/*"],
|
|
6
|
+
"lib/*": ["src/lib/*"],
|
|
7
|
+
"temp/*": ["src/temp/*"],
|
|
8
|
+
"assets/*": ["src/assets/*"],
|
|
9
|
+
<%_ if (helper.isDev) { _%>
|
|
10
|
+
"react": ["node_modules/react"],
|
|
11
|
+
"next/*": ["node_modules/next/*"],
|
|
12
|
+
<%_ } _%>
|
|
13
|
+
},
|
|
14
|
+
"target": "es5",
|
|
15
|
+
"types": ["node"],
|
|
16
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
17
|
+
"allowJs": true,
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"strict": true,
|
|
20
|
+
"strictFunctionTypes": false,
|
|
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
|
+
"noImplicitAny": true,
|
|
32
|
+
"noImplicitThis": true,
|
|
33
|
+
"noUnusedLocals": true,
|
|
34
|
+
"noUnusedParameters": true,
|
|
35
|
+
"incremental": true,
|
|
36
|
+
"forceConsistentCasingInFileNames": false
|
|
37
|
+
},
|
|
38
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
|
39
|
+
"exclude": ["node_modules"]
|
|
40
|
+
}
|
package/dist/templates/nextjs-app-router/.agents/skills/content-sdk-component-data-strategy/SKILL.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: content-sdk-component-data-strategy
|
|
3
|
+
description: Component data for App Router: layout data from getPage (or getPreview/getDesignLibraryData in editing). No getComponentData; pass site and locale from route params. Server Components use the client in server context; Client Components receive serializable props. Use when wiring component data or BYOC.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Content SDK Component Data Strategy (App Router)
|
|
7
|
+
|
|
8
|
+
This app does **not** use getComponentData. Page and layout data come from **getPage** (or getPreview/getDesignLibraryData in editing). Component props are derived from the layout/placeholders; pass site and locale from route params.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- User asks how to pass data to components, wire component props, or integrate custom/BYOC components.
|
|
13
|
+
- Task involves component props, server vs client components, or BYOC.
|
|
14
|
+
- User mentions "component data," "props," "BYOC," "server component," or "client component."
|
|
15
|
+
|
|
16
|
+
## How to perform
|
|
17
|
+
|
|
18
|
+
- Fetch at page/layout with getPage (or getPreview/getDesignLibraryData in draft). Pass site and locale from route params. Server Components use the client in server context; Client Components receive serializable props only. Register BYOC in the correct component map and pass props from layout.
|
|
19
|
+
|
|
20
|
+
## Hard Rules
|
|
21
|
+
|
|
22
|
+
- **Data source:** Page and layout from `client.getPage(path ?? [], { site, locale })` in the catch-all page (or getPreview/getDesignLibraryData when draftMode() is enabled). All Sitecore-driven data flows from this single fetch at the route level.
|
|
23
|
+
- **Server Components:** Use the same SitecoreClient in server context (e.g. in the page or layout). Pass data as props to children.
|
|
24
|
+
- **Client Components:** Receive **serializable** props from parent (no functions or non-serializable values). Do not create a new client inside components. Pass data from page/layout level into components.
|
|
25
|
+
- **BYOC or custom components:** Must be registered in the appropriate component map (.sitecore/component-map.ts or component-map.client.ts) and receive props in the shape the layout expects (e.g. fields, params).
|
|
26
|
+
- Do not fetch layout or page data inside a child component (e.g. another getPage call); fetch at page/layout level and pass props.
|
|
27
|
+
|
|
28
|
+
## Stop Conditions
|
|
29
|
+
|
|
30
|
+
- Stop if the user wants to fetch page/layout data inside a child component; recommend fetching at page/layout level and passing props.
|
|
31
|
+
- Stop if server/client boundary is ambiguous and the change could cause "use client" or serialization issues; clarify and follow Next.js and app conventions.
|
|
32
|
+
- Do not introduce getComponentData or duplicate getPage logic; this app uses getPage-only data flow.
|
|
33
|
+
|
|
34
|
+
## References
|
|
35
|
+
|
|
36
|
+
- content-sdk-graphql-data-fetching and [AGENTS.md](../../../AGENTS.md) for getPage and data flow.
|
|
37
|
+
- [Official Content SDK docs](https://doc.sitecore.com/xmc/en/developers/content-sdk/sitecore-content-sdk-for-xm-cloud.html).
|