-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-cmd.sh
More file actions
25 lines (21 loc) · 1.25 KB
/
Copy pathupdate-cmd.sh
File metadata and controls
25 lines (21 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
# ==============================================================================
# command-code Registry-Bypassing Installer
# Fixes npm E403 Forbidden errors caused by restrictive local .npmrc setups.
# Licensed under the Waqf Digital Public License (WaqfTech)
# Dedicated as a public utility digital asset.
# ==============================================================================
# Fetch the latest version from the public npm registry
echo "Checking for the latest version of command-code..."
VERSION=$(npm view command-code version 2>/dev/null)
# Fallback check if npm view fails due to the strict local security policy
if [ -z "$VERSION" ]; then
echo "⚠️ Warning: Could not auto-detect latest version via 'npm view' due to registry restrictions."
echo "Attempting to launch with default npx behavior..."
NPM_CONFIG_REGISTRY="https://registry.npmjs.org/" NPM_CONFIG_BEFORE="false" npx command-code@latest "$@"
exit $?
fi
echo "🚀 Found latest version: ${VERSION}"
echo "Running command-code via clean public registry config..."
# Execute the command with the dynamically fetched version and pass through any arguments
NPM_CONFIG_REGISTRY="https://registry.npmjs.org/" NPM_CONFIG_BEFORE="false" npx command-code@"${VERSION}" "$@"