The JavaScript storefront sample repository includes a single storefront application. You can add applications and the packages that support those applications to your cloned code repository.
Prerequisites
You cloned the 2105-spartacus branch of the sample repository. For more information, see Commerce Cloud Repository.
You followed the instructions in the readme file to prepare the files.
Procedure
Open the code repository.
Navigate to root/js-storefront and open the JavaScript storefront manifest file.
Enable SAP Commerce Cloud, composable storefront by adding the following data to the manifest file:
If you’re using a prebuilt application, ensure your output files, including index.html, are saved in <application.path>/dist/<application.name>. For example:
This placeholder is replaced with the real API aspect external URL at application startup.
To explicitly configure the back-end URL for each of your applications, use the ccv2.occ.backend.base.url.<$jsapp>.value service property in the JavaScript storefront service configuration. For example:
If you do not explicitly configure the back-end URL for each of your applications, JavaScript storefronts can use blue and green deployments. This allows the storefront to have different types of endpoints:
Green: JavaScript storefront automatically adds a green API endpoint. The JavaScript storefront does not startup if there is no endpoint.
Blue: JavaScript storefront automatically adds a default API endpoint.
To apply the changes, create a build.
The build process then automatically builds all JavaScript applications provided in the SAP Commerce Cloud code repository.
For each application defined in manifest.json, the build process checks whether the <application.path>/dist directory exists. If it doesn’t exist, the build process runs the following commands in the <application.path> directory:
For Client-Side Rendering (CSR):
yarn install - downloads dependencies that are declared in package.json,
yarn build - runs the build command that is declared in package.json.
For Server Side Rendering (SSR):
yarn install - downloads dependencies declared in package.json,
yarn build:ssr - runs the build command that is declared in package.json.
Otherwise, if the <application.path>/dist does exist, the build process assumes that this directory contains a JavaScript storefront that is already built and it skips the build.