@@ -14,7 +14,6 @@ cd "$(dirname "$0")"
14
14
15
15
# CLI, app, and test module 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
temp_module_path=` mktemp -d 2> /dev/null || mktemp -d -t ' temp_module_path' `
20
19
@@ -23,7 +22,7 @@ function cleanup {
23
22
ps -ef | grep ' react-scripts' | grep -v grep | awk ' {print $2}' | xargs kill -9
24
23
cd " $root_path "
25
24
# TODO: fix "Device or resource busy" and remove ``|| $CI`
26
- rm -rf " $temp_cli_path " " $ temp_app_path" " $temp_module_path " || $CI
25
+ rm -rf " $temp_app_path " " $temp_module_path " || $CI
27
26
}
28
27
29
28
# Error messages are redirected to stderr
@@ -40,30 +39,6 @@ function handle_exit {
40
39
exit
41
40
}
42
41
43
- function create_react_app {
44
- node " $temp_cli_path " /node_modules/create-react-app/index.js " $@ "
45
- }
46
-
47
- function install_package {
48
- local pkg=$( basename $1 )
49
-
50
- # Clean target (for safety)
51
- rm -rf node_modules/$pkg /
52
- rm -rf node_modules/** /$pkg /
53
-
54
- # Copy package into node_modules/ ignoring installed deps
55
- # rsync -a ${1%/} node_modules/ --exclude node_modules
56
- cp -R ${1%/ } node_modules/
57
- rm -rf node_modules/$pkg /node_modules/
58
-
59
- # Install `dependencies`
60
- cd node_modules/$pkg /
61
- yarn --production
62
- # Remove our packages to ensure side-by-side versions are used (which we link)
63
- rm -rf node_modules/{babel-preset-react-app,eslint-config-react-app,react-dev-utils,react-error-overlay,react-scripts}
64
- cd ../..
65
- }
66
-
67
42
# Check for the existence of one or more files.
68
43
function exists {
69
44
for f in $* ; do
@@ -98,41 +73,33 @@ yarn build:prod
98
73
cd ../..
99
74
100
75
# ******************************************************************************
101
- # First, pack react-scripts and create-react-app so we can use them .
76
+ # First, publish the monorepo .
102
77
# ******************************************************************************
103
78
104
- # Pack CLI
105
- cd " $root_path " /packages/create-react-app
106
- cli_path=$PWD /` npm pack`
107
-
108
- # Go to react-scripts
109
- cd " $root_path " /packages/react-scripts
110
-
111
- # Save package.json because we're going to touch it
112
- cp package.json package.json.orig
79
+ # Start local registry
80
+ tmp_registry_log=` mktemp`
81
+ nohup npx
[email protected] & > $tmp_registry_log &
82
+ # Wait for `verdaccio` to boot
83
+ grep -q ' http address' <( tail -f $tmp_registry_log )
113
84
114
- # Replace own dependencies (those in the `packages` dir) with the local paths
115
- # of those packages.
116
- node " $root_path " /tasks/replace-own-deps.js
85
+ # Set registry to local registry
86
+ npm set registry http://localhost:4873
87
+ yarn config set registry http://localhost:4873
117
88
118
- # Finally, pack react-scripts
119
- scripts_path= " $root_path " /packages/react-scripts/ ` npm pack `
89
+ # Login so we can publish packages
90
+ npx [email protected] -u user -p password -e [email protected] -r http://localhost:4873 --quotes
120
91
121
- # Restore package.json
122
- rm package.json
123
- mv package.json.orig package.json
92
+ # Publish the monorepo
93
+ git clean -f
94
+ ./tasks/release.sh --yes --force-publish= * --skip-git --cd-version=prerelease --exact --npm-tag=latest
124
95
125
96
# ******************************************************************************
126
- # Now that we have packed them, create a clean app folder and install them.
97
+ # Now that we have published them, create a clean app folder and install them.
127
98
# ******************************************************************************
128
99
129
- # Install the CLI in a temporary location
130
- cd " $temp_cli_path "
131
- yarn add " $cli_path "
132
-
133
100
# Install the app in a temporary location
134
101
cd $temp_app_path
135
- create_react_app --scripts-version= " $scripts_path " --internal-testing-template=" $root_path " /packages/react-scripts/fixtures/kitchensink test-kitchensink
102
+ npx create-react-app --internal-testing-template=" $root_path " /packages/react-scripts/fixtures/kitchensink test-kitchensink
136
103
137
104
# Install the test module
138
105
cd " $temp_module_path "
@@ -146,14 +113,8 @@ yarn add test-integrity@^2.0.1
146
113
# Enter the app directory
147
114
cd " $temp_app_path /test-kitchensink"
148
115
149
- # Link to our preset
150
- install_package " $root_path " /packages/babel-preset-react-app
151
- # Link to error overlay package because now it's a dependency
152
- # of react-dev-utils and not react-scripts
153
- install_package " $root_path " /packages/react-error-overlay
154
-
155
116
# Link to test module
156
- install_package " $temp_module_path /node_modules/test-integrity"
117
+ npm link " $temp_module_path /node_modules/test-integrity"
157
118
158
119
# Test the build
159
120
REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \
@@ -198,16 +159,10 @@ E2E_FILE=./build/index.html \
198
159
# ******************************************************************************
199
160
200
161
# Eject...
201
- echo yes | npm run eject
202
-
203
- # ...but still link to the local packages
204
- install_package " $root_path " /packages/babel-preset-react-app
205
- install_package " $root_path " /packages/eslint-config-react-app
206
- install_package " $root_path " /packages/react-error-overlay
207
- install_package " $root_path " /packages/react-dev-utils
162
+ echo yes | yarn eject
208
163
209
164
# Link to test module
210
- install_package " $temp_module_path /node_modules/test-integrity"
165
+ npm link " $temp_module_path /node_modules/test-integrity"
211
166
212
167
# Test the build
213
168
REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \
0 commit comments