Skip to content

Commit

Permalink
enforce changelog update
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Apr 24, 2024
1 parent 0b89b51 commit 4077d2f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"postinstall": "./scripts/postinstall.sh",
"clean": "ocular-clean",
"build": "npm run clean && ocular-build && lerna run build",
"version": "node scripts/verify-changelog.js && git add CHANGELOG.md",
"lint": "ocular-lint",
"cover": "ocular-test cover",
"publish-beta": "ocular-publish version-only-beta",
Expand Down
13 changes: 13 additions & 0 deletions scripts/verify-changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Verifies that CHANGELOG has been updated before publishing a new version
*/
import {readFileSync} from 'fs';

const {version} = JSON.parse(readFileSync('lerna.json'));

const changelog = readFileSync('CHANGELOG.md', 'utf-8');
const header = changelog.match(new RegExp(`^###.*\\b${version.replace('v', '')}\\b.*$`, 'm'));
if (!header) {
console.error(`Cannot find an entry for ${version} in CHANGELOG.md`);
process.exit(1);
}

0 comments on commit 4077d2f

Please sign in to comment.