File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
packages/create-react-app Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -143,11 +143,24 @@ if (program.info) {
143143 . then ( console . log ) ;
144144}
145145
146- if ( typeof projectName === 'undefined' ) {
147- console . error ( 'Please specify the project directory:' ) ;
148- console . log (
149- ` ${ chalk . cyan ( program . name ( ) ) } ${ chalk . green ( '<project-directory>' ) } `
150- ) ;
146+ const hasMultipleProjectNameArgs =
147+ process . argv [ 3 ] && ! process . argv [ 3 ] . startsWith ( '-' ) ;
148+ if ( typeof projectName === 'undefined' || hasMultipleProjectNameArgs ) {
149+ console . log ( ) ;
150+ if ( hasMultipleProjectNameArgs ) {
151+ console . error (
152+ `You have provided more than one argument for ${ chalk . green (
153+ '<project-directory>'
154+ ) } .`
155+ ) ;
156+ console . log ( ) ;
157+ console . log ( 'Please specify only one project directory, without spaces.' ) ;
158+ } else {
159+ console . error ( 'Please specify the project directory:' ) ;
160+ console . log (
161+ ` ${ chalk . cyan ( program . name ( ) ) } ${ chalk . green ( '<project-directory>' ) } `
162+ ) ;
163+ }
151164 console . log ( ) ;
152165 console . log ( 'For example:' ) ;
153166 console . log ( ` ${ chalk . cyan ( program . name ( ) ) } ${ chalk . green ( 'my-react-app' ) } ` ) ;
You can’t perform that action at this time.
0 commit comments