Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[create-sitecore-jss] Bug fix: Removes requirement for base initializer when adding appName to appNames array in case we are scaffolding a non base app #1931

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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