mirror of
https://github.com/JOYCEQL/magic-resume.git
synced 2026-07-03 14:07:11 +02:00
chore: new post-bump script
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { defineConfig } from 'bumpp'
|
||||
|
||||
export default defineConfig({
|
||||
execute: 'npx changelogen --output CHANGELOG.md && node -e "const fs=require(\'fs\'); const pkg=require(\'./package.json\'); let c=fs.readFileSync(\'CHANGELOG.md\',\'utf8\'); c=c.replace(/## v[\\d.]+...main/g, \'## v\' + pkg.version); fs.writeFileSync(\'CHANGELOG.md\', c);"',
|
||||
execute: 'node scripts/post-bump.mjs',
|
||||
commit: true,
|
||||
tag: true,
|
||||
push: false,
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
import { readFileSync, writeFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
const root = process.cwd();
|
||||
|
||||
console.log('Generating changelog...');
|
||||
execSync('npx changelogen --output CHANGELOG.md', { stdio: 'inherit' });
|
||||
|
||||
const pkgPath = resolve(root, 'package.json');
|
||||
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
||||
const version = pkg.version;
|
||||
|
||||
const changelogPath = resolve(root, 'CHANGELOG.md');
|
||||
let content = readFileSync(changelogPath, 'utf8');
|
||||
|
||||
const regex = /## v[\d.]+...main/g;
|
||||
if (regex.test(content)) {
|
||||
console.log(`Fixing changelog header for v${version}...`);
|
||||
content = content.replace(regex, `## v${version}`);
|
||||
writeFileSync(changelogPath, content);
|
||||
}
|
||||
|
||||
console.log('Post-bump script completed successfully.');
|
||||
Reference in New Issue
Block a user