Removed header output relabeling and added column filtering with label handling.
All checks were successful
build / build (push) Successful in 8s

This commit is contained in:
2026-03-07 18:48:29 +01:00
parent f5877d2ccd
commit 281b0c13aa
9 changed files with 160 additions and 80 deletions

View File

@@ -2,9 +2,10 @@
import fs from 'node:fs';
import path from 'node:path';
import { parseArgs } from 'node:util';
import semver from 'semver';
function bump(fileName, version) {
function bump(fileName, version, releaseType = 'patch') {
const filePath = path.resolve(process.cwd(), fileName);
if (!fs.existsSync(filePath)) {
@@ -18,7 +19,7 @@ function bump(fileName, version) {
throw new Error(`${fileName} does not contain a string "version" field.`);
}
const nextVersion = version ?? semver.inc(currentVersion, 'patch');
const nextVersion = version ?? semver.inc(currentVersion, releaseType);
if (!nextVersion) {
throw new Error(`Unsupported semver format: "${currentVersion}"`);
@@ -31,5 +32,18 @@ function bump(fileName, version) {
return nextVersion;
}
const bumpedVersion = bump('package.json');
const { values } = parseArgs({
options: {
'release-type': { type: 'string', short: 'r' },
},
strict: true,
allowPositionals: false,
});
const releaseType = values['release-type'] ?? 'patch';
if (!['major', 'minor', 'patch'].includes(releaseType)) {
throw new Error(`Invalid --release-type '${releaseType}'. Allowed: major, minor, patch.`);
}
const bumpedVersion = bump('package.json', undefined, releaseType);
bump('package-lock.json', bumpedVersion);