1212# Start in tasks/ even if run from root directory
1313cd " $( dirname " $0 " ) "
1414
15- # CLI and app temporary locations
15+ # App temporary location
1616# http://unix.stackexchange.com/a/84980
17- temp_cli_path=` mktemp -d 2> /dev/null || mktemp -d -t ' temp_cli_path' `
1817temp_app_path=` mktemp -d 2> /dev/null || mktemp -d -t ' temp_app_path' `
1918
2019function cleanup {
2120 echo ' Cleaning up.'
2221 cd " $root_path "
2322 # Uncomment when snapshot testing is enabled by default:
2423 # 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 "
2625}
2726
2827# Error messages are redirected to stderr
@@ -39,30 +38,6 @@ function handle_exit {
3938 exit
4039}
4140
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-
6641# Check for the existence of one or more files.
6742function exists {
6843 for f in $* ; do
@@ -96,12 +71,31 @@ if [ "$EXPECTED" != "$ACTUAL" ]; then
9671 exit 1
9772fi
9873
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+
9980# Prevent bootstrap, we only want top-level dependencies
10081cp package.json package.json.bak
10182grep -v " postinstall" package.json > temp && mv temp package.json
10283yarn
10384mv package.json.bak package.json
10485
86+ # Start local registry
87+ tmp_registry_log=` mktemp`
88+ nohup npx
[email protected] & > $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
[email protected] -u user -p password -e
[email protected] -r http://localhost:4873 --quotes
98+
10599# We removed the postinstall, so do it manually here
106100node bootstrap.js
107101
@@ -142,48 +136,18 @@ CI=true yarn test
142136# Test local start command
143137yarn start --smoke-test
144138
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
169141
170142# ******************************************************************************
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 .
172144# ******************************************************************************
173145
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-
184146# Install the app in a temporary location
185147cd $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
187151
188152# ******************************************************************************
189153# Now that we used create-react-app to create an app depending on react-scripts,
@@ -291,11 +255,6 @@ verify_module_scope
291255# Eject...
292256echo yes | npm run eject
293257
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-
299258# Test the build
300259yarn build
301260# Check for expected output
0 commit comments