@@ -510,7 +510,7 @@ async function normalizeVersion(version, {force}, versionTagPrefix) {
510510 return version ;
511511}
512512
513- function parseArgs ( args ) {
513+ async function parseArgs ( args ) {
514514 const options = {
515515 dryRun : false ,
516516 outfile : './CHANGELOG.md' ,
@@ -595,9 +595,19 @@ function parseArgs(args) {
595595 } ) ;
596596
597597 if ( ! options . version ) {
598- error ( 'Missing required option: --version; see --help for usage' ) ;
598+ if ( options . dryRun ) {
599+ const prefix = await getVersionTagPrefix ( ) ;
599600
600- return null ;
601+ const version = `${ prefix } 0.0.0-placeholder` ;
602+
603+ info ( `Using phony version ${ version } during --dry-run` ) ;
604+
605+ options . version = version ;
606+ } else {
607+ error ( 'Missing required option: --version; see --help for usage' ) ;
608+
609+ return null ;
610+ }
601611 }
602612
603613 return options ;
@@ -692,12 +702,6 @@ async function getVersionTagPrefix() {
692702}
693703
694704async function main ( _node , _script , ...args ) {
695- const options = parseArgs ( args ) ;
696- if ( ! options ) {
697- process . exit ( 1 ) ;
698- }
699- const { outfile, to, updateTags} = options ;
700-
701705 printBanner ( `
702706 changelog.js
703707 ============
@@ -706,6 +710,14 @@ async function main(_node, _script, ...args) {
706710 for duty!
707711 ` ) ;
708712
713+ const options = await parseArgs ( args ) ;
714+
715+ if ( ! options ) {
716+ process . exit ( 1 ) ;
717+ }
718+
719+ const { outfile, to, updateTags} = options ;
720+
709721 if ( updateTags ) {
710722 try {
711723 info ( 'Fetching remote tags: run with --no-update-tags to skip' ) ;
0 commit comments