@@ -9,6 +9,7 @@ const fs = require('fs');
99const path = require ( 'path' ) ;
1010const semver = require ( 'semver' ) ;
1111const packageJson = JSON . parse ( fs . readFileSync ( 'package.json' ) ) ;
12+ const modifiedFiles = [ ] ;
1213
1314const yargs = require ( 'yargs' )
1415 . option ( 'dryrun' , {
@@ -48,6 +49,14 @@ if (versionBump !== 'none') {
4849
4950 packageJson . version = version ;
5051 fs . writeFileSync ( 'package.json' , JSON . stringify ( packageJson , null , 2 ) ) ;
52+ modifiedFiles . push ( 'package.json' ) ;
53+
54+ if ( yargs . argv . bower ) {
55+ const bowerJson = fs . readFileSync ( 'bower.json' ) ;
56+ bowerJson . version = version ;
57+ fs . writeFileSync ( 'bower.json' , JSON . stringify ( bowerJson , null , 2 ) ) ;
58+ modifiedFiles . push ( 'bower.json' ) ;
59+ }
5160}
5261
5362
@@ -68,17 +77,24 @@ if (readlineSync.keyInYN('\n\nUpdate CHANGELOG?')) {
6877
6978 let fullChangelog = fs . readFileSync ( 'CHANGELOG.md' ) ;
7079 fs . writeFileSync ( 'CHANGELOG.md' , changelog + '\n' + fullChangelog ) ;
80+ modifiedFiles . push ( 'CHANGELOG.md' ) ;
81+ }
82+
83+
84+ // Run tests
85+ if ( readlineSync . keyInYN ( 'Run tests?' ) ) {
86+ _exec ( 'npm test' )
7187}
7288
7389
7490// Commit and push changes
7591if ( ! readlineSync . keyInYN ( 'Ready to publish?' ) ) {
76- console . log ( ' \n\nUndo changes:\n\ngit checkout CHANGELOG.md package.json \n\n' ) ;
92+ console . log ( ` \n\nRun this command to undo changes:\n\ngit checkout ${ modifiedFiles . join ( ' ' ) } \n\n` ) ;
7793 process . exit ( 1 ) ;
7894}
7995
8096if ( ! yargs . argv . dryrun ) {
81- _exec ( `git ci -m ${ version } package.json CHANGELOG.md ` ) ;
97+ _exec ( `git ci -m ${ version } ${ modifiedFiles . join ( ' ' ) } ` ) ;
8298}
8399
84100if ( ! yargs . argv . dryrun ) {
0 commit comments