Skip to content

Commit

Permalink
Merge pull request #71 from sitecorelabs/main
Browse files Browse the repository at this point in the history
Merged Restructure of Foundation Head Staging repository to Production repo
  • Loading branch information
robearlam authored Oct 2, 2024
2 parents db4978d + 42d76aa commit aa2ad29
Show file tree
Hide file tree
Showing 251 changed files with 3,215 additions and 25,400 deletions.
38 changes: 1 addition & 37 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,4 @@ _ReSharper*/
[Tt]est[Rr]esult*
.vs/
#Nuget packages folder
packages/

# temporary workaround
/docker/data/cm/*
!/docker/data/cm/.gitkeep
/docker/data/cd/*
!/docker/data/cd/.gitkeep
/docker/data/sql/*
!/docker/data/sql/.gitkeep
/docker/data/solr/*
!/docker/data/solr/.gitkeep
/docker/deploy/platform/*
!/docker/deploy/platform/.gitkeep
/docker/traefik/certs/*.pem
/src/rendering/node_modules
/src/rendering/coverage
/src/rendering/.next*/
/src/rendering/out/
/src/rendering/.generated
/src/rendering/*.graphql.d.ts
/src/rendering/*.graphqls.d.ts
/src/rendering/.DS_Store
/src/rendering/.env.local
/src/rendering/.env.*.local
/src/rendering/*.log*
/src/rendering/.vercel
/src/rendering/**/*.graphql.d.ts
/src/rendering/**/*.graphqls.d.ts
/src/rendering/**/.DS_Store
/src/rendering/**/.env.local
/src/rendering/**/.env.*.local
/src/rendering/**/*.log*
/src/rendering/.vercel
/src/rendering/src/temp/*
/src/rendering/src/temp/!.gitignore
/src/rendering/src/temp/!GraphQLFragmentTypes.json
/src/rendering/src/temp/!GraphQLIntrospectionResult.json
packages/
51 changes: 27 additions & 24 deletions README.md
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.
2 changes: 1 addition & 1 deletion XmCloudSXAStarter.sln → authoring/XmCloudAuthoring.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28729.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Platform", "src\platform\Platform.csproj", "{816F099C-E14B-4468-9E34-87F993C6484D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Platform", ".\platform\Platform.csproj", "{816F099C-E14B-4468-9E34-87F993C6484D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{196B5D43-B228-4632-9BC3-EAAF79B4EDA5}"
ProjectSection(SolutionItems) = preProject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"$schema": "../.sitecore/schemas/ModuleFile.schema.json",
"namespace": "RenderingHost",
"$schema": "../../.sitecore/schemas/ModuleFile.schema.json",
"namespace": "nextjs-starter",
"items": {
"path": "nextjs-starter",
"includes": [
{
"name": "DefaultRenderingHost",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>XmCloudSXAStarter</RootNamespace>
<AssemblyName>XmCloudSXAStarter</AssemblyName>
<RootNamespace>XmCloudNextJsStarter</RootNamespace>
<AssemblyName>XmCloudNextJsStarter</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("XmCloudSXAStarter")]
[assembly: AssemblyTitle("XmCloudNextJsStarter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("XmCloudSXAStarter")]
[assembly: AssemblyProduct("XmCloudNextJsStarter")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>..\..\docker\deploy\platform</PublishUrl>
<PublishUrl>..\..\..\local-containers\docker\deploy\platform</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish />
</PropertyGroup>
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions docker/traefik/config/dynamic/certs_config.yaml

This file was deleted.

184 changes: 92 additions & 92 deletions src/sxastarter/.env → headapps/nextjs-starter/.env
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 src/sxastarter/.eslintrc → headapps/nextjs-starter/.eslintrc
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"]
}
}
Loading

0 comments on commit aa2ad29

Please sign in to comment.