docs: use URLs for README and LICENSE and update them when bumping the version

This commit is contained in:
Johannes Loher 2022-02-08 21:36:26 +01:00
parent d62811da1c
commit f6d9491465

View file

@ -7,9 +7,14 @@ import semver from 'semver';
import yargs from 'yargs'; import yargs from 'yargs';
import { hideBin } from 'yargs/helpers'; import { hideBin } from 'yargs/helpers';
const repository = 'ghost/darkness-dependent-vision';
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) => const getDownloadURL = (version) =>
`https://git.f3l.de/ghost/darkness-dependent-vision/-/releases/${version}/downloads/darkness-dependent-vision.zip`; `${gitlabURL}/${repository}/-/releases/${version}/downloads/darkness-dependent-vision.zip`;
const getChangelogURL = (version) => `https://git.f3l.de/ghost/darkness-dependent-vision/-/releases/${version}`;
const manifestPath = 'module.json'; const manifestPath = 'module.json';
@ -63,9 +68,11 @@ function bumpVersion(release) {
console.log(`Bumping version number to '${targetVersion}'`); console.log(`Bumping version number to '${targetVersion}'`);
packageJson.version = targetVersion; packageJson.version = targetVersion;
fs.writeJSONSync('package.json', packageJson, { spaces: 4 }); fs.writeJSONSync('package.json', packageJson, { spaces: 4 });
manifest.license = getLicenseURL(targetVersion);
manifest.readme = getReadmeURL(targetVersion);
manifest.changelog = getChangelogURL(targetVersion);
manifest.version = targetVersion; manifest.version = targetVersion;
manifest.download = getDownloadURL(targetVersion); manifest.download = getDownloadURL(targetVersion);
manifest.changelog = getChangelogURL(targetVersion);
fs.writeJSONSync(manifestPath, manifest, { spaces: 4 }); fs.writeJSONSync(manifestPath, manifest, { spaces: 4 });
} }