mrdoob/three.js — pull request #4060 by PaulTondeur (2013-11-03 16:24:55+00:00)
Title: Building using grunt and automatic version bumping

This pull request was born while discussing issue #3102.

After implementing this pull request, three.js can be build by using grunt. All existing build scripts have been ported over to using grunt instead. By doing so allows us to make use of more automation, such as automatically generating a new version, push it to github and create a tag (in semver format).

To get this up and running you need to have node and grunt up and running. Please refer to their websites for full details on how to install those.
Once installed, run ```npm install``` from the root of this project. This will install additional npm modules as grunt-tasks. The following build commands will be available:

* ```grunt build:common``` Build three.min.js
* ```grunt build:canvas``` Build three-canvas.min.js
* ```grunt build:css3d``` Build three-css3d.min.js
* ```grunt build:webgl``` Build three-webgl.min.js
* ```grunt build:extras``` Build three-extras.min.js
* ```grunt build:math``` Build three-math.min.js
* ```grunt build:max``` Build three-max.min.js
* ```grunt build:all``` Executes all above tasks.
Next to each .min version, a non-minimized version will be created.

For releasing and tagging, you can simply run one of the following commands:
* ```grunt release:patch``` release a patch x.x.**x**
* ```grunt release:minor``` release a minor new version x.**x**.x
* ```grunt release:major``` release a major new version **x**.x.x
Before releasing, these commands will automatically update the version numbers in ```package.json```, ```bower.json``` and ```src/Three.js```. A new ```three.js``` and ```three.min.js``` will be build. A tag with the new version number will be created and the changed files will be pushed to GitHub.

I don't know the exact workflow of the three.js team. But I assume that the team develops in the ```dev``` branch. Pushing the above changes will only work when you run it while in this branch. This means that currently the only manual step is to push the changes from dev over to the master. Although this should be possible to automate this with grunt too.

In order to make the automatic versioning work, I had to create a [semver](http://semver.org/) version. At this moment the version is ```r62```, which I've translated to ```0.0.62```. I was in doubt wether or not ```0.62.0``` would be better or not. I leave that up to you to decide.

Once this is implemented, the door will be open for automatically making a NPM release and running the testsuite from grunt too.

In case you run into any issues or have questions, please let me know. I will be happy to help out.