35 lines
1.3 KiB
PowerShell
35 lines
1.3 KiB
PowerShell
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Position=0)]
|
|
[ValidateSet("public", "artifactory")]
|
|
[string]$RegistryType = "public"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
switch ($RegistryType) {
|
|
"public" {
|
|
Write-Host "Switching to public npm registry..." -ForegroundColor Yellow
|
|
Copy-Item ".npmrc.public" ".npmrc" -Force
|
|
Write-Host "[OK] Now using registry.npmjs.org" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "To install dependencies:" -ForegroundColor White
|
|
Write-Host " npm ci --force" -ForegroundColor Cyan
|
|
}
|
|
"artifactory" {
|
|
Write-Host "Switching to Artifactory registry..." -ForegroundColor Yellow
|
|
Copy-Item ".npmrc.artifactory" ".npmrc" -Force
|
|
Write-Host "[OK] Now using Artifactory registry" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "Make sure to set environment variables if authentication is required:" -ForegroundColor White
|
|
Write-Host ' $env:ARTIFACTORY_AUTH_TOKEN = "your_token"' -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "To install dependencies:" -ForegroundColor White
|
|
Write-Host " npm ci --force" -ForegroundColor Cyan
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Current .npmrc contents:" -ForegroundColor White
|
|
Get-Content ".npmrc"
|