Travis and Jake (A friendly integration)


Jun 24, 2022


Jake is the JavaScript build tool for NodeJS. Jake has been around since the very early days of Node, and is full featured and well tested. The most intriguing thing for me about JakeJS is Jake has capabilities similar to GNU Make, CMake, or Rake in the Ruby community, but for now let’s now integrate Jake into Travis and see how it works!

The Jakefile

Alright, so we need a Jakefile for Jake to be invoked in Travis, so let’s make a Jakefile in our root directory:

let { task, desc } = require('jake');

desc('This is the default task.');
task('default', function () {
  console.log('This is the default task.');
  console.log('Jake will run this task if you run `jake` with no task specified.');

desc('This is some other task. It depends on the default task');
task('otherTask', ['default'], function () {
  console.log('Some other task');

Alright my Jakefile looks good, let’s now build our .travis.yml.

Travis CI

This is how I have my .travis.yml configured so it can integrate with Jake:

dist: jammy
language: node_js
  - "12"
  - npm update -g npm
  - npm install -g jake
  - jake -v 

Where are using the latest Ubuntu image as you can see via dist: jammy, and you can see where I install Jake, and then I want to print out what version of Jake is running inside of Travis to make sure the integration went well.

Now before we deploy this sample to Travis, let’s make a directory called bin, and in bin let’s make a JavaScript file called cli.js, this is how mine looks:

#!/usr/bin/env node

// Load `jake` global


var args = process.argv.slice(2);, args);

We use classic JavaScript functions like slice you can also use pop, whatever you choose! This is just my example.

In Conclusion

You’ve just integrated Jake with Travis! As per usual here’s my repo so you can follow it and see the build results if you run into any problems.

As always, if you have any questions about integrating Jake and Travis, please email me [email protected] and I will assist you with this tutorial.

Happy building!

Written By

Reviewed By