12
12
# Start in tasks/ even if run from root directory
13
13
cd " $( dirname " $0 " ) "
14
14
15
- # CLI and app temporary locations
15
+ # App temporary location
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
22
# Uncomment when snapshot testing is enabled by default:
24
23
# rm ./packages/react-scripts/template/src/__snapshots__/App.test.js.snap
25
- rm -rf " $temp_cli_path " $temp_app_path
26
24
}
27
25
28
26
# Error messages are redirected to stderr
@@ -39,30 +37,6 @@ function handle_exit {
39
37
exit
40
38
}
41
39
42
- function create_react_app {
43
- node " $temp_cli_path " /node_modules/create-react-app/index.js " $@ "
44
- }
45
-
46
- function install_package {
47
- local pkg=$( basename $1 )
48
-
49
- # Clean target (for safety)
50
- rm -rf node_modules/$pkg /
51
- rm -rf node_modules/** /$pkg /
52
-
53
- # Copy package into node_modules/ ignoring installed deps
54
- # rsync -a ${1%/} node_modules/ --exclude node_modules
55
- cp -R ${1%/ } node_modules/
56
- rm -rf node_modules/$pkg /node_modules/
57
-
58
- # Install `dependencies`
59
- cd node_modules/$pkg /
60
- yarn --production
61
- # Remove our packages to ensure side-by-side versions are used (which we link)
62
- rm -rf node_modules/{babel-preset-react-app,eslint-config-react-app,react-dev-utils,react-error-overlay,react-scripts}
63
- cd ../..
64
- }
65
-
66
40
# Check for the existence of one or more files.
67
41
function exists {
68
42
for f in $* ; do
@@ -102,6 +76,21 @@ grep -v "postinstall" package.json > temp && mv temp package.json
102
76
yarn
103
77
mv package.json.bak package.json
104
78
79
+ yarn global add verdaccio
80
+ # Start local registry
81
+ tmp_registry_log=` mktemp`
82
+ nohup verdaccio & > $tmp_registry_log &
83
+ # Wait for `verdaccio` to boot
84
+ grep -q ' http address' <( tail -f $tmp_registry_log )
85
+
86
+ # Set registry to local registry
87
+ npm set registry http://localhost:4873
88
+ yarn config set registry http://localhost:4873
89
+
90
+ # Login so we can publish packages
91
+
92
+ npm-cli-login -u user -p password -e
[email protected] -r http://localhost:4873 --quotes
93
+
105
94
# We removed the postinstall, so do it manually here
106
95
node bootstrap.js
107
96
@@ -142,48 +131,21 @@ CI=true yarn test
142
131
# Test local start command
143
132
yarn start --smoke-test
144
133
145
- # ******************************************************************************
146
- # Next, pack react-scripts and create-react-app so we can verify they work.
147
- # ******************************************************************************
148
-
149
- # Pack CLI
150
- cd " $root_path " /packages/create-react-app
151
- cli_path=$PWD /` npm pack`
152
-
153
- # Go to react-scripts
154
- cd " $root_path " /packages/react-scripts
155
-
156
- # Save package.json because we're going to touch it
157
- cp package.json package.json.orig
158
-
159
- # Replace own dependencies (those in the `packages` dir) with the local paths
160
- # of those packages.
161
- node " $root_path " /tasks/replace-own-deps.js
162
-
163
- # Finally, pack react-scripts
164
- scripts_path=" $root_path " /packages/react-scripts/` npm pack`
165
-
166
- # Restore package.json
167
- rm package.json
168
- mv package.json.orig package.json
134
+ git clean -f
135
+ ./tasks/release.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest
169
136
170
137
# ******************************************************************************
171
- # Now that we have packed them, create a clean app folder and install them .
138
+ # Install react-scripts prerelease via create-react- app prerelease .
172
139
# ******************************************************************************
173
140
174
- # Install the CLI in a temporary location
175
- cd " $temp_cli_path "
176
-
177
- # Initialize package.json before installing the CLI because npm will not install
178
- # the CLI properly in the temporary location if it is missing.
179
- yarn init --yes
180
-
181
- # Now we can install the CLI from the local package.
182
- yarn add " $cli_path "
141
+ # Install latest CLI
142
+ yarn global add create-react-app
183
143
184
144
# Install the app in a temporary location
185
145
cd $temp_app_path
186
- create_react_app --scripts-version=" $scripts_path " test-app
146
+ create-react-app test-app
147
+
148
+ # TODO: verify we installed prerelease
187
149
188
150
# ******************************************************************************
189
151
# Now that we used create-react-app to create an app depending on react-scripts,
@@ -291,11 +253,6 @@ verify_module_scope
291
253
# Eject...
292
254
echo yes | npm run eject
293
255
294
- # ...but still link to the local packages
295
- install_package " $root_path " /packages/babel-preset-react-app
296
- install_package " $root_path " /packages/eslint-config-react-app
297
- install_package " $root_path " /packages/react-dev-utils
298
-
299
256
# Test the build
300
257
yarn build
301
258
# Check for expected output
0 commit comments