Click here to Skip to main content
15,881,757 members
Articles / Containers / Docker
Tip/Trick

itbldz Your Project!

Rate me:
Please Sign up or sign in to vote.
4.60/5 (3 votes)
4 May 2015CPOL3 min read 6.5K  
Creating a build for an existing TypeScript project in less than 5 minutes (or for any other language in 10 minutes)

Introduction

Whenever I start coding a new project, I tend to forget about adding a sophisticated, fully automated build pipeline. It's even worse with Nodejs/TypeScript, where everything seems to work out just fine in Visual Studio... but forcing everybody to use VS somewhat decreases willingness for participation, so at some point in time, we have to add some automation.

Grunt is great for things like this. But not for lazy people like me. There's too much ceremony, and the gruntfile tends to get a mess in minutes. Also, when using Grunt with 3rd Party libraries that don't have targets (phpunit anyone?) you really have to get dirty to execute one task multiple times.

The solution for this (as for very big files where the grunt file has become too big to open because your computer does not has enough RAM) is itbldz - a simple wrapper for grunt.

It has no gruntfile, the grunt modules are in (and loaded from) one single location and it comes with more awesome blabla... you can read more about it in the marketing brochure.

Getting Started

Open the root of your project in your terminal/powershell, and type:

npm install itbldz -g
init-itbldz

Follow the assistant, and set build to TypeScript and deployment to npm. Then type:

build-it

Done.

Congratulations, you now have a build :blush:

Deploy Your Code to npm

Now that your project has an automated build, you may want to share it with the world when then tests are green. We will now compile it, run the tests and then publish it to npm. If you haven't created a user on npm, do this now. Then type:

ship-it

Done.

Congratulations, you now have a deployment :blush:

Travis CI Your Code

Sometimes, you may be even too lazy to type so much. You'd rather have it on git and let Travis CI take care of the rest. Type:

init-itbldz

Again, select deploy only (this will leave your build untouched) and choose npm (but select only to bump the version) and gitHub. Open the deploy.json and add your github credentials to "publish.git" as described here: https://github.com/geddski/grunt-release.

Setup Travis CI by adding the following .travis.yml file to your project:

language: node_js
node_js:
  - "0.10"
  - "iojs"
before_install: npm install -g itbldz
deploy:
  provider: npm
  email: "YOUR EMAIL ADDRESS"
  api_key: "YOUR API KEY"
  skip_cleanup: true

See Travis Docs to learn how to get the API key. Configure your travis to work with your github, and type:

ship-it

Done! Want to trigger a new travis build and deploy again? Type:

ship-it

Done!

Only want to build, and not deploy to Ser Travis?

build-it

Congratulations, you now have continuous deployment! :blush:

Wanna Do the Same in Another Language?

Do...

init-itbldz

...and either select your language or the one that matches your language-scenario best and edit the created *.json to use the grunt-tasks for your language.

Done!

Wanna Dockerize It?

You totally may want a docker build-slave for that, now won't you? Create the following Dockerfile:

FROM    centos:centos6

# Enable EPEL for Node.js
RUN     curl -sL https://rpm.nodesource.com/setup | bash -
# Install Node.js and npm
RUN     yum install -y npm

# Install itbldz
RUN     npm install -g itbldz

# continue with your stuff...

Summary

For me, this is easy enough. Hope it is for you too!

Did you know?

  • itbldz is a wrapper for grunt so you can use all existing grunt tasks
  • itbldz is an Open Source Project

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) AutoScout24 GmbH
Austria Austria
Born, raised and killed by skynet I stopped worrying and started to code my own skynet whose sole purpose it will be to revenge my death by running over the terminator with a bobby car

Comments and Discussions

 
-- There are no messages in this forum --