43 lines
1022 B
Bash
43 lines
1022 B
Bash
#!/bin/bash
|
|
|
|
# Script to switch between npm registries
|
|
# Usage: ./switch-registry.sh [public|artifactory]
|
|
|
|
set -e
|
|
|
|
REGISTRY_TYPE=${1:-public}
|
|
|
|
case $REGISTRY_TYPE in
|
|
public)
|
|
echo "Switching to public npm registry..."
|
|
cp .npmrc.public .npmrc
|
|
echo "✓ Now using registry.npmjs.org"
|
|
echo ""
|
|
echo "To install dependencies:"
|
|
echo " npm ci --force"
|
|
;;
|
|
artifactory)
|
|
echo "Switching to Artifactory registry..."
|
|
cp .npmrc.artifactory .npmrc
|
|
echo "✓ Now using Artifactory registry"
|
|
echo ""
|
|
echo "Make sure to set environment variables if authentication is required:"
|
|
echo " export ARTIFACTORY_AUTH_TOKEN=your_token"
|
|
echo ""
|
|
echo "To install dependencies:"
|
|
echo " npm ci --force"
|
|
;;
|
|
*)
|
|
echo "Usage: $0 [public|artifactory]"
|
|
echo ""
|
|
echo "Options:"
|
|
echo " public - Use registry.npmjs.org (default)"
|
|
echo " artifactory - Use Artifactory npm registry"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
echo ""
|
|
echo "Current .npmrc contents:"
|
|
cat .npmrc
|