Improve scripts to release npm and bower simultaneously

This commit is contained in:
Rodrigo Fernandes 2016-05-14 13:46:38 +01:00
parent 3a78226a6c
commit c5a5a57c04
No known key found for this signature in database
GPG key ID: 08E3C5F38969078E
3 changed files with 19 additions and 2 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "diff2html", "name": "diff2html",
"version": "2.0.0-rc.1", "version": "2.0.0-rc.2",
"homepage": "http://rtfpessoa.github.io/diff2html/", "homepage": "http://rtfpessoa.github.io/diff2html/",
"description": "Fast Diff to colorized HTML", "description": "Fast Diff to colorized HTML",
"keywords": [ "keywords": [

View file

@ -37,6 +37,7 @@
"preferGlobal": true, "preferGlobal": true,
"scripts": { "scripts": {
"release": "./scripts/release.sh", "release": "./scripts/release.sh",
"release-bower": "./scripts/update-bower-version.sh",
"templates": "./scripts/hulk.js --wrapper node --variable 'browserTemplates' ./src/templates/*.mustache > ./src/templates/diff2html-templates.js", "templates": "./scripts/hulk.js --wrapper node --variable 'browserTemplates' ./src/templates/*.mustache > ./src/templates/diff2html-templates.js",
"style": "jscs src/*.js src/ui/js/*.js", "style": "jscs src/*.js src/ui/js/*.js",
"coverage": "istanbul cover _mocha -- -u exports -R spec ./test/**/*", "coverage": "istanbul cover _mocha -- -u exports -R spec ./test/**/*",
@ -44,7 +45,7 @@
"test": "npm run style && npm run coverage && npm run check-coverage", "test": "npm run style && npm run coverage && npm run check-coverage",
"codacy": "npm run coverage && cat ./coverage/lcov.info | codacy-coverage", "codacy": "npm run coverage && cat ./coverage/lcov.info | codacy-coverage",
"preversion": "npm run release && npm test", "preversion": "npm run release && npm test",
"version": "git add -A src dist", "version": "npm run release-bower && git add -A src dist package.json bower.json",
"postversion": "git push && git push --tags" "postversion": "git push && git push --tags"
}, },
"main": "./src/diff2html.js", "main": "./src/diff2html.js",

16
scripts/update-bower-version.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
#
# diff2html update bower version
# by rtfpessoa
#
set -e
echo "diff2html updating bower version..."
RELEASE_VERSION=$(cat package.json | grep "version" | head -1 | gsed -e 's/ "version": "\(.*\)",/\1/')
gsed -i 's/.*"version".*/ "version": "'${RELEASE_VERSION}'",/' bower.json
echo "diff2html updated bower version successfully!"