mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-01-12 22:46:30 +08:00
clean up changes to npm and yarn registry (#3756)
This commit is contained in:
committed by
Dan Abramov
parent
4c0bf037d1
commit
b02fe66732
@@ -15,11 +15,16 @@ cd "$(dirname "$0")"
|
||||
# CLI and app temporary locations
|
||||
# http://unix.stackexchange.com/a/84980
|
||||
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
|
||||
custom_registry_url=http://localhost:4873
|
||||
original_npm_registry_url=`npm get registry`
|
||||
original_yarn_registry_url=`yarn config get registry`
|
||||
|
||||
function cleanup {
|
||||
echo 'Cleaning up.'
|
||||
cd "$root_path"
|
||||
rm -rf "$temp_app_path"
|
||||
npm set registry "$original_npm_registry_url"
|
||||
yarn config set registry "$original_yarn_registry_url"
|
||||
}
|
||||
|
||||
# Error messages are redirected to stderr
|
||||
@@ -87,11 +92,11 @@ nohup npx verdaccio@2.7.2 &>$tmp_registry_log &
|
||||
grep -q 'http address' <(tail -f $tmp_registry_log)
|
||||
|
||||
# Set registry to local registry
|
||||
npm set registry http://localhost:4873
|
||||
yarn config set registry http://localhost:4873
|
||||
npm set registry "$custom_registry_url"
|
||||
yarn config set registry "$custom_registry_url"
|
||||
|
||||
# Login so we can publish packages
|
||||
npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r http://localhost:4873 --quotes
|
||||
npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r "$custom_registry_url" --quotes
|
||||
|
||||
# Publish the monorepo
|
||||
git clean -f
|
||||
|
||||
@@ -16,6 +16,9 @@ cd "$(dirname "$0")"
|
||||
# http://unix.stackexchange.com/a/84980
|
||||
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
|
||||
temp_module_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_module_path'`
|
||||
custom_registry_url=http://localhost:4873
|
||||
original_npm_registry_url=`npm get registry`
|
||||
original_yarn_registry_url=`yarn config get registry`
|
||||
|
||||
function cleanup {
|
||||
echo 'Cleaning up.'
|
||||
@@ -23,6 +26,8 @@ function cleanup {
|
||||
cd "$root_path"
|
||||
# TODO: fix "Device or resource busy" and remove ``|| $CI`
|
||||
rm -rf "$temp_app_path" "$temp_module_path" || $CI
|
||||
npm set registry "$original_npm_registry_url"
|
||||
yarn config set registry "$original_yarn_registry_url"
|
||||
}
|
||||
|
||||
# Error messages are redirected to stderr
|
||||
@@ -79,11 +84,11 @@ nohup npx verdaccio@2.7.2 &>$tmp_registry_log &
|
||||
grep -q 'http address' <(tail -f $tmp_registry_log)
|
||||
|
||||
# Set registry to local registry
|
||||
npm set registry http://localhost:4873
|
||||
yarn config set registry http://localhost:4873
|
||||
npm set registry "$custom_registry_url"
|
||||
yarn config set registry "$custom_registry_url"
|
||||
|
||||
# Login so we can publish packages
|
||||
npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r http://localhost:4873 --quotes
|
||||
npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r "$custom_registry_url" --quotes
|
||||
|
||||
# Publish the monorepo
|
||||
git clean -f
|
||||
|
||||
@@ -15,6 +15,9 @@ cd "$(dirname "$0")"
|
||||
# App temporary location
|
||||
# http://unix.stackexchange.com/a/84980
|
||||
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
|
||||
custom_registry_url=http://localhost:4873
|
||||
original_npm_registry_url=`npm get registry`
|
||||
original_yarn_registry_url=`yarn config get registry`
|
||||
|
||||
function cleanup {
|
||||
echo 'Cleaning up.'
|
||||
@@ -22,6 +25,8 @@ function cleanup {
|
||||
# Uncomment when snapshot testing is enabled by default:
|
||||
# rm ./packages/react-scripts/template/src/__snapshots__/App.test.js.snap
|
||||
rm -rf "$temp_app_path"
|
||||
npm set registry "$original_npm_registry_url"
|
||||
yarn config set registry "$original_yarn_registry_url"
|
||||
}
|
||||
|
||||
# Error messages are redirected to stderr
|
||||
@@ -87,11 +92,11 @@ nohup npx verdaccio@2.7.2 &>$tmp_registry_log &
|
||||
grep -q 'http address' <(tail -f $tmp_registry_log)
|
||||
|
||||
# Set registry to local registry
|
||||
npm set registry http://localhost:4873
|
||||
yarn config set registry http://localhost:4873
|
||||
npm set registry "$custom_registry_url"
|
||||
yarn config set registry "$custom_registry_url"
|
||||
|
||||
# Login so we can publish packages
|
||||
npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r http://localhost:4873 --quotes
|
||||
npx npm-cli-login@0.0.10 -u user -p password -e user@example.com -r "$custom_registry_url" --quotes
|
||||
|
||||
# Lint own code
|
||||
./node_modules/.bin/eslint --max-warnings 0 packages/babel-preset-react-app/
|
||||
|
||||
Reference in New Issue
Block a user