Next-generation platformDeprecated

Yarn and Angular CLI commands

This topic serves as a reference for Yarn and Angular CLI commands that are required for application development.

Table 1. Yarn and CLI command reference
Yarn command reference Purpose
yarn start Builds (JIT mode) and serves the application with customizations to browser on port 4500 with HMR enabled.
yarn start-aot Builds in AOT mode & serves the application with customizations to browser on port 4500 with HMR enabled.
yarn lint Runs linting on application and reports code violations to be fixed.
Note: Currently, linting runs on both src and store-extensions-src source code files. Linting errors/warnings should be fixed only in the store-extensions-src source code files. Linting warnings reported in the application-provided source code (<WORKSPACE>/storefrontend/src) should be ignored.
yarn test-prod Runs the unit test cases for the customizations.
yarn build-dist Creates a production build of the application and copies the output to the dist directory. This command should be used before pushing customization changes to cloud environments.
Note:
  • Ensure that you run the yarn ear-build-prod commands in the <store_temp> directory before pushing the changes to your source control.
  • If the yarn ear-build-prod command fails, the deployment of the customization jar on the cloud environments also fails. Hence, it is important that you run this command and the result is successful.
yarn verify Runs linting on the application, executes unit test cases and creates a production build of the application.
yarn verify-wc Runs linting on the application and creates a production build of the application.
Table 2. Important Angular CLI command reference
Command Purpose
ng g c --project=store-extensions --skip-import Generates component files in store-extensions-src folder.
ng g d --project=store-extensions --skip-import Generates directive files in the store-extensions-src folder.
ng g s --project=store-extensions Generates provider files in store-extensions-src.
ng g m --project=store-extensions Generates module files in store-extensions-src
Notes:
  • It is mandatory to pass the --project=store-extensions argument. Failing to do so will create the component in the application-provided src folder (<WORKSPACE>/store-frontend/src). The files created here are ignored and not rendered on browser.
  • The --skip-import option should be used only when creating components or directives in the application-provided feature modules. This argument can be ignored when creating components or directives in custom feature modules.