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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
#!/usr/bin/env node
// Bump the package.json versions in Taler-related packagesin
// this repository.
// The version must be in one of the following formats:
// - x.y.z
// - x.y.z-dev.n
import * as child_process from "child_process";
import * as fs from "fs";
let requestedVersion = process.argv[2];
let dry = false;
if (process.argv.includes("--dry")) {
dry = true;
}
let verMatched = false;
let verMajor = 0;
let verMinor = 0;
let verPatch = 0;
let verDev = undefined;
// Parse the requested version
const releaseVerRegex = /^(\d+)[.](\d+)[.](\d+)$/;
const devVerRegex = /^(\d+)[.](\d+)[.](\d+)-dev[.](\d+)$/;
const releaseMatch = requestedVersion.match(releaseVerRegex);
if (releaseMatch) {
verMatched = true;
verMajor = releaseMatch[1];
verMinor = releaseMatch[2];
verPatch = releaseMatch[3];
}
if (!verMatched) {
const devMatch = requestedVersion.match(devVerRegex);
if (devMatch) {
verMatched = true;
verMajor = devMatch[1];
verMinor = devMatch[2];
verPatch = devMatch[3];
verDev = devMatch[4];
}
}
const packages = fs.readdirSync("packages")
for (const pkg of packages) {
const p = `packages/${pkg}/package.json`;
const data = JSON.parse(fs.readFileSync(p));
console.log(p, data.version);
if (!dry) {
data.version = requestedVersion;
fs.writeFileSync(p, JSON.stringify(data, undefined, 2) + "\n");
}
}
{
const p = "packages/taler-wallet-webextension/manifest-common.json";
const data = JSON.parse(fs.readFileSync(p));
console.log("manifest version", data.version);
console.log("manifest version_name", data.version_name);
// In manifest.json, we transform x.y.z-dev.n info x.y.z.n.
// It's necessary because browsers only allow decimals and dots
// in that field.
let dottedVer = undefined;
if (verDev != null) {
dottedVer = `${verMajor}.${verMinor}.${verPatch}.${verDev}`;
} else {
dottedVer = `${verMajor}.${verMinor}.${verPatch}`;
}
console.log("new manifest version", dottedVer);
if (!dry) {
data.version = dottedVer;
data.version_name = requestedVersion;
fs.writeFileSync(p, JSON.stringify(data, undefined, 2) + "\n");
}
}
let debs = ["taler-wallet-cli", "taler-harness"];
for (const deb of debs) {
const p = `packages/${deb}/debian/changelog`;
const data = fs.readFileSync(p, {
encoding: "utf-8",
});
const lines = data.split("\n");
for (const line of lines) {
const s = line.trim();
if (s == "") {
continue;
}
const re = /\((.*)\)/;
const m = s.match(re);
const version = m[1];
let pfx = "";
if (version != requestedVersion) {
pfx = "[!] ";
if (!dry) {
const dateStr = child_process.execSync("date -R", {
encoding: "utf-8",
});
const entryLines = [
`${deb} (${requestedVersion}) unstable; urgency=low`,
"",
` * Release ${requestedVersion}`,
"",
` -- Florian Dold <dold@taler.net> ${dateStr}`,
``,
];
fs.writeFileSync(p, `${entryLines.join("\n")}${data}`);
}
}
console.log(`${pfx}${p} is ${version}`);
break;
}
}
|