From fff74d555d53222840fafd06da163b02d4c0b3fc Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Tue, 8 Feb 2022 21:46:12 +0100 Subject: [PATCH] docs: use URLs for LICENSE and README and update them during version bumps --- tools/bump-version.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/bump-version.js b/tools/bump-version.js index 293a0365..8038837b 100644 --- a/tools/bump-version.js +++ b/tools/bump-version.js @@ -7,8 +7,14 @@ import semver from "semver"; import yargs from "yargs"; import { hideBin } from "yargs/helpers"; -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 repository = "dungeonslayers/ds4"; +const gitlabURL = "https://git.f3l.de"; + +const getLicenseURL = (version) => `${gitlabURL}/${repository}/-/raw/${version}/LICENSE.md`; +const getReadmeURL = (version) => `${gitlabURL}/${repository}/-/raw/${version}/README.md`; +const getChangelogURL = (version) => `${gitlabURL}/${repository}/-/releases/${version}`; +const getDownloadURL = (version) => `${gitlabURL}/${repository}/-/releases/${version}/downloads/ds4.zip`; + const manifestPath = "./system.json"; /** @@ -61,9 +67,11 @@ function bumpVersion(release) { console.log(`Bumping version number to '${targetVersion}'`); packageJson.version = targetVersion; fs.writeJSONSync("package.json", packageJson, { spaces: 4 }); + manifest.license = getLicenseURL(targetVersion); + manifest.readme = getReadmeURL(targetVersion); + manifest.changelog = getChangelogURL(targetVersion); manifest.version = targetVersion; manifest.download = getDownloadURL(targetVersion); - manifest.changelog = getChangelogURL(targetVersion); fs.writeJSONSync(manifestPath, manifest, { spaces: 4 }); }