Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[e2e] clean up changes to npm and yarn registry #3756

Merged
merged 1 commit into from
Jan 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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