auth-yes/archive/.forum/env/setup-fedora.sh

47 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
set -e
echo "==== 1. INSTALL SYSTEM DEPENDENCIES ===="
sudo dnf install -y clang clang-devel graphviz pipx nodejs git
echo "==== 2. CONFIGURE PATH IN BASHRC ===="
pipx ensurepath
export PATH="$HOME/.cargo/bin:$HOME/.local/bin:$PATH"
grep -q 'export PATH="\$HOME/.cargo/bin:\$HOME/.local/bin:\$PATH"' ~/.bashrc || \
echo 'export PATH="$HOME/.cargo/bin:$HOME/.local/bin:$PATH"' >> ~/.bashrc
echo "==== 3. INSTALL CLI TOOLS (RUST, PYTHON, NPM) ===="
cargo install tree-sitter-cli
pipx install semgrep
sudo npm install -g @sourcegraph/scip-typescript madge @stryker-mutator/core
echo "==== 4. CONFIGURE TREE-SITTER GRAMMARS (TS & TSX) ===="
mkdir -p ~/.config/tree-sitter ~/.local/share/tree-sitter
# Set parser directory search path for tree-sitter CLI
cat << 'EOF' > ~/.config/tree-sitter/config.json
{
"parser-directories": [
"$HOME/.local/share/tree-sitter"
]
}
EOF
# Clone official TypeScript & TSX grammars if not already present
if [ ! -d "$HOME/.local/share/tree-sitter/tree-sitter-typescript" ]; then
git clone --depth 1 https://github.com/tree-sitter/tree-sitter-typescript.git \
"$HOME/.local/share/tree-sitter/tree-sitter-typescript"
fi
# Symlink the TSX grammar so tree-sitter automatically handles .tsx files
ln -sf "$HOME/.local/share/tree-sitter/tree-sitter-typescript/tsx" \
"$HOME/.local/share/tree-sitter/tree-sitter-tsx"
echo "==== 5. VERIFY TOOLCHAIN ===="
tree-sitter --version
semgrep --version
scip-typescript --version
madge --version
echo "==== FEDORA SETUP COMPLETE ===="