{"id":238310,"date":"2022-06-24T04:34:00","date_gmt":"2022-06-24T08:34:00","guid":{"rendered":"https:\/\/wordpress-756359-3782526.cloudwaysapps.com\/?p=238310"},"modified":"2024-09-21T04:53:25","modified_gmt":"2024-09-21T04:53:25","slug":"22-06-24-jakentravis","status":"publish","type":"post","link":"https:\/\/www.travis-ci.com\/blog\/22-06-24-jakentravis\/","title":{"rendered":"Travis and Jake (A friendly integration)"},"content":{"rendered":"\n<p>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\u2019s now integrate Jake into Travis and see how it works!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"the-jakefile\">The&nbsp;<code>Jakefile<\/code><\/h2>\n\n\n\n<p>Alright, so we need a&nbsp;<code>Jakefile<\/code>&nbsp;for Jake to be invoked in Travis, so let\u2019s make a&nbsp;<code>Jakefile<\/code>&nbsp;in our root directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>let { task, desc } = require('jake');\n\ndesc('This is the default task.');\ntask('default', function () {\n  console.log('This is the default task.');\n  console.log('Jake will run this task if you run `jake` with no task specified.');\n});\n\ndesc('This is some other task. It depends on the default task');\ntask('otherTask', &#91;'default'], function () {\n  console.log('Some other task');\n});<\/code><\/pre>\n\n\n\n<p>Alright my Jakefile looks good, let\u2019s now build our&nbsp;<code>.travis.yml<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"travis-ci\">Travis CI<\/h2>\n\n\n\n<p>This is how I have my&nbsp;<code>.travis.yml<\/code>&nbsp;configured so it can integrate with Jake:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dist: jammy\nlanguage: node_js\nnode_js:\n  - \"12\"\nbefore_install:\n  - npm update -g npm\n  - npm install -g jake\nscript: \n  - jake -v <\/code><\/pre>\n\n\n\n<p>Where are using the latest Ubuntu image as you can see via&nbsp;<code>dist: jammy<\/code>, 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.<\/p>\n\n\n\n<p>Now before we deploy this sample to Travis, let\u2019s make a directory called&nbsp;<code>bin<\/code>, and in&nbsp;<code>bin<\/code>&nbsp;let\u2019s make a JavaScript file called&nbsp;<code>cli.js<\/code>, this is how mine looks:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/usr\/bin\/env node\n\n\/\/ Load `jake` global\n\nrequire('..\/lib\/jake');\n\nvar args = process.argv.slice(2);\n\njake.run.apply(jake, args);<\/code><\/pre>\n\n\n\n<p>We use classic JavaScript functions like&nbsp;<code>slice<\/code>&nbsp;you can also use&nbsp;<code>pop<\/code>, whatever you choose! This is just my example.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"in-conclusion\">In Conclusion<\/h2>\n\n\n\n<p>You\u2019ve just integrated Jake with Travis! As per usual here\u2019s my&nbsp;<a href=\"https:\/\/github.com\/Montana\/travis-jake\">repo<\/a>&nbsp;so you can follow it and see the build results if you run into any problems.<\/p>\n\n\n\n<p>As always, if you have any questions about integrating Jake and Travis, please email me&nbsp;<a href=\"mailto:montana@travis-ci.org\">montana@travis-ci.org<\/a>&nbsp;and I will assist you with this tutorial.<\/p>\n\n\n\n<p>Happy building!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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\u2019s now integrate [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_breakdance_hide_in_design_set":false,"_breakdance_tags":"","footnotes":""},"categories":[16],"tags":[7,19,20,5],"class_list":["post-238310","post","type-post","status-publish","format-standard","hentry","category-news","tag-community","tag-feature","tag-infrastructure","tag-news"],"_links":{"self":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts\/238310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/comments?post=238310"}],"version-history":[{"count":1,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts\/238310\/revisions"}],"predecessor-version":[{"id":242649,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts\/238310\/revisions\/242649"}],"wp:attachment":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/media?parent=238310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/categories?post=238310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/tags?post=238310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}