Skip to content

Commit 11f09a1

Browse files
SaschaDensgaearon
authored andcommitted
Extend --scripts-version to include .tar.gz format (#3725)
* Extend --scripts-version to include .tar.gz format * Removal of debug console.log
1 parent 3a0b836 commit 11f09a1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/create-react-app/createReactApp.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ const program = new commander.Command(packageJson.name)
8585
'https://mysite.com/my-react-scripts-0.8.2.tgz'
8686
)}`
8787
);
88+
console.log(
89+
` - a .tar.gz archive: ${chalk.green(
90+
'https://mysite.com/my-react-scripts-0.8.2.tar.gz'
91+
)}`
92+
);
8893
console.log(
8994
` It is not needed unless you specifically want to use a fork.`
9095
);
@@ -432,7 +437,7 @@ function extractStream(stream, dest) {
432437

433438
// Extract package name from tarball url or path.
434439
function getPackageName(installPackage) {
435-
if (installPackage.indexOf('.tgz') > -1) {
440+
if (installPackage.match(/^.+\.(tgz|tar\.gz)$/)) {
436441
return getTemporaryDirectory()
437442
.then(obj => {
438443
let stream;
@@ -455,7 +460,7 @@ function getPackageName(installPackage) {
455460
`Could not extract the package name from the archive: ${err.message}`
456461
);
457462
const assumedProjectName = installPackage.match(
458-
/^.+\/(.+?)(?:-\d+.+)?\.tgz$/
463+
/^.+\/(.+?)(?:-\d+.+)?\.(tgz|tar\.gz)$/
459464
)[1];
460465
console.log(
461466
`Based on the filename, assuming it is "${chalk.cyan(

0 commit comments

Comments
 (0)