mono 0.0.2
mono: ^0.0.2 copied to clipboard
The fastest and most flexible CLI for managing Dart/Flutter monorepos, tasks, scanning, groups, and more.
mono #
CLI for managing Dart/Flutter monorepos.
Install (from workspace) #
Run from the workspace root (Dart >= 3.5 with workspaces):
dart pub get
dart pub global activate --source path mono
Or run directly from source during development:
dart run mono:mono <args>
Quick start #
# 1) Create config and scaffolding
mono setup
# 2) Detect packages by pubspec and cache list
mono scan
# 3) See what was detected
mono list packages
# 4) Run pub get across all packages (dependency order by default)
mono get all
Commands #
- setup
- Creates
mono.yaml(if missing) - Creates
monocfg/withmono_projects.yamlandtasks.yaml(if missing)
- Creates
- scan
- Scans workspace for
pubspec.yamland writesmonocfg/mono_projects.yaml
- Scans workspace for
- list packages|groups|tasks
- Packages from scan cache; groups from
monocfg/groups/*.list; tasks frommono.yaml+monocfg/tasks.yaml
- Packages from scan cache; groups from
- get [targets]
- Runs
flutter pub getfor Flutter packages,dart pub getfor Dart packages - Targets:
all,:group,glob*,packageName - Options:
-j, --concurrency <n>,--order dependency|none,--dry-run
- Runs
Target selection #
Examples:
mono get all
mono get :apps
mono get core_*
mono get app,ui,core
mono build :apps
- Uses dependency order by default; disable with
--order none
Configuration #
Root file mono.yaml (created by mono setup):
settings:
monocfgPath: monocfg
concurrency: auto
defaultOrder: dependency
include:
- "**"
exclude:
- "monocfg/**"
- ".dart_tool/**"
groups: {}
tasks: {}
- settings.monocfgPath: path to the config folder
- include/exclude: globs for scanning
pubspec.yaml - groups: map of groupName -> list of members (names, globs, or nested ":group")
- tasks: task definitions (merged with
monocfg/tasks.yaml)
monocfg folder #
- monocfg/mono_projects.yaml
packages:
- name: app
path: apps/app
kind: flutter
- monocfg/tasks.yaml (optional)
build:
plugin: exec
run:
- dart run build_runner build --delete-conflicting-outputs
Notes:
- Tasks are merged on top of
mono.yamltasks. plugin: execlets you define arbitrary shell commands per package.
Concurrency #
-j, --concurrency <n>CLI flag overridessettings.concurrencyautopicks a heuristic based on available CPUs
Dependency order #
dependency(default): topological order using local path/name depsnone: keep input/selection order
Project groups #
Define named groups under monocfg/groups/ with one package name per line.
Example file monocfg/groups/apps.list:
app
ui
Usage examples:
mono list groups
mono get :apps
mono get :mobile --order none
Notes:
- Group files are simple lists; blank lines and
#comments are ignored. - Group names are derived from filenames:
<name>.listusing lowercase slugs[a-z0-9][a-z0-9-_]*.
Custom tasks (custom commands) #
You can define reusable tasks under tasks in mono.yaml or monocfg/tasks.yaml. These are merged, with monocfg/tasks.yaml taking precedence. The built-in exec plugin lets you run shell commands in each target package. Tasks are runnable as top-level commands: mono <task> [targets].
Example (monocfg/tasks.yaml):
build:
plugin: exec
run:
- dart run build_runner build --delete-conflicting-outputs
format:
plugin: exec
run:
- dart format .
test:
plugin: exec
run:
- dart test
Discover tasks:
mono list tasks
Notes:
plugin: execruns the firstrunentry as a command in the package directory (additional entries can be added later).- You can set environment variables with
env:and express dependencies between tasks withdependsOn:inmono.yaml. - Tasks in
monocfg/tasks.yamloverride/extend those inmono.yaml.