typhonjs-npm-build-test
Version:
Provides a unified set of NPM scripts and dependencies for building and testing ES6+ NPM modules for TyphonJS and beyond.
80 lines (61 loc) • 4.38 kB
Markdown

[](https://www.npmjs.com/package/typhonjs-npm-build-test)
[](https://en.wikipedia.org/wiki/Indent_style#Allman_style)
[](https://github.com/typhonjs-node-npm-scripts/typhonjs-npm-build-test/blob/master/LICENSE)
[](https://gitter.im/typhonjs/TyphonJS)
[](https://www.versioneye.com/user/projects/56e5a03ddf573d00495abd11)
Requirements: Node v5+ / NPM 3+
Provides a unified environment combining the following set of NPM modules / scripts and dependencies for building, documenting, and testing ES6 NPM modules including instrumentation of JSPM / SystemJS tests for TyphonJS and beyond:
- [typhonjs-istanbul-instrument-jspm](https://www.npmjs.com/package/typhonjs-istanbul-instrument-jspm)
- [typhonjs-npm-scripts-build-babel](https://www.npmjs.com/package/typhonjs-npm-scripts-build-babel)
- [typhonjs-npm-scripts-publish](https://www.npmjs.com/package/typhonjs-npm-scripts-publish)
- [typhonjs-npm-scripts-test-mocha](https://www.npmjs.com/package/typhonjs-npm-scripts-test-mocha)
- [typhonjs-npm-scripts-runner](https://www.npmjs.com/package/typhonjs-npm-scripts-runner)
Please refer to the above NPM modules for documentation regarding expanded configuration details specific to each script.
All TyphonJS NPM script modules use `.npmscriptrc` found in the root path to store JSON formatted configuration parameters.
One can also use `.npmscriptrc.js` which will be required and must be CSJ formatted outputting an object via
`module.exports`. It should be noted that this NPM module requires NPM 3.0+ as flat packages for the `./node_modules`
directory is necessary to easily import the NPM modules linked by `typhonjs-npm-build-test`.
For the latest significant changes please see the [CHANGELOG](https://github.com/typhonjs-node-npm-scripts/typhonjs-npm-build-test/blob/master/CHANGELOG.md).
Please be aware of a 0.7.0 breaking change as [babel-preset-latest](https://www.npmjs.com/package/babel-preset-latest) has been swapped out for [babel-preset-env](https://www.npmjs.com/package/babel-preset-env).
Please be aware of a 0.5.0 breaking change as [typhonjs-node-esdoc](https://www.npmjs.com/package/typhonjs-node-esdoc) has been removed, so ESDoc is no longer available. Please check out with TJSDoc (the spiritual successor to ESDoc).
Please be aware of a 0.2.0 breaking change in [typhonjs-npm-scripts-test-mocha](https://github.com/typhonjs-node-npm-scripts/typhonjs-npm-scripts-test-mocha/blob/master/CHANGELOG.md#020-2016-06-02)
------
To configure all scripts included in `typhonjs-npm-build-test` provide this entry in `package.json` scripts entry:
```
"devDependencies": {
"typhonjs-npm-build-test": "^0.7.0"
},
"scripts": {
"build": "babel-node ./node_modules/typhonjs-npm-scripts-build-babel/scripts/build.js",
"eslint": "eslint .",
"prepublish": "babel-node ./node_modules/typhonjs-npm-scripts-publish/scripts/prepublish.js",
"test": "babel-node ./node_modules/typhonjs-npm-scripts-test-mocha/scripts/mocha.js",
"test-coverage": "babel-node ./node_modules/typhonjs-npm-scripts-test-mocha/scripts/mocha-istanbul.js"
},
```
The following is a standard `.npmscriptrc` file that all TyphonJS NPM modules use:
```
{
"build":
{
"babel": { "source": "src", "destination": "dist" }
},
"publish":
{
"prepublish": { "scripts": [ "npm run eslint", "npm run test", "npm run build" ] }
},
"test":
{
// Provides a report handling command that is executed after running tests / coverage when running on Travis CI.
"travis":
{
"report": "./node_modules/.bin/codecov",
"istanbul": { "command": "cover", "options": [ "--report lcovonly" ] }
},
"istanbul": { "command": "cover" },
"mocha": { "source": "./test/src", "options": [ "--compilers js:babel-register", "-t 120000 --recursive" ] }
}
}
```
Please note that you can add comments to `.npmscriptrc`.