Skip to content

Commit

Permalink
[Next.js] Fixes (part 2) for nextjs-xmcloud Initializer Template (#…
Browse files Browse the repository at this point in the history
…1658)

* [create-sitecore-jss] Minor fix to prevent "Are you building for XM Cloud?" prompt if nextjs-xmcloud template was specified

* update CHANGELOG
  • Loading branch information
ambrauer authored Nov 8, 2023
1 parent c55bf61 commit 900ccd7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Our versioning strategy is as follows:
* `[sitecore-jss-nextjs]` (Vercel/Sitecore) Deployment Protection Bypass support for editing integration. ([#1634](https://github.com/Sitecore/jss/pull/1634))
* `[sitecore-jss]` `[templates/nextjs]` Load environment-specific FEAAS theme stylesheets based on Sitecore Edge Platform URL ([#1645](https://github.com/Sitecore/jss/pull/1645))
* `[sitecore-jss-nextjs]` The _GraphQLRequestClient_ import from _@sitecore-jss/sitecore-jss-nextjs_ is deprecated, use import from _@sitecore-jss/sitecore-jss-nextjs/graphql_ submodule instead ([#1650](https://github.com/Sitecore/jss/pull/1650) [#1648](https://github.com/Sitecore/jss/pull/1648))
* `[create-sitecore-jss]` Introduced `nextjs-xmcloud` initializer template. This will include all base XM Cloud features, including Personalize, FEaaS, BYOC, Sitecore Edge Platform and Context support. ([#1653](https://github.com/Sitecore/jss/pull/1653)) ([#1657](https://github.com/Sitecore/jss/pull/1657))
* `[create-sitecore-jss]` Introduced `nextjs-xmcloud` initializer template. This will include all base XM Cloud features, including Personalize, FEaaS, BYOC, Sitecore Edge Platform and Context support. ([#1653](https://github.com/Sitecore/jss/pull/1653)) ([#1657](https://github.com/Sitecore/jss/pull/1657)) ([#1658](https://github.com/Sitecore/jss/pull/1658))

### 🐛 Bug Fixes

Expand Down
12 changes: 10 additions & 2 deletions packages/create-sitecore-jss/src/initializers/nextjs/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { QuestionCollection } from 'inquirer';
import CheckboxPrompt from 'inquirer/lib/prompts/checkbox';

import { clientAppPrompts, ClientAppAnswer, incompatibleAddonsMsg } from '../../common';
import { NextjsArgs } from './args';

export enum Prerender {
SSG = 'SSG',
Expand Down Expand Up @@ -35,8 +36,15 @@ export const prompts: QuestionCollection<NextjsAnswer> = [
name: 'xmcloud',
message: 'Are you building for Sitecore XM Cloud?',
default: false,
when: (answers: NextjsAnswer): boolean => {
return !answers.yes;
when: (answers: NextjsAnswer & NextjsArgs): boolean => {
// don't prompt if --yes or nextjs-xmcloud template was specified
if (answers.yes) {
return false;
} else if (answers.templates.includes('nextjs-xmcloud')) {
answers.xmcloud = true;
return false;
}
return true;
},
},
];
Expand Down

0 comments on commit 900ccd7

Please sign in to comment.