fix(deno): move guard check before aliases and remove deprecated commands

- Move the command existence check to the top of the plugin so aliases
  are not created when deno is not installed
- Remove  alias for  (deprecated and removed in Deno 2.0)
- Remove  alias for  (replaced by granular
  --unstable-* flags in Deno 2.0)
- Update README to reflect removed aliases and add usage instructions
This commit is contained in:
fauzan171 2026-06-06 23:44:04 +07:00
commit 963468fdf9
2 changed files with 23 additions and 20 deletions

View file

@ -2,19 +2,23 @@
This plugin sets up completion and aliases for [Deno](https://deno.land). This plugin sets up completion and aliases for [Deno](https://deno.land).
To use it, add `deno` to the plugins array in your zshrc file:
```zsh
plugins=(... deno)
```
## Aliases ## Aliases
| Alias | Full command | | Alias | Full command |
| ----- | ------------------- | | ----- | ---------------- |
| db | deno bundle | | dc | deno compile |
| dc | deno compile | | dca | deno cache |
| dca | deno cache | | dfmt | deno fmt |
| dfmt | deno fmt | | dh | deno help |
| dh | deno help | | dli | deno lint |
| dli | deno lint | | drn | deno run |
| drn | deno run | | drA | deno run -A |
| drA | deno run -A | | drw | deno run --watch |
| drw | deno run --watch | | dts | deno test |
| dru | deno run --unstable | | dup | deno upgrade |
| dts | deno test |
| dup | deno upgrade |

View file

@ -1,5 +1,9 @@
# Return immediately if deno is not found
if (( ! ${+commands[deno]} )); then
return
fi
# ALIASES # ALIASES
alias db='deno bundle'
alias dc='deno compile' alias dc='deno compile'
alias dca='deno cache' alias dca='deno cache'
alias dfmt='deno fmt' alias dfmt='deno fmt'
@ -8,15 +12,10 @@ alias dli='deno lint'
alias drn='deno run' alias drn='deno run'
alias drA='deno run -A' alias drA='deno run -A'
alias drw='deno run --watch' alias drw='deno run --watch'
alias dru='deno run --unstable'
alias dts='deno test' alias dts='deno test'
alias dup='deno upgrade' alias dup='deno upgrade'
# COMPLETION FUNCTION # COMPLETION FUNCTION
if (( ! $+commands[deno] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and # If the completion file doesn't exist yet, we need to autoload it and
# bind it to `deno`. Otherwise, compinit will have already done that. # bind it to `deno`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_deno" ]]; then if [[ ! -f "$ZSH_CACHE_DIR/completions/_deno" ]]; then