As part of the build process, we run the Grunt task as follows:
grunt release -r 3.9
The release number passed with the -r
option is used to tag various parts of the release.
The problem occurs with releases ending in zero - for example, 3.10. Grunt treats this as a number, omits the trailing zero, and thinks it is release 3.1.
Here is a simple Grunt file that demonstrates the problem:
module.exports = function(grunt) { grunt.registerTask('default', 'Release preparation', function () { var rel = grunt.option("r").toString(); grunt.log.writeln("Release data type:" + typeof rel); grunt.log.writeln("release (" + rel + ")"); }); };
Here is what you get:
$ grunt -r 3.10 Running "default" task Release data type:string release (3.1) Done, without errors.
toString()
converts it to a string accordingly, but the damage has already been done. The final zero is gone.
How to get around this?
source share