@@ -19,7 +19,7 @@ function cleanup {
1919 cd $root_path
2020 # Uncomment when snapshot testing is enabled by default:
2121 # rm ./packages/react-scripts/template/src/__snapshots__/App.test.js.snap
22- rm -rf $temp_cli_path $temp_app_path $clean_path
22+ rm -rf $temp_cli_path $temp_app_path
2323}
2424
2525# Error messages are redirected to stderr
@@ -53,16 +53,16 @@ set -x
5353cd ..
5454root_path=$PWD
5555
56- # Lint
56+ npm install
57+
58+ # Lint own code
5759./node_modules/.bin/eslint --ignore-path .gitignore ./
5860
5961# ******************************************************************************
6062# First, test the create-react-app development environment.
6163# This does not affect our users but makes sure we can develop it.
6264# ******************************************************************************
6365
64- npm install
65-
6666# Test local build command
6767npm run build
6868# Check for expected output
@@ -84,45 +84,19 @@ npm start -- --smoke-test
8484# Next, pack react-scripts and create-react-app so we can verify they work.
8585# ******************************************************************************
8686
87- # Pack CLI (it doesn't need cleaning)
87+ # Pack CLI
8888cd $root_path /packages/create-react-app
8989cli_path=$PWD /` npm pack`
9090
91- # Packing react-scripts takes more work because we want to clean it up first.
92- # Create a temporary clean folder that contains production only code.
93- # Do not overwrite any files in the current folder.
94- clean_path=` mktemp -d 2> /dev/null || mktemp -d -t ' clean_path' `
95-
96- # Copy some of the react-scripts project files to the temporary folder.
97- # Exclude folders that definitely won’t be part of the package from processing.
98- # We will strip the dev-only code there, `npm pack`, and copy the package back.
99- cd $root_path
100- rsync -av --exclude=' .git' --exclude=$clean_path \
101- --exclude=' node_modules' --exclude=' build' \
102- ' ./' $clean_path > /dev/null
103-
104- # Open the clean folder
105- cd $clean_path /packages/react-scripts
106-
107- # Now remove all the code relevant to development of Create React App.
108- files=" $( find -L . -name " *.js" -type f) "
109- for file in $files ; do
110- sed -i.bak ' /\/\/ @remove-on-publish-begin/,/\/\/ @remove-on-publish-end/d' $file
111- rm $file .bak
112- done
113-
114- # Install all our packages
115- cd $clean_path
116- $root_path /node_modules/.bin/lerna bootstrap
117-
118- cd $clean_path /packages/react-scripts
91+ # Go to react-scripts
92+ cd $root_path /packages/react-scripts
11993
12094# Like bundle-deps, this script modifies packages/react-scripts/package.json,
12195# copying own dependencies (those in the `packages` dir) to bundledDependencies
122- node $clean_path /tasks/bundle-own-deps.js
96+ node $root_path /tasks/bundle-own-deps.js
12397
12498# Finally, pack react-scripts
125- scripts_path=$clean_path /packages/react-scripts/` npm pack`
99+ scripts_path=$root_path /packages/react-scripts/` npm pack`
126100
127101# ******************************************************************************
128102# Now that we have packed them, create a clean app folder and install them.
@@ -168,9 +142,15 @@ npm start -- --smoke-test
168142# Finally, let's check that everything still works after ejecting.
169143# ******************************************************************************
170144
171- # Eject
145+ # Eject...
172146echo yes | npm run eject
173147
148+ # ...but still link to the local packages
149+ npm link $root_path /packages/babel-preset-react-app
150+ npm link $root_path /packages/eslint-config-react-app
151+ npm link $root_path /packages/react-dev-utils
152+ npm link $root_path /packages/react-scripts
153+
174154# Test the build
175155npm run build
176156# Check for expected output
0 commit comments