@@ -46,6 +46,26 @@ function exists {
46
46
done
47
47
}
48
48
49
+ # Check for accidental dependencies in package.json
50
+ function checkDependencies {
51
+ if ! awk ' /"dependencies": {/{y=1;next}/},/{y=0; next}y' package.json | \
52
+ grep -v -q -E ' ^\s*"react(-dom|-scripts)?"' ; then
53
+ echo " Dependencies are correct"
54
+ else
55
+ echo " There are extraneous dependencies in package.json"
56
+ exit 1
57
+ fi
58
+
59
+
60
+ if ! awk ' /"devDependencies": {/{y=1;next}/},/{y=0; next}y' package.json | \
61
+ grep -v -q -E ' ^\s*"react(-dom|-scripts)?"' ; then
62
+ echo " Dev Dependencies are correct"
63
+ else
64
+ echo " There are extraneous devDependencies in package.json"
65
+ exit 1
66
+ fi
67
+ }
68
+
49
69
function create_react_app {
50
70
node " $temp_cli_path " /node_modules/create-react-app/index.js $*
51
71
}
@@ -95,6 +115,7 @@ cd test-app-version-number
95
115
# Check corresponding scripts version is installed.
96
116
exists node_modules/react-scripts
97
117
grep ' "version": "0.4.0"' node_modules/react-scripts/package.json
118
+ checkDependencies
98
119
99
120
# ******************************************************************************
100
121
# Test --scripts-version with a tarball url
@@ -107,6 +128,7 @@ cd test-app-tarball-url
107
128
# Check corresponding scripts version is installed.
108
129
exists node_modules/react-scripts
109
130
grep ' "version": "0.4.0"' node_modules/react-scripts/package.json
131
+ checkDependencies
110
132
111
133
# ******************************************************************************
112
134
# Test --scripts-version with a custom fork of react-scripts
@@ -161,7 +183,7 @@ exists node_modules/@enoah_netzach/react-scripts
161
183
# Test nested folder path as the project name
162
184
# ******************************************************************************
163
185
164
- # Testing a path that exists
186
+ # Testing a path that exists
165
187
cd " $temp_app_path "
166
188
mkdir test-app-nested-paths-t1
167
189
cd test-app-nested-paths-t1
@@ -170,13 +192,13 @@ create_react_app test-app-nested-paths-t1/aa/bb/cc/dd
170
192
cd test-app-nested-paths-t1/aa/bb/cc/dd
171
193
npm start -- --smoke-test
172
194
173
- # Testing a path that does not exist
195
+ # Testing a path that does not exist
174
196
cd " $temp_app_path "
175
197
create_react_app test-app-nested-paths-t2/aa/bb/cc/dd
176
198
cd test-app-nested-paths-t2/aa/bb/cc/dd
177
199
npm start -- --smoke-test
178
200
179
- # Testing a path that is half exists
201
+ # Testing a path that is half exists
180
202
cd " $temp_app_path "
181
203
mkdir -p test-app-nested-paths-t3/aa
182
204
create_react_app test-app-nested-paths-t3/aa/bb/cc/dd
0 commit comments