File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -64,4 +64,3 @@ include_trailing_comma = true
6464force_grid_wrap = 0
6565use_parentheses = true
6666ensure_newline_before_comments = true
67-
Original file line number Diff line number Diff line change @@ -7,7 +7,8 @@ readonly NC='\033[0m'
77
88# GitHub repository info
99readonly REPO_URL=" https://github.com/raghavyuva/nixopus"
10- readonly PACKAGE_JSON_URL=" $REPO_URL /raw/master/package.json"
10+
11+ readonly PACKAGE_JSON_URL_MASTER=" https://raw.githubusercontent.com/raghavyuva/nixopus/master/package.json"
1112
1213# Logging functions
1314log_error () { echo -e " ${RED} [ERROR]${NC} $1 " >&2 ; }
@@ -49,15 +50,16 @@ detect_os() {
4950# Get CLI version and package list
5051get_package_info () {
5152 local package_json
52- package_json=$( curl -s " $PACKAGE_JSON_URL " || {
53- log_error " Failed to fetch package.json from repository"
53+ package_json=$( curl -fsSL " $PACKAGE_JSON_URL_MASTER " 2> /dev/null || true)
54+ if [[ -z " $package_json " || " $package_json " != \{ * ]]; then
55+ log_error " Failed to fetch package.json from master branch"
5456 exit 1
55- } )
56-
57+ fi
58+
5759 # Extract version and packages
5860 CLI_VERSION=$( echo " $package_json " | grep -o ' "cli-version":[[:space:]]*"[^"]*"' | cut -d' "' -f4)
59- CLI_PACKAGES=$( echo " $package_json " | grep -A 100 ' "cli-packages"' | sed -n ' /\[/,/\]/p' | grep -o ' "[^"]*\..*"' | tr -d ' "' )
60-
61+ CLI_PACKAGES=$( echo " $package_json " | grep -A 200 ' "cli-packages"' | sed -n ' /\[/,/\]/p' | grep -o ' "[^"]*\..*"' | tr -d ' "' )
62+
6163 if [[ -z " $CLI_VERSION " ]]; then
6264 log_error " Could not find cli-version in package.json"
6365 exit 1
You can’t perform that action at this time.
0 commit comments