From 782f8f4f509f0dc05c58e8175be07b3e710de908 Mon Sep 17 00:00:00 2001 From: Jor Sanders Date: Fri, 14 Nov 2025 12:33:39 +0100 Subject: [PATCH] feat: updates from macbook --- .gitignore | 3 ++- bin/create_certkey | 2 +- profile/nvm | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 43c08a4..561b90f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ ; Secret files are for tokens or other "Secret stuff" -*.secret \ No newline at end of file +*.secret +.DS_Store diff --git a/bin/create_certkey b/bin/create_certkey index a95f418..a3edf81 100755 --- a/bin/create_certkey +++ b/bin/create_certkey @@ -6,4 +6,4 @@ if [ $# -lt 1 ] || [[ $* == *"--help"* ]]; then exit 0 fi -openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 9000 -subj "/C=NL/ST=Noord-Holland/L=Amsterdam/O=jor.dev/OU=IT/CN=$1" +openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 9000 -subj "/C=NL/ST=Noord-Holland/L=Amsterdam/O=jor.dev/OU=IT/CN=$1" -addext "subjectAltName = DNS:localhost" diff --git a/profile/nvm b/profile/nvm index 6e295f4..3abe594 100644 --- a/profile/nvm +++ b/profile/nvm @@ -9,3 +9,29 @@ export NVM_DIR="$HOME/.nvm" [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm # shellcheck source=/dev/null [ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion + + +# Auto load correct Node version +autoload -U add-zsh-hook +load-nvmrc() { + # shellcheck disable=SC2155 + local node_version="$(nvm version)" + # shellcheck disable=SC2155 + local nvmrc_path="$(nvm_find_nvmrc)" + + if [ -n "$nvmrc_path" ]; then + # shellcheck disable=SC2155 + local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") + + if [ "$nvmrc_node_version" = "N/A" ]; then + nvm install + elif [ "$nvmrc_node_version" != "$node_version" ]; then + nvm use + fi + elif [ "$node_version" != "$(nvm version default)" ]; then + echo "Reverting to nvm default version" + nvm use default + fi +} +add-zsh-hook chpwd load-nvmrc +load-nvmrc