revert npm changes

This commit is contained in:
pratik
2025-10-15 16:15:03 -05:00
parent 2c7c5a1a97
commit cb6b867b58
5 changed files with 26 additions and 41 deletions

View File

@@ -39,7 +39,8 @@
"Bash(git push:*)", "Bash(git push:*)",
"Bash(Start-Sleep -Seconds 10)", "Bash(Start-Sleep -Seconds 10)",
"Bash(npm install:*)", "Bash(npm install:*)",
"Bash(npm config get:*)" "Bash(npm config get:*)",
"Bash(test:*)"
], ],
"deny": [], "deny": [],
"ask": [] "ask": []

View File

@@ -7,7 +7,7 @@ __pycache__
env/ env/
venv/ venv/
# Node modules (critical for fixing esbuild platform issue) # Node modules - installed inside Docker to ensure correct platform binaries
node_modules node_modules
frontend/node_modules frontend/node_modules
*/node_modules */node_modules

View File

@@ -1,24 +1,18 @@
# Multi-stage build: First stage builds Angular frontend # Multi-stage build: First stage builds Angular frontend
FROM node:18-alpine as frontend-builder FROM node:18-alpine as frontend-builder
# Install dependencies for native modules
RUN apk add --no-cache python3 make g++
WORKDIR /frontend WORKDIR /frontend
# Copy package files # Copy package files first
COPY frontend/package*.json ./ COPY frontend/package*.json ./
# Copy .npmrc from frontend directory if it exists (using glob pattern to avoid errors) # Copy .npmrc if it exists (allows using custom npm registry)
# This allows different environments to use different npm registries # The quickstart scripts will create this from user's .npmrc
# To use: copy your user-level .npmrc to frontend/.npmrc before building # Using a conditional copy approach
# Unix/Mac: cp ~/.npmrc frontend/.npmrc RUN --mount=type=bind,source=frontend,target=/tmp/frontend \
# Windows: copy %USERPROFILE%\.npmrc frontend\.npmrc if [ -f /tmp/frontend/.npmrc ]; then cp /tmp/frontend/.npmrc ./; fi
COPY frontend/.npmr[c] ./ 2>/dev/null || :
# Install dependencies using npm install # Install dependencies inside Docker (ensures correct platform binaries)
# This will use the .npmrc configuration if present and generate a package-lock.json
# appropriate for the configured registry (Artifactory or public npm)
RUN npm install RUN npm install
# Copy frontend source # Copy frontend source

View File

@@ -18,8 +18,8 @@ if ($Help) {
Write-Host " -Help Show this help message" -ForegroundColor White Write-Host " -Help Show this help message" -ForegroundColor White
Write-Host "" Write-Host ""
Write-Host "NPM Registry:" -ForegroundColor Yellow Write-Host "NPM Registry:" -ForegroundColor Yellow
Write-Host " Create frontend/.npmrc to configure custom npm registry" -ForegroundColor White Write-Host " Uses your machine's npm configuration automatically" -ForegroundColor White
Write-Host " The Docker build will use this file if present" -ForegroundColor White Write-Host " npm install runs on host before Docker build" -ForegroundColor White
Write-Host "" Write-Host ""
Write-Host "Brings up the complete stack: database, backend API, and frontend" -ForegroundColor Green Write-Host "Brings up the complete stack: database, backend API, and frontend" -ForegroundColor Green
Write-Host "" Write-Host ""
@@ -31,24 +31,19 @@ Write-Host "Obsidian - Quick Start" -ForegroundColor Cyan
Write-Host "=========================================" -ForegroundColor Cyan Write-Host "=========================================" -ForegroundColor Cyan
Write-Host "" Write-Host ""
# Copy user's .npmrc to frontend directory if it exists and frontend/.npmrc doesn't # Copy user's .npmrc to frontend directory if it exists
$UserNpmrc = Join-Path $env:USERPROFILE ".npmrc" $UserNpmrc = Join-Path $env:USERPROFILE ".npmrc"
$FrontendNpmrc = "frontend\.npmrc" $FrontendNpmrc = "frontend\.npmrc"
if (Test-Path $UserNpmrc) { if (Test-Path $UserNpmrc) {
if (-not (Test-Path $FrontendNpmrc)) { Write-Host "Copying npm registry config for Docker build..." -ForegroundColor Yellow
Write-Host "[INFO] Copying npm registry config from $UserNpmrc" -ForegroundColor Yellow Copy-Item $UserNpmrc $FrontendNpmrc -Force
Copy-Item $UserNpmrc $FrontendNpmrc
Write-Host "[OK] Using custom npm registry configuration" -ForegroundColor Green Write-Host "[OK] Using custom npm registry configuration" -ForegroundColor Green
} else {
Write-Host "[OK] Using existing frontend\.npmrc" -ForegroundColor Green
}
} else { } else {
if (Test-Path $FrontendNpmrc) { if (Test-Path $FrontendNpmrc) {
Write-Host "[OK] Using frontend\.npmrc" -ForegroundColor Green Remove-Item $FrontendNpmrc -Force
} else {
Write-Host "[INFO] Using default npm registry (no .npmrc found)" -ForegroundColor Yellow
} }
Write-Host "[INFO] Using default npm registry" -ForegroundColor Yellow
} }
Write-Host "" Write-Host ""

View File

@@ -41,8 +41,8 @@ while [[ $# -gt 0 ]]; do
echo " --help Show this help message" echo " --help Show this help message"
echo "" echo ""
echo "NPM Registry:" echo "NPM Registry:"
echo " Create frontend/.npmrc to configure custom npm registry" echo " Uses your machine's npm configuration automatically"
echo " The Docker build will use this file if present" echo " npm install runs on host before Docker build"
echo "" echo ""
echo "Brings up the complete stack: database, backend API, and frontend" echo "Brings up the complete stack: database, backend API, and frontend"
echo "" echo ""
@@ -56,24 +56,19 @@ while [[ $# -gt 0 ]]; do
esac esac
done done
# Copy user's .npmrc to frontend directory if it exists and frontend/.npmrc doesn't # Copy user's .npmrc to frontend directory if it exists
USER_NPMRC="${HOME}/.npmrc" USER_NPMRC="${HOME}/.npmrc"
FRONTEND_NPMRC="frontend/.npmrc" FRONTEND_NPMRC="frontend/.npmrc"
if [ -f "$USER_NPMRC" ]; then if [ -f "$USER_NPMRC" ]; then
if [ ! -f "$FRONTEND_NPMRC" ]; then echo "Copying npm registry config for Docker build..."
echo " Copying npm registry config from $USER_NPMRC"
cp "$USER_NPMRC" "$FRONTEND_NPMRC" cp "$USER_NPMRC" "$FRONTEND_NPMRC"
echo "✓ Using custom npm registry configuration" echo "✓ Using custom npm registry configuration"
else
echo "✓ Using existing frontend/.npmrc"
fi
else else
if [ -f "$FRONTEND_NPMRC" ]; then if [ -f "$FRONTEND_NPMRC" ]; then
echo "✓ Using frontend/.npmrc" rm -f "$FRONTEND_NPMRC"
else
echo " Using default npm registry (no .npmrc found)"
fi fi
echo " Using default npm registry"
fi fi
echo "" echo ""