Skip to content

Instantly share code, notes, and snippets.

@jamlfy
Created April 22, 2015 22:27
Show Gist options
  • Select an option

  • Save jamlfy/e6955639c9ae99323726 to your computer and use it in GitHub Desktop.

Select an option

Save jamlfy/e6955639c9ae99323726 to your computer and use it in GitHub Desktop.
Change the version auto

Copian el archivo pre-push.js a repo/.git/hooks/pre-push. Y cada ves que le dan push le cambia la versión del patch

#!/usr/bin/env node
const path = require('path');
const fs = require('fs');
const URI_PACK = path.resolve('package.json');
var pack = require(URI_PACK);
var vers = pack.version.split('.');
var max = vers.length -1;
vers[max] = parseFloat(vers[ max ]) + 1;
pack.version = vers.join('.');
fs.writeFile(URI_PACK, JSON.stringify(pack, null, '\t'), function (err) {
if (err) throw err;
console.log('Change version Patch');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment