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",
"version": "9.2.3",
"version": "9.4.0",
"description": "Extensible Dev Tools for Monorepos",
"homepage": "https://nx.dev",
"main": "index.js",
@ -272,4 +272,4 @@
"pre-push": "yarn checkcommit && yarn documentation && yarn checkformat"
}
}
}
}

View File

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

View File

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