chase-jay commited on
Commit
91d28c9
·
verified ·
1 Parent(s): 2c6e772

quickstart: npmmirror registry, no credential prompts

Browse files
Files changed (2) hide show
  1. quickstart-linux.sh +6 -3
  2. quickstart-windows.ps1 +7 -2
quickstart-linux.sh CHANGED
@@ -35,6 +35,7 @@ CUDA_VER="${RWKV_CUDA_VER:-12.9}"
35
  DEEPSEEK_KEY="${DEEPSEEK_API_KEY:-}"
36
  HF_ENDPOINT="${HF_ENDPOINT:-https://hf-mirror.com}"
37
  NODE_MIRROR="${NODE_MIRROR:-https://npmmirror.com/mirrors/node}"
 
38
  PORT="${RWKV_PORT:-8000}"
39
  API_KEY="${RWKV_API_KEY:-rwkv-local}"
40
  PI_REPO="${RWKV_PI_REPO:-https://github.com/w1c2j3/rwkv-pi.git}"
@@ -48,7 +49,7 @@ while [ $# -gt 0 ]; do
48
  --cuda) CUDA_VER="$2"; shift 2 ;;
49
  --deepseek-key) DEEPSEEK_KEY="$2"; shift 2 ;;
50
  --hf-endpoint) HF_ENDPOINT="${2%/}"; shift 2 ;;
51
- --official-hf) HF_ENDPOINT="https://huggingface.co"; NODE_MIRROR="https://nodejs.org/dist"; shift ;;
52
  --port) PORT="$2"; shift 2 ;;
53
  --api-key) API_KEY="$2"; shift 2 ;;
54
  --install-only) INSTALL_ONLY=1; shift ;;
@@ -208,9 +209,11 @@ fi
208
 
209
  echo "==> [5/6] Installing and building rwkv-pi client..."
210
  if [ ! -d "$INSTALL_DIR/rwkv-pi/.git" ]; then
211
- git clone "$PI_REPO" "$INSTALL_DIR/rwkv-pi"
 
 
212
  fi
213
- (cd "$INSTALL_DIR/rwkv-pi" && npm ci --no-audit --no-fund)
214
 
215
  # Preserve existing DEEPSEEK_API_KEY in .env if re-running without --deepseek-key
216
  if [ -z "$DEEPSEEK_KEY" ] && [ -f "$INSTALL_DIR/rwkv-pi/.env" ]; then
 
35
  DEEPSEEK_KEY="${DEEPSEEK_API_KEY:-}"
36
  HF_ENDPOINT="${HF_ENDPOINT:-https://hf-mirror.com}"
37
  NODE_MIRROR="${NODE_MIRROR:-https://npmmirror.com/mirrors/node}"
38
+ NPM_REGISTRY="${NPM_REGISTRY:-https://registry.npmmirror.com}"
39
  PORT="${RWKV_PORT:-8000}"
40
  API_KEY="${RWKV_API_KEY:-rwkv-local}"
41
  PI_REPO="${RWKV_PI_REPO:-https://github.com/w1c2j3/rwkv-pi.git}"
 
49
  --cuda) CUDA_VER="$2"; shift 2 ;;
50
  --deepseek-key) DEEPSEEK_KEY="$2"; shift 2 ;;
51
  --hf-endpoint) HF_ENDPOINT="${2%/}"; shift 2 ;;
52
+ --official-hf) HF_ENDPOINT="https://huggingface.co"; NODE_MIRROR="https://nodejs.org/dist"; NPM_REGISTRY="https://registry.npmjs.org"; shift ;;
53
  --port) PORT="$2"; shift 2 ;;
54
  --api-key) API_KEY="$2"; shift 2 ;;
55
  --install-only) INSTALL_ONLY=1; shift ;;
 
209
 
210
  echo "==> [5/6] Installing and building rwkv-pi client..."
211
  if [ ! -d "$INSTALL_DIR/rwkv-pi/.git" ]; then
212
+ GIT_TERMINAL_PROMPT=0 git clone --depth 1 "$PI_REPO" "$INSTALL_DIR/rwkv-pi"
213
+ else
214
+ GIT_TERMINAL_PROMPT=0 git -C "$INSTALL_DIR/rwkv-pi" pull --ff-only || echo " [WARN] Could not update rwkv-pi; keeping the existing copy."
215
  fi
216
+ (cd "$INSTALL_DIR/rwkv-pi" && npm ci --no-audit --no-fund --registry "$NPM_REGISTRY")
217
 
218
  # Preserve existing DEEPSEEK_API_KEY in .env if re-running without --deepseek-key
219
  if [ -z "$DEEPSEEK_KEY" ] && [ -f "$INSTALL_DIR/rwkv-pi/.env" ]; then
quickstart-windows.ps1 CHANGED
@@ -30,6 +30,8 @@ param(
30
  $ErrorActionPreference = "Stop"
31
  $EngineVersion = "v1.8.15"
32
  $HfEndpoint = $HfEndpoint.TrimEnd("/")
 
 
33
 
34
  function Assert-Command([string]$Name, [string]$Hint) {
35
  if (-not (Get-Command $Name -ErrorAction SilentlyContinue)) {
@@ -221,12 +223,15 @@ if (-not (Test-Path (Join-Path $InstallDir "demos\.templates"))) {
221
  Write-Host "==> [5/6] Installing and building rwkv-pi client..." -ForegroundColor Cyan
222
  $PiDir = Join-Path $InstallDir "rwkv-pi"
223
  if (-not (Test-Path (Join-Path $PiDir ".git"))) {
224
- & git clone $PiRepo $PiDir
225
  if ($LASTEXITCODE -ne 0) { throw "[ERROR] git clone failed for $PiRepo" }
 
 
 
226
  }
227
  Push-Location $PiDir
228
  try {
229
- & npm.cmd ci --no-audit --no-fund
230
  if ($LASTEXITCODE -ne 0) { throw "[ERROR] npm ci failed inside $PiDir" }
231
  } finally {
232
  Pop-Location
 
30
  $ErrorActionPreference = "Stop"
31
  $EngineVersion = "v1.8.15"
32
  $HfEndpoint = $HfEndpoint.TrimEnd("/")
33
+ $NpmRegistry = if ($HfEndpoint -like "*huggingface.co*") { "https://registry.npmjs.org" } else { "https://registry.npmmirror.com" }
34
+ $env:GIT_TERMINAL_PROMPT = "0"
35
 
36
  function Assert-Command([string]$Name, [string]$Hint) {
37
  if (-not (Get-Command $Name -ErrorAction SilentlyContinue)) {
 
223
  Write-Host "==> [5/6] Installing and building rwkv-pi client..." -ForegroundColor Cyan
224
  $PiDir = Join-Path $InstallDir "rwkv-pi"
225
  if (-not (Test-Path (Join-Path $PiDir ".git"))) {
226
+ & git clone --depth 1 $PiRepo $PiDir
227
  if ($LASTEXITCODE -ne 0) { throw "[ERROR] git clone failed for $PiRepo" }
228
+ } else {
229
+ & git -C $PiDir pull --ff-only
230
+ if ($LASTEXITCODE -ne 0) { Write-Host " [WARN] Could not update rwkv-pi; keeping the existing copy." -ForegroundColor Yellow }
231
  }
232
  Push-Location $PiDir
233
  try {
234
+ & npm.cmd ci --no-audit --no-fund --registry $NpmRegistry
235
  if ($LASTEXITCODE -ne 0) { throw "[ERROR] npm ci failed inside $PiDir" }
236
  } finally {
237
  Pop-Location