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,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,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useEffect, JSX } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import '@sitecore-
|
|
3
|
+
import { initContentSdk } from '@sitecore-content-sdk/nextjs';
|
|
4
|
+
import { eventsPlugin } from '@sitecore-content-sdk/events';
|
|
5
|
+
import { analyticsBrowserAdapter, analyticsPlugin } from '@sitecore-content-sdk/analytics-core';
|
|
5
6
|
import config from 'sitecore.config';
|
|
6
7
|
|
|
7
8
|
const Bootstrap = ({
|
|
@@ -23,16 +24,23 @@ const Bootstrap = ({
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
if (config.api.edge?.clientContextId) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
initContentSdk({
|
|
28
|
+
config: {
|
|
29
|
+
contextId: config.api.edge.clientContextId,
|
|
30
|
+
edgeUrl: config.api.edge.edgeUrl,
|
|
31
|
+
siteName: siteName || config.defaultSite,
|
|
32
|
+
},
|
|
33
|
+
plugins: [
|
|
34
|
+
analyticsPlugin({
|
|
35
|
+
options: {
|
|
36
|
+
enableCookie: true,
|
|
37
|
+
cookieDomain: window.location.hostname.replace(/^www\./, ''),
|
|
38
|
+
},
|
|
39
|
+
adapter: analyticsBrowserAdapter(),
|
|
40
|
+
}),
|
|
41
|
+
eventsPlugin(),
|
|
42
|
+
],
|
|
43
|
+
});
|
|
36
44
|
} else {
|
|
37
45
|
console.error('Client Edge API settings missing from configuration');
|
|
38
46
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { setCachedPageParams } from '@sitecore-content-sdk/nextjs';
|
|
2
|
+
|
|
3
|
+
export default async function SiteLayout({
|
|
4
|
+
children,
|
|
5
|
+
params,
|
|
6
|
+
}: {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
params: Promise<{ site: string; locale: string }>;
|
|
9
|
+
}) {
|
|
10
|
+
const { site, locale } = await params;
|
|
11
|
+
|
|
12
|
+
// Update the cached page info with the current site and locale values.
|
|
13
|
+
// This ensures the notFound page can access the correct site and locale information when rendered
|
|
14
|
+
// without opting out of SSG by using functions like `headers()`.
|
|
15
|
+
setCachedPageParams({ locale, site });
|
|
16
|
+
|
|
17
|
+
return <>{children}</>;
|
|
18
|
+
}
|
|
19
|
+
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import Link from 'next/link';
|
|
2
|
-
import {
|
|
3
|
-
import { Suspense } from 'react';
|
|
4
|
-
import { ErrorPage } from '@sitecore-content-sdk/nextjs';
|
|
5
|
-
import { parseRewriteHeader } from '@sitecore-content-sdk/nextjs/utils';
|
|
2
|
+
import { ErrorPage, getCachedPageParams } from '@sitecore-content-sdk/nextjs';
|
|
6
3
|
import client from 'lib/sitecore-client';
|
|
7
4
|
import scConfig from 'sitecore.config';
|
|
8
5
|
import Layout from 'src/Layout';
|
|
9
6
|
import Providers from 'src/Providers';
|
|
10
7
|
import { NextIntlClientProvider } from 'next-intl';
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
// which allows streaming dynamic content while keeping static parts prerendered.
|
|
15
|
-
// This pattern also works seamlessly when Cache Components is enabled.
|
|
16
|
-
async function DynamicNotFoundContent() {
|
|
17
|
-
const headersList = await headers();
|
|
18
|
-
const { site, locale } = parseRewriteHeader(headersList);
|
|
9
|
+
export default async function NotFound() {
|
|
10
|
+
const { site, locale } = getCachedPageParams();
|
|
19
11
|
|
|
20
12
|
const page = await client.getErrorPage(ErrorPage.NotFound, {
|
|
21
13
|
site: site || scConfig.defaultSite,
|
|
@@ -40,20 +32,3 @@ async function DynamicNotFoundContent() {
|
|
|
40
32
|
</div>
|
|
41
33
|
);
|
|
42
34
|
}
|
|
43
|
-
|
|
44
|
-
export default function NotFound() {
|
|
45
|
-
// Wrap dynamic content in Suspense to enable Next.js 16 Partial Prerendering (PPR).
|
|
46
|
-
// PPR allows streaming dynamic content while keeping static parts prerendered for better performance.
|
|
47
|
-
return (
|
|
48
|
-
<Suspense
|
|
49
|
-
fallback={
|
|
50
|
-
<div style={{ padding: 10 }}>
|
|
51
|
-
<h1>Page not found</h1>
|
|
52
|
-
<p>Loading...</p>
|
|
53
|
-
</div>
|
|
54
|
-
}
|
|
55
|
-
>
|
|
56
|
-
<DynamicNotFoundContent />
|
|
57
|
-
</Suspense>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { isDesignLibraryPreviewData } from '@sitecore-content-sdk/nextjs/editing';
|
|
2
2
|
import { notFound } from 'next/navigation';
|
|
3
3
|
import { draftMode } from 'next/headers';
|
|
4
|
-
import { Suspense } from 'react';
|
|
5
4
|
<% if (prerender === 'SSG') { -%>
|
|
6
5
|
import { SiteInfo } from '@sitecore-content-sdk/nextjs';
|
|
7
6
|
import sites from '.sitecore/sites.json';
|
|
@@ -19,11 +18,12 @@ type PageProps = {
|
|
|
19
18
|
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
|
20
19
|
};
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
//
|
|
26
|
-
|
|
21
|
+
export default async function Page({ params, searchParams }: PageProps) {
|
|
22
|
+
const { site, locale, path } = await params;
|
|
23
|
+
|
|
24
|
+
// Set site and locale to be available in src/i18n/request.ts for fetching the dictionary
|
|
25
|
+
setRequestLocale(`${site}_${locale}`);
|
|
26
|
+
|
|
27
27
|
const draft = await draftMode();
|
|
28
28
|
|
|
29
29
|
// Fetch the page data from Sitecore
|
|
@@ -53,21 +53,6 @@ async function DynamicPageContent({ site, locale, path, searchParams }: { site:
|
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export default async function Page({ params, searchParams }: PageProps) {
|
|
57
|
-
const { site, locale, path } = await params;
|
|
58
|
-
|
|
59
|
-
// Set site and locale to be available in src/i18n/request.ts for fetching the dictionary
|
|
60
|
-
setRequestLocale(`${site}_${locale}`);
|
|
61
|
-
|
|
62
|
-
// Wrap dynamic content in Suspense to enable Next.js 16 Partial Prerendering (PPR).
|
|
63
|
-
// PPR allows streaming dynamic content while keeping static parts prerendered for better performance.
|
|
64
|
-
return (
|
|
65
|
-
<Suspense fallback={<div>Loading...</div>}>
|
|
66
|
-
<DynamicPageContent site={site} locale={locale} path={path} searchParams={searchParams} />
|
|
67
|
-
</Suspense>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
56
|
<% if (prerender === 'SSG') { -%>
|
|
72
57
|
// This function gets called at build and export time to determine
|
|
73
58
|
// pages for SSG ("paths", as tokenized array).
|
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import { draftMode } from 'next/headers';
|
|
2
|
-
import { Suspense } from 'react';
|
|
3
2
|
import Bootstrap from 'src/Bootstrap';
|
|
4
3
|
|
|
5
|
-
// Part of layout component that handles dynamic data, like the `draftMode()` call.
|
|
6
|
-
// This component is wrapped in Suspense to enable Next.js 16 Partial Prerendering (PPR),
|
|
7
|
-
// which allows streaming dynamic content while keeping static parts prerendered.
|
|
8
|
-
// This pattern also works seamlessly when Cache Components is enabled.
|
|
9
|
-
async function DynamicLayoutContent({ site, children }: { site: string; children: React.ReactNode }) {
|
|
10
|
-
const { isEnabled } = await draftMode();
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<>
|
|
14
|
-
<Bootstrap siteName={site} isPreviewMode={isEnabled} />
|
|
15
|
-
{children}
|
|
16
|
-
</>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
4
|
export default async function SiteLayout({
|
|
21
5
|
children,
|
|
22
6
|
params,
|
|
@@ -25,12 +9,12 @@ export default async function SiteLayout({
|
|
|
25
9
|
params: Promise<{ site: string }>;
|
|
26
10
|
}) {
|
|
27
11
|
const { site } = await params;
|
|
12
|
+
const { isEnabled } = await draftMode();
|
|
28
13
|
|
|
29
|
-
// Wrap dynamic content in Suspense to enable Next.js 16 Partial Prerendering (PPR).
|
|
30
|
-
// PPR allows streaming dynamic content while keeping static parts prerendered for better performance.
|
|
31
14
|
return (
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
|
|
15
|
+
<>
|
|
16
|
+
<Bootstrap siteName={site} isPreviewMode={isEnabled} />
|
|
17
|
+
{children}
|
|
18
|
+
</>
|
|
35
19
|
);
|
|
36
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
1
|
+
@import "tailwindcss";
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import Link from 'next/link';
|
|
2
|
-
import { Suspense } from 'react';
|
|
3
2
|
import client from 'lib/sitecore-client';
|
|
4
3
|
import scConfig from 'sitecore.config';
|
|
5
4
|
import { ErrorPage } from '@sitecore-content-sdk/nextjs';
|
|
6
5
|
import Layout from 'src/Layout';
|
|
7
6
|
import Providers from 'src/Providers';
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
// This component is wrapped in Suspense to enable Next.js 16 Partial Prerendering (PPR),
|
|
11
|
-
// which allows streaming dynamic content while keeping static parts prerendered.
|
|
12
|
-
// This pattern also works seamlessly when Cache Components is enabled.
|
|
13
|
-
async function DynamicNotFoundContent() {
|
|
8
|
+
export default async function NotFound() {
|
|
14
9
|
if (scConfig.defaultSite) {
|
|
15
10
|
const page = await client.getErrorPage(ErrorPage.NotFound, {
|
|
16
11
|
site: scConfig.defaultSite,
|
|
@@ -34,20 +29,3 @@ async function DynamicNotFoundContent() {
|
|
|
34
29
|
</div>
|
|
35
30
|
);
|
|
36
31
|
}
|
|
37
|
-
|
|
38
|
-
export default function NotFound() {
|
|
39
|
-
// Wrap dynamic content in Suspense to enable Next.js 16 Partial Prerendering (PPR).
|
|
40
|
-
// PPR allows streaming dynamic content while keeping static parts prerendered for better performance.
|
|
41
|
-
return (
|
|
42
|
-
<Suspense
|
|
43
|
-
fallback={
|
|
44
|
-
<div style={{ padding: 10 }}>
|
|
45
|
-
<h1>Page not found</h1>
|
|
46
|
-
<p>Loading...</p>
|
|
47
|
-
</div>
|
|
48
|
-
}
|
|
49
|
-
>
|
|
50
|
-
<DynamicNotFoundContent />
|
|
51
|
-
</Suspense>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { CdpHelper, useSitecore } from '@sitecore-content-sdk/nextjs';
|
|
3
3
|
import { useEffect, JSX } from 'react';
|
|
4
|
-
import { pageView } from '@sitecore-
|
|
4
|
+
import { pageView } from '@sitecore-content-sdk/events';
|
|
5
5
|
import config from 'sitecore.config';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-content-sdk-app",
|
|
3
|
-
"version": "2.0.0",
|
|
3
|
+
"version": "2.0.2-canary.0",
|
|
4
4
|
"description": "Sitecore Content SDK initializer",
|
|
5
5
|
"bin": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"ts-node": "^10.9.2",
|
|
71
71
|
"typescript": "~5.8.3"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "2c38dbe915264c92dfc8482535afa0f0466e0b35"
|
|
74
74
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const path_1 = __importDefault(require("path"));
|
|
16
|
-
const common_1 = require("../../common");
|
|
17
|
-
const prompts_1 = require("./prompts");
|
|
18
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
19
|
-
class AngularInitializer {
|
|
20
|
-
init(args) {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const answers = yield inquirer_1.default.prompt(prompts_1.prompts, args);
|
|
23
|
-
const templatePath = path_1.default.resolve(__dirname, '../../templates/angular');
|
|
24
|
-
yield (0, common_1.transform)(templatePath, Object.assign(Object.assign({}, args), answers));
|
|
25
|
-
const response = {};
|
|
26
|
-
return response;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.default = AngularInitializer;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.prompts = void 0;
|
|
4
|
-
const common_1 = require("../../common");
|
|
5
|
-
const defaultName = 'content-sdk-angular';
|
|
6
|
-
exports.prompts = [
|
|
7
|
-
...common_1.baseAppPrompts,
|
|
8
|
-
{
|
|
9
|
-
type: 'input',
|
|
10
|
-
name: 'appName',
|
|
11
|
-
message: 'What would you like to name your application?',
|
|
12
|
-
default: defaultName,
|
|
13
|
-
when: (answers) => {
|
|
14
|
-
if (answers.yes && !answers.appName) {
|
|
15
|
-
answers.appName = defaultName;
|
|
16
|
-
}
|
|
17
|
-
return !answers.appName;
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
];
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
3
|
-
"version": 1,
|
|
4
|
-
"cli": {
|
|
5
|
-
"packageManager": "yarn"
|
|
6
|
-
},
|
|
7
|
-
"newProjectRoot": "projects",
|
|
8
|
-
"projects": {
|
|
9
|
-
"<%- appName %>": {
|
|
10
|
-
"projectType": "application",
|
|
11
|
-
"schematics": {},
|
|
12
|
-
"root": "",
|
|
13
|
-
"sourceRoot": "src",
|
|
14
|
-
"prefix": "app",
|
|
15
|
-
"architect": {
|
|
16
|
-
"build": {
|
|
17
|
-
"builder": "@angular/build:application",
|
|
18
|
-
"options": {
|
|
19
|
-
"browser": "src/main.ts",
|
|
20
|
-
"tsConfig": "tsconfig.json",
|
|
21
|
-
"assets": [
|
|
22
|
-
{
|
|
23
|
-
"glob": "**/*",
|
|
24
|
-
"input": "public"
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"styles": ["src/styles.css"],
|
|
28
|
-
"server": "src/main.server.ts",
|
|
29
|
-
"outputMode": "server",
|
|
30
|
-
"ssr": {
|
|
31
|
-
"entry": "src/server.ts"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"configurations": {
|
|
35
|
-
"production": {
|
|
36
|
-
"budgets": [
|
|
37
|
-
{
|
|
38
|
-
"type": "initial",
|
|
39
|
-
"maximumWarning": "500kB",
|
|
40
|
-
"maximumError": "1MB"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"type": "anyComponentStyle",
|
|
44
|
-
"maximumWarning": "4kB",
|
|
45
|
-
"maximumError": "8kB"
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
"outputHashing": "all"
|
|
49
|
-
},
|
|
50
|
-
"development": {
|
|
51
|
-
"optimization": false,
|
|
52
|
-
"extractLicenses": false,
|
|
53
|
-
"sourceMap": true
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"defaultConfiguration": "production"
|
|
57
|
-
},
|
|
58
|
-
"serve": {
|
|
59
|
-
"builder": "@angular/build:dev-server",
|
|
60
|
-
"options": {
|
|
61
|
-
"prebundle": false
|
|
62
|
-
},
|
|
63
|
-
"configurations": {
|
|
64
|
-
"production": {
|
|
65
|
-
"buildTarget": "<%- appName %>:build:production"
|
|
66
|
-
},
|
|
67
|
-
"development": {
|
|
68
|
-
"buildTarget": "<%- appName %>:build:development"
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
"defaultConfiguration": "development"
|
|
72
|
-
},
|
|
73
|
-
"test": {
|
|
74
|
-
"builder": "@angular/build:unit-test"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|