forked from pixano/pixano-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangeversion.js
35 lines (30 loc) · 839 Bytes
/
changeversion.js
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
const glob = require( 'glob' );
const fs = require('fs');
// new version number
const VERSION = process.argv.slice(2)[0] || "0.5.2";
// util function to update version in given package.json
function updatePackage(filename) {
const p = JSON.parse(fs.readFileSync(filename));
p.version = VERSION;
Object.keys(p.dependencies).forEach((d) => {
if (d.includes("@pixano")) {
p.dependencies[d] = VERSION;
}
});
const output = JSON.stringify(p, null, 2);
fs.writeFileSync(filename, output);
}
// update version in demo
glob( 'demo/package.json', ( err, files ) => {
if (files) {
files.forEach(updatePackage);
}
});
// update version in packages
glob( 'packages/*/package.json', ( err, files ) => {
if (files) {
files.forEach(updatePackage);
}
});
// update root version
updatePackage('package.json');