@@ -510,7 +510,7 @@ async function normalizeVersion(version, {force}, versionTagPrefix) {
510
510
return version ;
511
511
}
512
512
513
- function parseArgs ( args ) {
513
+ async function parseArgs ( args ) {
514
514
const options = {
515
515
dryRun : false ,
516
516
outfile : './CHANGELOG.md' ,
@@ -595,9 +595,19 @@ function parseArgs(args) {
595
595
} ) ;
596
596
597
597
if ( ! options . version ) {
598
- error ( 'Missing required option: --version; see --help for usage' ) ;
598
+ if ( options . dryRun ) {
599
+ const prefix = await getVersionTagPrefix ( ) ;
599
600
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
+ }
601
611
}
602
612
603
613
return options ;
@@ -692,12 +702,6 @@ async function getVersionTagPrefix() {
692
702
}
693
703
694
704
async 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
-
701
705
printBanner ( `
702
706
changelog.js
703
707
============
@@ -706,6 +710,14 @@ async function main(_node, _script, ...args) {
706
710
for duty!
707
711
` ) ;
708
712
713
+ const options = await parseArgs ( args ) ;
714
+
715
+ if ( ! options ) {
716
+ process . exit ( 1 ) ;
717
+ }
718
+
719
+ const { outfile, to, updateTags} = options ;
720
+
709
721
if ( updateTags ) {
710
722
try {
711
723
info ( 'Fetching remote tags: run with --no-update-tags to skip' ) ;
0 commit comments