forked from RocketChat/Rocket.Chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion.js
More file actions
47 lines (36 loc) · 944 Bytes
/
version.js
File metadata and controls
47 lines (36 loc) · 944 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* eslint object-shorthand: 0, prefer-template: 0 */
const path = require('path');
const fs = require('fs');
let pkgJson = {};
try {
pkgJson = require(path.resolve(
process.cwd(),
'./package.json'
));
} catch (err) {
console.error('no root package.json found');
}
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const files = [
'./package.json',
'./.sandstorm/sandstorm-pkgdef.capnp',
'./.travis/snap.sh',
'./packages/rocketchat-lib/rocketchat.info'
];
console.log('Current version:', pkgJson.version);
rl.question('New version: ', function(version) {
rl.close();
version = version.trim();
if (version === '') {
return;
}
console.log('Updating files to version ' + version);
files.forEach(function(file) {
const data = fs.readFileSync(file, 'utf8');
fs.writeFileSync(file, data.replace(pkgJson.version, version), 'utf8');
});
});