refactor: remove version update script and related version handling code

This commit is contained in:
Sebastian Espei
2026-03-30 01:30:54 +02:00
parent a617279c2d
commit 2bdacb7507
4 changed files with 0 additions and 88 deletions

View File

@@ -22,7 +22,6 @@
"test:watch": "vitest watch",
"build:docker": "vite build",
"format": "prettier --write .",
"update-version": "node scripts/update-version.js",
"release": "node scripts/release.js patch",
"release:minor": "node scripts/release.js minor",
"release:major": "node scripts/release.js major",

View File

@@ -1,64 +0,0 @@
#!/usr/bin/env node
/**
* Script to update version numbers in HTML files from package.json
* Run this script whenever you need to sync HTML versions with package.json
*/
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Read version from package.json
const packageJson = JSON.parse(
fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')
);
const version = packageJson.version;
// HTML files to update
const htmlFiles = [
'index.html',
'about.html',
'contact.html',
'faq.html',
'privacy.html',
'terms.html',
'src/pages/add-stamps.html',
'src/pages/bookmark.html',
'src/pages/json-to-pdf.html',
'src/pages/pdf-multi-tool.html',
'src/pages/pdf-to-json.html',
'src/pages/table-of-contents.html',
];
console.log(`Updating version to ${version} in HTML files...`);
let updatedCount = 0;
htmlFiles.forEach((file) => {
const filePath = path.join(__dirname, '..', file);
if (!fs.existsSync(filePath)) {
console.log(`⚠️ Skipping ${file} (not found)`);
return;
}
let content = fs.readFileSync(filePath, 'utf8');
// Replace version in <span id="app-version">X.X.X</span>
const regex = /(<span id="app-version">)[^<]+(<\/span>)/g;
const newContent = content.replace(regex, `$1${version}$2`);
if (content !== newContent) {
fs.writeFileSync(filePath, newContent, 'utf8');
console.log(`✓ Updated ${file}`);
updatedCount++;
} else {
console.log(`- ${file} (already up to date)`);
}
});
console.log(`\nDone! Updated ${updatedCount} file(s) to version ${version}`);

View File

@@ -20,11 +20,6 @@ if (__SIMPLE_MODE__) {
}
});
const versionElement = document.getElementById('app-version-simple');
if (versionElement) {
versionElement.textContent = APP_VERSION;
}
const langContainer = document.getElementById('simple-mode-lang-switcher');
if (langContainer) {
const switcher = createLanguageSwitcher();

View File

@@ -1,18 +0,0 @@
import packageJson from '../package.json';
export const APP_VERSION = packageJson.version;
export function injectVersion() {
const versionElements = document.querySelectorAll('#app-version, #app-version-simple');
versionElements.forEach((element) => {
element.textContent = APP_VERSION;
});
}
if (typeof document !== 'undefined') {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', injectVersion);
} else {
injectVersion();
}
}