Maintenance in progress: we are indexing a large batch of new skills. Some pages may load slowly or briefly show no results. Nothing is lost, and everything is back to normal within the hour.

Melos Guide

Guide for Melos monorepo management in Flutter/Dart projects. Use when user asks about melos setup, melos commands, workspace scripts, or monorepo workflows. Triggers on "melos bootstrap", "run melos script", "setup melos", "workspace management".

majiayu000 fee0ed3 2 files · 2.2 KB Updated 567 repo stars

File contents

Melos Guide

Melos 是 Flutter/Dart 单仓库 (monorepo) 管理工具。

初始化

# 安装 melos CLI(如未安装)
dart pub global activate melos

# 确保 PATH 包含 pub-cache/bin
export PATH="$PATH:$HOME/.pub-cache/bin"

# 初始化工作区依赖
melos bootstrap

预定义脚本

命令 说明
melos outdated 检查过期依赖
melos upgrade 升级依赖
melos gen 代码生成(仅对依赖 build_runner 的包)
melos analyze 静态分析
melos fix 自动修复
melos sort 排序 import
melos precommit 提交前检查:fix + format + sort
melos test 运行测试(仅对有 test/ 目录的包)

常用命令

melos run --help              # 查看所有脚本
melos clean && melos bootstrap # 清理并重新初始化
melos list                    # 列出所有包
melos exec --scope="pkg" -- cmd # 对特定包执行命令

工作区配置

根目录 pubspec.yaml

workspace:
  - apps/*
  - packages/*

子包 pubspec.yaml

resolution: workspace

majiayu000/claude-skill-registry-data/tree/main/development/melos-guide commit fee0ed30c4

Frequently asked questions

npx skillmds add majiayu000/melos-guide