File tree Expand file tree Collapse file tree 2 files changed +24
-7
lines changed
packages/create-react-app Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ const program = new commander.Command(packageJson.name)
84
84
` A custom ${ chalk . cyan ( '--scripts-version' ) } can be one of:`
85
85
) ;
86
86
console . log ( ` - a specific npm version: ${ chalk . green ( '0.8.2' ) } ` ) ;
87
+ console . log ( ` - a specific npm tag: ${ chalk . green ( '@next' ) } ` ) ;
87
88
console . log (
88
89
` - a custom fork published on npm: ${ chalk . green (
89
90
'my-react-scripts'
@@ -394,14 +395,18 @@ function getInstallPackage(version, originalDirectory) {
394
395
const validSemver = semver . valid ( version ) ;
395
396
if ( validSemver ) {
396
397
packageToInstall += `@${ validSemver } ` ;
397
- } else if ( version && version . match ( / ^ f i l e : / ) ) {
398
- packageToInstall = `file:${ path . resolve (
399
- originalDirectory ,
400
- version . match ( / ^ f i l e : ( .* ) ? $ / ) [ 1 ]
401
- ) } `;
402
398
} else if ( version ) {
403
- // for tar.gz or alternative paths
404
- packageToInstall = version ;
399
+ if ( version [ 0 ] === '@' ) {
400
+ packageToInstall += version ;
401
+ } else if ( version . match ( / ^ f i l e : / ) ) {
402
+ packageToInstall = `file:${ path . resolve (
403
+ originalDirectory ,
404
+ version . match ( / ^ f i l e : ( .* ) ? $ / ) [ 1 ]
405
+ ) } `;
406
+ } else {
407
+ // for tar.gz or alternative paths
408
+ packageToInstall = version ;
409
+ }
405
410
}
406
411
return packageToInstall ;
407
412
}
Original file line number Diff line number Diff line change @@ -101,6 +101,18 @@ npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r "$custom_reg
101
101
git clean -df
102
102
./tasks/publish.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest
103
103
104
+ # ******************************************************************************
105
+ # Test --scripts-version with a distribution tag
106
+ # ******************************************************************************
107
+
108
+ cd " $temp_app_path "
109
+ npx create-react-app --scripts-version=@latest test-app-dist-tag
110
+ cd test-app-dist-tag
111
+
112
+ # Check corresponding scripts version is installed.
113
+ exists node_modules/react-scripts
114
+ checkDependencies
115
+
104
116
# ******************************************************************************
105
117
# Test --scripts-version with a version number
106
118
# ******************************************************************************
You can’t perform that action at this time.
0 commit comments