From a2b1c7d256c3a0f946a91300f6e194e1c5204a76 Mon Sep 17 00:00:00 2001 From: yavorsk Date: Mon, 16 Sep 2024 13:58:33 +0300 Subject: [PATCH 1/2] remove requirment for base initializer when adding appName to array; fixes development test 'Should create nextjs app with Styleguide using post-initializer template only' --- .../src/init-runner.test.ts | 27 +++++++++++++++++++ .../create-sitecore-jss/src/init-runner.ts | 4 +-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/packages/create-sitecore-jss/src/init-runner.test.ts b/packages/create-sitecore-jss/src/init-runner.test.ts index 41d5feaa47..ae53a28cde 100644 --- a/packages/create-sitecore-jss/src/init-runner.test.ts +++ b/packages/create-sitecore-jss/src/init-runner.test.ts @@ -168,6 +168,33 @@ describe('initRunner', () => { ); }); + it('should aggregate nextSteps when using non base, post-initializer template', async () => { + const templates = ['bar']; + const appName = 'test-app-bar'; + const args = { + silent: false, + destination: 'samples/next', + templates, + }; + + const mockBar = mockInitializer(false, { + appName, + nextSteps: ['bar step 1', 'bar step 2'], + initializers: ['baz'], + }); + const mockBaz = mockInitializer(false, { appName, nextSteps: ['baz step 1'] }); + createStub = sinon.stub(InitializerFactory.prototype, 'create'); + createStub.withArgs('bar').returns(mockBar); + createStub.withArgs('baz').returns(mockBaz); + + await initRunner(templates, args); + + expect(nextStepsStub).to.be.calledOnceWith( + [appName], + ['bar step 1', 'bar step 2', 'baz step 1'] + ); + }); + it('should pass two appNames when two main apps initialized', async () => { const templates = ['foo', 'bar']; const args = { diff --git a/packages/create-sitecore-jss/src/init-runner.ts b/packages/create-sitecore-jss/src/init-runner.ts index a9ca33a644..db636d94b2 100644 --- a/packages/create-sitecore-jss/src/init-runner.ts +++ b/packages/create-sitecore-jss/src/init-runner.ts @@ -27,9 +27,7 @@ export const initRunner = async (initializers: string[], args: BaseArgs) => { const response = await initializer.init(args); // We can have multiple appNames if base template requires to setup an additional standalone app (e.g. XM Cloud proxy) - if (initializer.isBase) { - appNames.add(response.appName); - } + appNames.add(response.appName); nextStepsArr = [...nextStepsArr, ...(response.nextSteps ?? [])]; // process any returned initializers if (response.initializers && response.initializers.length > 0) { From 70ba90afc8acbaebc243c1a9d0d0064e5e35cb75 Mon Sep 17 00:00:00 2001 From: yavorsk Date: Mon, 16 Sep 2024 14:03:48 +0300 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61f139b458..3c4fee739f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ Our versioning strategy is as follows: * Rework Angular initializer to support XMCloud and SXP journeys; * Add SXA styles to xmcloud addon * `[create-sitecore-jss]` `[template/angular]` `[template/angular-xmcloud]` `[template/node-xmcloud-proxy]` Edge Proxy / Context Id support ([#1875](https://github.com/Sitecore/jss/pull/1875))([#1885](https://github.com/Sitecore/jss/pull/1885)) -* `[create-sitecore-jss]` Rework Angular initializer to support XMCloud and SXP journeys ([#1845](https://github.com/Sitecore/jss/pull/1845))([#1858](https://github.com/Sitecore/jss/pull/1858))([#1868](https://github.com/Sitecore/jss/pull/1868))([#1881](https://github.com/Sitecore/jss/pull/1881))([#1882](https://github.com/Sitecore/jss/pull/1882)) +* `[create-sitecore-jss]` Rework Angular initializer to support XMCloud and SXP journeys ([#1845](https://github.com/Sitecore/jss/pull/1845))([#1858](https://github.com/Sitecore/jss/pull/1858))([#1868](https://github.com/Sitecore/jss/pull/1868))([#1881](https://github.com/Sitecore/jss/pull/1881))([#1882](https://github.com/Sitecore/jss/pull/1882))([#1931](https://github.com/Sitecore/jss/pull/1931)) * `[create-sitecore-jss]` Allow node-xmcloud-proxy app to be installed alongside Angular SPA application * `proxyAppDestination` arg can be passed into `create-sitecore-jss` command to define path for proxy to be installed in * `[templates/angular]` `[templates/angular-xmcloud]` `[template/node-xmcloud-proxy]` `[sitecore-jss-proxy]` Introduced /api/editing/config endpoint ([#1903](https://github.com/Sitecore/jss/pull/1903))