Sukram
Sukram

Reputation: 381

How to use the new @spartacus/[email protected] schematics?

I’m currently giving Spartacus 3.2 a spin and I’m struggling a bit with the new schematics.

The information on https://sap.github.io/spartacus-docs/building-the-spartacus-storefront-from-libraries/ does not match the information on https://sap.github.io/spartacus-docs/schematics/#adding-spartacus-core-libraries-and-features-to-your-angular-project

Upvotes: 1

Views: 214

Answers (1)

Nikola Zarić
Nikola Zarić

Reputation: 885

What do I have to select to get the same b2c features as for the 3.1 schematics

To have the b2c configuration, you need to select the "b2c" configuration on the first prompt. Here, "b2c" means only some b2c-related configuration, and it's not related to b2c features. The second prompt will ask you which additional Spartacus features you would like to install. Here, you can just press "Enter" if you don't want any of the additional features. The exception to this is our new "User" library which is mandatory to be installed.

Why are basic things like "Cart" and "Product" even presented as option? or are they preselected already because I chose "b2c"?

The reason for this is because some clients like to use Spartacus as just a catalog site, without any cart functionality (for example). Currently, these libraries only contain some extra features related to cart and product and the core mechanisms for these features are still present in core and storefrontlib. This is part of our effort to improve the code splitting and lazy loading. And again, the second prompt doesn't change based on your choice between b2c/b2c configuration.

What is the purpose of useMetaTags?

Meta tags are explained in our docs:

useMetaTags determines whether or not to configure the baseUrl and mediaUrl in the meta tags from index.html.

EDIT What this actually means:
The generated spartacus-configuration.module.ts will not contain any configuration for occ.baseUrl to ensure the URLs are loaded from the meta tags.

How an I pre-select features on the command line? i.e. how can I add schematics without a prompt?

To run the @spartacus/schematics without the prompt you need to pass the --no-interactive flag. Alternatively, to preselect the feature on CLI, you need to pass --features=feature1 --features=feature2 etc., where the feature name corresponds to the menu option names (e.g. --features="Assisted Services Module")

Upvotes: 2

Related Questions