Package Scripts

This wiki page provides details on the complete list of npm scripts include in the package.

Linting


npm run lint

This script checks the Typescript source against the set of rules outlined in tslint.json

Building


npm run build

This script with compile the TypeScript source to ES6-compatible JavaScript. Subsequent calls to transpile and uglify complete the process by transpiling to ES5-compatible JavaScript and performing comprehensive minification.

prebuild

Note: this step does not need to be run manually

npm run prebuild

This simply prepares the build environment by running clean:dist.

postbuild

Note: this step does not need to be run manually

npm run postbuild

This script continues the build process by calling transpile.

Compiling


Compiling the TypeScript source
npm run compile:src

This script compiles the TypeScript files in the src directory (excluding *.spec.ts).

Compiling the Mocha/Chai tests
npm run compile:tests

This script compiles the TypeScript *.spec.ts files in the src directory.

Compiling the TypeScript examples
npm run compile:examples

This script compiles the TypeScript examples in the examples directory.

Documenting


npm run doc

This will generate html documentation for the TypeScript source code via the typedoc tool.

predoc

Note: this step does not need to be run manually

npm run prebuild

This simply prepares the doc environment by running clean:docs.

Cleaning


npm run clean

A full clean will run each of the individual cleans below and completely resets the directory structure.

Clean sources folder
npm run clean:src

This will clean any residual *.js and *.js.map files generated from other scripts.

Clean distribution folder
npm run clean:dist

This will completely remove the dist folder containing compiled and transpiled code ready for distribution.

Clean documentation folder
npm run clean:docs

This will remove the documentation generated with the doc script under the docs/autogen directory.

Clean examples folder
npm run clean:examples

This will clean any residual *.js and *.js.map files generated from the compile:examples script.

Clean miscellaneous items
npm run clean:misc

This will remove index.d.ts, index.js, index.js.map, and any npm-debug.log that might have been generated.

Testing


npm run test

This script will run all Mocha/Chai tests in the project.

pretest

Note: this step does not need to be run manually

npm run pretest

This simply cleans the src directory.

Transpiling


npm run transpile

This script will transpile the compiled ES6-compatible JavaScript in dist/es6 to ES5-JavaScript and place the results in dist/es5.

Note: this command does not need to be run directly since it is chained after the build script.

Note: for those running this command directly, it assumes a dist/es6 directory exists and will transpile any JavaScript that resides there.

pretranspile

Note: this step does not need to be run manually

npm run pretranspile

This simply cleans the dist/es5 directory.

posttranspile

Note: this step does not need to be run manually

npm run posttranspile

This script continues the build chain by calling uglify.

Uglifying


npm run uglify

This script readies the JavaScript in dist/es5 for deployment. It concatenates, compresses, mangles, and uglifies the code into an efficiently deployable product.

Note: this command does not need to be run directly since it is chained after the transpile script.

Note: for those running this command directly, it assumes a dist/es5 directory exists and will process any JavaScript that resides there.

preuglify

Note: this step does not need to be run manually

npm run preuglify

This simply removes any existing deployable product.

The Whole Nine Yards


npm run thewholenine

This script will perform a complete pre-deployment workup (except auto-generated documentation). It runs lint, build (including transpile and uglify), test, and then securitycheck.

Note: this script does not run doc because that command will generate links to the most recent GitHub commit. If no changes have been made to the code, links will be correct. However, if you are checking code in after this build, wait generate docs until after the push is accepted.

prethewholenine

Note: this step does not need to be run manually

npm run prethwholenine

This simply cleans the environment with clean.

Miscellaneous


Security Check
npm run securitycheck

This script will run Node Security’s nsp tool to search for common security vulnerabilities in your code.