Sets the version in the config.xml of the cordova project.
npm install --save-dev gulp-cordova-version
var gulp = require('gulp'),
create = require('gulp-cordova-create'),
version = require('gulp-cordova-version');
gulp.task('build', function() {
return gulp.src('dist')
.pipe(create())
.pipe(version('2.3.1'));
});
This will set the version attribute in the config.xml
file.
Tip: You can use the version of your
package.json
file and call the plugin withversion(require('./package.json').version)
.
It is also possible to pass in a second object to set the android-versionCode
and ios-CFBundleVersion
in your config.xml
file.
gulp.task('build', function() {
return gulp.src('dist')
.pipe(create())
.pipe(version('2.3.1', {androidVersionCode: 231, iosBundleVersion: '2.3.1'}));
});
Required
Type: string
The version of the application in the format x.y.z
.
Type: object
Object with two optional properties to set specific platform version codes. To set the version code for android, use the androidVersionCode
property. To set the CFBundleVersion in iOS, use the iosBundleVersion
property.
See gulp-cordova
for the full list of available packages.
MIT © Sam Verschueren