feat(repo): improve local-registry publishing (#2979)

This commit is contained in:
Jason Jean 2020-05-11 01:22:17 -04:00 committed by GitHub
parent c00f996bea
commit 89e8379f8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 11 deletions

39
.verdaccio/config.yml Normal file
View File

@ -0,0 +1,39 @@
# path to a directory with all packages
storage: ./build/local-registry/storage
auth:
htpasswd:
file: ./htpasswd
# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
cache: true
yarn:
url: https://registry.yarnpkg.com
cache: true
packages:
'@*/*':
# scoped packages
access: $all
publish: $all
unpublish: $all
proxy: npmjs
'**':
# allow all users (including non-authenticated users) to read and
# publish all packages
access: $all
# allow all users (including non-authenticated users) to publish/publish packages
publish: $all
unpublish: $all
# if package is not available locally, proxy requests to 'yarn' registry
proxy: npmjs
# log settings
logs:
- { type: stdout, format: pretty, level: http }

1
.verdaccio/htpasswd Normal file
View File

@ -0,0 +1 @@
test:$6FrCaT/v0dwE:autocreated 2020-03-25T19:10:50.254Z

View File

@ -1,6 +1,6 @@
{ {
"name": "@nrwl/nx-source", "name": "@nrwl/nx-source",
"version": "9.2.3", "version": "9.4.0",
"description": "Extensible Dev Tools for Monorepos", "description": "Extensible Dev Tools for Monorepos",
"homepage": "https://nx.dev", "homepage": "https://nx.dev",
"main": "index.js", "main": "index.js",

View File

@ -1,15 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
ENABLE=$1 COMMAND=$1
if [[ $ENABLE == "enable" ]]; then if [[ $COMMAND == "enable" ]]; then
echo "Setting registry to local registry" echo "Setting registry to local registry"
echo "To Disable: yarn local-registry disable" echo "To Disable: yarn local-registry disable"
npm config set registry http://localhost:4873/ npm config set registry http://localhost:4873/
yarn config set registry http://localhost:4873/ yarn config set registry http://localhost:4873/
fi fi
if [[ $ENABLE == "disable" ]]; then if [[ $COMMAND == "disable" ]]; then
npm config delete registry npm config delete registry
yarn config delete registry yarn config delete registry
CURRENT_NPM_REGISTRY=`npm config get registry` CURRENT_NPM_REGISTRY=`npm config get registry`
@ -20,7 +20,12 @@ if [[ $ENABLE == "disable" ]]; then
echo " > YARN: $CURRENT_YARN_REIGSTRY" echo " > YARN: $CURRENT_YARN_REIGSTRY"
fi fi
if [[ $ENABLE == "start" ]]; then if [[ $COMMAND == "clear" ]]; then
echo "Starting Local Registry" echo "Clearing Local Registry"
npx verdaccio rm -rf ./build/local-registry/storage
fi
if [[ $COMMAND == "start" ]]; then
echo "Starting Local Registry"
npx verdaccio --config ./.verdaccio/config.yml
fi fi

View File

@ -9,9 +9,7 @@ LOCALBUILD=$3
PACKAGE_SOURCE=build/packages PACKAGE_SOURCE=build/packages
NPM_DEST=build/npm NPM_DEST=build/npm
ORIG_DIRECTORY=`pwd` ORIG_DIRECTORY=`pwd`
NPM_REGISTRY=`npm config get registry` # for local releases
# We are running inside of a child_process, so we need to reauth
npm adduser
if [ "$LOCALBUILD" = "--local" ]; then if [ "$LOCALBUILD" = "--local" ]; then
echo echo
@ -31,6 +29,9 @@ if [ "$LOCALBUILD" = "--local" ]; then
fi fi
else else
echo "Publishing to public npm" echo "Publishing to public npm"
# We are running inside of a child_process, so we need to reauth
npm adduser
fi fi
for package in $NPM_DEST/*/ for package in $NPM_DEST/*/