forked from sitecorelabs/xmcloud-foundation-head
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from sitecorelabs/main
Merged Restructure of Foundation Head Staging repository to Production repo
- Loading branch information
Showing
251 changed files
with
3,215 additions
and
25,400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
# XM Cloud Starter Kit (Next JS) | ||
|
||
## QUICK START | ||
|
||
1. In an ADMIN terminal: | ||
|
||
```ps1 | ||
.\init.ps1 -InitEnv -LicenseXmlPath "C:\path\to\license.xml" -AdminPassword "DesiredAdminPassword" | ||
``` | ||
2. Restart your terminal and run: | ||
```ps1 | ||
.\up.ps1 | ||
# XM Cloud Next.js Starter Kit | ||
This repository contains the Next.js Starter Kit for Sitecore XM Cloud Development. It is intended to get developers up and running quickly with a new Next.js project that is integrated with Sitecore XM Cloud. | ||
|
||
## GitHub Template | ||
This Github repository is a template that can be used to create your own repository. To get started, click the `Use this template` button at the top of the repository. | ||
|
||
### Prerequisites | ||
- Access to an Sitecore XM Cloud Environment | ||
- [Node.js LTS](https://nodejs.org/en/) | ||
|
||
### Getting Started Guide | ||
For developers new to XM Cloud you can follow the Getting Started Guide on the [Sitecore Documentation Site](https://doc.sitecore.com/xmc) to get up and running with XM Cloud. This will walk you through the process of creating a new XM Cloud Project, provisioning an Environment, deploying the NextJs Starter Kit, and finally creating your first Component. | ||
|
||
### Running the Next.js Starter Kit | ||
- Log into the Sitecore XM Cloud Deploy Portal, locate your Environment and select the `Developer Settings` tab. | ||
- Ensure that the `Preview` toggle is enabled. | ||
- In the `Local Development` section, click to copy the sample `.env` file contents to your clipboard. | ||
- Create a new `.env.local` file in the `./headapps/nextjs-starter` folder of this repository and paste the contents from your clipboard. | ||
- Run the following commands in the root of the repository to start the NextJs application: | ||
```bash | ||
cd headapps/nextjs-starter | ||
npm install | ||
npm run start:connected | ||
``` | ||
- You should now be able to access your site on `http://localhost:3000` and see your changes in real-time as you make them. | ||
|
||
3. Follow the instructions to [deploy to XM Cloud](#deploy-to-xmcloud) | ||
4. Create Edge token and [query from edge](#query-edge) | ||
*** | ||
## About this Solution | ||
This solution is designed to help developers learn and get started quickly | ||
with XMCLoud + SXA. | ||
## Disconnected offline development | ||
It is possible to mock a small subset of the XM Cloud Application elements to enable offline development. This can allow for a disconnected development experience, however it is recommend to work in the default connected mode. | ||
|
||
You can find more information about how setup the offline development experience [here](./local-containers/README.md) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/renderinghost.module.json → authoring/items/nextjs-starter.module.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,92 @@ | ||
# For development purposes, note Next.js supports a .env.local | ||
# file, which is already configured to be git ignored. | ||
# Read more about Next.js support of environment variables here: | ||
# https://nextjs.org/docs/basic-features/environment-variables | ||
|
||
# The public URL to use for absolute URLs, which are required when | ||
# the Next.js app is run within Sitecore editors. | ||
# This should match the `serverSideRenderingEngineApplicationUrl` | ||
# in your Sitecore configuration (see \sitecore\config\sxastarter.config). | ||
# Be sure to update these values accordingly as your public endpoint changes. | ||
# See https://jss.sitecore.com/docs/fundamentals/services/view-engine | ||
# If undefined, http://localhost:3000 is used by default. | ||
# In production non-editing environments it is desirable to use relative URLs, so this may be set to empty string. | ||
#PUBLIC_URL= | ||
|
||
# To secure the Sitecore editor endpoint exposed by your Next.js app | ||
# (`/api/editing/render` by default), a secret token is used. This (client-side) | ||
# value must match your server-side value (see \sitecore\config\sxastarter.config). | ||
# We recommend an alphanumeric value of at least 16 characters. | ||
JSS_EDITING_SECRET= | ||
|
||
# ====== Sitecore Preview / Delivery Edge ====== | ||
|
||
# Your Sitecore API key is needed to build the app. Typically, the API key is | ||
# defined in `scjssconfig.json` (as `sitecore.apiKey`). This file may not exist | ||
# when building locally (if you've never run `jss setup`), or when building in a | ||
# higher environment (since `scjssconfig.json` is ignored from source control). | ||
# In this case, use this environment variable to provide the value at build time. | ||
SITECORE_API_KEY= | ||
|
||
# Your Sitecore API hostname is needed to build the app. Typically, the API host is | ||
# defined in `scjssconfig.json` (as `sitecore.layoutServiceHost`). This file may | ||
# not exist when building locally (if you've never run `jss setup`), or when building | ||
# in a higher environment (since `scjssconfig.json` is ignored from source control). | ||
# In this case, use this environment variable to provide the value at build time. | ||
SITECORE_API_HOST= | ||
|
||
# Your GraphQL Edge endpoint. This is required for Sitecore Experience Edge. | ||
# For Sitecore XM, this is typically optional. By default, the endpoint is calculated using | ||
# the resolved Sitecore API hostname + the `graphQLEndpointPath` defined in your `package.json`. | ||
GRAPH_QL_ENDPOINT= | ||
|
||
# ============================================== | ||
|
||
# Your Sitecore site name. | ||
# Uses your `package.json` config `appName` if empty. | ||
# When using the Next.js Multisite add-on, the value of the variable represents the default/configured site. | ||
SITECORE_SITE_NAME= | ||
|
||
# Your default app language. | ||
DEFAULT_LANGUAGE= | ||
|
||
# How many times should GraphQL Layout, Dictionary and ErrorPages services retry a fetch when endpoint rate limit is reached | ||
# You can disable it for all the services by configuring it to 0. | ||
GRAPH_QL_SERVICE_RETRIES=3 | ||
|
||
# The way in which layout and dictionary data is fetched from Sitecore | ||
FETCH_WITH=GraphQL | ||
|
||
# Indicates whether SSG `getStaticPaths` pre-render any pages | ||
# Set the environment variable DISABLE_SSG_FETCH=true | ||
# to enable full ISR (Incremental Static Regeneration) flow | ||
DISABLE_SSG_FETCH= | ||
|
||
# Sitecore JSS npm packages utilize the debug module for debug logging. | ||
# https://www.npmjs.com/package/debug | ||
# Set the DEBUG environment variable to 'sitecore-jss:*' to see all logs: | ||
#DEBUG=sitecore-jss:* | ||
# Or be selective and show for example only layout service logs: | ||
#DEBUG=sitecore-jss:layout | ||
# Or everything BUT layout service logs: | ||
#DEBUG=sitecore-jss:*,-sitecore-jss:layout | ||
|
||
|
||
# ========== Sitecore Edge Platform =========== | ||
|
||
# Your unified Sitecore Edge Context Id. | ||
# This will be used over any Sitecore Preview / Delivery Edge variables (above). | ||
SITECORE_EDGE_CONTEXT_ID= | ||
|
||
# ============================================== | ||
|
||
# An optional Sitecore Personalize scope identifier. | ||
# This can be used to isolate personalization data when multiple XM Cloud Environments share a Personalize tenant. | ||
# This should match the PAGES_PERSONALIZE_SCOPE environment variable for your connected XM Cloud Environment. | ||
NEXT_PUBLIC_PERSONALIZE_SCOPE= | ||
|
||
# Timeout (ms) for Sitecore CDP requests to respond within. Default is 400. | ||
PERSONALIZE_MIDDLEWARE_CDP_TIMEOUT= | ||
|
||
# Timeout (ms) for Sitecore Experience Edge requests to respond within. Default is 400. | ||
PERSONALIZE_MIDDLEWARE_EDGE_TIMEOUT= | ||
# For development purposes, note Next.js supports a .env.local | ||
# file, which is already configured to be git ignored. | ||
# Read more about Next.js support of environment variables here: | ||
# https://nextjs.org/docs/basic-features/environment-variables | ||
|
||
# The public URL to use for absolute URLs, which are required when | ||
# the Next.js app is run within Sitecore editors. | ||
# This should match the `serverSideRenderingEngineApplicationUrl` | ||
# in your Sitecore configuration (see \sitecore\config\sxastarter.config). | ||
# Be sure to update these values accordingly as your public endpoint changes. | ||
# See https://jss.sitecore.com/docs/fundamentals/services/view-engine | ||
# If undefined, http://localhost:3000 is used by default. | ||
# In production non-editing environments it is desirable to use relative URLs, so this may be set to empty string. | ||
#PUBLIC_URL= | ||
|
||
# To secure the Sitecore editor endpoint exposed by your Next.js app | ||
# (`/api/editing/render` by default), a secret token is used. This (client-side) | ||
# value must match your server-side value (see \sitecore\config\sxastarter.config). | ||
# We recommend an alphanumeric value of at least 16 characters. | ||
JSS_EDITING_SECRET= | ||
|
||
# ====== Sitecore Preview / Delivery Edge ====== | ||
|
||
# Your Sitecore API key is needed to build the app. Typically, the API key is | ||
# defined in `scjssconfig.json` (as `sitecore.apiKey`). This file may not exist | ||
# when building locally (if you've never run `jss setup`), or when building in a | ||
# higher environment (since `scjssconfig.json` is ignored from source control). | ||
# In this case, use this environment variable to provide the value at build time. | ||
SITECORE_API_KEY= | ||
|
||
# Your Sitecore API hostname is needed to build the app. Typically, the API host is | ||
# defined in `scjssconfig.json` (as `sitecore.layoutServiceHost`). This file may | ||
# not exist when building locally (if you've never run `jss setup`), or when building | ||
# in a higher environment (since `scjssconfig.json` is ignored from source control). | ||
# In this case, use this environment variable to provide the value at build time. | ||
SITECORE_API_HOST= | ||
|
||
# Your GraphQL Edge endpoint. This is required for Sitecore Experience Edge. | ||
# For Sitecore XM, this is typically optional. By default, the endpoint is calculated using | ||
# the resolved Sitecore API hostname + the `graphQLEndpointPath` defined in your `package.json`. | ||
GRAPH_QL_ENDPOINT= | ||
|
||
# ============================================== | ||
|
||
# Your Sitecore site name. | ||
# Uses your `package.json` config `appName` if empty. | ||
# When using the Next.js Multisite add-on, the value of the variable represents the default/configured site. | ||
SITECORE_SITE_NAME= | ||
|
||
# Your default app language. | ||
DEFAULT_LANGUAGE= | ||
|
||
# How many times should GraphQL Layout, Dictionary and ErrorPages services retry a fetch when endpoint rate limit is reached | ||
# You can disable it for all the services by configuring it to 0. | ||
GRAPH_QL_SERVICE_RETRIES=3 | ||
|
||
# The way in which layout and dictionary data is fetched from Sitecore | ||
FETCH_WITH=GraphQL | ||
|
||
# Indicates whether SSG `getStaticPaths` pre-render any pages | ||
# Set the environment variable DISABLE_SSG_FETCH=true | ||
# to enable full ISR (Incremental Static Regeneration) flow | ||
DISABLE_SSG_FETCH= | ||
|
||
# Sitecore JSS npm packages utilize the debug module for debug logging. | ||
# https://www.npmjs.com/package/debug | ||
# Set the DEBUG environment variable to 'sitecore-jss:*' to see all logs: | ||
#DEBUG=sitecore-jss:* | ||
# Or be selective and show for example only layout service logs: | ||
#DEBUG=sitecore-jss:layout | ||
# Or everything BUT layout service logs: | ||
#DEBUG=sitecore-jss:*,-sitecore-jss:layout | ||
|
||
|
||
# ========== Sitecore Edge Platform =========== | ||
|
||
# Your unified Sitecore Edge Context Id. | ||
# This will be used over any Sitecore Preview / Delivery Edge variables (above). | ||
SITECORE_EDGE_CONTEXT_ID= | ||
|
||
# ============================================== | ||
|
||
# An optional Sitecore Personalize scope identifier. | ||
# This can be used to isolate personalization data when multiple XM Cloud Environments share a Personalize tenant. | ||
# This should match the PAGES_PERSONALIZE_SCOPE environment variable for your connected XM Cloud Environment. | ||
NEXT_PUBLIC_PERSONALIZE_SCOPE= | ||
|
||
# Timeout (ms) for Sitecore CDP requests to respond within. Default is 400. | ||
PERSONALIZE_MIDDLEWARE_CDP_TIMEOUT= | ||
|
||
# Timeout (ms) for Sitecore Experience Edge requests to respond within. Default is 400. | ||
PERSONALIZE_MIDDLEWARE_EDGE_TIMEOUT= |
52 changes: 26 additions & 26 deletions
52
src/sxastarter/.eslintrc → headapps/nextjs-starter/.eslintrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
{ | ||
"root": true, | ||
"extends": [ | ||
"next", | ||
"next/core-web-vitals", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier", | ||
"plugin:yaml/recommended", | ||
"plugin:prettier/recommended" | ||
], | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"prettier", | ||
"yaml", | ||
"react" | ||
], | ||
"ignorePatterns": [".generated/**/*", "**/*.d.ts", "**/*.js"], | ||
"rules": { | ||
"@next/next/no-img-element": "off", // Don't force next/image | ||
"jsx-a11y/alt-text": ["warn", { "elements": ["img"] }], // Don't force alt for <Image/> (sourced from Sitecore media) | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/no-unused-vars": "error", | ||
"@typescript-eslint/no-explicit-any": "error", | ||
"jsx-quotes": ["error", "prefer-double"] | ||
} | ||
} | ||
{ | ||
"root": true, | ||
"extends": [ | ||
"next", | ||
"next/core-web-vitals", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier", | ||
"plugin:yaml/recommended", | ||
"plugin:prettier/recommended" | ||
], | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"prettier", | ||
"yaml", | ||
"react" | ||
], | ||
"ignorePatterns": [".generated/**/*", "**/*.d.ts", "**/*.js"], | ||
"rules": { | ||
"@next/next/no-img-element": "off", // Don't force next/image | ||
"jsx-a11y/alt-text": ["warn", { "elements": ["img"] }], // Don't force alt for <Image/> (sourced from Sitecore media) | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/no-unused-vars": "error", | ||
"@typescript-eslint/no-explicit-any": "error", | ||
"jsx-quotes": ["error", "prefer-double"] | ||
} | ||
} |
Oops, something went wrong.