1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-06-01 10:58:05 +02:00

Add new alpha version to updates JSON

This commit is contained in:
kkapsner 2024-02-17 00:02:35 +01:00
parent 7229133c8d
commit 4b8481aa14

View File

@ -21,6 +21,23 @@ function getXPIFileName(id, version){
return `${id}-${version}.xpi`; return `${id}-${version}.xpi`;
} }
async function addAlphaVersionToUpdatesJSON(version){
"use strict";
const updatesPath = path.join(versionsPath, "updates.json");
const data = JSON.parse(await fs.promises.readFile(updatesPath));
const versions = data.addons["CanvasBlocker-Beta@kkapsner.de"].updates;
if (versions.some(function(entry){
entry.version === version;
})){
return;
}
versions.push({
version,
update_link: `https://canvasblocker.kkapsner.de/versions/${getXPIFileName("canvasblocker_beta", version)}`
});
await fs.promises.writeFile(updatesPath, JSON.stringify(data, undefined, "\t"));
}
async function getAlphaVersion(manifest){ async function getAlphaVersion(manifest){
"use strict"; "use strict";
function f(n){ function f(n){
@ -73,6 +90,7 @@ async function run(){
} }
if (args.type === "alpha"){ if (args.type === "alpha"){
manifest.version = await getAlphaVersion(manifest); manifest.version = await getAlphaVersion(manifest);
addAlphaVersionToUpdatesJSON(manifest.version);
} }
else if (args.type === "rc"){ else if (args.type === "rc"){
manifest.version = getRCVersion(manifest); manifest.version = getRCVersion(manifest);