This module is used to determine the target files or directories of a
Travis CI build. It accomplishes that by examining the git history for
repository being tested, and comparing the current git commit hash with
the last hash on origin/master.
🚀 Are you ready to tackle ES6 and hone your JavaScript Skills? 🚀
Check out these outstanding ES6 courses by @wesbos
First thing's first, install the module:
npm install travis-target --save-devconst { target } = require('travis-target');
let options = {};
let targets = await target(options);Node.js version 7 or higher is recommended. This module makes use of
async / await patterns. Code using this module should be run as such:
node --harmony-async-await appOr you can use harmonize at the start of your app entry point file:
require('harmonize')(['harmony-async-await']);If you can't use version 7, use Babel.js to handle runtime
transpilation. My pattern is to use an index.js file which sets up Babel
and calls out to the app entry point:
require('babel-core/register');
require('babel-polyfill');
require('./app');
The module's target accepts an options Object, which can contain options for the
webpack-dev-middleware and webpack-hot-middleware bundled with this module.
The following is a property reference for the Object:
Type: Function
optional
Note: Results are filtered using pattern prior to any mapping.
Should you have the need to perform advanced mapping of the results,
specify a function for the map property which accepts a lone target
parameter.
Example:
const { target } = require('travis-target');
let options = { map: (target) => { ... } };
let targets = await target(options);Type: RegExp
optional
If you'd like the target results to be filtered by a particular pattern, assign a regular expression to this property, and the results will only contain targets which match the pattern.
To exclude results that match a pattern, use a negative look-ahead RegExp.
Example:
const { target } = require('travis-target');
// only return targets that begin with 'src/'
let options = { pattern: /^src\//gi };
let targets = await target(options);npm install
npm install gulp -g
gulpWe welcome your contributions! Please have a read of CONTRIBUTING.