11const Changelog = require ( './changelog.js' )
2+ const WordPress = require ( './wordpress.js' )
23const defaults = require ( './defaults.js' )
34const pkg = require ( '../package.json' )
45const fs = require ( 'fs' )
@@ -44,6 +45,9 @@ module.exports = class Bump {
4445
4546 '--version' : Boolean ,
4647 '-v' : '--version' ,
48+
49+ '--skip-wordpress' : Boolean ,
50+ '-w' : '--skip-wordpress' ,
4751 } )
4852
4953 // Get CLI arg values.
@@ -54,6 +58,7 @@ module.exports = class Bump {
5458 if ( this . args [ '--skip-v-in-version' ] ) this . argv . changelog . skipV = this . args [ '--skip-v-in-version' ]
5559 if ( this . args [ '--initial-changelog-text' ] ) this . argv . changelog . initialText = this . args [ '--initial-changelog-text' ]
5660 if ( this . args [ '--initial-changelog-text-url' ] ) this . argv . changelog . initialTextUrl = this . args [ '--initial-changelog-text-url' ]
61+ if ( this . args [ '--skip-wordpress' ] ) this . argv . skipWordPress = this . args [ '--skip-wordpress' ]
5762 if ( this . args [ '--version' ] ) this . argv . version = this . args [ '--version' ]
5863
5964 // Setup defaults.
@@ -69,10 +74,15 @@ module.exports = class Bump {
6974 if ( this . options . help ) return this . help ( )
7075
7176 // Log package version.
72- if ( this . options . version ) return this . version ( )
77+ if ( this . options . version ) return this . logPackageVersion ( )
78+
79+ // @todo : Get version once and pass it to Changelog and WordPress.
7380
74- // Setup Changelog.
81+ // Handle Changelog bump .
7582 new Changelog ( this . options . changelog )
83+
84+ // Handle WordPress bump.
85+ new WordPress ( { skipWordPress : this . options . skipWordPress } )
7686 }
7787
7888 /**
@@ -81,22 +91,27 @@ module.exports = class Bump {
8191 * @since unreleased
8292 */
8393 help ( ) {
84- const readme = fs . readFileSync ( './node_modules/release-bump/README.md' , 'utf-8' )
94+ const path = './node_modules/release-bump/README.md'
95+ this . readme = fs . readFileSync ( path , 'utf-8' )
8596 // Get CLI documentation.
8697 . match ( / # # # C L I .* # # # J a v a S c r i p t A P I / s) [ 0 ]
8798 // Filter configuration details.
8899 . replace ( / # # # C L I .* # # # # C o n f i g u r a t i o n \n \n / s, '' )
89100 // Remove last line.
90101 . replace ( / \n \n # # # J a v a S c r i p t A P I / s, '' )
91- console . info ( readme )
102+ console . info ( this . readme )
92103 }
93104
94105 /**
95106 * Log package version.
96107 *
97108 * @since unreleased
98109 */
99- version ( ) {
100- console . info ( pkg . version )
110+ logPackageVersion ( ) {
111+ if ( pkg . version ) {
112+ console . info ( pkg . version )
113+ } else {
114+ console . warn ( 'No version found.' )
115+ }
101116 }
102117}
0 commit comments