Add asdf as version manager (#2)

* feat(asdf): add new version manager asdf

* feat(asdf): replace nvm with asdf

* feat(asdf): replace rbenv with asdf

* chore: add aliases for git

* feat(asdf): replace pyenv with asdf

* feat(asdf): add asdf as version manager for rust

* chore: shorten comments

* feat(asdf): add asdf as deno version manager

* feat(asdf): add direnv plugin and setup shell

* chore(asdf): move configuration in folder
This commit is contained in:
Stefan Imhoff
2022-10-27 19:53:56 +02:00
committed by GitHub
parent b956d4c41a
commit 1e43546b9a
18 changed files with 107 additions and 152 deletions

View File

@@ -7,12 +7,16 @@
- link:
~/.ack: ack
~/.ag: ag
~/.asdfrc: asdf/asdfrc
~/.config/base16-shell: .base16-shell
~/.config/kitty: kitty
~/.config/nvim: nvim
~/.config/starship.toml: starship.toml
~/.config/tmuxinator: tmuxinator
~/.ctags: ctags
~/.default-gems: asdf/default-gems
~/.default-npm-packages: asdf/default-npm-packages
~/.default-python-packages: asdf/default-python-packages
~/.editorconfig: editorconfig
~/.gitconfig: gitconfig
~/.gitignore: gitignore

View File

@@ -2,7 +2,10 @@
source "https://rubygems.org"
gem "neovim"
gem "lunchy"
gem "git-up"
gem "bundler"
gem "erb_lint"
gem "git-up"
gem "github-linguist"
gem "lunchy"
gem "neovim"
gem "tmuxinator"

1
asdf/asdfrc Normal file
View File

@@ -0,0 +1 @@
legacy_version_file = yes

6
asdf/default-gems Normal file
View File

@@ -0,0 +1,6 @@
bundler
erb_lint
git-up
lunchy
neovim
tmuxinator

31
asdf/default-npm-packages Normal file
View File

@@ -0,0 +1,31 @@
@fsouza/prettierd
a11y
alex
babel-cli
browser-sync
caniuse-cmd
commitizen
cz-conventional-changelog
eslint
eslint_d
fast-cli
gifify
github-codeowners
json-server
jsonlint
lighthouse
markdownlint-cli
neovim
netlify-cli
npm-check
npm-check-updates
pageres-cli
pageres-cli
prettier
prettier-init
prettier-stylelint
prettier_d_slim
prettyjson
typesync
write-good
yarn

View File

@@ -0,0 +1,3 @@
codespell
fawkes
pipenv

5
setup/deno.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
asdf plugin-add deno
asdf install deno latest
asdf global deno latest

4
setup/direnv.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
asdf plugin-add direnv
asdf direnv setup --shell zsh --version latest

View File

@@ -1,10 +0,0 @@
#!/bin/sh
brew install brew-gem
brew gem install bundler # Bundler manages an application's dependencies
brew gem install git-up # git command to fetch and rebase all branches
brew gem install github-linguist # Language Savant.
brew gem install lunchy # Friendly wrapper around launchctl
brew gem install neovim # Ruby provider for NeoVim
brew gem install erb_lint # Lint ERB or HTML

View File

@@ -1,37 +1,34 @@
#!/bin/sh
# Install Xcode Developer Tools
# Xcode Developer Tools
xcode-select --install
# Install TMUX Plugin Manager
# TMUX Plugin Manager
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# Install Homebrew
# Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Installing Homebrew packages, Cask binaries and Mac App Store software
# Homebrew packages, Cask binaries and Mac App Store software
source ./brew.sh
# Installing Node.js
source ./nvm.sh
# Direnv
source ./direnv.sh
# Installing global Node.js modules
source ./npm.sh
# Node.js
source ./nodejs.sh
# Installing Python version manager
# Python
source ./python.sh
# Installing Lua packages
# Lua
source ./lua.sh
# Installing Rust packages
# Rust
source ./rust.sh
# Install current version of Ruby
# Ruby
source ./ruby.sh
# Install global Gems
source ./gem.sh
# Install Visual Studio Code Extensions
# Visual Studio Code Extensions
source ./vscode.sh

5
setup/nodejs.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
asdf plugin-add nodejs
asdf install nodejs latest
asdf global nodejs latest

View File

@@ -1,62 +0,0 @@
#!/bin/sh
npm install -g @11ty/eleventy # Eleventy
npm install -g @hyperspace/cli # Hyp CLI
npm install -g @fsouza/prettierd # Prettier, as a daemon, for ludicrous formatting speed
npm install -g a11y # Runs an accessibility audit against a URL
npm install -g alex # Catch insensitive, inconsiderate writing
npm install -g babel-cli # Babel command line
npm install -g browser-sync # Live CSS Reload & Browser Syncing
npm install -g caniuse-cmd # caniuse for the command line ➜ caniuse border-radius
npm install -g commitizen # Git commit, but play nice with conventions ➜ git cz
npm install -g cz-conventional-changelog # Prompts for conventional changelog standard
npm install -g degit # Straightforward project scaffolding
npm install -g esbuild # An extremely fast JavaScript bundler
npm install -g eslint # An AST-based pattern checker for JavaScript
npm install -g eslint-plugin-babel
npm install -g eslint-plugin-chai
npm install -g eslint-plugin-chai-expect
npm install -g eslint-plugin-flowtype
npm install -g eslint-plugin-html
npm install -g eslint-plugin-jasmine
npm install -g eslint-plugin-jsdoc
npm install -g eslint-plugin-json
npm install -g eslint-plugin-jsx
npm install -g eslint-plugin-jsx-extras
npm install -g eslint-plugin-lodash
npm install -g eslint-plugin-mocha
npm install -g eslint-plugin-node
npm install -g eslint-plugin-react
npm install -g eslint-plugin-redux
npm install -g eslint_d # Like Eslint, but faster
npm install -g fast-cli # Test your download speed using fast.com ➜ fast
npm install -g gifify # Convert any video file to an optimized animated GIF
npm install -g github-codeowners # A CLI tool for working with GitHub CODEOWNERS
npm install -g glyphhanger # Your web font utility belt
npm install -g http-server # A simple zero-configuration command-line http server
npm install -g json-server # Small JSON file server for REST API mock ➜ touch db.json; json-server --watch db.json
npm install -g jsonlint # A JSON linter
npm install -g lighthouse # Lighthouse analyzes web apps and web pages.
npm install -g nativefier # Wrap web apps natively
npm install -g neovim # Node.js provider for NeoVim
npm install -g netlify-cli # The Netlify CLI tools.
npm install -g nodemon # Simple monitor script for use during development of a node.js app.
npm install -g npm-check # Check for outdated, incorrect, and unused dependencies. ➜ npm-check -g
npm install -g npm-check-updates # Find newer versions of dependencies ➜ ncu
npm install -g npx # Executes commands
npm install -g markdownlint # Markdown lint tool and style checker
npm install -g markdownlint-cli # Command Line Interface for MarkdownLint
npm install -g pageres-cli # Capture website screenshots ➜ pageres [ todomvc.com 1200x1000 ] [ yeoman.io 800x600 1200x1000 ] --crop
npm install -g prettier # Prettier is an opinionated code formatter
npm install -g prettier-init # Just a CLI for creating a .prettierrc file.
npm install -g prettier-stylelint # Format your styles with ease
npm install -g prettier_d_slim # Prettier, but fast
npm install -g prettyjson # Package for formatting JSON data ➜ prettyjson package.json. curl https://api.github.com/users/rafeca | prettyjson
npm install -g stylelint # Modern CSS linter
npm install -g stylelint-config-prettier
npm install -g stylelint-config-standard
npm install -g tldr # tldr;
npm install -g typescript # TypeScript is a language for application scale JavaScript development
npm install -g typesync # Install missing TypeScript typings for dependencies in your package.json.
npm install -g write-good # Linter for English prose
npm install -g yarn # Fast, reliable, and secure dependency management.

View File

@@ -1,14 +0,0 @@
#!/bin/sh
# Manual install of nvm
git clone https://github.com/creationix/nvm.git ~/.nvm
cd ~/.nvm
git checkout `git describe --abbrev=0 --tags`
cd ~/.dotfiles/
# Reload nvm into this environment
export NVM_DIR="$HOME/.nvm/"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
nvm install stable
nvm alias default stable

View File

@@ -1,21 +1,10 @@
#!/bin/sh
# Install Pyenv
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
# Activate Pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
pyenv install 3.10.1
asdf plugin-add python
asdf install python latest
asdf global python latest
pip install -r ~/.dotfiles/python/pip-requirements.txt
jupyter nbextension install --py --sys-prefix jupyter_ascending
jupyter nbextension enable jupyter_ascending --sys-prefix --py
jupyter serverextension enable jupyter_ascending --sys-prefix --py
conda install -n base ipykernel --update-deps --force-reinstall
conda install --file ~/.dotfiles/python/conda-requirements.txt

View File

@@ -1,6 +1,7 @@
#!/bin/sh
rbenv install $(rbenv install -l | grep -v - | tail -1)
rbenv global $(rbenv install -l | grep -v - | tail -1)
asdf plugin add ruby
asdf install ruby latest
asdf global ruby latest
bundle install --gemfile=~/.dotfiles/Gemfile

View File

@@ -1,6 +1,7 @@
#!/bin/sh
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
asdf plugin-add rust
asdf install rust latest
asdf global rust latest
cargo install stylua

View File

@@ -1,6 +1,20 @@
# Don't print a new line at the start of the prompt
add_newline = false
command_timeout = 1000
[nodejs]
detect_files = ["package.json", ".node-version", ".nvmrc", ".tool-versions"]
[ruby]
detect_files = ["Gemfile", ".ruby-version", ".tool-versions"]
[python]
detect_files = [".python-version", "Pipfile", "__init__.py", "pyproject.toml", "requirements.txt", "setup.py", "tox.ini", '.tool-versions']
[rust]
detect_files = ["Cargo.toml", ".tool-versions"]
# "bold red" style when capacity is between 0% and 10%
[[battery.display]]
threshold = 10

35
zshrc
View File

@@ -31,28 +31,12 @@ export FZF_CTRL_T_OPTS="--preview 'bat --color=always --style=numbers {}' --bind
export FZF_ALT_C_COMMAND="fd --type d $FD_OPTIONS --color=never --hidden"
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -50'"
# rbenv
export RBENV_ROOT="$HOME/.rbenv/"
# nvm (Node Version Manager)
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
# Rancher
export PATH="$HOME/.rd/bin:$PATH"
# Rust
export PATH="$HOME/.cargo/bin:$PATH"
# Ruby
export PATH="/usr/local/opt/ruby/bin:$PATH"
# Pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
# Conda
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
@@ -75,6 +59,10 @@ export MANPATH="/usr/local/man:$MANPATH"
# Bat
export BAT_PAGER="less -R"
# Asdf
. /usr/local/opt/asdf/libexec/asdf.sh
source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc"
# Starship
eval "$(starship init zsh)"
@@ -160,17 +148,6 @@ unquarantine() {
done
}
# Auto change the nvm version based on a .nvmrc file based on the current directory.
# See https://github.com/creationix/nvm/issues/110#issuecomment-190125863
autoload -U add-zsh-hook
load-nvmrc() {
if [[ -f .nvmrc && -r .nvmrc ]]; then
nvm use
fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc
# fe [FUZZY PATTERN] - Open the selected file with the default editor
# - Bypass fuzzy finder if there's only one match (--select-1)
# - Exit if there's no match (--exit-0)
@@ -323,11 +300,9 @@ antigen bundle jira
antigen bundle man
antigen bundle node
antigen bundle npm
antigen bundle nvm
antigen bundle pip
antigen bundle pyenv
antigen bundle python
antigen bundle rbenv
antigen bundle rsync
antigen bundle ssh-agent
antigen bundle sudo
@@ -368,6 +343,8 @@ alias gb='git branch'
alias gba='git branch -a'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gcam='git commit --amend'
alias gcan='git commit --amend --no-edit'
alias gd='git diff -- . ":(exclude)yarn.lock"' # Show differences between index and working tree
alias gdc='git diff --cached' # Show changes in next commit (differences between index and last commit)
alias gdh='git diff head' # Show difference between files in working tree and last commit