11import prompts from 'prompts' ;
2- import { prerelease } from 'semver' ;
2+ import semver from 'semver' ;
33import { ChangeFileInfo , ChangeType } from '../types/ChangeInfo' ;
44import { BeachballOptions } from '../types/BeachballOptions' ;
55import { isValidChangeType } from '../validation/isValidChangeType' ;
@@ -28,12 +28,18 @@ export async function promptForChange(params: {
2828
2929 // Get the questions for each package first, in case one package has a validation issue
3030 const packageQuestions : { [ pkg : string ] : prompts . PromptObject [ ] } = { } ;
31+ let hasError = false ;
3132 for ( const pkg of changedPackages ) {
3233 const questions = _getQuestionsForPackage ( { pkg, ...params } ) ;
33- if ( ! questions ) {
34- return ; // validation issue
34+ if ( questions ) {
35+ packageQuestions [ pkg ] = questions ;
36+ } else {
37+ // show all the errors before returning
38+ hasError = true ;
3539 }
36- packageQuestions [ pkg ] = questions ;
40+ }
41+ if ( hasError ) {
42+ return ;
3743 }
3844
3945 // Now prompt for each package
@@ -56,6 +62,7 @@ export async function promptForChange(params: {
5662
5763/**
5864 * Build the list of questions to ask the user for this package.
65+ * Also validates the options and returns undefined if there's an issue.
5966 * @internal exported for testing
6067 */
6168export function _getQuestionsForPackage ( params : {
@@ -75,7 +82,7 @@ export function _getQuestionsForPackage(params: {
7582 }
7683
7784 const packageInfo = packageInfos [ pkg ] ;
78- const showPrereleaseOption = ! ! prerelease ( packageInfo . version ) ;
85+ const showPrereleaseOption = ! ! semver . prerelease ( packageInfo . version ) ;
7986 const changeTypeChoices : prompts . Choice [ ] = [
8087 ...( showPrereleaseOption ? [ { value : 'prerelease' , title : ' [1mPrerelease[22m - bump prerelease version' } ] : [ ] ) ,
8188 { value : 'patch' , title : ' [1mPatch[22m - bug fixes; no API changes.' } ,
0 commit comments