Updating the package.json file

You must update the package.json file of the application to add the shared library, @buc/svc-angular, as a dependency.

Procedure

  1. Add @buc/svc-angular to the package.json file of the application as a dependency. Here are two different ways to add the dependency.
    • Edit package.json manually and add @buc/svc-angular to the dependencies array:
      "@buc/svc-angular": "*"
    • Run the following command:
      yarn add @buc/svc-angular@*
    The version of the @buc/svc-angular library is set to "*" to point to the latest version that is uploaded to the repository.
  2. Add the Angular library for conversions, @ngx-translate/core, to the package.json file of the application as a dependency. Here are two different ways to add the dependency.
    • Edit package.json manually to add to the dependencies array:
      "@ngx-translate/core": "^11.0.1"
    • Run the following command:
      yarn add @ngx-translate/core@11.0.1
  3. If required, install all dependencies for your repository by using the following command.
    yarn install

Add a start script to be used for serving the Angular application.

  1. Define the following parameters for the start script:
    --port <number>
    The port number entered in the URL for Local development mode url in the Customization settings. For example, 9000.
    --ssl
    Ensures that the application is served over an HTTPS connection. This option is recommended for secure deployment.
    --source-map
    Helps debug the application during local development.
    --base-href
    The context root for the application or the static part of the URL to access the application.
    Note:
    • This value must be consistent with the project name that you specified when you created the Angular project in the procedure Base setup for Angular and mapping the hosts file.
    • This value must correspond to the path provided or the first part of the path after the protocol and host in the Local development mode url field in the Settings > Customization page.

      For example, for Local development mode url given as https://localhost:9000/buc-custom-app-starter and <project name> as buc-custom-app-starter, the --base-href must be specified as buc-custom-app-starter.

    --host=bucgenerichost
    The DEV tenant only supports connecting to a local server with the hostname bucgenerichost.
    Here is an example of the start script:
    "start": "ng serve --port 9000 --ssl --source-map --host=bucgenerichost
          --base-href=/buc-custom-app-starter/"
    Ensure that you use the same parameters when you add the feature through Customization settings in Order Hub (Settings > Customization).
    Screenshot of the Customization page. The path value should be the same value as the --base-href. The port in the local development mode url should be the same as the --port number
  2. Optional: It is recommended that you modify the existing build entry to the following:
    "build": "ng build --aot --prod"
  3. Ensure that namein package.json corresponds to the project name that you specified when you created the Angular project in the procedure Base setup for Angular and mapping the hosts file. This value also corresponds to --base-href in the start script.

What to do next

Important: Conventions for versioning

Order Hub uses the following conventions of semantic versioning. It is recommended that you follow the same conventions for versioning your applications to ensure consistency. For example, in this version "1.2003.1":

  • 1 - Major version. Represents technology or generation updates like changing from Angular 8 to Angular 10.
  • 2003 - Minor version. Corresponds to the year and month and is updated for each monthly release. 2003 represents March 2020. Oct 2020 is given as 2010.
  • 1 - Patch version. Increments for any changes, bug fixes, features, or patches within a monthly release.