@@ -9,6 +9,7 @@ const fs = require('fs');
9
9
const path = require ( 'path' ) ;
10
10
const semver = require ( 'semver' ) ;
11
11
const packageJson = JSON . parse ( fs . readFileSync ( 'package.json' ) ) ;
12
+ const modifiedFiles = [ ] ;
12
13
13
14
const yargs = require ( 'yargs' )
14
15
. option ( 'dryrun' , {
@@ -48,6 +49,14 @@ if (versionBump !== 'none') {
48
49
49
50
packageJson . version = version ;
50
51
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
+ }
51
60
}
52
61
53
62
@@ -68,17 +77,24 @@ if (readlineSync.keyInYN('\n\nUpdate CHANGELOG?')) {
68
77
69
78
let fullChangelog = fs . readFileSync ( 'CHANGELOG.md' ) ;
70
79
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' )
71
87
}
72
88
73
89
74
90
// Commit and push changes
75
91
if ( ! 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` ) ;
77
93
process . exit ( 1 ) ;
78
94
}
79
95
80
96
if ( ! yargs . argv . dryrun ) {
81
- _exec ( `git ci -m ${ version } package.json CHANGELOG.md ` ) ;
97
+ _exec ( `git ci -m ${ version } ${ modifiedFiles . join ( ' ' ) } ` ) ;
82
98
}
83
99
84
100
if ( ! yargs . argv . dryrun ) {
0 commit comments