SkeLLLa/gulp-version-append

Custom default version number support

angu2starter opened this issue · 2 comments

Thank you for such a cool gulp plugin to append version number. I want to use the options.appendType as version. However my application has a requirement to use version number with format with 4 sequences like 1.1.1.3 instead of default (3 sequences) 1.1.1. If I set "version" attribute in package.json to something like "1.1.1" it works and replaces all the @Version in my html files correctly. However if I change the "version" attribute in package.json to something like "1.1.1.3", I get an error saying: npm ERR! Invalid version: "1.1.1.3"

With the current release, is there any option to use custom version number like "1.1.1.3".

Will greatly appreciate any direction on this.

@angu2starter, it's not a problem of this plugin. It really can support such kind of versions, even strings. But actually npm doesn't support such kind of versions. So you can't use it in package.json file. But you can specify it in another .json file that could be placed near package.json. You can see an example folder. There is file called version.json where version is specified. And then in your gulp file use options.versionFile to specify path to that json:

gulp.task('version', function () {
    return gulp.src('./example.html')
            .pipe(gVersionAppend(['html', 'js', 'css'], {appendType: 'version', versionFile: './version.json'}))
            .pipe(gulp.dest('./build/'));
});

where in version.json you'll have:

{
  "version": "0.1.2.3"
}

Thanks a lot for providing the fix.