fix: auto-patch Angular CLI node version constraint and support nvm in start scripts
- Auto-patch Angular CLI 22.1.6 node-version.js requirement from ^22.22.3 to 22.22.0 across Linux, macOS, and Windows startup scripts - Automatically detect and load nvm in start.sh and install_deps.sh when available - Ensure Showcase UI can be built on Cloudtop and Debian systems running Node 22.22.x without requiring root privileges
This commit is contained in:
1 parent
c79c6eb27b
commit
db69288fac
4 files changed
+49
-2
No files matched your search
@@ -156,6 +156,10 @@ if ((-not (Test-Path $ShowcaseIndex)) -and (-not (Test-Path $ShowcaseIndexAlt1))
|
|||||||
Push-Location "$RootDir\apps\showcase_ui"
|
Push-Location "$RootDir\apps\showcase_ui"
|
||||||
try {
|
try {
|
||||||
npm install --silent
|
npm install --silent
|
||||||
|
$cliNodeVersion = "$RootDir\apps\showcase_ui\node_modules\@angular\cli\src\utilities\node-version.js"
|
||||||
|
if (Test-Path $cliNodeVersion) {
|
||||||
|
(Get-Content $cliNodeVersion) -replace '22\.22\.3', '22.22.0' | Set-Content $cliNodeVersion
|
||||||
|
}
|
||||||
npm run build
|
npm run build
|
||||||
Write-Host " ✔ Showcase UI compiled successfully." -ForegroundColor Green
|
Write-Host " ✔ Showcase UI compiled successfully." -ForegroundColor Green
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
+20
-1
@@ -271,9 +271,28 @@ setup_showcase_ui() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Try loading nvm if available in user environment
|
||||||
|
export NVM_DIR="${HOME}/.nvm"
|
||||||
|
if [ -s "${NVM_DIR}/nvm.sh" ]; then
|
||||||
|
# shellcheck disable=SC1090,SC1091
|
||||||
|
. "${NVM_DIR}/nvm.sh" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
if has_cmd npm; then
|
if has_cmd npm; then
|
||||||
echo -e " ${YELLOW}🎨 Building Angular Showcase UI...${NC}"
|
echo -e " ${YELLOW}🎨 Building Angular Showcase UI...${NC}"
|
||||||
(cd "${ROOT_DIR}/apps/showcase_ui" && npm install --silent && npm run build)
|
(
|
||||||
|
cd "${ROOT_DIR}/apps/showcase_ui"
|
||||||
|
npm install --silent
|
||||||
|
CLI_NODE_VERSION="${ROOT_DIR}/apps/showcase_ui/node_modules/@angular/cli/src/utilities/node-version.js"
|
||||||
|
if [ -f "${CLI_NODE_VERSION}" ]; then
|
||||||
|
if [ "${OS_TYPE}" = "Darwin" ]; then
|
||||||
|
sed -i '' 's/22\.22\.3/22.22.0/g' "${CLI_NODE_VERSION}" 2>/dev/null || true
|
||||||
|
else
|
||||||
|
sed -i 's/22\.22\.3/22.22.0/g' "${CLI_NODE_VERSION}" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
npm run build
|
||||||
|
)
|
||||||
echo -e " ${GREEN}✓ Showcase UI compiled successfully.${NC}"
|
echo -e " ${GREEN}✓ Showcase UI compiled successfully.${NC}"
|
||||||
else
|
else
|
||||||
echo -e " ${YELLOW}⚠ Could not find npm. Showcase UI will show fallback notice on launch.${NC}"
|
echo -e " ${YELLOW}⚠ Could not find npm. Showcase UI will show fallback notice on launch.${NC}"
|
||||||
|
|||||||
@@ -118,6 +118,10 @@ if ((-not (Test-Path $ShowcaseIndex)) -and (-not (Test-Path $ShowcaseIndexAlt1))
|
|||||||
Push-Location "$RootDir\apps\showcase_ui"
|
Push-Location "$RootDir\apps\showcase_ui"
|
||||||
try {
|
try {
|
||||||
npm install --silent
|
npm install --silent
|
||||||
|
$cliNodeVersion = "$RootDir\apps\showcase_ui\node_modules\@angular\cli\src\utilities\node-version.js"
|
||||||
|
if (Test-Path $cliNodeVersion) {
|
||||||
|
(Get-Content $cliNodeVersion) -replace '22\.22\.3', '22.22.0' | Set-Content $cliNodeVersion
|
||||||
|
}
|
||||||
npm run build
|
npm run build
|
||||||
Write-Host " [OK] Showcase UI compiled successfully." -ForegroundColor Green
|
Write-Host " [OK] Showcase UI compiled successfully." -ForegroundColor Green
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@@ -145,9 +145,29 @@ if [ ! -f "${SHOWCASE_INDEX}" ] && [ ! -f "${SHOWCASE_INDEX_ALT1}" ] && [ ! -f "
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Try loading nvm if available in user environment
|
||||||
|
export NVM_DIR="${HOME}/.nvm"
|
||||||
|
if [ -s "${NVM_DIR}/nvm.sh" ]; then
|
||||||
|
# shellcheck disable=SC1090,SC1091
|
||||||
|
. "${NVM_DIR}/nvm.sh" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
if command -v npm >/dev/null 2>&1; then
|
if command -v npm >/dev/null 2>&1; then
|
||||||
echo -e " ${YELLOW}🎨 Showcase UI build not found. Compiling Angular Showcase UI...${NC}"
|
echo -e " ${YELLOW}🎨 Showcase UI build not found. Compiling Angular Showcase UI...${NC}"
|
||||||
(cd "${SCRIPT_DIR}/apps/showcase_ui" && npm install --silent && npm run build)
|
(
|
||||||
|
cd "${SCRIPT_DIR}/apps/showcase_ui"
|
||||||
|
npm install --silent
|
||||||
|
# Auto-patch Angular CLI node version constraint if running on Node 22.22.x (e.g. Cloudtop / Debian)
|
||||||
|
CLI_NODE_VERSION="${SCRIPT_DIR}/apps/showcase_ui/node_modules/@angular/cli/src/utilities/node-version.js"
|
||||||
|
if [ -f "${CLI_NODE_VERSION}" ]; then
|
||||||
|
if [ "$(uname -s)" = "Darwin" ]; then
|
||||||
|
sed -i '' 's/22\.22\.3/22.22.0/g' "${CLI_NODE_VERSION}" 2>/dev/null || true
|
||||||
|
else
|
||||||
|
sed -i 's/22\.22\.3/22.22.0/g' "${CLI_NODE_VERSION}" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
npm run build
|
||||||
|
)
|
||||||
else
|
else
|
||||||
echo -e " ${YELLOW}⚠ Could not auto-install Node.js. Showcase UI will serve fallback build notice.${NC}"
|
echo -e " ${YELLOW}⚠ Could not auto-install Node.js. Showcase UI will serve fallback build notice.${NC}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user