Skip to content

Commit 3257f65

Browse files
committed
Fix builds for dev
1 parent 1123cff commit 3257f65

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

Gruntfile.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,20 @@ module.exports = function(grunt) {
176176
}
177177
};
178178

179-
if (grunt.option('dev')) {
180-
gruntConfig.pkg.release = 'dev';
181-
gruntConfig.pkg.version = gruntConfig.pkg.version + '-post';
182-
} else {
183-
gruntConfig.pkg.release = gruntConfig.pkg.version;
184-
}
185-
186179
grunt.initConfig(gruntConfig);
187180

188181
// Custom Grunt tasks
182+
grunt.registerTask('version', function() {
183+
var pkg = grunt.config.get('pkg');
184+
if (grunt.option('dev')) {
185+
pkg.release = 'dev';
186+
pkg.version = grunt.config.get('gitinfo').local.branch.current.shortSHA;
187+
} else {
188+
pkg.release = pkg.version;
189+
}
190+
grunt.config.set('pkg', pkg);
191+
});
192+
189193
grunt.registerMultiTask('fixSourceMaps', function () {
190194
this.files.forEach(function (f) {
191195
var result;
@@ -224,8 +228,8 @@ module.exports = function(grunt) {
224228
grunt.loadNpmTasks('grunt-gitinfo');
225229

226230
// Build tasks
227-
grunt.registerTask('build.core', ['clean', 'gitinfo', 'concat:core', 'uglify', 'fixSourceMaps']);
228-
grunt.registerTask('build.all', ['clean', 'gitinfo', 'concat:all', 'uglify', 'fixSourceMaps']);
231+
grunt.registerTask('build.core', ['clean', 'gitinfo', 'version', 'concat:core', 'uglify', 'fixSourceMaps']);
232+
grunt.registerTask('build.all', ['clean', 'gitinfo', 'version', 'concat:all', 'uglify', 'fixSourceMaps']);
229233
grunt.registerTask('build', ['build.all']);
230234
grunt.registerTask('dist', ['build.core', 'copy:dist']);
231235

0 commit comments

Comments
 (0)