11import { Argv , CommandModule , showHelp } from 'yargs' ;
22import { readNxJson } from '../../project-graph/file-utils' ;
3+ import { logger } from '../../utils/logger' ;
34import {
45 OutputStyle ,
56 RunManyOptions ,
@@ -159,15 +160,18 @@ const releaseCommand: CommandModule<NxReleaseArgs, ReleaseOptions> = {
159160 }
160161 return true ;
161162 } ) ,
162- handler : ( args ) =>
163- import ( './release' )
164- . then ( ( m ) => m . releaseCLIHandler ( args ) )
165- . then ( ( versionDataOrExitCode ) => {
166- if ( typeof versionDataOrExitCode === 'number' ) {
167- return process . exit ( versionDataOrExitCode ) ;
168- }
169- process . exit ( 0 ) ;
170- } ) ,
163+ handler : async ( args ) => {
164+ const release = await import ( './release' ) ;
165+ const result = await release . releaseCLIHandler ( args ) ;
166+ if ( args . dryRun ) {
167+ logger . warn ( `\nNOTE: The "dryRun" flag means no changes were made.` ) ;
168+ }
169+
170+ if ( typeof result === 'number' ) {
171+ process . exit ( result ) ;
172+ }
173+ process . exit ( 0 ) ;
174+ } ,
171175} ;
172176
173177const versionCommand : CommandModule < NxReleaseArgs , VersionOptions > = {
@@ -195,15 +199,18 @@ const versionCommand: CommandModule<NxReleaseArgs, VersionOptions> = {
195199 'Whether or not to stage the changes made by this command. Useful when combining this command with changelog generation.' ,
196200 } )
197201 ) ,
198- handler : ( args ) =>
199- import ( './version' )
200- . then ( ( m ) => m . releaseVersionCLIHandler ( args ) )
201- . then ( ( versionDataOrExitCode ) => {
202- if ( typeof versionDataOrExitCode === 'number' ) {
203- return process . exit ( versionDataOrExitCode ) ;
204- }
205- process . exit ( 0 ) ;
206- } ) ,
202+ handler : async ( args ) => {
203+ const release = await import ( './version' ) ;
204+ const result = await release . releaseVersionCLIHandler ( args ) ;
205+ if ( args . dryRun ) {
206+ logger . warn ( `\nNOTE: The "dryRun" flag means no changes were made.` ) ;
207+ }
208+
209+ if ( typeof result === 'number' ) {
210+ process . exit ( result ) ;
211+ }
212+ process . exit ( 0 ) ;
213+ } ,
207214} ;
208215
209216const changelogCommand : CommandModule < NxReleaseArgs , ChangelogOptions > = {
@@ -254,10 +261,16 @@ const changelogCommand: CommandModule<NxReleaseArgs, ChangelogOptions> = {
254261 } )
255262 ) ,
256263 handler : async ( args ) => {
257- const status = await (
258- await import ( './changelog' )
259- ) . releaseChangelogCLIHandler ( args ) ;
260- process . exit ( status ) ;
264+ const release = await import ( './changelog' ) ;
265+ const result = await release . releaseChangelogCLIHandler ( args ) ;
266+ if ( args . dryRun ) {
267+ logger . warn ( `\nNOTE: The "dryRun" flag means no changes were made.` ) ;
268+ }
269+
270+ if ( typeof result === 'number' ) {
271+ process . exit ( result ) ;
272+ }
273+ process . exit ( 0 ) ;
261274 } ,
262275} ;
263276
@@ -284,6 +297,10 @@ const publishCommand: CommandModule<NxReleaseArgs, PublishOptions> = {
284297 const status = await (
285298 await import ( './publish' )
286299 ) . releasePublishCLIHandler ( coerceParallelOption ( withOverrides ( args , 2 ) ) ) ;
300+ if ( args . dryRun ) {
301+ logger . warn ( `\nNOTE: The "dryRun" flag means no changes were made.` ) ;
302+ }
303+
287304 process . exit ( status ) ;
288305 } ,
289306} ;
0 commit comments