2026-05-21 20:49:33 -04:00
|
|
|
import fs from 'fs';
|
|
|
|
|
import path from 'path';
|
|
|
|
|
import { execSync } from 'child_process';
|
|
|
|
|
import { fileURLToPath } from 'url';
|
2026-03-19 16:26:25 +11:00
|
|
|
|
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
|
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
|
|
|
|
|
|
const version = process.argv[2];
|
|
|
|
|
|
|
|
|
|
if (!version) {
|
2026-05-21 20:49:33 -04:00
|
|
|
console.error('Version argument missing');
|
2026-03-19 16:26:25 +11:00
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-21 20:49:33 -04:00
|
|
|
const root = path.resolve(__dirname, '..');
|
2026-03-19 16:26:25 +11:00
|
|
|
const newVersionTag = `v${version}`;
|
|
|
|
|
|
|
|
|
|
// Update package.json + package-lock.json safely
|
|
|
|
|
execSync(`npm version ${version} --no-git-tag-version`, {
|
|
|
|
|
cwd: root,
|
2026-05-21 20:49:33 -04:00
|
|
|
stdio: 'inherit',
|
2026-03-19 16:26:25 +11:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
console.log(`Updated package.json and package-lock.json → ${version}`);
|
|
|
|
|
|
|
|
|
|
// Update UI version references
|
|
|
|
|
const files = [
|
2026-05-21 20:49:33 -04:00
|
|
|
'src/app/features/settings/about/About.tsx',
|
|
|
|
|
'src/app/pages/auth/AuthFooter.tsx',
|
|
|
|
|
'src/app/pages/client/WelcomePage.tsx',
|
2026-03-19 16:26:25 +11:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
files.forEach((filePath) => {
|
|
|
|
|
const absPath = path.join(root, filePath);
|
|
|
|
|
|
|
|
|
|
if (!fs.existsSync(absPath)) {
|
|
|
|
|
console.warn(`File not found: ${filePath}`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-21 20:49:33 -04:00
|
|
|
const content = fs.readFileSync(absPath, 'utf8');
|
2026-03-19 16:26:25 +11:00
|
|
|
const updated = content.replace(/v\d+\.\d+\.\d+/g, newVersionTag);
|
|
|
|
|
|
|
|
|
|
fs.writeFileSync(absPath, updated);
|
|
|
|
|
|
|
|
|
|
console.log(`Updated ${filePath} → ${newVersionTag}`);
|
2026-05-21 20:49:33 -04:00
|
|
|
});
|