Flexible build lifecycles for grunt
This plugin requires Grunt
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-build-lifecycle --save-dev
Inspired by the maven build lifecycle, the
lifecycle task allows you to tame your grunt tasks with a consistent build lifecycle.
This means that the process for compiling, testing, and packaging a particular project is clearly defined. For the person building a project, this means that it is only necessary to learn a small set of commands to build any project, and the
lifecycle task will ensure they get the results they desired.
In your project's Gruntfile, add a section named
lifecycle to the data object passed into
This will create the following grunt tasks:
deploy. Running any of these tasks will run all the preceding lifecycle tasks sequentially.
grunt test runs the
You can run build phases individually with
grunt phase-<name>, where name is one of the lifecycles.
For example, based on the above example
grunt phase-compile runs the
Additionally, you can skip phases with the
grunt install --skip=validate,test will skip the
To skip all tests phases, use
Perhaps maven-ish build cycles are not your thing, you can define your own set of lifecycle phases. Here's another example. Just remeber, consistency is a good thing.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.