Skip to content

Prepare for release #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add script to get the release notes
Usage:
```sh
npm run release-notes         # Gets notes for current version
npm run release-notes 1.2.3   # Gets notes for explicit version
```
  • Loading branch information
RobinMalfait committed Oct 19, 2022
commit d082e8cc1cb630080db4616ec4cda017b68fce29
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"build": "npm run swcify",
"dev": "npm run swcify -- --watch",
"postbuild": "tsc --emitDeclarationOnly",
"prepublishOnly": "npm run build"
"prepublishOnly": "npm run build",
"release-notes": "node ./scripts/release-notes.js"
},
"prettier": {
"printWidth": 100,
Expand Down
16 changes: 16 additions & 0 deletions scripts/release-notes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
let path = require('path')
let fs = require('fs')

let version = process.argv[2] || require('../package.json').version
let changelog = fs.readFileSync(path.resolve(__dirname, '..', 'CHANGELOG.md'), 'utf8')
let match = new RegExp(
`## \\[${version}\\] - (.*)\\n\\n([\\s\\S]*?)\\n(?:(?:##\\s)|(?:\\[))`,
'g'
).exec(changelog)

if (match) {
let [, date, notes] = match
console.log(notes.trim())
} else {
console.log(`Placeholder release notes for version: v${version}`)
}