refactor: resturcture files so that lincensing info can be bundled properly
This commit is contained in:
parent
699ba74840
commit
1aa284311f
484 changed files with 119 additions and 179 deletions
|
@ -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", {
|
||||
|
|
|
@ -9,12 +9,12 @@ import { distDirectory, sourceDirectory } from "./const.js";
|
|||
import { convertPackFileToJSONFile } from "./json-pack-tools.js";
|
||||
|
||||
const packsDistDirectory = path.join(distDirectory, "packs");
|
||||
const packsSourceDirectory = path.join(sourceDirectory, "packs");
|
||||
const packsSourceDirectory = "packs";
|
||||
|
||||
console.log(`Converting pack files in ${packsDistDirectory} to json files in ${packsSourceDirectory}:`);
|
||||
|
||||
const conversionPromises = (await promises.readdir(packsDistDirectory, { withFileTypes: true }))
|
||||
.filter((dirent) => dirent.isFile() && path.extname(dirent.name))
|
||||
.filter((dirent) => dirent.isFile() && path.extname(dirent.name) === ".db")
|
||||
.map(async (dirent) => convertPackFileToJSONFile(path.join(packsDistDirectory, dirent.name), packsSourceDirectory));
|
||||
|
||||
await Promise.all(conversionPromises);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue