From 63e497626495a7ce92ce484f28256e55bce2a13e Mon Sep 17 00:00:00 2001 From: Artem Alexeyenko Date: Tue, 31 Jan 2023 11:18:10 -0500 Subject: [PATCH 1/2] Incompatibility message when installing sxa and styleguide --- .../src/initializers/nextjs-sxa/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/create-sitecore-jss/src/initializers/nextjs-sxa/index.ts b/packages/create-sitecore-jss/src/initializers/nextjs-sxa/index.ts index d24687c824..7a7d6cad64 100644 --- a/packages/create-sitecore-jss/src/initializers/nextjs-sxa/index.ts +++ b/packages/create-sitecore-jss/src/initializers/nextjs-sxa/index.ts @@ -5,6 +5,7 @@ import { transform, DEFAULT_APPNAME, ClientAppArgs, + incompatibleAddonsMsg, } from '../../common'; export default class NextjsSxaInitializer implements Initializer { @@ -28,6 +29,13 @@ export default class NextjsSxaInitializer implements Initializer { await transform(templatePath, mergedArgs); + if ( + args.templates.includes('nextjs-styleguide') || + pkg.config?.templates?.includes('nextjs-styleguide') + ) { + console.log(incompatibleAddonsMsg('nextjs-sxa', 'nextjs-styleguide')); + } + const response = { // TODO: next steps nextSteps: [], From 810a83d5f98dec27773c710725683f792b00cb16 Mon Sep 17 00:00:00 2001 From: Artem Alexeyenko Date: Tue, 31 Jan 2023 13:08:25 -0500 Subject: [PATCH 2/2] add prompt warning --- .../src/initializers/nextjs/prompts.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/create-sitecore-jss/src/initializers/nextjs/prompts.ts b/packages/create-sitecore-jss/src/initializers/nextjs/prompts.ts index d44236f4c4..e501ed1d91 100644 --- a/packages/create-sitecore-jss/src/initializers/nextjs/prompts.ts +++ b/packages/create-sitecore-jss/src/initializers/nextjs/prompts.ts @@ -53,5 +53,14 @@ export class NextjsCheckbox extends CheckboxPrompt { isValid: incompatibleAddonsMsg('nextjs-styleguide-tracking', 'nextjs-personalize'), }); } + + const isSxaSelected = isSelected('nextjs-sxa'); + const isStyleguideSelected = isSelected('nextjs-styleguide'); + + if (isSxaSelected && isStyleguideSelected) { + this.onError({ + isValid: incompatibleAddonsMsg('nextjs-sxa', 'nextjs-styleguide'), + }); + } } }