2024-02-22 13:02:46 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# # try except this script
|
|
|
|
|
# set -e
|
|
|
|
|
|
|
|
|
|
# print current dir
|
|
|
|
|
echo
|
|
|
|
|
pwd
|
|
|
|
|
|
|
|
|
|
|
2024-08-06 06:22:03 +08:00
|
|
|
# only run this step for litellm enterprise, we run this if enterprise/enterprise_ui/_enterprise.json exists
|
|
|
|
|
if [ ! -f "enterprise/enterprise_ui/enterprise_colors.json" ]; then
|
|
|
|
|
echo "Admin UI - using default LiteLLM UI"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
2024-02-22 13:02:46 +08:00
|
|
|
|
2024-08-06 06:22:03 +08:00
|
|
|
echo "Building Custom Admin UI..."
|
2024-02-22 13:02:46 +08:00
|
|
|
|
2024-08-06 06:22:03 +08:00
|
|
|
# Install dependencies
|
|
|
|
|
# Check if we are on macOS
|
|
|
|
|
if [[ "$(uname)" == "Darwin" ]]; then
|
|
|
|
|
# Install dependencies using Homebrew
|
|
|
|
|
if ! command -v brew &> /dev/null; then
|
|
|
|
|
echo "Error: Homebrew not found. Please install Homebrew and try again."
|
|
|
|
|
exit 1
|
2024-02-22 13:02:46 +08:00
|
|
|
fi
|
2024-08-06 06:22:03 +08:00
|
|
|
brew update
|
|
|
|
|
brew install curl
|
|
|
|
|
else
|
|
|
|
|
# Assume Linux, try using apt-get
|
|
|
|
|
if command -v apt-get &> /dev/null; then
|
|
|
|
|
apt-get update
|
|
|
|
|
apt-get install -y curl
|
|
|
|
|
elif command -v apk &> /dev/null; then
|
|
|
|
|
# Try using apk if apt-get is not available
|
|
|
|
|
apk update
|
|
|
|
|
apk add curl
|
|
|
|
|
else
|
|
|
|
|
echo "Error: Unsupported package manager. Cannot install dependencies."
|
|
|
|
|
exit 1
|
2024-06-12 09:59:42 +08:00
|
|
|
fi
|
2024-08-06 06:22:03 +08:00
|
|
|
fi
|
chore: harden npm supply chain — pin overrides, enforce npm ci, add ignore-scripts (#24838)
* chore: harden npm supply chain — pin overrides, enforce npm ci, add ignore-scripts
Replace open-ended >= version overrides with exact pins matching lockfile
versions across all 6 package.json files. Remove dead overrides for packages
not present in lockfiles. Switch CI and devcontainer from npm install to
npm ci for deterministic lockfile-based installs.
Add .npmrc to all 7 JS project directories with ignore-scripts=true (blocks
postinstall RAT vectors like the axios@1.14.1 supply chain attack) and
min-release-age=3d (refuses packages published <3 days ago, requires npm
>=11.10). Remove Yarn-only resolutions field from docs/my-website.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: bump sharp to 0.33.5 in docs, add docs .npmrc
sharp 0.32.x uses postinstall to download native binaries, which breaks
with ignore-scripts=true. sharp 0.33+ distributes via optionalDependencies
instead, making it compatible with the new .npmrc hardening.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: remove docs .npmrc to fix Vercel deploy
Vercel's build for docs/my-website uses npm install which needs
sharp 0.32.6's postinstall script. Since we don't control Vercel's
build process, remove the .npmrc from docs rather than fight it.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: Dockerfile npm ci + nvm checksum verification
- Replace npm install with npm ci in Dockerfile.non_root,
Dockerfile.custom_ui, and spend-logs/Dockerfile for deterministic
lockfile-based installs
- Replace curl-pipe-bash nvm install with download-then-verify pattern
in build_admin_ui.sh, build_ui.sh, and build_ui_custom_path.sh
- Update nvm from v0.38.0 (2021) to v0.40.4 (Jan 2026) with SHA256
checksum verification before execution
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: macOS sha256sum compat + clarify min-release-age scope
- Use shasum -a 256 fallback on macOS where sha256sum is unavailable
- Clarify in .npmrc comments that min-release-age only protects local
npm install, not npm ci (used in CI)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 04:41:37 +08:00
|
|
|
NVM_VERSION="v0.40.4"
|
|
|
|
|
NVM_CHECKSUM="4b7412c49960c7d31e8df72da90c1fb5b8cccb419ac99537b737028d497aba4f"
|
|
|
|
|
NVM_SCRIPT=$(mktemp)
|
|
|
|
|
trap 'rm -f "$NVM_SCRIPT"' EXIT
|
|
|
|
|
curl -fsSL "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" -o "$NVM_SCRIPT"
|
|
|
|
|
if command -v sha256sum &>/dev/null; then
|
|
|
|
|
echo "${NVM_CHECKSUM} ${NVM_SCRIPT}" | sha256sum -c -
|
|
|
|
|
elif command -v shasum &>/dev/null; then
|
|
|
|
|
echo "${NVM_CHECKSUM} ${NVM_SCRIPT}" | shasum -a 256 -c -
|
|
|
|
|
else
|
|
|
|
|
echo "No sha256 tool found; cannot verify nvm checksum"; exit 1
|
|
|
|
|
fi || { echo "nvm checksum verification failed"; exit 1; }
|
|
|
|
|
bash "$NVM_SCRIPT"
|
2024-08-06 06:22:03 +08:00
|
|
|
source ~/.nvm/nvm.sh
|
|
|
|
|
nvm install v18.17.0
|
|
|
|
|
nvm use v18.17.0
|
2024-06-12 09:59:42 +08:00
|
|
|
|
2024-08-06 06:22:03 +08:00
|
|
|
# copy _enterprise.json from this directory to /ui/litellm-dashboard, and rename it to ui_colors.json
|
|
|
|
|
cp enterprise/enterprise_ui/enterprise_colors.json ui/litellm-dashboard/ui_colors.json
|
2024-02-22 13:02:46 +08:00
|
|
|
|
2024-08-06 06:22:03 +08:00
|
|
|
# cd in to /ui/litellm-dashboard
|
|
|
|
|
cd ui/litellm-dashboard
|
2024-02-22 13:02:46 +08:00
|
|
|
|
2024-08-06 06:22:03 +08:00
|
|
|
# ensure have access to build_ui.sh
|
|
|
|
|
chmod +x ./build_ui.sh
|
2024-02-22 13:02:46 +08:00
|
|
|
|
2024-08-06 06:22:03 +08:00
|
|
|
# run ./build_ui.sh
|
|
|
|
|
./build_ui.sh
|
2024-06-12 09:59:42 +08:00
|
|
|
|
2024-08-06 06:22:03 +08:00
|
|
|
# return to root directory
|
|
|
|
|
cd ../..
|