Skip to content

Commit b02fe66

Browse files
viankakrisnagaearon
authored andcommitted
clean up changes to npm and yarn registry (#3756)
1 parent 4c0bf03 commit b02fe66

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

tasks/e2e-installs.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@ cd "$(dirname "$0")"
1515
# CLI and app temporary locations
1616
# http://unix.stackexchange.com/a/84980
1717
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
18+
custom_registry_url=http://localhost:4873
19+
original_npm_registry_url=`npm get registry`
20+
original_yarn_registry_url=`yarn config get registry`
1821

1922
function cleanup {
2023
echo 'Cleaning up.'
2124
cd "$root_path"
2225
rm -rf "$temp_app_path"
26+
npm set registry "$original_npm_registry_url"
27+
yarn config set registry "$original_yarn_registry_url"
2328
}
2429

2530
# Error messages are redirected to stderr
@@ -87,11 +92,11 @@ nohup npx verdaccio@2.7.2 &>$tmp_registry_log &
8792
grep -q 'http address' <(tail -f $tmp_registry_log)
8893

8994
# Set registry to local registry
90-
npm set registry http://localhost:4873
91-
yarn config set registry http://localhost:4873
95+
npm set registry "$custom_registry_url"
96+
yarn config set registry "$custom_registry_url"
9297

9398
# Login so we can publish packages
94-
npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r http://localhost:4873 --quotes
99+
npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r "$custom_registry_url" --quotes
95100

96101
# Publish the monorepo
97102
git clean -f

tasks/e2e-kitchensink.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ cd "$(dirname "$0")"
1616
# http://unix.stackexchange.com/a/84980
1717
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
1818
temp_module_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_module_path'`
19+
custom_registry_url=http://localhost:4873
20+
original_npm_registry_url=`npm get registry`
21+
original_yarn_registry_url=`yarn config get registry`
1922

2023
function cleanup {
2124
echo 'Cleaning up.'
2225
ps -ef | grep 'react-scripts' | grep -v grep | awk '{print $2}' | xargs kill -9
2326
cd "$root_path"
2427
# TODO: fix "Device or resource busy" and remove ``|| $CI`
2528
rm -rf "$temp_app_path" "$temp_module_path" || $CI
29+
npm set registry "$original_npm_registry_url"
30+
yarn config set registry "$original_yarn_registry_url"
2631
}
2732

2833
# Error messages are redirected to stderr
@@ -79,11 +84,11 @@ nohup npx verdaccio@2.7.2 &>$tmp_registry_log &
7984
grep -q 'http address' <(tail -f $tmp_registry_log)
8085

8186
# Set registry to local registry
82-
npm set registry http://localhost:4873
83-
yarn config set registry http://localhost:4873
87+
npm set registry "$custom_registry_url"
88+
yarn config set registry "$custom_registry_url"
8489

8590
# Login so we can publish packages
86-
npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r http://localhost:4873 --quotes
91+
npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r "$custom_registry_url" --quotes
8792

8893
# Publish the monorepo
8994
git clean -f

tasks/e2e-simple.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ cd "$(dirname "$0")"
1515
# App temporary location
1616
# http://unix.stackexchange.com/a/84980
1717
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
18+
custom_registry_url=http://localhost:4873
19+
original_npm_registry_url=`npm get registry`
20+
original_yarn_registry_url=`yarn config get registry`
1821

1922
function cleanup {
2023
echo 'Cleaning up.'
2124
cd "$root_path"
2225
# Uncomment when snapshot testing is enabled by default:
2326
# rm ./packages/react-scripts/template/src/__snapshots__/App.test.js.snap
2427
rm -rf "$temp_app_path"
28+
npm set registry "$original_npm_registry_url"
29+
yarn config set registry "$original_yarn_registry_url"
2530
}
2631

2732
# Error messages are redirected to stderr
@@ -87,11 +92,11 @@ nohup npx verdaccio@2.7.2 &>$tmp_registry_log &
8792
grep -q 'http address' <(tail -f $tmp_registry_log)
8893

8994
# Set registry to local registry
90-
npm set registry http://localhost:4873
91-
yarn config set registry http://localhost:4873
95+
npm set registry "$custom_registry_url"
96+
yarn config set registry "$custom_registry_url"
9297

9398
# Login so we can publish packages
94-
npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r http://localhost:4873 --quotes
99+
npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r "$custom_registry_url" --quotes
95100

96101
# Lint own code
97102
./node_modules/.bin/eslint --max-warnings 0 packages/babel-preset-react-app/

0 commit comments

Comments
 (0)