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.
Files changed (71) hide show
  1. package/README.md +5 -5
  2. package/dist/bin.js +119 -119
  3. package/dist/common/base/Initializer.js +2 -2
  4. package/dist/common/base/args.js +2 -2
  5. package/dist/common/base/prompts.js +7 -7
  6. package/dist/common/index.js +18 -18
  7. package/dist/common/processes/install.js +55 -55
  8. package/dist/common/processes/next.js +63 -63
  9. package/dist/common/processes/transform.js +115 -115
  10. package/dist/common/utils/cmd.js +53 -53
  11. package/dist/common/utils/helpers.js +80 -80
  12. package/dist/index.js +6 -6
  13. package/dist/initialize.js +71 -71
  14. package/dist/initializers/nextjs/args.js +2 -2
  15. package/dist/initializers/nextjs/index.js +30 -30
  16. package/dist/initializers/nextjs/prompts.js +26 -26
  17. package/dist/initializers/nextjs-app-router (beta)/args.js +2 -2
  18. package/dist/initializers/nextjs-app-router (beta)/index.js +30 -30
  19. package/dist/initializers/nextjs-app-router (beta)/prompts.js +26 -26
  20. package/dist/templates/nextjs/.cursor/rules/general.mdc +81 -81
  21. package/dist/templates/nextjs/.cursor/rules/javascript.mdc +112 -112
  22. package/dist/templates/nextjs/.cursor/rules/project-setup.mdc +100 -100
  23. package/dist/templates/nextjs/.cursor/rules/sitecore.mdc +147 -147
  24. package/dist/templates/nextjs/.env.container.example +27 -27
  25. package/dist/templates/nextjs/.env.remote.example +45 -44
  26. package/dist/templates/nextjs/.gitattributes +11 -11
  27. package/dist/templates/nextjs/.prettierrc +8 -8
  28. package/dist/templates/nextjs/.vscode/extensions.json +8 -8
  29. package/dist/templates/nextjs/.vscode/launch.json +15 -15
  30. package/dist/templates/nextjs/.windsurfrules +183 -183
  31. package/dist/templates/nextjs/CLAUDE.md +170 -170
  32. package/dist/templates/nextjs/LICENSE.txt +202 -202
  33. package/dist/templates/nextjs/LLMs.txt +179 -179
  34. package/dist/templates/nextjs/README.md +7 -7
  35. package/dist/templates/nextjs/copilot-instructions.md +170 -170
  36. package/dist/templates/nextjs/eslint.config.mjs +81 -81
  37. package/dist/templates/nextjs/gitignore +28 -28
  38. package/dist/templates/nextjs/package.json +68 -68
  39. package/dist/templates/nextjs/sitecore.config.ts.example +38 -38
  40. package/dist/templates/nextjs/src/middleware.ts +16 -7
  41. package/dist/templates/nextjs/tsconfig.json +40 -40
  42. package/dist/templates/nextjs-app-router (beta)/.cursor/rules/app-router-setup.mdc +116 -116
  43. package/dist/templates/nextjs-app-router (beta)/.cursor/rules/general.mdc +80 -80
  44. package/dist/templates/nextjs-app-router (beta)/.cursor/rules/javascript.mdc +112 -112
  45. package/dist/templates/nextjs-app-router (beta)/.cursor/rules/sitecore.mdc +171 -171
  46. package/dist/templates/nextjs-app-router (beta)/.env.container.example +27 -27
  47. package/dist/templates/nextjs-app-router (beta)/.env.remote.example +45 -44
  48. package/dist/templates/nextjs-app-router (beta)/.gitattributes +11 -11
  49. package/dist/templates/nextjs-app-router (beta)/.sitecore/import-map.server.ts +60 -0
  50. package/dist/templates/nextjs-app-router (beta)/.windsurfrules +287 -287
  51. package/dist/templates/nextjs-app-router (beta)/CLAUDE.md +271 -271
  52. package/dist/templates/nextjs-app-router (beta)/LLMs.txt +236 -236
  53. package/dist/templates/nextjs-app-router (beta)/README.md +7 -7
  54. package/dist/templates/nextjs-app-router (beta)/copilot-instructions.md +271 -271
  55. package/dist/templates/nextjs-app-router (beta)/eslint.config.mjs +29 -29
  56. package/dist/templates/nextjs-app-router (beta)/gitignore +31 -29
  57. package/dist/templates/nextjs-app-router (beta)/package.json +54 -54
  58. package/dist/templates/nextjs-app-router (beta)/postcss.config.mjs +5 -5
  59. package/dist/templates/nextjs-app-router (beta)/sitecore.config.ts.example +38 -38
  60. package/dist/templates/nextjs-app-router (beta)/src/Layout.tsx +9 -3
  61. package/dist/templates/nextjs-app-router (beta)/src/Providers.tsx +9 -17
  62. package/dist/templates/nextjs-app-router (beta)/src/app/[site]/[locale]/[[...path]]/page.tsx +1 -5
  63. package/dist/templates/nextjs-app-router (beta)/src/app/api/editing/config/route.ts +2 -0
  64. package/dist/templates/nextjs-app-router (beta)/src/app/api/editing/render/route.ts +1 -1
  65. package/dist/templates/nextjs-app-router (beta)/src/app/globals.css +1 -1
  66. package/dist/templates/nextjs-app-router (beta)/src/middleware.ts +12 -1
  67. package/dist/templates/nextjs-app-router (beta)/tsconfig.json +48 -48
  68. package/package.json +73 -74
  69. package/LICENSE.MD +0 -202
  70. package/dist/templates/nextjs-app-router (beta)/src/DesignLibraryLayout.tsx +0 -7
  71. /package/dist/templates/nextjs-app-router (beta)/.sitecore/{import-map.ts → import-map.client.ts} +0 -0
