Skip to content

Commit

Permalink
Tweak failure message
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Mar 5, 2017
1 parent 5d64ee4 commit 22f6945
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/create-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,10 @@ function getPackageName(installPackage) {
}).catch(function(err) {
// The package name could be with or without semver version, e.g. react-scripts-0.2.0-alpha.1.tgz
// However, this function returns package name only without semver version.
console.log('Failed to extract package: ' + err.message);
console.log('Falling back to naive behavior ...')
return Promise.resolve(installPackage.match(/^.+\/(.+?)(?:-\d+.+)?\.tgz$/)[1]);
console.log('Could not extract the package name from the archive: ' + err.message);
var assumedProjectName = installPackage.match(/^.+\/(.+?)(?:-\d+.+)?\.tgz$/)[1];
console.log('Based on the filename, assuming it is "' + chalk.cyan(assumedProjectName) + '"');
return Promise.resolve(assumedProjectName);
});
} else if (installPackage.indexOf('git+') === 0) {
// Pull package name out of git urls e.g:
Expand Down

0 comments on commit 22f6945

Please sign in to comment.