Add hybrid versioning scripts, version shown in app footer

This commit is contained in:
2026-01-16 16:55:13 +00:00
parent 966006db6a
commit 5bd9780ac0
8 changed files with 214 additions and 11 deletions

45
scripts/bump-version.js Normal file
View File

@@ -0,0 +1,45 @@
// scripts/bump-version.js - Manual version bump script
const fs = require('fs');
const path = require('path');
const args = process.argv.slice(2);
const bumpType = args[0] || 'patch'; // patch, minor, major
if (!['patch', 'minor', 'major'].includes(bumpType)) {
console.error('Usage: npm run version:bump [patch|minor|major]');
console.error(' patch: 0.2.1 → 0.2.2 (bug fixes)');
console.error(' minor: 0.2.1 → 0.3.0 (new features)');
console.error(' major: 0.2.1 → 1.0.0 (breaking changes)');
process.exit(1);
}
const packagePath = path.join(__dirname, '../package.json');
const pkg = require(packagePath);
const [major, minor, patch] = pkg.version.split('.').map(Number);
let newVersion;
switch (bumpType) {
case 'major':
newVersion = `${major + 1}.0.0`;
break;
case 'minor':
newVersion = `${major}.${minor + 1}.0`;
break;
case 'patch':
default:
newVersion = `${major}.${minor}.${patch + 1}`;
break;
}
const oldVersion = pkg.version;
pkg.version = newVersion;
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2) + '\n');
console.log(`✓ Bumped version: ${oldVersion}${newVersion}`);
console.log(`\nNext steps:`);
console.log(` 1. Review the change: git diff package.json`);
console.log(` 2. Commit: git add package.json && git commit -m "Bump version to ${newVersion}"`);
console.log(` 3. (Optional) Tag: git tag v${newVersion}`);
console.log(` 4. Build to see full version: npm run build`);