Skip to content

Commit

Permalink
feat(repo): improve local-registry publishing (#2979)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz committed May 11, 2020
1 parent c00f996 commit 89e8379
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 10 deletions.
39 changes: 39 additions & 0 deletions .verdaccio/config.yml
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions .verdaccio/htpasswd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test:$6FrCaT/v0dwE:autocreated 2020-03-25T19:10:50.254Z
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -272,4 +272,4 @@
"pre-push": "yarn checkcommit && yarn documentation && yarn checkformat"
}
}
}
}
15 changes: 10 additions & 5 deletions scripts/local-registry.sh
Original file line number Diff line number Diff line change
@@ -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`
Expand All @@ -20,7 +20,12 @@ if [[ $ENABLE == "disable" ]]; then
echo " > YARN: $CURRENT_YARN_REIGSTRY"
fi

if [[ $ENABLE == "start" ]]; then
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
npx verdaccio --config ./.verdaccio/config.yml
fi
7 changes: 4 additions & 3 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/*/
Expand Down

0 comments on commit 89e8379

Please sign in to comment.