refactor: resturcture files so that lincensing info can be bundled properly

This commit is contained in:
Johannes Loher 2022-01-31 15:13:32 +01:00
parent 699ba74840
commit 1aa284311f
484 changed files with 119 additions and 179 deletions

View file

@ -3,28 +3,21 @@
// SPDX-License-Identifier: MIT
import fs from "fs-extra";
import path from "node:path";
import semver from "semver";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { sourceDirectory } from "./const.js";
const getDownloadURL = (version) => `https://git.f3l.de/dungeonslayers/ds4/-/releases/${version}/downloads/ds4.zip`;
const getChangelogURL = (version) => `https://git.f3l.de/dungeonslayers/ds4/-/releases/${version}`;
const manifestPath = "./system.json";
/**
* Get the contents of the manifest file as object.
* @returns {{file: unknown, name: string}} An object describing the manifest
* @returns {unknown} An object describing the manifest
*/
function getManifest() {
const manifestPath = path.join(sourceDirectory, "system.json");
if (fs.existsSync(manifestPath)) {
return {
file: fs.readJSONSync(manifestPath),
name: "system.json",
};
return fs.readJSONSync(manifestPath);
}
}
@ -68,10 +61,10 @@ function bumpVersion(release) {
console.log(`Bumping version number to '${targetVersion}'`);
packageJson.version = targetVersion;
fs.writeJSONSync("package.json", packageJson, { spaces: 4 });
manifest.file.version = targetVersion;
manifest.file.download = getDownloadURL(targetVersion);
manifest.file.changelog = getChangelogURL(targetVersion);
fs.writeJSONSync(path.join(sourceDirectory, manifest.name), manifest.file, { spaces: 4 });
manifest.version = targetVersion;
manifest.download = getDownloadURL(targetVersion);
manifest.changelog = getChangelogURL(targetVersion);
fs.writeJSONSync(manifestPath, manifest, { spaces: 4 });
}
const argv = yargs(hideBin(process.argv)).usage("Usage: $0").option("release", {