The distro.json and ns.package.json Files

To determine which files to include with the Distribution folder of SCA, Gulp.js uses two configuration files:

The distro.json file resides in the following location, depending on your implementation:

The distro.json file defines the modules that are included in SCA. It also specifies additional configuration information.

Gulp.js parses this file to determine which files within the Modules directory to combine or copy into the Distribution folder. The distro.json file contains the following parameters:

Although the distro.json file defines the modules that are included in SCA, the ns.package.json file determines which files within an individual module are included. Each module included in the distro.json file must have a corresponding ns.package.json file. The ns.package.json file:

JavaScript Example

            {
   "gulp": {
      "javascript": [
         "JavaScript/*.js"
      ]
   ,   "templates": [
         "Templates/*.txt"
      ]
   ,   "ssp-libraries": [
         "SuiteScript/*.js"
      ]
   ,   "services.new": [
         "SuiteScript/*.Service.ss"
      ]
   }
} 

          

TypeScript Example

            {
   "gulp": {
      "javascript": [
         "JavaScript/*.js"
         "JavaScript/*.ts
      ]
   ,   "templates": [
         "Templates/*.txt"
      ]
   ,   "ssp-libraries": [
         "SuiteScript/*.js"
      ]
   ,   "services.new": [
         "SuiteScript/*.Service.ss"
      ]
   }
} 

          

In the preceding JavaScript example, there is a mapping between file types and partial paths to the location of the files. In general, Gulp.js uses wildcards to specify the contents of a directory. For example, JavaScript/*.js includes all files with the .js extension that are in the JavaScript folder. However, when creating your own modules, you can point to specific files within a directory, for example:

          ...
"javascript": [
         "JavaScript/MyJavaScriptFile.js"
      ]
... 

        

The types shown in the preceding examples (javascript, templates, services, etc.) correspond to a specific Gulp task. Gulp tasks determine how certain file types are handled. For example, the javascript Gulp task causes all JavaScript files within a distribution to be compiled into a single file. Other Gulp tasks are responsible for copying files from the Modules directory to the Distribution directory.

If you are using the 2019.2 release of SCA or later, many of the source files are written in TypeScript with .ts filename extensions. In this case, the ns.package.json file uses JavaScript/*.ts to include .ts files as JavaScript. For example:

          ...
"javascript": [
         "JavaScript/*.js",
         "JavaScript/*.ts"
      ]
... 

        

As a best practice, use only the default Gulp tasks when creating or editing a module. To use a custom file type within the ns.package.json file, you must create your own custom Gulp task.

Gulp tasks are stored in the following location:

SCA/gulp/tasks

Note:

This directory is created when you install Gulp.js. It is not included in the downloaded version of the SCA source directory. See Set Up the Commerce Developer Environment for more information.

Related Topics

SCA Build Process
How Files Are Combined
Contents of the Deploy and Local Distribution Directories

General Notices