@@ -14,13 +14,12 @@ cd "$(dirname "$0")"
14
14
15
15
# CLI and app temporary locations
16
16
# http://unix.stackexchange.com/a/84980
17
- temp_cli_path=` mktemp -d 2> /dev/null || mktemp -d -t ' temp_cli_path' `
18
17
temp_app_path=` mktemp -d 2> /dev/null || mktemp -d -t ' temp_app_path' `
19
18
20
19
function cleanup {
21
20
echo ' Cleaning up.'
22
21
cd " $root_path "
23
- rm -rf " $temp_cli_path " " $ temp_app_path"
22
+ rm -rf " $temp_app_path "
24
23
}
25
24
26
25
# Error messages are redirected to stderr
@@ -55,10 +54,6 @@ function checkDependencies {
55
54
fi
56
55
}
57
56
58
- function create_react_app {
59
- node " $temp_cli_path " /node_modules/create-react-app/index.js $*
60
- }
61
-
62
57
# Exit the script with a helpful error message when any error is encountered
63
58
trap ' set +x; handle_error $LINENO $BASH_COMMAND' ERR
64
59
@@ -72,6 +67,12 @@ set -x
72
67
cd ..
73
68
root_path=$PWD
74
69
70
+ if hash npm 2> /dev/null
71
+ then
72
+ npm i -g npm@latest
73
+ npm cache clean || npm cache verify
74
+ fi
75
+
75
76
# Prevent bootstrap, we only want top-level dependencies
76
77
cp package.json package.json.bak
77
78
grep -v " postinstall" package.json > temp && mv temp package.json
@@ -86,23 +87,32 @@ yarn run build:prod
86
87
cd ../..
87
88
88
89
# ******************************************************************************
89
- # First, pack and install create-react-app .
90
+ # First, publish the monorepo .
90
91
# ******************************************************************************
91
92
92
- # Pack CLI
93
- cd " $root_path " /packages/create-react-app
94
- cli_path=$PWD /` npm pack`
93
+ # Start local registry
94
+ tmp_registry_log=` mktemp`
95
+ nohup npx verdaccio@2.7.2 & > $tmp_registry_log &
96
+ # Wait for `verdaccio` to boot
97
+ grep -q ' http address' <( tail -f $tmp_registry_log )
98
+
99
+ # Set registry to local registry
100
+ npm set registry http://localhost:4873
101
+ yarn config set registry http://localhost:4873
102
+
103
+ # Login so we can publish packages
104
+ npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r http://localhost:4873 --quotes
95
105
96
- # Install the CLI in a temporary location
97
- cd " $temp_cli_path "
98
- yarn add " $cli_path "
106
+ # Publish the monorepo
107
+ git clean -f
108
+ ./tasks/release.sh --yes --force-publish= * --skip-git --cd-version=prerelease --exact --npm-tag=latest
99
109
100
110
# ******************************************************************************
101
111
# Test --scripts-version with a version number
102
112
# ******************************************************************************
103
113
104
114
cd " $temp_app_path "
105
- create_react_app --scripts-version=1.0.17 test-app-version-number
115
+ npx create-react-app --scripts-version=1.0.17 test-app-version-number
106
116
cd test-app-version-number
107
117
108
118
# Check corresponding scripts version is installed.
@@ -115,7 +125,7 @@ checkDependencies
115
125
# ******************************************************************************
116
126
117
127
cd " $temp_app_path "
118
- create_react_app --use-npm --scripts-version=1.0.17 test-use-npm-flag
128
+ npx create-react-app --use-npm --scripts-version=1.0.17 test-use-npm-flag
119
129
cd test-use-npm-flag
120
130
121
131
# Check corresponding scripts version is installed.
@@ -129,7 +139,7 @@ checkDependencies
129
139
# ******************************************************************************
130
140
131
141
cd " $temp_app_path "
132
- create_react_app --scripts-version=https://registry.npmjs.org/react-scripts/-/react-scripts-1.0.17.tgz test-app-tarball-url
142
+ npx create-react-app --scripts-version=https://registry.npmjs.org/react-scripts/-/react-scripts-1.0.17.tgz test-app-tarball-url
133
143
cd test-app-tarball-url
134
144
135
145
# Check corresponding scripts version is installed.
@@ -142,7 +152,7 @@ checkDependencies
142
152
# ******************************************************************************
143
153
144
154
cd " $temp_app_path "
145
- create_react_app --scripts-version=react-scripts-fork test-app-fork
155
+ npx create-react-app --scripts-version=react-scripts-fork test-app-fork
146
156
cd test-app-fork
147
157
148
158
# Check corresponding scripts version is installed.
@@ -154,7 +164,7 @@ exists node_modules/react-scripts-fork
154
164
155
165
cd " $temp_app_path "
156
166
# we will install a non-existing package to simulate a failed installataion.
157
- create_react_app --scripts-version=` date +%s` test-app-should-not-exist || true
167
+ npx create-react-app --scripts-version=` date +%s` test-app-should-not-exist || true
158
168
# confirm that the project folder was deleted
159
169
test ! -d test-app-should-not-exist
160
170
@@ -166,7 +176,7 @@ cd "$temp_app_path"
166
176
mkdir test-app-should-remain
167
177
echo ' ## Hello' > ./test-app-should-remain/README.md
168
178
# we will install a non-existing package to simulate a failed installataion.
169
- create_react_app --scripts-version=` date +%s` test-app-should-remain || true
179
+ npx create-react-app --scripts-version=` date +%s` test-app-should-remain || true
170
180
# confirm the file exist
171
181
test -e test-app-should-remain/README.md
172
182
# confirm only README.md is the only file in the directory
180
190
181
191
cd $temp_app_path
182
192
curl " https://registry.npmjs.org/@enoah_netzach/react-scripts/-/react-scripts-0.9.0.tgz" -o enoah-scripts-0.9.0.tgz
183
- create_react_app --scripts-version=$temp_app_path /enoah-scripts-0.9.0.tgz test-app-scoped-fork-tgz
193
+ npx create-react-app --scripts-version=$temp_app_path /enoah-scripts-0.9.0.tgz test-app-scoped-fork-tgz
184
194
cd test-app-scoped-fork-tgz
185
195
186
196
# Check corresponding scripts version is installed.
@@ -195,20 +205,20 @@ cd "$temp_app_path"
195
205
mkdir test-app-nested-paths-t1
196
206
cd test-app-nested-paths-t1
197
207
mkdir -p test-app-nested-paths-t1/aa/bb/cc/dd
198
- create_react_app test-app-nested-paths-t1/aa/bb/cc/dd
208
+ npx create-react-app test-app-nested-paths-t1/aa/bb/cc/dd
199
209
cd test-app-nested-paths-t1/aa/bb/cc/dd
200
210
yarn start --smoke-test
201
211
202
212
# Testing a path that does not exist
203
213
cd " $temp_app_path "
204
- create_react_app test-app-nested-paths-t2/aa/bb/cc/dd
214
+ npx create-react-app test-app-nested-paths-t2/aa/bb/cc/dd
205
215
cd test-app-nested-paths-t2/aa/bb/cc/dd
206
216
yarn start --smoke-test
207
217
208
218
# Testing a path that is half exists
209
219
cd " $temp_app_path "
210
220
mkdir -p test-app-nested-paths-t3/aa
211
- create_react_app test-app-nested-paths-t3/aa/bb/cc/dd
221
+ npx create-react-app test-app-nested-paths-t3/aa/bb/cc/dd
212
222
cd test-app-nested-paths-t3/aa/bb/cc/dd
213
223
yarn start --smoke-test
214
224
0 commit comments