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:
somew1nd committed 2026-09-04 11:37:05 -07:00
1 parent c79c6eb27b
commit db69288fac
4 files changed
+49 -2

No files matched your search

+4
View File
@@ -156,6 +156,10 @@ if ((-not (Test-Path $ShowcaseIndex)) -and (-not (Test-Path $ShowcaseIndexAlt1))
Push-Location "$RootDir\apps\showcase_ui"
try {
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
Write-Host " ✔ Showcase UI compiled successfully." -ForegroundColor Green
} catch {
+20 -1
View File
@@ -271,9 +271,28 @@ setup_showcase_ui() {
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
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}"
else
echo -e " ${YELLOW}⚠ Could not find npm. Showcase UI will show fallback notice on launch.${NC}"
+4
View File
@@ -118,6 +118,10 @@ if ((-not (Test-Path $ShowcaseIndex)) -and (-not (Test-Path $ShowcaseIndexAlt1))
Push-Location "$RootDir\apps\showcase_ui"
try {
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
Write-Host " [OK] Showcase UI compiled successfully." -ForegroundColor Green
} catch {
+21 -1
View File
@@ -145,9 +145,29 @@ if [ ! -f "${SHOWCASE_INDEX}" ] && [ ! -f "${SHOWCASE_INDEX_ALT1}" ] && [ ! -f "
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
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
echo -e " ${YELLOW}⚠ Could not auto-install Node.js. Showcase UI will serve fallback build notice.${NC}"
fi