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
24
+ rm -rf " $temp_app_path "
26
25
}
27
26
28
27
# Error messages are redirected to stderr
@@ -39,30 +38,6 @@ function handle_exit {
39
38
exit
40
39
}
41
40
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
41
# Check for the existence of one or more files.
67
42
function exists {
68
43
for f in $* ; do
@@ -96,12 +71,31 @@ if [ "$EXPECTED" != "$ACTUAL" ]; then
96
71
exit 1
97
72
fi
98
73
74
+ if hash npm 2> /dev/null
75
+ then
76
+ npm i -g npm@latest
77
+ npm cache clean || npm cache verify
78
+ fi
79
+
99
80
# Prevent bootstrap, we only want top-level dependencies
100
81
cp package.json package.json.bak
101
82
grep -v " postinstall" package.json > temp && mv temp package.json
102
83
yarn
103
84
mv package.json.bak package.json
104
85
86
+ # Start local registry
87
+ tmp_registry_log=` mktemp`
88
+ nohup npx verdaccio@2.7.2 & > $tmp_registry_log &
89
+ # Wait for `verdaccio` to boot
90
+ grep -q ' http address' <( tail -f $tmp_registry_log )
91
+
92
+ # Set registry to local registry
93
+ npm set registry http://localhost:4873
94
+ yarn config set registry http://localhost:4873
95
+
96
+ # Login so we can publish packages
97
+ npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r http://localhost:4873 --quotes
98
+
105
99
# We removed the postinstall, so do it manually here
106
100
node bootstrap.js
107
101
@@ -142,48 +136,18 @@ CI=true yarn test
142
136
# Test local start command
143
137
yarn start --smoke-test
144
138
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
139
+ git clean -f
140
+ ./tasks/release.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest
169
141
170
142
# ******************************************************************************
171
- # Now that we have packed them, create a clean app folder and install them .
143
+ # Install react-scripts prerelease via create-react- app prerelease .
172
144
# ******************************************************************************
173
145
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 "
183
-
184
146
# Install the app in a temporary location
185
147
cd $temp_app_path
186
- create_react_app --scripts-version=" $scripts_path " test-app
148
+ npx create-react-app test-app
149
+
150
+ # TODO: verify we installed prerelease
187
151
188
152
# ******************************************************************************
189
153
# Now that we used create-react-app to create an app depending on react-scripts,
@@ -291,11 +255,6 @@ verify_module_scope
291
255
# Eject...
292
256
echo yes | npm run eject
293
257
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
258
# Test the build
300
259
yarn build
301
260
# Check for expected output
0 commit comments