8000 ci: running some test cases with a local registry to better reflect real-world use cases by haoqunjiang · Pull Request #4193 · vuejs/vue-cli · GitHub
[go: up one dir, main page]

Skip to content

ci: running some test cases with a local registry to better reflect real-world use cases #4193

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

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
ci: add script for running a local registry with verdaccio
  • Loading branch information
haoqunjiang committed Jun 24, 2019
commit 6f0b8971eba7435c1994ef6fbbef51be8fe0edd4
38 changes: 38 additions & 0 deletions scripts/local-registry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# adapted from https://github.com/facebook/create-react-app/blob/master/tasks/local-registry.sh

custom_registry_url=http://localhost:4873
original_npm_registry_url=`npm get registry`
original_yarn_registry_url=`yarn config get registry`
default_verdaccio_package=verdaccio@4

function startLocalRegistry {
# Start local registry
tmp_registry_log=`mktemp`
echo "Registry output file: $tmp_registry_log"
(cd && nohup npx $default_verdaccio_package -c $1 &>$tmp_registry_log &)
# Wait for Verdaccio to boot
grep -q 'http address' <(tail -f $tmp_registry_log)

# Set registry to local registry
npm set registry "$custom_registry_url"
yarn config set registry "$custom_registry_url"

# Login so we can publish packages
(cd && npx npm-auth-to-token@1 -u user -p password -e user@example.com -r "$custom_registry_url")
}

function stopLocalRegistry {
# Restore the original NPM and Yarn registry URLs and stop Verdaccio
npm set registry "$original_npm_registry_url"
yarn config set registry "$original_yarn_registry_url"

# Kill Verdaccio process
ps -ef | grep 'verdaccio' | grep -v grep | awk '{print $2}' | xargs kill -9
}

function publishToLocalRegistry {
git clean -df
yarn release --local-registry
}
0