Replies: 18 comments 4 replies
-
|
There is already an example for a Node.js project here (https://mise.jdx.dev/templates.html#a-node-js-project). Here is what I usually do with [tools]
node = '22'
[tasks.pnpmInstall]
alias = 'pi'
description = 'Installs dependencies with pnpm'
run = 'corepack enable && pnpm install'
sources = ['package.json', 'pnpm-lock.yaml', 'mise.toml']
outputs = ['node_modules/.pnpm/lock.yaml']
[tasks.dev]
description = 'Calls your dev script in `package.json`'
run = 'node --run dev'
depends = ['pnpmInstall']
[tasks.nodeRun]
alias = 'nr'
description = 'Call any script in your package.json file. Example: mise nr lint'
run = 'node --run {{arg(name="script")}}'
depends = ['pnpmInstall']Note that |
Beta Was this translation helpful? Give feedback.
-
|
presets: https://github.com/jdx/mise/issues/3320#issuecomment-2510282208 |
Beta Was this translation helpful? Give feedback.
-
|
For additional context on the "template documentation". I wrote a few to demonstrate templates without readers needed to try in mise.toml. I would merge them into cookbooks to demonstrate the real world setup. I would also reduce the template documentation examples when cookbooks have good examples. |
Beta Was this translation helpful? Give feedback.
-
|
Agree that the existing examples could be moved to cookbooks now. We can do a page for each language (example: one page for Node.JS, one for terraform, one for python, etc.) Also, when seeing |
Beta Was this translation helpful? Give feedback.
-
|
Mise search https://github.com/jdx/mise/issues/3364#issue-2719788807 [tasks.search]
run = "mise use --pin $(mise registry -b aqua | fzf --multi | awk '{print $2}')"Might want to adapt it to not be aqua specific |
Beta Was this translation helpful? Give feedback.
-
I think it could be implemented internally, like for |
Beta Was this translation helpful? Give feedback.
-
|
I know skim can be imported as a library and has a very similar feature set to fzf. |
Beta Was this translation helpful? Give feedback.
-
|
we don't need no skim, we have demand |
Beta Was this translation helpful? Give feedback.
-
Not sure I trust the author of that library. I hear bad things π |
Beta Was this translation helpful? Give feedback.
-
|
this is a way to convert from though I'd like this to be a part of |
Beta Was this translation helpful? Give feedback.
-
|
I've been using docker to debug issues in a clean environment over the weekend: [tasks.docker]
run = "docker run --pull=always -it --rm --entrypoint bash jdxcode/mise:latest"Puts me in a fresh debian shell with mise installed. I then normally run the following manually: β― mise docker
[docker] $ docker run --pull=always -it --rm --entrypoint bash jdxcode/mise:latest
latest: Pulling from jdxcode/mise
Digest: sha256:eecc479b6259479ffca5a4f9c68dbfe8631ca62dc59aa60c9ab5e4f6e9982701
Status: Image is up to date for jdxcode/mise:latest
root@75f179a190a1:/mise# eval "$(mise activate bash)"
root@75f179a190a1:/mise# echo "" >/mise/config.toml
root@75f179a190a1:/mise# mise prune --yes
mise pruned configuration links
mise [email protected] β remove /mise/cache/python/3.13.1But it might be nice to automate that bit too. |
Beta Was this translation helpful? Give feedback.
-
|
Using # ~/.config/mise/config.toml
[tools]
"cargo:record-query" = "latest"function mise_parse_env {
rq -m < <(
zcat -q < <(
printf $'\x1f\x8b\x08\x00\x00\x00\x00\x00'
base64 -d <<< "$1"
)
)
}$ mise_parse_env "${__MISE_DIFF}"
{
"new": {
...
},
"old": {
...
},
"path": [
...
]
} |
Beta Was this translation helpful? Give feedback.
-
|
Nice one @joshbode! It could also be a great showcase of the new task tools feature that was recently merged, because cargo:record-query can be defined as a task tool. |
Beta Was this translation helpful? Give feedback.
-
|
Another trick that works with the latest version (required #3640 to make In ZSH to set the prompt colour whenever # activate mise like normal
source <(command mise activate zsh)
typeset -i _mise_updated
# replace default mise hook
function _mise_hook {
local diff=${__MISE_DIFF}
source <(command mise hook-env -s zsh)
[[ ${diff} == ${__MISE_DIFF} ]]
_mise_updated=$?
}
_PROMPT="β± " # or _PROMPT=${PROMPT} to keep the default
function _prompt {
if (( ${_mise_updated} )); then
PROMPT='%F{blue}${_PROMPT}%f'
else
PROMPT='%(?.%F{green}${_PROMPT}%f.%F{red}${_PROMPT}%f)'
fi
}
add-zsh-hook precmd _promptNow, when |
Beta Was this translation helpful? Give feedback.
-
|
I've seen a few similar requests around this behaviour: https://github.com/jdx/mise/issues/3808#issuecomment-2561850395 |
Beta Was this translation helpful? Give feedback.
-
|
I think this trimmed-down min_version = "2025.2.5"
[tasks.build]
description = "Build the project"
run = "go build ./..."
sources = ["go.mod", "go.sum", "**/*.go"]
outputs = { auto = true }
depends = ["generate"]
alias = "b"
[tasks.check]
description = "Run linters and tests"
depends = ["lint", "test"]
alias = "c"
[tasks.fix]
description = "Fix as many lint errors as possible"
run = "golangci-lint run --fix"
depends = ["build"]
alias = "f"
[tasks.generate]
description = "Run go:generate instructions located in the project's source code"
run = "go generate ./..."
depends = ["go-sanity-check"]
sources = ["go.mod", "go.sum", "**/*.go"]
outputs = { auto = true }
alias = "g"
[tasks.go-mod-graph]
description = "Generate graph of this project's module dependencies"
run = """
#!/usr/bin/env bash
go mod graph | digraph to dot > module-graph.dot
printf "Install Graphviz https://graphviz.org/, run 'dot -Tsvg -o module-graph.svg module-graph.dot' and open module-graph.svg in your web browser.\n"
"""
[tasks.go-sanity-check]
description = "Run various quick Go-related sanity checks"
hide = true
run = [
"go mod verify",
"go mod download",
"go mod tidy",
"git diff --exit-code -- go.mod go.sum",
]
[tasks.golangci-lint]
# Edit .golangci.yml to set the linters used
description = "Run golangci-lint"
hide = true
run = "golangci-lint run"
depends = "build"
sources = ["go.mod", "go.sum", "**/*.go"]
outputs = { auto = true }
# If this task and test run at the same time, force it to run last to improve
# diagnostics in case of test compilation failures.
wait_for = ["test"]
[tasks.lint]
description = "Run linters"
hide = true
depends = [
"go-sanity-check",
"golangci-lint",
]
[tasks.test]
description = "Run tests"
run = "go test -shuffle=on -race ./..."
depends = "build"
sources = ["go.mod", "go.sum", "**/*.go"]
outputs = { auto = true }
alias = "t"
[tasks.update-versions]
description = "Update tools and dependencies"
run = [
"mise x -- go get -u -t ./...",
"mise up"
]
alias = "u"
[tools]
go = "latest"
"go:golang.org/x/tools/cmd/digraph" = "latest"
golangci-lint = "latest" |
Beta Was this translation helpful? Give feedback.
-
|
Whatever tool I use to manage Rubies, I end up trying to re-create RVM's gemsets to allow each app to run in a relatively clean environment, usually with some allowances for sharing certain gems. This sets up Ruby's [[env]]
GEM_HOME = "{{config_root}}/.gem/ruby/{{exec(command='cat .ruby-version')}}"
GEM_PATH = "{{env.GEM_HOME}}"
[[env]]
_.path = "{{env.GEM_HOME}}/bin"
[hooks]
enter = [
"[ -d \"$GEM_HOME\" ] || mkdir -p \"$GEM_HOME\"",
"gem which ruby-lsp > /dev/null 2>&1 || gem install ruby-lsp"
] |
Beta Was this translation helpful? Give feedback.
-
|
My teammates were used to using aliases, so I made a hook to onboard them to mise, coming from a shared alias file. All mise tasks with aliases will get aliased. [tools]
jq = "latest"
[[hooks.enter]]
description = "Setup aliasses in BASH without poluting ~/.bashrc"
shell="bash"
script = """
mkdir -p /tmp/mise
mise tasks --json | jq -r '
.[] |
select(.hide != true and .aliases != null and .aliases != []) |
.name as $name |
.aliases[] |
"alias \\(.)=\\"mise r \\($name)\\""
' > /tmp/mise/aliases.sh
chmod +x /tmp/mise/aliases.sh
eval "$(cat /tmp/mise/aliases.sh)"
"""
[[hooks.enter]]
description = "Setup aliasses in ZSH without poluting ~/.zshrc"
shell="zsh"
script = """
mkdir -p /tmp/mise
mise tasks --json | jq -r '
.[] |
select(.hide != true and .aliases != null and .aliases != []) |
.name as $name |
.aliases[] |
"alias \\(.)=\\"mise r \\($name)\\""
' > /tmp/mise/aliases.sh
chmod +x /tmp/mise/aliases.sh
eval "$(cat /tmp/mise/aliases.sh)"
""" |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to create a cookbook section for the docs. Show me parts of your mise.toml you think are interesting.
In particular I think tasks, hooks, and env would be really helpful for people to see examples of.
Beta Was this translation helpful? Give feedback.
All reactions