Skip to content

Commit

Permalink
update changelog when using npm version
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhl committed Mar 11, 2022
1 parent d21bf7d commit 089ab9e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.github/
.vscode/
.vscode-test/
bin/
out/**
src/**
test/**
Expand Down
21 changes: 21 additions & 0 deletions bin/version
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
# Usage: version <version> [<file>...]
# Update CHANGELOG.md for releasing the current state as <version>

if [ $# -eq 0 ]; then
sed -En '2,/^$/s/^# //p' "$0" >&2
exit 64
fi

VERSION=$1
shift

sed -E -f- -i~ CHANGELOG.md <<SED
/^## \[Unreleased\]\$/ a \\
\\
## [$VERSION] - $(date -Idate)
s;^\[Unreleased\]: ([^[:blank:]]+)/v([^/[:blank:]]+)...HEAD\$;\
[Unreleased]: \1/v$VERSION...HEAD\\
[$VERSION]: \1/v\2...v$VERSION;
SED
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
},
"main": "./dist/extension.js",
"scripts": {
"version": "bin/version $npm_package_version && git add CHANGELOG.md",
"package": "vsce package",
"vscode:prepublish": "npm run build -- --minify",
"clean": "rimraf ./out ./dist",
Expand Down

0 comments on commit 089ab9e

Please sign in to comment.