Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions packages/create-react-app/createReactApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,24 @@ if (program.info) {
.then(console.log);
}

if (typeof projectName === 'undefined') {
console.error('Please specify the project directory:');
console.log(
` ${chalk.cyan(program.name())} ${chalk.green('<project-directory>')}`
);
const hasMultipleProjectNameArgs =
process.argv[3] && !process.argv[3].startsWith('-');
if (typeof projectName === 'undefined' || hasMultipleProjectNameArgs) {
console.log();
if (hasMultipleProjectNameArgs) {
console.error(
`You have provided more than one argument for ${chalk.green(
'<project-directory>'
)}.`
);
console.log();
console.log('Please specify only one project directory, without spaces.');
} else {
console.error('Please specify the project directory:');
console.log(
` ${chalk.cyan(program.name())} ${chalk.green('<project-directory>')}`
);
}
console.log();
console.log('For example:');
console.log(` ${chalk.cyan(program.name())} ${chalk.green('my-react-app')}`);
Expand Down