The distro.json and ns.package.json Files

This topic applies to

Applies to

SuiteCommerce Advanced

To determine which files to include with the Distribution folder of SuiteCommerce Advanced, Gulp.js uses two types of configuration files. These files are:

  • distro.json

  • ns.package.json

The distro.json file exists in the top level of the SCA directory. This file defines which modules are included within SuiteCommerce Advanced. 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:

  • name: specifies the name of the application. By default this value is SuiteCommerce Advanced <version>.

  • version: specifies the application version.

  • modules: lists the modules SuiteCommerce Advanced uses. Each module is listed on a separate line and uses the following format:

    "<module_name>": "<module_version>"

    By default the SuiteCommerce Advanced modules are listed in alphabetical order because there are no dependencies between modules. However, when customizing SuiteCommerce Advanced, your modules may have dependencies on other modules. In that case, you must ensure that any required modules are listed before other modules.

  • taskConfig: defines the gulp tasks required by the build process. In general, you do not need to edit these tasks..

  • copy: specifies the source and target paths when copying files to the Distribution directory.

While the distro.json file defines the modules that are included in SuiteCommerce Advanced, the ns.package.json file determines which files within an individual module are included. Each module included in the distro.json must have a corrsponding ns.package.json file. This file must be at the top level of the module folder. The ns.package.json file uses the following structure:

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

In the above 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 above 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.

NetSuite recommends that you use only the default Gulp tasks when creating or editing a module. To use a custom file type within ns.package.json, 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 SuiteCommerce Advanced source directory. See Developer Environment for more information.