Skip to content

Commit

Permalink
clean up changes to npm and yarn registry (#3756)
Browse files Browse the repository at this point in the history
  • Loading branch information
viankakrisna authored and gaearon committed Jan 11, 2018
1 parent 4c0bf03 commit b02fe66
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
11 changes: 8 additions & 3 deletions tasks/e2e-installs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions tasks/e2e-kitchensink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ 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.'
ps -ef | grep 'react-scripts' | grep -v grep | awk '{print $2}' | xargs kill -9
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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions tasks/e2e-simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@ 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.'
cd "$root_path"
# 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
Expand Down Expand Up @@ -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/
Expand Down

0 comments on commit b02fe66

Please sign in to comment.