From 67dd2045e364f381131a47abe607bd042bda1a8a Mon Sep 17 00:00:00 2001 From: Slawomir Koszewski Date: Sat, 7 Mar 2026 11:06:10 +0100 Subject: [PATCH] refactor: moved bump-patch.mjs to the generic sk-tools package. --- scripts/bump-patch.mjs | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100755 scripts/bump-patch.mjs diff --git a/scripts/bump-patch.mjs b/scripts/bump-patch.mjs deleted file mode 100755 index 259dd83..0000000 --- a/scripts/bump-patch.mjs +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env node - -import fs from 'node:fs'; -import path from 'node:path'; -import semver from 'semver'; - -function bump(fileName, version) { - const filePath = path.resolve(process.cwd(), fileName); - - if (!fs.existsSync(filePath)) { - throw new Error(`File not found: ${filePath}`); - } - - const json = JSON.parse(fs.readFileSync(filePath, 'utf8')); - const currentVersion = json.version; - - if (typeof currentVersion !== 'string') { - throw new Error(`${fileName} does not contain a string "version" field.`); - } - - const nextVersion = version ?? semver.inc(currentVersion, 'patch'); - - if (!nextVersion) { - throw new Error(`Unsupported semver format: "${currentVersion}"`); - } - - json.version = nextVersion; - - fs.writeFileSync(filePath, `${JSON.stringify(json, null, 4)}\n`, 'utf8'); - console.log(`Bumped version in ${fileName} to ${nextVersion}`); - return nextVersion; -} - -const bumpedVersion = bump('package.json'); -bump('package-lock.json', bumpedVersion);