Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { execSync } = require('child_process');
- const fs = require('fs');
- const d = process.cwd(); //__dirname;
- let pkgInfo = require(d + '/package.json');
- let ver = pkgInfo.version;
- if ( ! ver.match(/-SNAPSHOT$/) ) {
- throw new Error("You can't publish non-snapshot version. Sorry");
- }
- ver = ver.replace(/-SNAPSHOT$/i, '');
- let tag = 'v' + ver;
- pkgInfo.version = ver;
- fs.writeFileSync(d + '/package.json', JSON.stringify(pkgInfo, null, 2));
- execSync('/usr/bin/git commit ./package.json -m "Release ' + tag + '" ');
- execSync('/usr/bin/git tag -a ' + tag + ' -m "Version ' + ver + '" ');
- execSync('/usr/bin/git push origin --tags');
Add Comment
Please, Sign In to add comment