Currently, I have multiple angular modules. A custom Grunt task concats, minifies and packages each module so it is ready to deploy. The only thing I haven't done yet is to manage the version of these modules.
Each project (one per module) contains a package.json file, in which I declare the name and version of a component :
{
"name": "my-module",
"version" : "1.0.0",
// etc.
}
So each module is built in a directory */dist/my-module/1.0.0/
But, in the module itself, I need to access its version. For example, in a controller, I declare a variable $scope.version = '1.0.0'
. But currently, it is hardcoded in the controller script.
First question, is there a way the module could get the version from the package.json file ? Or that the grunt task building the application replaces a given flag in the scripts by the current version of the module ? (for example, I could declare my variable $scope.version = 'FLAG_VERSION'
knowing that during the build grunt will replace the flag by the right value)
Second question, is there some grunt component which allows to tag the current version of a module in my VCS (SVN for example) and then increment the current version ? In short, perform a release of the module.
Edit: new question asked on that matter, see Bump a specific version number on SVN using Grunt
Any help or lead will be appreciated !