forked from BrandwatchLtd/selleckt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion
executable file
·26 lines (21 loc) · 855 Bytes
/
version
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env node
var newVersion = process.argv[2],
fs = require('fs'),
child_process = require('child_process'),
packageJson = require('./package.json'),
bowerJson = require('./bower.json');
if(!/^[0-9]+\.[0-9]+\.[0-9]+$/.test(newVersion)){
console.error('Invalid version', newVersion);
return process.exit(1);
}
console.log('tagging version', newVersion);
packageJson.version = bowerJson.version = newVersion;
fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2));
fs.writeFileSync('./bower.json', JSON.stringify(bowerJson, null, 2));
child_process.exec('git commit -am "v' + newVersion + '"', function(code){
if(code > 0){
console.error('Could not commit new version');
return process.exit(1);
}
child_process.spawn('git', ['tag', '' + newVersion], {stdio: 'inherit'});
});