node package manager

ag-project-builder

ag-project-builder

Custom project build system

js-semistandard-style

This is a custom build system. Do NOT use it unless you are absolutely sure.

Installation

$ npm install ag-project-builder --save-dev

Usage

In the project root directory, there must be two files:

  • builder.json - build configuration file.

  • builder.js of the following content:

// builder.js file 
const builder = require('ad-project-builder');
builder();

In package.json:

{
  "scripts": {
    "build": "node builder.js",
    "build:prod": "node builder.js -m"
  }
}

Arguments

  • [--minify | -m] Minify javascript.

builder.json File

{
  "section-1": {},
  "section-N": {}
}

Section ui_languages

Type: {Array<String>}

The elements of this array are language codes supported by the application. The first element is the default value for a dictionary entry.

For each element of this array, there will be created a separate dictionary object and a set of rendered HTML files.

Section paths

Type: Object

paths.dictionaries {String} - Relative path from the project root to the folder containing language dictionaries.

paths.html_templates {String} - Relative path from the project root to the folder containing HTML templates.

paths.html_destination {String} - Relative path from the project root to the folder rendered HTML files have to be saved to.

paths.scss_lint_ignore {Array<String>} - Globs for SCSS files to NOT be linted. The globs are relative from the project root.

paths.scss_source {String} - Relative path from the project root to the folder containing sources SCSS files.

paths.css_destination {String} - Relative path from the project root to the folder that CSS files have to be placed to.

paths.js_linting {Array<String>} - Globs for files to be linted. The globs are relative from the project root.

paths.js_compilation {Object} - Settings object for compilation and minifying client-side javascript.

paths.js_compilation.root_src {String} - Relative path from the project root to the folder that contains root javascript files that have to be bundled. The folder can have sub-folders, but all files in those sub-folders are processed as root files, so don't keep modules in there.

paths.js_compilation.dest {String} - Relative path from the project root to the folder that bundled client-side javascript files have to be saved to. The build tool keeps the structure of sub-folders as of in paths.js_compilation.root_src.

Processing javascript

During a build process, the Builder performs the following tasks:

  • Linting server-side and client-side javascript files. If linting results in errors the entire build process terminates.

  • Compilation and bundling client-side javascript files.

  • Minifying the compiled and bundled client-side javascript files if the build process is started with flags testing, staging, or production.