revert npm logic
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[switch]$Rebuild,
|
||||
[switch]$Bsf,
|
||||
[switch]$Help
|
||||
)
|
||||
|
||||
@@ -16,11 +15,11 @@ if ($Help) {
|
||||
Write-Host ""
|
||||
Write-Host "Options:" -ForegroundColor Yellow
|
||||
Write-Host " -Rebuild Force rebuild of all containers" -ForegroundColor White
|
||||
Write-Host " -Bsf Use Artifactory npm registry instead of public npm" -ForegroundColor White
|
||||
Write-Host " -Help Show this help message" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "Environment Variables (when using -Bsf):" -ForegroundColor Yellow
|
||||
Write-Host ' $env:ARTIFACTORY_AUTH_TOKEN Authentication token for Artifactory' -ForegroundColor White
|
||||
Write-Host "NPM Registry:" -ForegroundColor Yellow
|
||||
Write-Host " Create frontend/.npmrc to configure custom npm registry" -ForegroundColor White
|
||||
Write-Host " The Docker build will use this file if present" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "Brings up the complete stack: database, backend API, and frontend" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
@@ -32,26 +31,24 @@ Write-Host "Obsidian - Quick Start" -ForegroundColor Cyan
|
||||
Write-Host "=========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Determine npm registry and build arguments
|
||||
$NpmRegistry = "public"
|
||||
$BuildArgs = @()
|
||||
# Copy user's .npmrc to frontend directory if it exists and frontend/.npmrc doesn't
|
||||
$UserNpmrc = Join-Path $env:USERPROFILE ".npmrc"
|
||||
$FrontendNpmrc = "frontend\.npmrc"
|
||||
|
||||
if ($Bsf) {
|
||||
$NpmRegistry = "artifactory"
|
||||
$BuildArgs += "--build-arg"
|
||||
$BuildArgs += "NPM_REGISTRY=artifactory"
|
||||
|
||||
Write-Host "Using Artifactory npm registry" -ForegroundColor Yellow
|
||||
|
||||
if ($env:ARTIFACTORY_AUTH_TOKEN) {
|
||||
Write-Host "[OK] Artifactory auth token detected" -ForegroundColor Green
|
||||
$BuildArgs += "--build-arg"
|
||||
$BuildArgs += "ARTIFACTORY_AUTH_TOKEN=$env:ARTIFACTORY_AUTH_TOKEN"
|
||||
if (Test-Path $UserNpmrc) {
|
||||
if (-not (Test-Path $FrontendNpmrc)) {
|
||||
Write-Host "[INFO] Copying npm registry config from $UserNpmrc" -ForegroundColor Yellow
|
||||
Copy-Item $UserNpmrc $FrontendNpmrc
|
||||
Write-Host "[OK] Using custom npm registry configuration" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "[WARNING] ARTIFACTORY_AUTH_TOKEN not set (may be required for authentication)" -ForegroundColor Yellow
|
||||
Write-Host "[OK] Using existing frontend\.npmrc" -ForegroundColor Green
|
||||
}
|
||||
} else {
|
||||
Write-Host "Using public npm registry (registry.npmjs.org)" -ForegroundColor Green
|
||||
if (Test-Path $FrontendNpmrc) {
|
||||
Write-Host "[OK] Using frontend\.npmrc" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "[INFO] Using default npm registry (no .npmrc found)" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
Write-Host ""
|
||||
|
||||
@@ -101,40 +98,20 @@ if ($Rebuild) {
|
||||
Write-Host "Removing existing images for rebuild..." -ForegroundColor White
|
||||
& docker compose down --rmi local
|
||||
Write-Host "Building and starting all services..." -ForegroundColor White
|
||||
if ($BuildArgs.Count -gt 0) {
|
||||
& docker compose build $BuildArgs
|
||||
& docker compose up -d
|
||||
} else {
|
||||
& docker compose up -d --build
|
||||
}
|
||||
& docker compose up -d --build
|
||||
} else {
|
||||
& docker-compose down
|
||||
Write-Host "Removing existing images for rebuild..." -ForegroundColor White
|
||||
& docker-compose down --rmi local
|
||||
Write-Host "Building and starting all services..." -ForegroundColor White
|
||||
if ($BuildArgs.Count -gt 0) {
|
||||
& docker-compose build $BuildArgs
|
||||
& docker-compose up -d
|
||||
} else {
|
||||
& docker-compose up -d --build
|
||||
}
|
||||
& docker-compose up -d --build
|
||||
}
|
||||
} else {
|
||||
Write-Host "Starting all services..." -ForegroundColor Green
|
||||
if ($ComposeCmd -eq "docker compose") {
|
||||
if ($BuildArgs.Count -gt 0) {
|
||||
& docker compose build $BuildArgs
|
||||
& docker compose up -d
|
||||
} else {
|
||||
& docker compose up -d
|
||||
}
|
||||
& docker compose up -d
|
||||
} else {
|
||||
if ($BuildArgs.Count -gt 0) {
|
||||
& docker-compose build $BuildArgs
|
||||
& docker-compose up -d
|
||||
} else {
|
||||
& docker-compose up -d
|
||||
}
|
||||
& docker-compose up -d
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user