Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ensure correct nodejs version is installed #3691

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Yaminyam
Copy link
Member

Fixes #2526

Summary

correct nodejs version

This PR addresses an issue where the script did not check if the currently installed Node.js version matches the required version.

If Node.js was already installed but with a different version, the script would not update it to the required version.

I have written logic to check if the Node version is exactly a specific version, not just above a certain version. Let me know if you find anything wrong with this!


pyenv enviornment check

The part of setting environment variables was refactored into a function and generalized for future reuse!
(add "config/fish/config.fish" for fish shell user too!)
I also eliminated the possibility of duplicating the script_content by using grep.

append_to_profiles() {
  script_content="$1"
  PROFILE_FILES=("zshrc" "bashrc" "profile" "bash_profile" "config/fish/config.fish")

  for PROFILE_FILE in "${PROFILE_FILES[@]}"; do
    FULL_PATH="${HOME}/.${PROFILE_FILE}"

    if [ -e "$FULL_PATH" ] && ! grep -qF "$script_content" "$FULL_PATH"; then
      echo "$script_content" >>"$FULL_PATH"
    fi
  done
}

and I considered a case where pyenv is installed but the environment variables are not set.

if ! type "pyenv" >/dev/null 2>&1 && [ ! -d "$HOME/.pyenv" ]; then

Checklist:

  • Installer updates including:
    • New mandatory config options

@Copilot Copilot bot review requested due to automatic review settings February 13, 2025 05:42

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Files not reviewed (1)
  • scripts/install-dev.sh: Language not supported
@github-actions github-actions bot added comp:installer Related to Installer size:M 30~100 LoC labels Feb 13, 2025
@Yaminyam Yaminyam added the skip:changelog Make the action workflow to skip towncrier check label Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:installer Related to Installer size:M 30~100 LoC skip:changelog Make the action workflow to skip towncrier check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verify that the node.js version is correct in install-dev.sh
2 participants