@@ -19,7 +19,7 @@ function cleanup {
19
19
cd $root_path
20
20
# Uncomment when snapshot testing is enabled by default:
21
21
# 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
23
23
}
24
24
25
25
# Error messages are redirected to stderr
@@ -53,16 +53,16 @@ set -x
53
53
cd ..
54
54
root_path=$PWD
55
55
56
- # Lint
56
+ npm install
57
+
58
+ # Lint own code
57
59
./node_modules/.bin/eslint --ignore-path .gitignore ./
58
60
59
61
# ******************************************************************************
60
62
# First, test the create-react-app development environment.
61
63
# This does not affect our users but makes sure we can develop it.
62
64
# ******************************************************************************
63
65
64
- npm install
65
-
66
66
# Test local build command
67
67
npm run build
68
68
# Check for expected output
@@ -84,45 +84,19 @@ npm start -- --smoke-test
84
84
# Next, pack react-scripts and create-react-app so we can verify they work.
85
85
# ******************************************************************************
86
86
87
- # Pack CLI (it doesn't need cleaning)
87
+ # Pack CLI
88
88
cd $root_path /packages/create-react-app
89
89
cli_path=$PWD /` npm pack`
90
90
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
119
93
120
94
# Like bundle-deps, this script modifies packages/react-scripts/package.json,
121
95
# 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
123
97
124
98
# Finally, pack react-scripts
125
- scripts_path=$clean_path /packages/react-scripts/` npm pack`
99
+ scripts_path=$root_path /packages/react-scripts/` npm pack`
126
100
127
101
# ******************************************************************************
128
102
# Now that we have packed them, create a clean app folder and install them.
@@ -168,9 +142,15 @@ npm start -- --smoke-test
168
142
# Finally, let's check that everything still works after ejecting.
169
143
# ******************************************************************************
170
144
171
- # Eject
145
+ # Eject...
172
146
echo yes | npm run eject
173
147
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
+
174
154
# Test the build
175
155
npm run build
176
156
# Check for expected output
0 commit comments