Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including travis-target with all npm packages installed. Try it out:

var travisTarget = require("travis-target")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

travis-target v0.2.0

Determine the target files or directories for a Travis CI build

travis-target Build Status

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.

Getting Started

First thing's first, install the module:

npm install travis-target --save-dev
const { target } = require('travis-target');

let options = {};
let targets = await target(options);

Requirements

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 app

Or 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');

target Options

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:

map

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);

pattern

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);

Testing

npm install
npm install gulp -g
gulp

Contributing

We welcome your contributions! Please have a read of CONTRIBUTING.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free