create-content-sdk-app 1.3.0-canary.7 → 1.3.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/README.md +5 -5
- package/dist/bin.js +119 -119
- package/dist/common/base/Initializer.js +2 -2
- package/dist/common/base/args.js +2 -2
- package/dist/common/base/prompts.js +7 -7
- package/dist/common/index.js +18 -18
- package/dist/common/processes/install.js +55 -55
- package/dist/common/processes/next.js +63 -63
- package/dist/common/processes/transform.js +115 -115
- package/dist/common/utils/cmd.js +53 -53
- package/dist/common/utils/helpers.js +80 -80
- package/dist/index.js +6 -6
- package/dist/initialize.js +71 -71
- package/dist/initializers/nextjs/args.js +2 -2
- package/dist/initializers/nextjs/index.js +30 -30
- package/dist/initializers/nextjs/prompts.js +26 -26
- package/dist/initializers/nextjs-app-router (beta)/args.js +2 -2
- package/dist/initializers/nextjs-app-router (beta)/index.js +30 -30
- package/dist/initializers/nextjs-app-router (beta)/prompts.js +26 -26
- 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 +147 -147
- package/dist/templates/nextjs/.env.container.example +27 -27
- package/dist/templates/nextjs/.env.remote.example +45 -44
- 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 +183 -183
- package/dist/templates/nextjs/CLAUDE.md +170 -170
- package/dist/templates/nextjs/LICENSE.txt +202 -202
- package/dist/templates/nextjs/LLMs.txt +179 -179
- package/dist/templates/nextjs/README.md +7 -7
- package/dist/templates/nextjs/copilot-instructions.md +170 -170
- 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 +38 -38
- package/dist/templates/nextjs/src/middleware.ts +16 -7
- package/dist/templates/nextjs/tsconfig.json +40 -40
- package/dist/templates/nextjs-app-router (beta)/.cursor/rules/app-router-setup.mdc +116 -116
- package/dist/templates/nextjs-app-router (beta)/.cursor/rules/general.mdc +80 -80
- package/dist/templates/nextjs-app-router (beta)/.cursor/rules/javascript.mdc +112 -112
- package/dist/templates/nextjs-app-router (beta)/.cursor/rules/sitecore.mdc +171 -171
- package/dist/templates/nextjs-app-router (beta)/.env.container.example +27 -27
- package/dist/templates/nextjs-app-router (beta)/.env.remote.example +45 -44
- package/dist/templates/nextjs-app-router (beta)/.gitattributes +11 -11
- package/dist/templates/nextjs-app-router (beta)/.sitecore/import-map.server.ts +60 -0
- package/dist/templates/nextjs-app-router (beta)/.windsurfrules +287 -287
- package/dist/templates/nextjs-app-router (beta)/CLAUDE.md +271 -271
- package/dist/templates/nextjs-app-router (beta)/LLMs.txt +236 -236
- package/dist/templates/nextjs-app-router (beta)/README.md +7 -7
- package/dist/templates/nextjs-app-router (beta)/copilot-instructions.md +271 -271
- package/dist/templates/nextjs-app-router (beta)/eslint.config.mjs +29 -29
- package/dist/templates/nextjs-app-router (beta)/gitignore +31 -29
- package/dist/templates/nextjs-app-router (beta)/package.json +54 -54
- package/dist/templates/nextjs-app-router (beta)/postcss.config.mjs +5 -5
- package/dist/templates/nextjs-app-router (beta)/sitecore.config.ts.example +38 -38
- package/dist/templates/nextjs-app-router (beta)/src/Layout.tsx +9 -3
- package/dist/templates/nextjs-app-router (beta)/src/Providers.tsx +9 -17
- package/dist/templates/nextjs-app-router (beta)/src/app/[site]/[locale]/[[...path]]/page.tsx +1 -5
- package/dist/templates/nextjs-app-router (beta)/src/app/api/editing/config/route.ts +2 -0
- package/dist/templates/nextjs-app-router (beta)/src/app/api/editing/render/route.ts +1 -1
- package/dist/templates/nextjs-app-router (beta)/src/app/globals.css +1 -1
- package/dist/templates/nextjs-app-router (beta)/src/middleware.ts +12 -1
- package/dist/templates/nextjs-app-router (beta)/tsconfig.json +48 -48
- package/package.json +73 -74
- package/LICENSE.MD +0 -202
- package/dist/templates/nextjs-app-router (beta)/src/DesignLibraryLayout.tsx +0 -7
- /package/dist/templates/nextjs-app-router (beta)/.sitecore/{import-map.ts → import-map.client.ts} +0 -0
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "content-sdk-nextjs-app-router",
|
|
3
|
-
"description": "Application utilizing Content SDK and Next.js",
|
|
4
|
-
"version": "0.1.0",
|
|
5
|
-
"private": true,
|
|
6
|
-
"author": {
|
|
7
|
-
"name": "Sitecore Corporation",
|
|
8
|
-
"url": "https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html"
|
|
9
|
-
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/sitecore/content-sdk.git"
|
|
13
|
-
},
|
|
14
|
-
"bugs": {
|
|
15
|
-
"url": "https://github.com/sitecore/content-sdk/issues"
|
|
16
|
-
},
|
|
17
|
-
"license": "Apache-2.0",
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "cross-env NODE_ENV=production npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build next:build",
|
|
20
|
-
"lint": "eslint ./src/**/*.tsx ./src/**/*.ts",
|
|
21
|
-
"next:build": "next build",
|
|
22
|
-
"next:dev": "cross-env NODE_OPTIONS='--inspect' next dev",
|
|
23
|
-
"next:start": "next start",
|
|
24
|
-
"sitecore-tools:generate-map": "sitecore-tools project component generate-map",
|
|
25
|
-
"sitecore-tools:generate-map:watch": "sitecore-tools project component generate-map --watch",
|
|
26
|
-
"sitecore-tools:build": "sitecore-tools project build",
|
|
27
|
-
"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",
|
|
28
|
-
"start": "cross-env-shell NODE_ENV=production npm-run-all --serial build next:start"
|
|
29
|
-
},
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@sitecore-cloudsdk/core": "^0.5.4",
|
|
32
|
-
"@sitecore-cloudsdk/events": "^0.5.4",
|
|
33
|
-
"@sitecore-content-sdk/nextjs": "<%- version %>",
|
|
34
|
-
"@sitecore-feaas/clientside": "^0.6.0",
|
|
35
|
-
"@sitecore/components": "~2.1.0",
|
|
36
|
-
"next": "^15.5.0",
|
|
37
|
-
"react": "^19.1.0",
|
|
38
|
-
"react-dom": "^19.1.0",
|
|
39
|
-
"next-intl": "^4.3.5"
|
|
40
|
-
},
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"@eslint/eslintrc": "^3",
|
|
43
|
-
"@sitecore-content-sdk/cli": "<%- version %>",
|
|
44
|
-
"@tailwindcss/postcss": "^4",
|
|
45
|
-
"@types/node": "^22.15.14",
|
|
46
|
-
"@types/react": "^19.1.10",
|
|
47
|
-
"@types/react-dom": "^19.1.7",
|
|
48
|
-
"cross-env": "^10.0.0",
|
|
49
|
-
"eslint": "^9.33.0",
|
|
50
|
-
"eslint-config-next": "15.5.0",
|
|
51
|
-
"npm-run-all2": "^8.0.4",
|
|
52
|
-
"tailwindcss": "^4",
|
|
53
|
-
"typescript": "~5.8.3"
|
|
54
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "content-sdk-nextjs-app-router",
|
|
3
|
+
"description": "Application utilizing Content SDK and Next.js",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Sitecore Corporation",
|
|
8
|
+
"url": "https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/sitecore/content-sdk.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/sitecore/content-sdk/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "Apache-2.0",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "cross-env NODE_ENV=production npm-run-all --serial sitecore-tools:generate-map sitecore-tools:build next:build",
|
|
20
|
+
"lint": "eslint ./src/**/*.tsx ./src/**/*.ts",
|
|
21
|
+
"next:build": "next build",
|
|
22
|
+
"next:dev": "cross-env NODE_OPTIONS='--inspect' next dev",
|
|
23
|
+
"next:start": "next start",
|
|
24
|
+
"sitecore-tools:generate-map": "sitecore-tools project component generate-map",
|
|
25
|
+
"sitecore-tools:generate-map:watch": "sitecore-tools project component generate-map --watch",
|
|
26
|
+
"sitecore-tools:build": "sitecore-tools project build",
|
|
27
|
+
"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",
|
|
28
|
+
"start": "cross-env-shell NODE_ENV=production npm-run-all --serial build next:start"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@sitecore-cloudsdk/core": "^0.5.4",
|
|
32
|
+
"@sitecore-cloudsdk/events": "^0.5.4",
|
|
33
|
+
"@sitecore-content-sdk/nextjs": "<%- version %>",
|
|
34
|
+
"@sitecore-feaas/clientside": "^0.6.0",
|
|
35
|
+
"@sitecore/components": "~2.1.0",
|
|
36
|
+
"next": "^15.5.0",
|
|
37
|
+
"react": "^19.1.0",
|
|
38
|
+
"react-dom": "^19.1.0",
|
|
39
|
+
"next-intl": "^4.3.5"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@eslint/eslintrc": "^3",
|
|
43
|
+
"@sitecore-content-sdk/cli": "<%- version %>",
|
|
44
|
+
"@tailwindcss/postcss": "^4",
|
|
45
|
+
"@types/node": "^22.15.14",
|
|
46
|
+
"@types/react": "^19.1.10",
|
|
47
|
+
"@types/react-dom": "^19.1.7",
|
|
48
|
+
"cross-env": "^10.0.0",
|
|
49
|
+
"eslint": "^9.33.0",
|
|
50
|
+
"eslint-config-next": "15.5.0",
|
|
51
|
+
"npm-run-all2": "^8.0.4",
|
|
52
|
+
"tailwindcss": "^4",
|
|
53
|
+
"typescript": "~5.8.3"
|
|
54
|
+
}
|
|
55
55
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const config = {
|
|
2
|
-
plugins: ["@tailwindcss/postcss"],
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
export default config;
|
|
1
|
+
const config = {
|
|
2
|
+
plugins: ["@tailwindcss/postcss"],
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export default config;
|
|
@@ -1,38 +1,38 @@
|
|
|
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: process.env.SITECORE_EDGE_URL || process.env.NEXT_PUBLIC_SITECORE_EDGE_URL,
|
|
16
|
-
},
|
|
17
|
-
local: {
|
|
18
|
-
apiKey: process.env.NEXT_PUBLIC_SITECORE_API_KEY || '',
|
|
19
|
-
apiHost: process.env.NEXT_PUBLIC_SITECORE_API_HOST || '',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
defaultSite: process.env.NEXT_PUBLIC_DEFAULT_SITE_NAME,
|
|
23
|
-
defaultLanguage: process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE || 'en',
|
|
24
|
-
editingSecret: process.env.SITECORE_EDITING_SECRET,
|
|
25
|
-
redirects: {
|
|
26
|
-
enabled: true,
|
|
27
|
-
locales: ['en'],
|
|
28
|
-
},
|
|
29
|
-
multisite: {
|
|
30
|
-
enabled: true,
|
|
31
|
-
useCookieResolution: () => process.env.VERCEL_ENV === 'preview',
|
|
32
|
-
},
|
|
33
|
-
personalize: {
|
|
34
|
-
scope: process.env.NEXT_PUBLIC_PERSONALIZE_SCOPE,
|
|
35
|
-
edgeTimeout: parseInt(process.env.PERSONALIZE_MIDDLEWARE_EDGE_TIMEOUT!, 10),
|
|
36
|
-
cdpTimeout: parseInt(process.env.PERSONALIZE_MIDDLEWARE_EDGE_TIMEOUT!, 10),
|
|
37
|
-
},
|
|
38
|
-
});
|
|
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: process.env.SITECORE_EDGE_URL || process.env.NEXT_PUBLIC_SITECORE_EDGE_URL,
|
|
16
|
+
},
|
|
17
|
+
local: {
|
|
18
|
+
apiKey: process.env.NEXT_PUBLIC_SITECORE_API_KEY || '',
|
|
19
|
+
apiHost: process.env.NEXT_PUBLIC_SITECORE_API_HOST || '',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultSite: process.env.NEXT_PUBLIC_DEFAULT_SITE_NAME,
|
|
23
|
+
defaultLanguage: process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE || 'en',
|
|
24
|
+
editingSecret: process.env.SITECORE_EDITING_SECRET,
|
|
25
|
+
redirects: {
|
|
26
|
+
enabled: true,
|
|
27
|
+
locales: ['en'],
|
|
28
|
+
},
|
|
29
|
+
multisite: {
|
|
30
|
+
enabled: true,
|
|
31
|
+
useCookieResolution: () => process.env.VERCEL_ENV === 'preview',
|
|
32
|
+
},
|
|
33
|
+
personalize: {
|
|
34
|
+
scope: process.env.NEXT_PUBLIC_PERSONALIZE_SCOPE,
|
|
35
|
+
edgeTimeout: parseInt(process.env.PERSONALIZE_MIDDLEWARE_EDGE_TIMEOUT!, 10),
|
|
36
|
+
cdpTimeout: parseInt(process.env.PERSONALIZE_MIDDLEWARE_EDGE_TIMEOUT!, 10),
|
|
37
|
+
},
|
|
38
|
+
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { JSX } from 'react';
|
|
2
|
-
import { AppPlaceholder, Field, Page } from '@sitecore-content-sdk/nextjs';
|
|
2
|
+
import { AppPlaceholder, DesignLibraryApp, Field, Page } from '@sitecore-content-sdk/nextjs';
|
|
3
3
|
import Scripts from 'src/Scripts';
|
|
4
4
|
import SitecoreStyles from 'components/content-sdk/SitecoreStyles';
|
|
5
|
-
import { DesignLibraryLayout } from './DesignLibraryLayout';
|
|
6
5
|
import componentMap from '.sitecore/component-map';
|
|
7
6
|
|
|
8
7
|
interface LayoutProps {
|
|
@@ -25,7 +24,14 @@ const Layout = ({ page }: LayoutProps): JSX.Element => {
|
|
|
25
24
|
{/* root placeholder for the app, which we add components to using route data */}
|
|
26
25
|
<div className={mainClassPageEditing}>
|
|
27
26
|
{mode.isDesignLibrary ? (
|
|
28
|
-
|
|
27
|
+
route && (
|
|
28
|
+
<DesignLibraryApp
|
|
29
|
+
page={page}
|
|
30
|
+
rendering={route}
|
|
31
|
+
componentMap={componentMap}
|
|
32
|
+
loadServerImportMap={() => import('.sitecore/import-map.server')}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
29
35
|
) : (
|
|
30
36
|
<>
|
|
31
37
|
<header>
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
ComponentPropsCollection,
|
|
5
|
-
ComponentPropsContext,
|
|
6
|
-
Page,
|
|
7
|
-
SitecoreProvider,
|
|
8
|
-
} from '@sitecore-content-sdk/nextjs';
|
|
3
|
+
import { Page, SitecoreProvider } from '@sitecore-content-sdk/nextjs';
|
|
9
4
|
import scConfig from 'sitecore.config';
|
|
10
5
|
import components from '.sitecore/component-map.client';
|
|
11
6
|
|
|
12
|
-
export default function Providers({
|
|
13
|
-
children,
|
|
14
|
-
page,
|
|
15
|
-
componentProps = {},
|
|
16
|
-
}: {
|
|
17
|
-
children: React.ReactNode;
|
|
18
|
-
page: Page;
|
|
19
|
-
componentProps?: ComponentPropsCollection;
|
|
20
|
-
}) {
|
|
7
|
+
export default function Providers({ children, page }: { children: React.ReactNode; page: Page }) {
|
|
21
8
|
return (
|
|
22
|
-
<SitecoreProvider
|
|
23
|
-
|
|
9
|
+
<SitecoreProvider
|
|
10
|
+
api={scConfig.api}
|
|
11
|
+
componentMap={components}
|
|
12
|
+
page={page}
|
|
13
|
+
loadImportMap={() => import('.sitecore/import-map.client')}
|
|
14
|
+
>
|
|
15
|
+
{children}
|
|
24
16
|
</SitecoreProvider>
|
|
25
17
|
);
|
|
26
18
|
}
|
package/dist/templates/nextjs-app-router (beta)/src/app/[site]/[locale]/[[...path]]/page.tsx
CHANGED
|
@@ -9,7 +9,6 @@ import scConfig from 'sitecore.config';
|
|
|
9
9
|
<% } -%>
|
|
10
10
|
import client from 'src/lib/sitecore-client';
|
|
11
11
|
import Layout, { RouteFields } from 'src/Layout';
|
|
12
|
-
import components from '.sitecore/component-map';
|
|
13
12
|
import Providers from 'src/Providers';
|
|
14
13
|
import { NextIntlClientProvider } from 'next-intl';
|
|
15
14
|
import { setRequestLocale } from 'next-intl/server';
|
|
@@ -44,12 +43,9 @@ export default async function Page({ params, searchParams }: PageProps) {
|
|
|
44
43
|
notFound();
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
// Fetch the component data from Sitecore (Likely will be deprecated)
|
|
48
|
-
const componentProps = await client.getComponentData(page.layout, {}, components);
|
|
49
|
-
|
|
50
46
|
return (
|
|
51
47
|
<NextIntlClientProvider>
|
|
52
|
-
<Providers page={page}
|
|
48
|
+
<Providers page={page}>
|
|
53
49
|
<Layout page={page} />
|
|
54
50
|
</Providers>
|
|
55
51
|
</NextIntlClientProvider>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createEditingConfigRouteHandler } from '@sitecore-content-sdk/nextjs/route-handler';
|
|
2
2
|
import components from '.sitecore/component-map';
|
|
3
|
+
import clientComponents from '.sitecore/component-map.client';
|
|
3
4
|
import metadata from '.sitecore/metadata.json';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -9,5 +10,6 @@ import metadata from '.sitecore/metadata.json';
|
|
|
9
10
|
|
|
10
11
|
export const { GET, OPTIONS } = createEditingConfigRouteHandler({
|
|
11
12
|
components,
|
|
13
|
+
clientComponents,
|
|
12
14
|
metadata,
|
|
13
15
|
});
|
|
@@ -12,4 +12,4 @@ import { createEditingRenderRouteHandlers } from '@sitecore-content-sdk/nextjs/r
|
|
|
12
12
|
* 4. Return the rendered HTML for editing mode
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
export const { GET, OPTIONS } = createEditingRenderRouteHandlers({});
|
|
15
|
+
export const { GET, POST, OPTIONS } = createEditingRenderRouteHandlers({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
1
|
+
@import "tailwindcss";
|
|
@@ -31,7 +31,6 @@ const multisite = new AppRouterMultisiteMiddleware({
|
|
|
31
31
|
* List of sites for site resolver to work with
|
|
32
32
|
*/
|
|
33
33
|
sites,
|
|
34
|
-
...scConfig.api.edge,
|
|
35
34
|
...scConfig.multisite,
|
|
36
35
|
// This function determines if the middleware should be turned off on per-request basis.
|
|
37
36
|
// Certain paths are ignored by default (e.g. files and Next.js API routes), but you may wish to disable more.
|
|
@@ -45,6 +44,7 @@ const redirects = new RedirectsMiddleware({
|
|
|
45
44
|
*/
|
|
46
45
|
sites,
|
|
47
46
|
...scConfig.api.edge,
|
|
47
|
+
...scConfig.api.local,
|
|
48
48
|
...scConfig.redirects,
|
|
49
49
|
// This function determines if the middleware should be turned off on per-request basis.
|
|
50
50
|
// Certain paths are ignored by default (e.g. Next.js API routes), but you may wish to disable more.
|
|
@@ -64,7 +64,18 @@ const personalize = new PersonalizeMiddleware({
|
|
|
64
64
|
// Certain paths are ignored by default (e.g. Next.js API routes), but you may wish to disable more.
|
|
65
65
|
// By default it is disabled while in development mode.
|
|
66
66
|
// This is an important performance consideration since Next.js Edge middleware runs on every request.
|
|
67
|
+
// NOTE: Personalize requires Edge configuration and cannot work with local containers.
|
|
68
|
+
// The middleware will disable itself if Edge config is not present.
|
|
67
69
|
skip: () => false,
|
|
70
|
+
// This is an example of how to provide geo data for personalization.
|
|
71
|
+
// The provided callback will be called on each request to extract geo data.
|
|
72
|
+
// extractGeoDataCb: () => {
|
|
73
|
+
// return {
|
|
74
|
+
// city: 'Athens',
|
|
75
|
+
// country: 'Greece',
|
|
76
|
+
// region: 'Attica',
|
|
77
|
+
// };
|
|
78
|
+
// },
|
|
68
79
|
});
|
|
69
80
|
|
|
70
81
|
export function middleware(req: NextRequest, ev: NextFetchEvent) {
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
4
|
-
"paths": {
|
|
5
|
-
"components/*": [
|
|
6
|
-
"src/components/*"
|
|
7
|
-
],
|
|
8
|
-
"lib/*": [
|
|
9
|
-
"src/lib/*"
|
|
10
|
-
],
|
|
11
|
-
"temp/*": [
|
|
12
|
-
"src/temp/*"
|
|
13
|
-
],
|
|
14
|
-
"assets/*": [
|
|
15
|
-
"src/assets/*"
|
|
16
|
-
],
|
|
17
|
-
".sitecore/*": [
|
|
18
|
-
".sitecore/*"
|
|
19
|
-
],
|
|
20
|
-
<%_ if (helper.isDev) { _%>
|
|
21
|
-
"next/*": ["node_modules/next/*"],
|
|
22
|
-
<%_ } _%>
|
|
23
|
-
},
|
|
24
|
-
"target": "ES2017",
|
|
25
|
-
"types": ["node"],
|
|
26
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
27
|
-
"allowJs": true,
|
|
28
|
-
"skipLibCheck": true,
|
|
29
|
-
"strict": true,
|
|
30
|
-
"noEmit": true,
|
|
31
|
-
"esModuleInterop": true,
|
|
32
|
-
"strictFunctionTypes": false,
|
|
33
|
-
"module": "esnext",
|
|
34
|
-
"moduleResolution": "node",
|
|
35
|
-
"allowSyntheticDefaultImports": true,
|
|
36
|
-
"resolveJsonModule": true,
|
|
37
|
-
"isolatedModules": true,
|
|
38
|
-
"jsx": "preserve",
|
|
39
|
-
"incremental": true,
|
|
40
|
-
"plugins": [
|
|
41
|
-
{
|
|
42
|
-
"name": "next"
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
47
|
-
"exclude": ["node_modules"]
|
|
48
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"paths": {
|
|
5
|
+
"components/*": [
|
|
6
|
+
"src/components/*"
|
|
7
|
+
],
|
|
8
|
+
"lib/*": [
|
|
9
|
+
"src/lib/*"
|
|
10
|
+
],
|
|
11
|
+
"temp/*": [
|
|
12
|
+
"src/temp/*"
|
|
13
|
+
],
|
|
14
|
+
"assets/*": [
|
|
15
|
+
"src/assets/*"
|
|
16
|
+
],
|
|
17
|
+
".sitecore/*": [
|
|
18
|
+
".sitecore/*"
|
|
19
|
+
],
|
|
20
|
+
<%_ if (helper.isDev) { _%>
|
|
21
|
+
"next/*": ["node_modules/next/*"],
|
|
22
|
+
<%_ } _%>
|
|
23
|
+
},
|
|
24
|
+
"target": "ES2017",
|
|
25
|
+
"types": ["node"],
|
|
26
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
27
|
+
"allowJs": true,
|
|
28
|
+
"skipLibCheck": true,
|
|
29
|
+
"strict": true,
|
|
30
|
+
"noEmit": true,
|
|
31
|
+
"esModuleInterop": true,
|
|
32
|
+
"strictFunctionTypes": false,
|
|
33
|
+
"module": "esnext",
|
|
34
|
+
"moduleResolution": "node",
|
|
35
|
+
"allowSyntheticDefaultImports": true,
|
|
36
|
+
"resolveJsonModule": true,
|
|
37
|
+
"isolatedModules": true,
|
|
38
|
+
"jsx": "preserve",
|
|
39
|
+
"incremental": true,
|
|
40
|
+
"plugins": [
|
|
41
|
+
{
|
|
42
|
+
"name": "next"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
47
|
+
"exclude": ["node_modules"]
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,74 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "create-content-sdk-app",
|
|
3
|
-
"version": "1.3.0
|
|
4
|
-
"description": "Sitecore Content SDK initializer",
|
|
5
|
-
"bin": "./dist/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "npm run clean && tsc && ts-node ./scripts/build-templates.ts",
|
|
8
|
-
"clean": "del-cli dist types",
|
|
9
|
-
"lint": "eslint \"./src/**/*.ts\"",
|
|
10
|
-
"watch": "ts-node ./scripts/watch-templates.ts",
|
|
11
|
-
"test": "mocha --require ts-node/register \"./src/**/*.test.ts\"",
|
|
12
|
-
"coverage": "nyc npm test"
|
|
13
|
-
},
|
|
14
|
-
"engines": {
|
|
15
|
-
"node": ">=22"
|
|
16
|
-
},
|
|
17
|
-
"repository": {
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "https://github.com/Sitecore/content-sdk.git",
|
|
20
|
-
"directory": "packages/create-content-sdk-app"
|
|
21
|
-
},
|
|
22
|
-
"homepage": "https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html",
|
|
23
|
-
"author": "Sitecore Corporation",
|
|
24
|
-
"license": "Apache-2.0",
|
|
25
|
-
"bugs": {
|
|
26
|
-
"url": "https://github.com/Sitecore/content-sdk/issues"
|
|
27
|
-
},
|
|
28
|
-
"files": [
|
|
29
|
-
"dist"
|
|
30
|
-
],
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"chalk": "^4.1.2",
|
|
33
|
-
"cross-spawn": "^7.0.6",
|
|
34
|
-
"ejs": "^3.1.10",
|
|
35
|
-
"fs-extra": "^11.3.0",
|
|
36
|
-
"glob": "^11.0.2",
|
|
37
|
-
"inquirer": "^8.2.4",
|
|
38
|
-
"minimist": "^1.2.8"
|
|
39
|
-
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"@stylistic/eslint-plugin": "^5.2.2",
|
|
42
|
-
"@types/chai": "^5.2.2",
|
|
43
|
-
"@types/cross-spawn": "^6.0.6",
|
|
44
|
-
"@types/ejs": "^3.1.5",
|
|
45
|
-
"@types/fs-extra": "^11.0.4",
|
|
46
|
-
"@types/glob": "^8.1.0",
|
|
47
|
-
"@types/inquirer": "^9.0.8",
|
|
48
|
-
"@types/minimist": "^1.2.5",
|
|
49
|
-
"@types/mocha": "^10.0.10",
|
|
50
|
-
"@types/node": "^22.15.14",
|
|
51
|
-
"@types/proxyquire": "^1.3.31",
|
|
52
|
-
"@types/sinon": "17.0.4",
|
|
53
|
-
"@types/sinon-chai": "^4.0.0",
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "8.39.0",
|
|
55
|
-
"@typescript-eslint/parser": "8.39.0",
|
|
56
|
-
"chai": "^4.4.1",
|
|
57
|
-
"chokidar": "^4.0.3",
|
|
58
|
-
"del-cli": "^6.0.0",
|
|
59
|
-
"eslint": "^9.32.0",
|
|
60
|
-
"eslint-config-prettier": "^10.1.8",
|
|
61
|
-
"eslint-plugin-import": "2.32.0",
|
|
62
|
-
"eslint-plugin-jsdoc": "52.0.3",
|
|
63
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
64
|
-
"mocha": "^11.2.2",
|
|
65
|
-
"nyc": "^17.1.0",
|
|
66
|
-
"prettier": "^2.8.0",
|
|
67
|
-
"proxyquire": "^2.1.3",
|
|
68
|
-
"sinon": "^20.0.0",
|
|
69
|
-
"sinon-chai": "^3.7.0",
|
|
70
|
-
"ts-node": "^10.9.2",
|
|
71
|
-
"typescript": "~5.8.3"
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "create-content-sdk-app",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Sitecore Content SDK initializer",
|
|
5
|
+
"bin": "./dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "npm run clean && tsc && ts-node ./scripts/build-templates.ts",
|
|
8
|
+
"clean": "del-cli dist types",
|
|
9
|
+
"lint": "eslint \"./src/**/*.ts\"",
|
|
10
|
+
"watch": "ts-node ./scripts/watch-templates.ts",
|
|
11
|
+
"test": "mocha --require ts-node/register \"./src/**/*.test.ts\"",
|
|
12
|
+
"coverage": "nyc npm test"
|
|
13
|
+
},
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=22"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/Sitecore/content-sdk.git",
|
|
20
|
+
"directory": "packages/create-content-sdk-app"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html",
|
|
23
|
+
"author": "Sitecore Corporation",
|
|
24
|
+
"license": "Apache-2.0",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/Sitecore/content-sdk/issues"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"chalk": "^4.1.2",
|
|
33
|
+
"cross-spawn": "^7.0.6",
|
|
34
|
+
"ejs": "^3.1.10",
|
|
35
|
+
"fs-extra": "^11.3.0",
|
|
36
|
+
"glob": "^11.0.2",
|
|
37
|
+
"inquirer": "^8.2.4",
|
|
38
|
+
"minimist": "^1.2.8"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@stylistic/eslint-plugin": "^5.2.2",
|
|
42
|
+
"@types/chai": "^5.2.2",
|
|
43
|
+
"@types/cross-spawn": "^6.0.6",
|
|
44
|
+
"@types/ejs": "^3.1.5",
|
|
45
|
+
"@types/fs-extra": "^11.0.4",
|
|
46
|
+
"@types/glob": "^8.1.0",
|
|
47
|
+
"@types/inquirer": "^9.0.8",
|
|
48
|
+
"@types/minimist": "^1.2.5",
|
|
49
|
+
"@types/mocha": "^10.0.10",
|
|
50
|
+
"@types/node": "^22.15.14",
|
|
51
|
+
"@types/proxyquire": "^1.3.31",
|
|
52
|
+
"@types/sinon": "17.0.4",
|
|
53
|
+
"@types/sinon-chai": "^4.0.0",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "8.39.0",
|
|
55
|
+
"@typescript-eslint/parser": "8.39.0",
|
|
56
|
+
"chai": "^4.4.1",
|
|
57
|
+
"chokidar": "^4.0.3",
|
|
58
|
+
"del-cli": "^6.0.0",
|
|
59
|
+
"eslint": "^9.32.0",
|
|
60
|
+
"eslint-config-prettier": "^10.1.8",
|
|
61
|
+
"eslint-plugin-import": "2.32.0",
|
|
62
|
+
"eslint-plugin-jsdoc": "52.0.3",
|
|
63
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
64
|
+
"mocha": "^11.2.2",
|
|
65
|
+
"nyc": "^17.1.0",
|
|
66
|
+
"prettier": "^2.8.0",
|
|
67
|
+
"proxyquire": "^2.1.3",
|
|
68
|
+
"sinon": "^20.0.0",
|
|
69
|
+
"sinon-chai": "^3.7.0",
|
|
70
|
+
"ts-node": "^10.9.2",
|
|
71
|
+
"typescript": "~5.8.3"
|
|
72
|
+
}
|
|
73
|
+
}
|