Skip to content

Commit

Permalink
Fix automatic changelog versioning
Browse files Browse the repository at this point in the history
`npm version` will now automatically replace the text "v.next" with
the new version and the date.
  • Loading branch information
chadxz committed Jan 18, 2016
1 parent 6df7cac commit 57a871b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CHANGELOG.md
@@ -1,7 +1,13 @@
# Change Log
All notable changes to this project will be documented in this file.

## minor - 2016-01-18
## v.next

## Fixed

- Fixed automatic changelog versioning using the wrong version

## 2.1.0 - 2016-01-18

### Fixed

Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -4,6 +4,7 @@
"description": "Client-side JavaScript library for Respoke.",
"main": "respoke/respoke.js",
"scripts": {
"version": "scripts/release-changelog.sh",
"build": "grunt build:dev",
"watch": "webpack --watch",
"dist": "grunt build:dist",
Expand Down
12 changes: 12 additions & 0 deletions scripts/release-changelog.sh
@@ -0,0 +1,12 @@
#!/bin/bash
set -e
# this script is automatically run by npm when issuing the `npm version`
# command, as long as it is referenced as the "version" npm script.

# Stamp the changelog
if [ -f "CHANGELOG.md" ] && $(grep -iq "v.next" CHANGELOG.md); then
version=$(node -e "console.log(require('./package.json').version)")
echo "Applying version and date to changelog..."
sed -i "" -e "s/v\.next/${version} - $(date +"%Y-%m-%d")/" CHANGELOG.md
git add CHANGELOG.md
fi

0 comments on commit 57a871b

Please sign in to comment.