Skip to content

Commit

Permalink
Add bump-changelog script
Browse files Browse the repository at this point in the history
  • Loading branch information
frangio committed Sep 16, 2020
1 parent d8a2d24 commit a2a2ee8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 1.0.2 (unreleased)
## Unreleased

- Fix false positive variable initialization check in Solidity 0.7.1. ([#171](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/171))

Expand Down
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"prepare": "tsc -b && yarn prepare:contracts",
"prepare:contracts": "buidler compile",
"test": "tsc -b && buidler compile --force && ava",
"test:watch": "buidler compile --force && fgbg 'ava --watch' 'tsc -b --watch'"
"test:watch": "buidler compile --force && fgbg 'ava --watch' 'tsc -b --watch'",
"version": "node ../../scripts/bump-changelog.js"
},
"devDependencies": {
"@nomiclabs/buidler": "^1.3.6",
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-buidler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"prepublish": "rimraf dist *.tsbuildinfo",
"prepare": "tsc -b",
"test": "tsc -b && ava",
"test:watch": "fgbg 'ava --watch' 'tsc -b --watch'"
"test:watch": "fgbg 'ava --watch' 'tsc -b --watch'",
"version": "node ../../scripts/bump-changelog.js"
},
"devDependencies": {
"@nomiclabs/buidler": "^1.3.7",
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-truffle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"prepublish": "rimraf dist *.tsbuildinfo",
"prepare": "tsc -b",
"test": "tsc -b && bash test.sh"
"test": "tsc -b && bash test.sh",
"version": "node ../../scripts/bump-changelog.js"
},
"devDependencies": {
"bn.js": "^5.1.2",
Expand Down
19 changes: 19 additions & 0 deletions scripts/bump-changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env node

const { version } = require(process.cwd() + '/package.json');
const [date] = new Date().toISOString().split('T');

const fs = require('fs');
const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');

const unreleased = /^## Unreleased$/im;

if (!unreleased.test(changelog)) {
console.error('Missing changelog entry');
process.exit(1);
}

fs.writeFileSync('CHANGELOG.md', changelog.replace(unreleased, `## ${version} (${date})`));

const proc = require('child_process');
proc.execSync('git add CHANGELOG.md', { stdio: 'inherit' });

0 comments on commit a2a2ee8

Please sign in to comment.