forked from facebook/create-react-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal-registry.sh
30 lines (25 loc) · 1.01 KB
/
local-registry.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
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.5.1
function startLocalRegistry {
# Start local registry
tmp_registry_log=`mktemp`
echo "Registry output file: $tmp_registry_log"
(cd && nohup npx ${VERDACCIO_PACKAGE:-$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"
}
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"
}
function publishToLocalRegistry {
git clean -df
./tasks/publish.sh prerelease --yes --force-publish=* --no-git-tag-version --no-commit-hooks --no-push --exact --dist-tag=latest
}