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)
8484 ` A custom ${ chalk . cyan ( '--scripts-version' ) } can be one of:`
8585 ) ;
8686 console . log ( ` - a specific npm version: ${ chalk . green ( '0.8.2' ) } ` ) ;
87+ console . log ( ` - a specific npm tag: ${ chalk . green ( '@next' ) } ` ) ;
8788 console . log (
8889 ` - a custom fork published on npm: ${ chalk . green (
8990 'my-react-scripts'
@@ -394,14 +395,18 @@ function getInstallPackage(version, originalDirectory) {
394395 const validSemver = semver . valid ( version ) ;
395396 if ( validSemver ) {
396397 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- ) } `;
402398 } 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+ }
405410 }
406411 return packageToInstall ;
407412}
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
101101git clean -df
102102./tasks/publish.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest
103103
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+
104116# ******************************************************************************
105117# Test --scripts-version with a version number
106118# ******************************************************************************
You can’t perform that action at this time.
0 commit comments