mise-tool-management
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMise - Tool Management
Mise - 工具版本管理
Managing development tool versions across projects with Mise as a unified version manager.
使用Mise作为统一的版本管理器,跨项目管理开发工具版本。
Basic Tool Installation
基础工具安装
Installing Tools
安装工具
bash
undefinedbash
undefinedInstall specific version
Install specific version
mise install node@20.10.0
mise install python@3.12.0
mise install rust@1.75.0
mise install node@20.10.0
mise install python@3.12.0
mise install rust@1.75.0
Install latest version
Install latest version
mise install node@latest
mise install python@latest
mise install node@latest
mise install python@latest
Install from .tool-versions or mise.toml
Install from .tool-versions or mise.toml
mise install
undefinedmise install
undefinedSetting Tool Versions
设置工具版本
bash
undefinedbash
undefinedSet global version
Set global version
mise use --global node@20
mise use --global node@20
Set project version
Set project version
mise use node@20.10.0
mise use python@3.12 rust@1.75
mise use node@20.10.0
mise use python@3.12 rust@1.75
Use latest
Use latest
mise use node@latest
undefinedmise use node@latest
undefinedTool Configuration in mise.toml
mise.toml中的工具配置
Basic Tool Definitions
基础工具定义
toml
undefinedtoml
undefinedmise.toml
mise.toml
[tools]
node = "20.10.0"
python = "3.12.0"
rust = "1.75.0"
terraform = "1.6.0"
undefined[tools]
node = "20.10.0"
python = "3.12.0"
rust = "1.75.0"
terraform = "1.6.0"
undefinedVersion Prefixes
版本前缀
toml
[tools]toml
[tools]Latest patch version
Latest patch version
node = "20.10"
node = "20.10"
Latest minor version
Latest minor version
node = "20"
node = "20"
Latest version
Latest version
node = "latest"
node = "latest"
Prefix notation
Prefix notation
terraform = "1.6" # Latest 1.6.x
undefinedterraform = "1.6" # Latest 1.6.x
undefinedMultiple Versions
多版本配置
toml
[tools]toml
[tools]Use multiple versions
Use multiple versions
node = ["20.10.0", "18.19.0"]
python = ["3.12", "3.11", "3.10"]
```bashnode = ["20.10.0", "18.19.0"]
python = ["3.12", "3.11", "3.10"]
```bashSwitch between versions
Switch between versions
mise shell node@18.19.0
undefinedmise shell node@18.19.0
undefinedTool-Specific Configuration
工具专属配置
Node.js Configuration
Node.js配置
toml
[tools]
node = { version = "20.10.0", postinstall = "corepack enable" }toml
[tools]
node = { version = "20.10.0", postinstall = "corepack enable" }Python with Virtual Environments
搭配虚拟环境的Python配置
toml
[tools]
python = "3.12"
[env]
_.python.venv = { path = ".venv", create = true }toml
[tools]
python = "3.12"
[env]
_.python.venv = { path = ".venv", create = true }Custom Tool Sources
自定义工具源
toml
[tools]toml
[tools]From specific registry
From specific registry
"cargo:eza" = "latest"
"npm:typescript" = "5.3"
"cargo:eza" = "latest"
"npm:typescript" = "5.3"
From git repository
From git repository
my-tool = "git:https://github.com/org/tool.git"
undefinedmy-tool = "git:https://github.com/org/tool.git"
undefinedSupported Languages & Tools
支持的语言与工具
Core Tools
核心工具
toml
[tools]toml
[tools]Languages
Languages
bun = "1.0"
deno = "1.38"
elixir = "1.15"
erlang = "26.1"
go = "1.21"
java = "21"
node = "20.10"
python = "3.12"
ruby = "3.3"
rust = "1.75"
zig = "0.11"
bun = "1.0"
deno = "1.38"
elixir = "1.15"
erlang = "26.1"
go = "1.21"
java = "21"
node = "20.10"
python = "3.12"
ruby = "3.3"
rust = "1.75"
zig = "0.11"
Infrastructure
Infrastructure
terraform = "1.6"
kubectl = "1.28"
awscli = "2.13"
undefinedterraform = "1.6"
kubectl = "1.28"
awscli = "2.13"
undefinedPackage Managers
包管理器
toml
[tools]
"npm:pnpm" = "8.10"
"npm:yarn" = "4.0"
"cargo:cargo-binstall" = "latest"
"go:github.com/golangci/golangci-lint/cmd/golangci-lint" = "latest"toml
[tools]
"npm:pnpm" = "8.10"
"npm:yarn" = "4.0"
"cargo:cargo-binstall" = "latest"
"go:github.com/golangci/golangci-lint/cmd/golangci-lint" = "latest"Tool Version Strategies
工具版本策略
Lock to Specific Versions
锁定到特定版本
toml
undefinedtoml
undefinedProduction: Pin exact versions
Production: Pin exact versions
[tools]
node = "20.10.0"
terraform = "1.6.4"
undefined[tools]
node = "20.10.0"
terraform = "1.6.4"
undefinedUse Ranges for Flexibility
使用版本范围提升灵活性
toml
undefinedtoml
undefinedDevelopment: Use minor version ranges
Development: Use minor version ranges
[tools]
node = "20" # Any 20.x
python = "3.12" # Any 3.12.x
undefined[tools]
node = "20" # Any 20.x
python = "3.12" # Any 3.12.x
undefinedLatest for Experimentation
使用最新版本进行实验
toml
undefinedtoml
undefinedExperimental projects
Experimental projects
[tools]
rust = "latest"
bun = "latest"
undefined[tools]
rust = "latest"
bun = "latest"
undefinedManaging Tool Aliases
管理工具别名
Creating Aliases
创建别名
bash
undefinedbash
undefinedSet alias for current directory
Set alias for current directory
mise alias set node lts 20.10.0
mise alias set node lts 20.10.0
Set global alias
Set global alias
mise alias set --global python3 python@3.12
undefinedmise alias set --global python3 python@3.12
undefinedUsing Aliases in Configuration
在配置中使用别名
toml
[tools]
node = "lts"
python = "3.12"toml
[tools]
node = "lts"
python = "3.12"Tool Verification
工具验证
Check Installed Tools
检查已安装工具
bash
undefinedbash
undefinedList installed tools
List installed tools
mise list
mise list
Check current versions
Check current versions
mise current
mise current
Verify tool installation
Verify tool installation
mise doctor
undefinedmise doctor
undefinedTool Information
工具信息查询
bash
undefinedbash
undefinedShow tool details
Show tool details
mise ls-remote node
mise ls-remote node
List available versions
List available versions
mise ls-remote python
mise ls-remote python
Check latest version
Check latest version
mise latest node
undefinedmise latest node
undefinedMigration from Other Version Managers
从其他版本管理器迁移
From asdf
从asdf迁移
bash
undefinedbash
undefinedMise reads .tool-versions files
Mise reads .tool-versions files
cat .tool-versions
cat .tool-versions
nodejs 20.10.0
nodejs 20.10.0
python 3.12.0
python 3.12.0
Migrate to mise.toml
Migrate to mise.toml
mise use node@20.10.0 python@3.12.0
undefinedmise use node@20.10.0 python@3.12.0
undefinedFrom nvm
从nvm迁移
bash
undefinedbash
undefinedRead from .nvmrc
Read from .nvmrc
cat .nvmrc
cat .nvmrc
20.10.0
20.10.0
mise use node@$(cat .nvmrc)
undefinedmise use node@$(cat .nvmrc)
undefinedFrom pyenv
从pyenv迁移
bash
undefinedbash
undefinedRead from .python-version
Read from .python-version
mise use python@$(cat .python-version)
undefinedmise use python@$(cat .python-version)
undefinedBest Practices
最佳实践
Pin Production Dependencies
固定生产环境依赖版本
toml
undefinedtoml
undefinedGood: Explicit production versions
Good: Explicit production versions
[tools]
node = "20.10.0"
terraform = "1.6.4"
postgres = "16.1"
undefined[tools]
node = "20.10.0"
terraform = "1.6.4"
postgres = "16.1"
undefinedDocument Required Tools
记录所需工具
toml
undefinedtoml
undefinedmise.toml - All project dependencies in one place
mise.toml - All project dependencies in one place
[tools]
node = "20.10.0"
python = "3.12.0"
terraform = "1.6.4"
kubectl = "1.28.0"
[env]
PROJECT_NAME = "my-app"
undefined[tools]
node = "20.10.0"
python = "3.12.0"
terraform = "1.6.4"
kubectl = "1.28.0"
[env]
PROJECT_NAME = "my-app"
undefinedUse Tool-Specific Settings
使用工具专属设置
toml
[tools]toml
[tools]Enable corepack for package managers
Enable corepack for package managers
node = { version = "20.10.0", postinstall = "corepack enable" }
node = { version = "20.10.0", postinstall = "corepack enable" }
Create Python virtual environment
Create Python virtual environment
python = { version = "3.12", venv = ".venv" }
undefinedpython = { version = "3.12", venv = ".venv" }
undefinedVerify Tool Installation
验证工具安装
bash
undefinedbash
undefinedIn CI/CD pipelines
In CI/CD pipelines
mise install --check
mise doctor
mise install --check
mise doctor
Verify specific tools
Verify specific tools
mise current node
mise current python
undefinedmise current node
mise current python
undefinedCommon Patterns
常见模式
Monorepo Tool Management
单体仓库工具管理
toml
undefinedtoml
undefinedRoot mise.toml - shared tools
Root mise.toml - shared tools
[tools]
node = "20.10.0"
terraform = "1.6.4"
[tools]
node = "20.10.0"
terraform = "1.6.4"
packages/api/mise.toml - additional tools
packages/api/mise.toml - additional tools
[tools]
"npm:typescript" = "5.3"
"npm:prisma" = "5.7"
[tools]
"npm:typescript" = "5.3"
"npm:prisma" = "5.7"
packages/web/mise.toml
packages/web/mise.toml
[tools]
"npm:next" = "14.0"
undefined[tools]
"npm:next" = "14.0"
undefinedDevelopment vs Production
开发环境与生产环境区分
toml
undefinedtoml
undefinedmise.toml - production tools
mise.toml - production tools
[tools]
node = "20.10.0"
postgres = "16.1"
[tools]
node = "20.10.0"
postgres = "16.1"
mise.local.toml - development tools (gitignored)
mise.local.toml - development tools (gitignored)
[tools]
"npm:nodemon" = "latest"
"cargo:cargo-watch" = "latest"
undefined[tools]
"npm:nodemon" = "latest"
"cargo:cargo-watch" = "latest"
undefinedTool Updates Strategy
工具更新策略
bash
undefinedbash
undefinedCheck for updates
Check for updates
mise outdated
mise outdated
Update to latest patch version
Update to latest patch version
mise upgrade node
mise upgrade node
Update all tools
Update all tools
mise upgrade
mise upgrade
Update with constraints
Update with constraints
mise use node@20 # Updates to latest 20.x
undefinedmise use node@20 # Updates to latest 20.x
undefinedAnti-Patterns
反模式
Don't Mix Version Managers
不要混用多个版本管理器
bash
undefinedbash
undefinedBad: Using multiple version managers
Bad: Using multiple version managers
nvm use 20
mise use node@20 # Conflicts
nvm use 20
mise use node@20 # Conflicts
Good: Use only Mise
Good: Use only Mise
mise use node@20
undefinedmise use node@20
undefinedDon't Hardcode Tool Paths
不要硬编码工具路径
bash
undefinedbash
undefinedBad: Hardcoded paths
Bad: Hardcoded paths
/Users/me/.local/share/mise/installs/node/20.10.0/bin/node
/Users/me/.local/share/mise/installs/node/20.10.0/bin/node
Good: Use mise shims or mise exec
Good: Use mise shims or mise exec
mise exec -- node
mise x -- node
undefinedmise exec -- node
mise x -- node
undefinedDon't Skip Version Constraints
不要跳过版本约束
toml
undefinedtoml
undefinedBad: No version specified
Bad: No version specified
[tools]
node = "latest" # Can break on updates
[tools]
node = "latest" # Can break on updates
Good: Specify constraints
Good: Specify constraints
[tools]
node = "20.10.0" # Explicit
[tools]
node = "20.10.0" # Explicit
OR
OR
node = "20" # Controlled range
undefinednode = "20" # Controlled range
undefinedDon't Ignore Tool Dependencies
不要忽略工具依赖
toml
undefinedtoml
undefinedBad: Missing required tools
Bad: Missing required tools
[tools]
terraform = "1.6"
[tools]
terraform = "1.6"
Missing: kubectl, helm for deployment
Missing: kubectl, helm for deployment
Good: Include all dependencies
Good: Include all dependencies
[tools]
terraform = "1.6.4"
kubectl = "1.28.0"
helm = "3.13.0"
undefined[tools]
terraform = "1.6.4"
kubectl = "1.28.0"
helm = "3.13.0"
undefinedAdvanced Patterns
进阶模式
Conditional Tool Installation
条件化工具安装
toml
[tools]toml
[tools]Install based on platform
Install based on platform
node = "20.10.0"
python = "3.12"
node = "20.10.0"
python = "3.12"
Platform-specific tools
Platform-specific tools
[tools."cargo:watchexec-cli"]
platforms = ["linux", "darwin"]
version = "latest"
undefined[tools."cargo:watchexec-cli"]
platforms = ["linux", "darwin"]
version = "latest"
undefinedTool Installation Hooks
工具安装钩子
toml
[tools]
node = {
version = "20.10.0",
postinstall = '''
corepack enable
npm install -g npm@latest
'''
}toml
[tools]
node = {
version = "20.10.0",
postinstall = '''
corepack enable
npm install -g npm@latest
'''
}Backend Selection
后端选择
toml
undefinedtoml
undefinedUse specific backend for tools
Use specific backend for tools
[tools]
[tools]
Use core backend (faster)
Use core backend (faster)
node = "core:20.10.0"
node = "core:20.10.0"
Use asdf plugin
Use asdf plugin
ruby = "asdf:3.3.0"
undefinedruby = "asdf:3.3.0"
undefinedRelated Skills
相关技能
- task-configuration: Defining tasks that use managed tools
- environment-management: Managing environment variables with tools
- task-configuration: 定义使用已管理工具的任务
- environment-management: 结合工具管理环境变量