https://github.com/shedd/ionic_build_tools#bump-app-versionsHis build tools provide more than just gulp commands, the readme alone can save you time and help you avoid mistakes.
However, I just needed something simple for bumping version numbers in package.json and config.xml.
Extra NPM packages
- npm install gulp-xml-editor --save-dev
- npm install gulp-json-transform --save-dev
Requires
- var jsonTransform = require('gulp-json-transform');
- var xeditor = require('gulp-xml-editor');
Gulp Task
gulp.task( 'package', ['sass'], function(){gulp.src('./package.json').pipe( jsonTransform(function(data){var version = data.version.split('.');version[2]++;data.version = version.join('.');return data;},2)).pipe(gulp.dest('.'));gulp.src("./config.xml").pipe(xeditor(function(xml, xmljs) {var version = xml.root().attr('version').value().split('.');version[2]++;xml.root().attr('version',version.join('.'));return xml;})).pipe(gulp.dest("."));});
No comments:
Post a Comment