Skip to content

Commit

Permalink
[create-sitecore-jss] Removes requirement for base initializer when a…
Browse files Browse the repository at this point in the history
…dding appName to appNames array in case we are scaffolding a non base app (#1931)
  • Loading branch information
yavorsk authored Sep 16, 2024
1 parent cc443e1 commit ff54a91
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
27 changes: 27 additions & 0 deletions packages/create-sitecore-jss/src/init-runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
4 changes: 1 addition & 3 deletions packages/create-sitecore-jss/src/init-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ff54a91

Please sign in to comment.