Skip to content

Commit

Permalink
Update changelog version on pre instead post
Browse files Browse the repository at this point in the history
  • Loading branch information
eythaann committed May 11, 2024
1 parent a8ce9ee commit 28234f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build:schemas": "ts-node scripts/createJsonSchemas.ts",
"lint": "eslint . --max-warnings 0",
"lint:fix": "eslint . --fix --max-warnings 0",
"postversion": "ts-node scripts/postversion.ts"
"preversion": "ts-node scripts/preversion.ts"
},
"keywords": [],
"author": {
Expand Down
6 changes: 3 additions & 3 deletions scripts/postversion.ts → scripts/preversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { execSync } from 'child_process';
import fs from 'fs';

let changelogContent = fs.readFileSync('changelog.md', 'utf-8');
changelogContent = changelogContent.replace(/## \[Unreleased\]/g, `## \[Unreleased\]\n## [${process.env.npm_package_version}]`);
changelogContent = changelogContent.replace(/## \[Unreleased\]/g, `## \[Unreleased\]\n## [${process.env.npm_new_version}]`);
fs.writeFileSync('changelog.md', changelogContent);

execSync('git add .');
execSync('git commit --amend --no-edit');
execSync('git add changelog.md');
execSync(`git commit -m "v${process.env.npm_new_version}: update changelog"`);

0 comments on commit 28234f4

Please sign in to comment.