Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"lint:inspect": "pnpx @eslint/config-inspector@latest",
"lint:packages": "FORCE_COLOR=1 turbo lint",
"lint:publint": "FORCE_COLOR=1 turbo lint:publint",
"local:registry:down": "./scripts/local-registry.sh down",
"local:registry:pub": "./scripts/local-registry.sh pub",
"local:registry:pub:pkg": "./scripts/local-registry.sh pub:pkg",
"local:registry:up": "./scripts/local-registry.sh up",
"nuke": "node ./scripts/nuke.mjs",
"prepare": "husky install",
"release": "changeset publish && git push --follow-tags",
Expand Down
115 changes: 115 additions & 0 deletions scripts/local-registry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#!/bin/bash

# Local Verdaccio Registry Script
# Usage: ./scripts/local-registry.sh [up|down|pub|pub:pkg <filter>]

set -e

REGISTRY_URL="http://localhost:4873"

case "$1" in
up)
echo ""
echo "📦 Local Verdaccio Registry"
echo "==========================="
echo "Registry running at: $REGISTRY_URL"
echo ""
echo "To install packages in your test app:"
echo " 1. Update package.json catalog: \"@clerk/backend\": \"local\""
echo " 2. Run: bun install --registry $REGISTRY_URL"
echo ""
echo "To stop: pnpm local:registry:down"
echo ""
verdaccio --config verdaccio.install.yaml --listen 4873
;;

down)
pkill -f 'verdaccio.*4873' && echo "Verdaccio stopped" || echo "Verdaccio not running"
;;

pub)
# Disable changelog (requires GitHub token)
pnpm dlx json -I -f .changeset/config.json -e 'this.changelog = false'

# Version packages with snapshot
pnpm changeset version --snapshot local

# Restore changeset config
git checkout HEAD -- .changeset/config.json

# Build all packages
pnpm build

# Set npm registry to local Verdaccio
npm config set registry $REGISTRY_URL
npm config set //${REGISTRY_URL#http://}/:_authToken localToken

# Publish to Verdaccio
npm_config_registry=$REGISTRY_URL pnpm changeset publish --no-git-tag --tag local

# Reset npm registry
npm config set registry https://registry.npmjs.org

# Reset git changes
git checkout -- 'packages/*/package.json' '.changeset/'

echo ""
echo "✅ Published to local Verdaccio"
echo " Install with: bun install --registry $REGISTRY_URL"
;;

pub:pkg)
if [ -z "$2" ]; then
echo "Error: Package filter required"
echo "Usage: $0 pub:pkg <filter>"
echo "Example: $0 pub:pkg @clerk/backend"
exit 1
fi

FILTER="$2"

# Disable changelog (requires GitHub token)
pnpm dlx json -I -f .changeset/config.json -e 'this.changelog = false'

# Version packages with snapshot
pnpm changeset version --snapshot local

# Restore changeset config
git checkout HEAD -- .changeset/config.json

# Build only the specified package (and its dependencies)
pnpm build --filter "$FILTER"

# Set npm registry to local Verdaccio
npm config set registry $REGISTRY_URL
npm config set //${REGISTRY_URL#http://}/:_authToken localToken

# Publish only the specified package
pnpm --filter "$FILTER" exec npm publish --registry $REGISTRY_URL --tag local

# Reset npm registry
npm config set registry https://registry.npmjs.org

# Reset git changes
git checkout -- 'packages/*/package.json' '.changeset/'

echo ""
echo "✅ Published $FILTER to local Verdaccio"
echo " Install with: bun install --registry $REGISTRY_URL"
;;

*)
echo "Usage: $0 [up|down|pub|pub:pkg <filter>]"
echo ""
echo " up - Start Verdaccio registry"
echo " down - Stop Verdaccio registry"
echo " pub - Build and publish all packages"
echo " pub:pkg <pkg> - Build and publish a single package"
echo ""
echo "Examples:"
echo " $0 up"
echo " $0 pub"
echo " $0 pub:pkg @clerk/backend"
exit 1
;;
esac
Loading