use npx json instead of jq (#617)
This commit is contained in:
parent
8935a248f6
commit
094b9dc474
|
@ -57,7 +57,7 @@ As with most Node projects, major development scripts can be found in the `packa
|
||||||
|
|
||||||
#### Dependencies
|
#### Dependencies
|
||||||
|
|
||||||
The build toolchain requires `npm` and `jq` to be installed. You can use the `scripts/setup-dev.sh` script to install these prerequisites.
|
The build toolchain requires `npm` to be installed. You can install it using `scripts/setup-dev.sh`.
|
||||||
|
|
||||||
#### Enabling Sandboxing
|
#### Enabling Sandboxing
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
"eslint-plugin-react": "^7.37.5",
|
"eslint-plugin-react": "^7.37.5",
|
||||||
"eslint-plugin-react-hooks": "^5.2.0",
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
"globals": "^16.0.0",
|
"globals": "^16.0.0",
|
||||||
|
"json": "^11.0.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"memfs": "^4.17.2",
|
"memfs": "^4.17.2",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
|
@ -5920,6 +5921,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/json": {
|
||||||
|
"version": "11.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/json/-/json-11.0.0.tgz",
|
||||||
|
"integrity": "sha512-N/ITv3Yw9Za8cGxuQqSqrq6RHnlaHWZkAFavcfpH/R52522c26EbihMxnY7A1chxfXJ4d+cEFIsyTgfi9GihrA==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"json": "lib/json.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/json-bigint": {
|
"node_modules/json-bigint": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"react-devtools-core": "^4.28.5",
|
"react-devtools-core": "^4.28.5",
|
||||||
"typescript-eslint": "^8.30.1",
|
"typescript-eslint": "^8.30.1",
|
||||||
"yargs": "^17.7.2"
|
"yargs": "^17.7.2",
|
||||||
|
"json": "^11.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,11 @@ done
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
# if GEMINI_SANDBOX is not set, see if it is set in user settings
|
# if GEMINI_SANDBOX is not set, see if it is set in user settings
|
||||||
# note it can be string or boolean, and if missing jq will return null
|
# note it can be string or boolean, and if missing `npx json` will return empty string
|
||||||
USER_SETTINGS_FILE="$HOME/.gemini/settings.json"
|
USER_SETTINGS_FILE="$HOME/.gemini/settings.json"
|
||||||
if [ -z "${GEMINI_SANDBOX:-}" ] && [ -f "$USER_SETTINGS_FILE" ]; then
|
if [ -z "${GEMINI_SANDBOX:-}" ] && [ -f "$USER_SETTINGS_FILE" ]; then
|
||||||
USER_SANDBOX_SETTING=$(sed -e 's/\/\/.*//' -e 's/\/\*.*\*\///g' -e '/^[[:space:]]*\/\//d' "$USER_SETTINGS_FILE" | jq -r '.sandbox')
|
USER_SANDBOX_SETTING=$(sed -e 's/\/\/.*//' -e 's/\/\*.*\*\///g' -e '/^[[:space:]]*\/\//d' "$USER_SETTINGS_FILE" | npx json 'sandbox')
|
||||||
if [ "$USER_SANDBOX_SETTING" != null ]; then
|
if [ -n "$USER_SANDBOX_SETTING" ]; then
|
||||||
GEMINI_SANDBOX=$USER_SANDBOX_SETTING
|
GEMINI_SANDBOX=$USER_SANDBOX_SETTING
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Check if npm is installed
|
# Check if npm is installed
|
||||||
if ! command -v npm &> /dev/null
|
if ! command -v npm &>/dev/null; then
|
||||||
then
|
|
||||||
echo "npm not found. Installing npm via nvm..."
|
echo "npm not found. Installing npm via nvm..."
|
||||||
# Download and install nvm:
|
# Download and install nvm:
|
||||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
||||||
|
@ -26,19 +25,10 @@ then
|
||||||
# Download and install Node.js:
|
# Download and install Node.js:
|
||||||
nvm install 22
|
nvm install 22
|
||||||
# Verify the Node.js version:
|
# Verify the Node.js version:
|
||||||
node -v # Should print "v22.15.0".
|
node -v # Should print "v22.15.0".
|
||||||
nvm current # Should print "v22.15.0".
|
nvm current # Should print "v22.15.0".
|
||||||
# Verify npm version:
|
# Verify npm version:
|
||||||
npm -v # Should print "10.9.2".
|
npm -v # Should print "10.9.2".
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if jq is installed
|
|
||||||
if ! command -v jq &> /dev/null
|
|
||||||
then
|
|
||||||
echo "jq not found. Installing jq..."
|
|
||||||
# This assumes a Debian/Ubuntu based system. Adjust for other distributions.
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y jq
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Development environment setup complete."
|
echo "Development environment setup complete."
|
||||||
|
|
Loading…
Reference in New Issue