@@ -1,271 +1,271 @@
1
- # GitHub Copilot Instructions for Sitecore Content SDK Next.js App Router Project
2
-
3
- ## Project Purpose and Tech Stack
4
-
5
- This is a **Sitecore Content SDK** application built with **Next.js App Router** and **TypeScript**. The project follows Sitecore best practices for XM Cloud development and leverages the latest Next.js App Router features for improved performance and developer experience.
6
-
7
- ### Key Technologies
8
- - **Next.js App Router** - React framework with Server Components and modern routing
9
- - **Sitecore Content SDK** - Official SDK for Sitecore XM Cloud integration
10
- - **TypeScript** - Type-safe JavaScript development
11
- - **Sitecore XM Cloud** - Headless CMS platform
12
- - **React Server Components** - Server-side rendering for better performance
13
- - **next-intl** - Internationalization support
14
-
15
- ## Coding Standards
16
-
17
- ### TypeScript Standards
18
- - Use **strict mode** in tsconfig.json
19
- - Prefer type assertions over `any`: `value as ContentItem`
20
- - Use discriminated unions for complex state management
21
- - Enable strict null checks and strict function types
22
-
23
- ### Naming Conventions
24
- - **Variables/Functions**: camelCase (`getUserData()`, `isLoading`, `currentUser`)
25
- - **Components**: PascalCase (`SitecoreComponent`, `PageLayout`, `ContentBlock`)
26
- - **Constants**: UPPER_SNAKE_CASE (`API_ENDPOINT`, `DEFAULT_TIMEOUT`)
27
- - **Directories**: kebab-case (`src/components`, `src/api-clients`)
28
- - **Types/Interfaces**: PascalCase (`ContentItem`, `LayoutProps`, `SitecoreConfig`)
29
-
30
- ### Modular Layout (App Router)
31
- ```
32
- src/
33
- app/ # App Router pages and layouts
34
- components/ # UI components (React)
35
- lib/ # Configuration and utilities
36
- i18n/ # Internationalization setup
37
- types/ # TypeScript type definitions
38
- hooks/ # Custom React hooks
39
- ```
40
-
41
- ## Library Usage
42
-
43
- ### @sitecore-content-sdk
44
- - Use `SitecoreClient` for content fetching
45
- - Implement proper error handling with try/catch blocks
46
- - Cache API responses using React Query or SWR
47
- - Handle content preview vs. published content scenarios
48
-
49
- ```typescript
50
- import { SitecoreClient } from '@sitecore-content-sdk/nextjs/client';
51
- import scConfig from 'sitecore.config';
52
-
53
- const client = new SitecoreClient({
54
- ...scConfig,
55
- });
56
- ```
57
-
58
- ### React App Router Patterns
59
- - Use **Server Components** for data fetching and static content (default)
60
- - Use **Client Components** for interactivity (use 'use client' directive)
61
- - Implement proper error boundaries with error.tsx
62
- - Use loading.tsx for loading states
63
- - Leverage layout.tsx for shared page structure
64
-
65
- ### Sitecore Field Components
66
- - Always use Sitecore field components: `<Text>`, `<RichText>`, `<Image>`
67
- - Validate field existence before rendering
68
- - Handle empty/null fields gracefully
69
- - Prefer Sitecore field components over manual rendering
70
-
71
- ```typescript
72
- // Good: Using Sitecore field components
73
- <Text field={fields?.title} tag="h1" />
74
- <RichText field={fields?.content} />
75
- <Image field={fields?.backgroundImage} />
76
-
77
- // Avoid: Manual field value extraction unless necessary
78
- ```
79
-
80
- ## Example Patterns and Prompts
81
-
82
- ### Server Component Development
83
- ```typescript
84
- // Server Component example (default in App Router)
85
- import { SitecoreClient } from '@sitecore-content-sdk/nextjs/client';
86
- import scConfig from 'sitecore.config';
87
-
88
- const client = new SitecoreClient({
89
- ...scConfig,
90
- });
91
-
92
- export default async function SitecorePage({ params }: { params: { path: string[] } }) {
93
- try {
94
- const pageData = await client.getPage(params.path.join('/'));
95
- return <SitecoreLayout layoutData={pageData?.layout} />;
96
- } catch (error) {
97
- return <div>Content not found</div>;
98
- }
99
- }
100
- ```
101
-
102
- ### Client Component Integration
103
-
104
- Interactive Sitecore Components:
105
-
106
- - Use 'use client' directive when needed
107
- - Keep client components focused on interactivity
108
- - Pass server-fetched data as props
109
- - Handle hydration mismatches carefully
110
-
111
- ```typescript
112
- 'use client';
113
-
114
- interface InteractiveSitecoreComponentProps {
115
- fields: {
116
- title: Field;
117
- content: Field;
118
- };
119
- }
120
-
121
- export default function InteractiveSitecoreComponent({
122
- fields,
123
- }: InteractiveSitecoreComponentProps) {
124
- // Client-side interactivity here
125
- return (
126
- <div>
127
- <Text field={fields?.title} tag="h2" />
128
- <RichText field={fields?.content} />
129
- </div>
130
- );
131
- }
132
- ```
133
-
134
- ### Component Development
135
- ```typescript
136
- // Component props interface
137
- interface HeroProps {
138
- fields: {
139
- title: Field;
140
- subtitle: Field;
141
- backgroundImage: Field;
142
- };
143
- }
144
-
145
- export default function Hero({ fields }: HeroProps) {
146
- return (
147
- <div>
148
- <Text field={fields?.title} tag="h1" />
149
- <Text field={fields?.subtitle} tag="p" />
150
- <Image field={fields?.backgroundImage} />
151
- </div>
152
- );
153
- }
154
- ```
155
-
156
- ### Error Handling
157
-
158
- API Calls:
159
-
160
- - Always wrap in try/catch blocks
161
- - Throw custom errors with context: `SitecoreFetchError`, `ConfigurationError`
162
- - Handle edge cases with guard clauses
163
-
164
- ```typescript
165
- async function fetchPageData(path: string): Promise<Page | null> {
166
- if (!path) {
167
- throw new Error('Page path is required');
168
- }
169
-
170
- try {
171
- const pageData = await client.getPage(path);
172
- return pageData;
173
- } catch (error) {
174
- throw new SitecoreFetchError(`Failed to fetch page data for ${path}`, error);
175
- }
176
- }
177
- ```
178
-
179
- ### Configuration
180
- ```typescript
181
- // sitecore.config.ts
182
- import { defineConfig } from '@sitecore-content-sdk/nextjs/config';
183
-
184
- export default defineConfig({
185
- api: {
186
- edge: {
187
- contextId: process.env.SITECORE_EDGE_CONTEXT_ID || '',
188
- clientContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID,
189
- edgeUrl: process.env.SITECORE_EDGE_URL || 'https://edge-platform.sitecorecloud.io',
190
- },
191
- local: {
192
- apiKey: process.env.SITECORE_API_KEY || '',
193
- apiHost: process.env.SITECORE_API_HOST || '',
194
- },
195
- },
196
- defaultSite: process.env.NEXT_PUBLIC_DEFAULT_SITE_NAME || 'default',
197
- defaultLanguage: process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE || 'en',
198
- editingSecret: process.env.SITECORE_EDITING_SECRET,
199
- });
200
- ```
201
-
202
- ### Internationalization
203
-
204
- Multi-language Support:
205
-
206
- - Configure next-intl for language routing
207
- - Handle Sitecore language contexts
208
- - Implement language switching
209
- - Use proper locale-based data fetching
210
-
211
- ```typescript
212
- // Language-aware data fetching
213
- import { getTranslations } from 'next-intl/server';
214
-
215
- export default async function LocalizedPage() {
216
- const t = await getTranslations('common');
217
- // Fetch Sitecore content for current locale
218
- }
219
- ```
220
-
221
- ## Development Workflow
222
-
223
- 1. **Install dependencies**: `npm install`
224
- 2. **Configure environment**: Copy `.env.example` to `.env.local`
225
- 3. **Start development**: `npm run dev`
226
- 4. **Build for production**: `npm run build`
227
-
228
- ## App Router Best Practices
229
-
230
- ### Server vs Client Components
231
- - Use Server Components for Sitecore content rendering (default)
232
- - Use Client Components for user interactions
233
- - Minimize client-side JavaScript
234
- - Leverage server-side data fetching
235
-
236
- ### Routing and Layouts
237
- - Use layout.tsx for shared page structure
238
- - Implement loading.tsx for loading states
239
- - Create error.tsx for error boundaries
240
- - Use page.tsx for route content
241
- - Use [...path] for Sitecore catch-all routes
242
-
243
- ### Performance Optimization
244
- - Leverage Server Components for better performance
245
- - Use streaming for improved loading experience
246
- - Implement proper caching strategies
247
- - Optimize images with Next.js Image component
248
-
249
- ## Best Practices
250
-
251
- ### Performance
252
- - Optimize images using Next.js Image component
253
- - Implement proper loading states
254
- - Cache expensive operations appropriately
255
- - Consider server-side rendering implications
256
- - Lazy-load non-critical modules
257
- - Use Server Components for better performance
258
-
259
- ### Security
260
- - Sanitize user inputs before processing
261
- - Validate data at application boundaries
262
- - Use HTTPS for all Sitecore connections
263
- - Never expose sensitive configuration in client-side code
264
- - Escape content when rendering to prevent XSS
265
-
266
- ### Code Quality
267
- - Follow DRY principle - extract common functionality
268
- - Use SOLID principles for maintainable code
269
- - Write self-documenting code with clear intent
270
- - Implement proper error boundaries
271
- - Test behavior, not implementation details
1
+ # GitHub Copilot Instructions for Sitecore Content SDK Next.js App Router Project
2
+
3
+ ## Project Purpose and Tech Stack
4
+
5
+ This is a **Sitecore Content SDK** application built with **Next.js App Router** and **TypeScript**. The project follows Sitecore best practices for XM Cloud development and leverages the latest Next.js App Router features for improved performance and developer experience.
6
+
7
+ ### Key Technologies
8
+ - **Next.js App Router** - React framework with Server Components and modern routing
9
+ - **Sitecore Content SDK** - Official SDK for Sitecore XM Cloud integration
10
+ - **TypeScript** - Type-safe JavaScript development
11
+ - **Sitecore XM Cloud** - Headless CMS platform
12
+ - **React Server Components** - Server-side rendering for better performance
13
+ - **next-intl** - Internationalization support
14
+
15
+ ## Coding Standards
16
+
17
+ ### TypeScript Standards
18
+ - Use **strict mode** in tsconfig.json
19
+ - Prefer type assertions over `any`: `value as ContentItem`
20
+ - Use discriminated unions for complex state management
21
+ - Enable strict null checks and strict function types
22
+
23
+ ### Naming Conventions
24
+ - **Variables/Functions**: camelCase (`getUserData()`, `isLoading`, `currentUser`)
25
+ - **Components**: PascalCase (`SitecoreComponent`, `PageLayout`, `ContentBlock`)
26
+ - **Constants**: UPPER_SNAKE_CASE (`API_ENDPOINT`, `DEFAULT_TIMEOUT`)
27
+ - **Directories**: kebab-case (`src/components`, `src/api-clients`)
28
+ - **Types/Interfaces**: PascalCase (`ContentItem`, `LayoutProps`, `SitecoreConfig`)
29
+
30
+ ### Modular Layout (App Router)
31
+ ```
32
+ src/
33
+ app/ # App Router pages and layouts
34
+ components/ # UI components (React)
35
+ lib/ # Configuration and utilities
36
+ i18n/ # Internationalization setup
37
+ types/ # TypeScript type definitions
38
+ hooks/ # Custom React hooks
39
+ ```
40
+
41
+ ## Library Usage
42
+
43
+ ### @sitecore-content-sdk
44
+ - Use `SitecoreClient` for content fetching
45
+ - Implement proper error handling with try/catch blocks
46
+ - Cache API responses using React Query or SWR
47
+ - Handle content preview vs. published content scenarios
48
+
49
+ ```typescript
50
+ import { SitecoreClient } from '@sitecore-content-sdk/nextjs/client';
51
+ import scConfig from 'sitecore.config';
52
+
53
+ const client = new SitecoreClient({
54
+ ...scConfig,
55
+ });
56
+ ```
57
+
58
+ ### React App Router Patterns
59
+ - Use **Server Components** for data fetching and static content (default)
60
+ - Use **Client Components** for interactivity (use 'use client' directive)
61
+ - Implement proper error boundaries with error.tsx
62
+ - Use loading.tsx for loading states
63
+ - Leverage layout.tsx for shared page structure
64
+
65
+ ### Sitecore Field Components
66
+ - Always use Sitecore field components: `<Text>`, `<RichText>`, `<Image>`
67
+ - Validate field existence before rendering
68
+ - Handle empty/null fields gracefully
69
+ - Prefer Sitecore field components over manual rendering
70
+
71
+ ```typescript
72
+ // Good: Using Sitecore field components
73
+ <Text field={fields?.title} tag="h1" />
74
+ <RichText field={fields?.content} />
75
+ <Image field={fields?.backgroundImage} />
76
+
77
+ // Avoid: Manual field value extraction unless necessary
78
+ ```
79
+
80
+ ## Example Patterns and Prompts
81
+
82
+ ### Server Component Development
83
+ ```typescript
84
+ // Server Component example (default in App Router)
85
+ import { SitecoreClient } from '@sitecore-content-sdk/nextjs/client';
86
+ import scConfig from 'sitecore.config';
87
+
88
+ const client = new SitecoreClient({
89
+ ...scConfig,
90
+ });
91
+
92
+ export default async function SitecorePage({ params }: { params: { path: string[] } }) {
93
+ try {
94
+ const pageData = await client.getPage(params.path.join('/'));
95
+ return <SitecoreLayout layoutData={pageData?.layout} />;
96
+ } catch (error) {
97
+ return <div>Content not found</div>;
98
+ }
99
+ }
100
+ ```
101
+
102
+ ### Client Component Integration
103
+
104
+ Interactive Sitecore Components:
105
+
106
+ - Use 'use client' directive when needed
107
+ - Keep client components focused on interactivity
108
+ - Pass server-fetched data as props
109
+ - Handle hydration mismatches carefully
110
+
111
+ ```typescript
112
+ 'use client';
113
+
114
+ interface InteractiveSitecoreComponentProps {
115
+ fields: {
116
+ title: Field;
117
+ content: Field;
118
+ };
119
+ }
120
+
121
+ export default function InteractiveSitecoreComponent({
122
+ fields,
123
+ }: InteractiveSitecoreComponentProps) {
124
+ // Client-side interactivity here
125
+ return (
126
+ <div>
127
+ <Text field={fields?.title} tag="h2" />
128
+ <RichText field={fields?.content} />
129
+ </div>
130
+ );
131
+ }
132
+ ```
133
+
134
+ ### Component Development
135
+ ```typescript
136
+ // Component props interface
137
+ interface HeroProps {
138
+ fields: {
139
+ title: Field;
140
+ subtitle: Field;
141
+ backgroundImage: Field;
142
+ };
143
+ }
144
+
145
+ export default function Hero({ fields }: HeroProps) {
146
+ return (
147
+ <div>
148
+ <Text field={fields?.title} tag="h1" />
149
+ <Text field={fields?.subtitle} tag="p" />
150
+ <Image field={fields?.backgroundImage} />
151
+ </div>
152
+ );
153
+ }
154
+ ```
155
+
156
+ ### Error Handling
157
+
158
+ API Calls:
159
+
160
+ - Always wrap in try/catch blocks
161
+ - Throw custom errors with context: `SitecoreFetchError`, `ConfigurationError`
162
+ - Handle edge cases with guard clauses
163
+
164
+ ```typescript
165
+ async function fetchPageData(path: string): Promise<Page | null> {
166
+ if (!path) {
167
+ throw new Error('Page path is required');
168
+ }
169
+
170
+ try {
171
+ const pageData = await client.getPage(path);
172
+ return pageData;
173
+ } catch (error) {
174
+ throw new SitecoreFetchError(`Failed to fetch page data for ${path}`, error);
175
+ }
176
+ }
177
+ ```
178
+
179
+ ### Configuration
180
+ ```typescript
181
+ // sitecore.config.ts
182
+ import { defineConfig } from '@sitecore-content-sdk/nextjs/config';
183
+
184
+ export default defineConfig({
185
+ api: {
186
+ edge: {
187
+ contextId: process.env.SITECORE_EDGE_CONTEXT_ID || '',
188
+ clientContextId: process.env.NEXT_PUBLIC_SITECORE_EDGE_CONTEXT_ID,
189
+ edgeUrl: process.env.SITECORE_EDGE_URL || 'https://edge-platform.sitecorecloud.io',
190
+ },
191
+ local: {
192
+ apiKey: process.env.SITECORE_API_KEY || '',
193
+ apiHost: process.env.SITECORE_API_HOST || '',
194
+ },
195
+ },
196
+ defaultSite: process.env.NEXT_PUBLIC_DEFAULT_SITE_NAME || 'default',
197
+ defaultLanguage: process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE || 'en',
198
+ editingSecret: process.env.SITECORE_EDITING_SECRET,
199
+ });
200
+ ```
201
+
202
+ ### Internationalization
203
+
204
+ Multi-language Support:
205
+
206
+ - Configure next-intl for language routing
207
+ - Handle Sitecore language contexts
208
+ - Implement language switching
209
+ - Use proper locale-based data fetching
210
+
211
+ ```typescript
212
+ // Language-aware data fetching
213
+ import { getTranslations } from 'next-intl/server';
214
+
215
+ export default async function LocalizedPage() {
216
+ const t = await getTranslations('common');
217
+ // Fetch Sitecore content for current locale
218
+ }
219
+ ```
220
+
221
+ ## Development Workflow
222
+
223
+ 1. **Install dependencies**: `npm install`
224
+ 2. **Configure environment**: Copy `.env.example` to `.env.local`
225
+ 3. **Start development**: `npm run dev`
226
+ 4. **Build for production**: `npm run build`
227
+
228
+ ## App Router Best Practices
229
+
230
+ ### Server vs Client Components
231
+ - Use Server Components for Sitecore content rendering (default)
232
+ - Use Client Components for user interactions
233
+ - Minimize client-side JavaScript
234
+ - Leverage server-side data fetching
235
+
236
+ ### Routing and Layouts
237
+ - Use layout.tsx for shared page structure
238
+ - Implement loading.tsx for loading states
239
+ - Create error.tsx for error boundaries
240
+ - Use page.tsx for route content
241
+ - Use [...path] for Sitecore catch-all routes
242
+
243
+ ### Performance Optimization
244
+ - Leverage Server Components for better performance
245
+ - Use streaming for improved loading experience
246
+ - Implement proper caching strategies
247
+ - Optimize images with Next.js Image component
248
+
249
+ ## Best Practices
250
+
251
+ ### Performance
252
+ - Optimize images using Next.js Image component
253
+ - Implement proper loading states
254
+ - Cache expensive operations appropriately
255
+ - Consider server-side rendering implications
256
+ - Lazy-load non-critical modules
257
+ - Use Server Components for better performance
258
+
259
+ ### Security
260
+ - Sanitize user inputs before processing
261
+ - Validate data at application boundaries
262
+ - Use HTTPS for all Sitecore connections
263
+ - Never expose sensitive configuration in client-side code
264
+ - Escape content when rendering to prevent XSS
265
+
266
+ ### Code Quality
267
+ - Follow DRY principle - extract common functionality
268
+ - Use SOLID principles for maintainable code
269
+ - Write self-documenting code with clear intent
270
+ - Implement proper error boundaries
271
+ - Test behavior, not implementation details
@@ -1,29 +1,29 @@
1
- import { dirname } from "path";
2
- import { fileURLToPath } from "url";
3
- import { FlatCompat } from "@eslint/eslintrc";
4
-
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = dirname(__filename);
7
-
8
- const compat = new FlatCompat({
9
- baseDirectory: __dirname,
10
- });
11
-
12
- const eslintConfig = [
13
- ...compat.extends("next/core-web-vitals", "next/typescript"),
14
- {
15
- rules: {
16
- // Don't force alt for <Image/> (sourced from Sitecore media)
17
- "jsx-a11y/alt-text": "off",
18
- },
19
- ignores: [
20
- "node_modules/**",
21
- ".next/**",
22
- "out/**",
23
- "build/**",
24
- "next-env.d.ts",
25
- ],
26
- },
27
- ];
28
-
29
- export default eslintConfig;
1
+ import { dirname } from "path";
2
+ import { fileURLToPath } from "url";
3
+ import { FlatCompat } from "@eslint/eslintrc";
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = dirname(__filename);
7
+
8
+ const compat = new FlatCompat({
9
+ baseDirectory: __dirname,
10
+ });
11
+
12
+ const eslintConfig = [
13
+ ...compat.extends("next/core-web-vitals", "next/typescript"),
14
+ {
15
+ rules: {
16
+ // Don't force alt for <Image/> (sourced from Sitecore media)
17
+ "jsx-a11y/alt-text": "off",
18
+ },
19
+ ignores: [
20
+ "node_modules/**",
21
+ ".next/**",
22
+ "out/**",
23
+ "build/**",
24
+ "next-env.d.ts",
25
+ ],
26
+ },
27
+ ];
28
+
29
+ export default eslintConfig;
@@ -1,29 +1,31 @@
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/component-map.client.ts
29
- !.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/component-map.client.ts
29
+ !.sitecore/import-map.ts
30
+ !.sitecore/import-map.server.ts
31
+ !.sitecore/import-map.client.ts