{ "$schema": "http://json-schema.org/draft-07/schema", "title": "melos.yaml", "description": "The workspace configuration file for Melos", "type": "object", "required": ["name", "packages"], "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "name": { "type": "string", "description": "The name of the Melos workspace - used by IDE documentation." }, "repository": { "anyOf": [ { "type": "string", "description": "The hosted git repository which contains the workspace." }, { "type": "object", "description": "The self-hosted git repository which contains the workspace.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "required": ["type", "origin", "owner", "name"], "properties": { "type": { "type": "string", "description": "The type of repository", "enum": ["github", "gitlab"] }, "origin": { "type": "string", "description": "The origin of the repository, e.g. https://git.example.dev/gitlab" }, "owner": { "type": "string", "description": "The owner of the repository" }, "name": { "type": "string", "description": "The name of the repository" } } } ] }, "packages": { "type": "array", "description": "Patterns for packages that are included in the melos workspace.", "items": { "type": "string" } }, "ignore": { "type": "array", "description": "Patterns for packages to exclude from the melos workspace.", "items": { "type": "string" } }, "sdkPath": { "type": "string", "description": "Path to the Dart/Flutter SDK that should be used." }, "quiet": { "type": "boolean", "description": "Whether to only print warnings, errors and the output of failed commands. Defaults to false.", "default": false }, "useRootAsPackage": { "type": "boolean", "description": "Whether to include the repository root as a package in the workspace. Defaults to false.", "default": false }, "discoverNestedWorkspaces": { "type": "boolean", "description": "Whether to recursively discover packages in nested workspaces. Defaults to false.", "default": false }, "pub": { "type": "object", "description": "Configuration for HTTP requests to pub or alternate registries.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "timeoutSeconds": { "type": "number", "description": "Optional timeout in seconds applied to registry HTTP requests. Use 0 or omit to disable timeouts (default)." }, "retry": { "type": "object", "description": "Retry/backoff settings applied to registry HTTP requests.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "delayFactorMillis": { "type": "number", "description": "Base delay in milliseconds before exponential backoff is applied. Defaults to 200ms." }, "randomizationFactor": { "type": "number", "description": "Jitter factor between 0 and 1 applied to each retry delay. Defaults to 0.25 (25%)." }, "maxDelaySeconds": { "type": "number", "description": "Maximum delay in seconds between retry attempts. Defaults to 30 seconds." }, "maxAttempts": { "type": "integer", "description": "Maximum number of attempts (including the first request) before giving up. Defaults to 8." } } } } }, "categories": { "type": "object", "description": "Categorize packages in the workspace.", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "ide": { "type": "object", "description": "IDE-specific configurations.\n\nThis allows connecting the different scripts to the IDE or tells melos to generate the necessary files for mono-repositories to work in the IDE.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "intellij": { "description": "IntelliJ-specific configurations.", "anyOf": [ { "type": "boolean", "description": "Whether IntelliJ support is enabled." }, { "type": "object", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "enabled": { "type": "boolean", "description": "Whether IntelliJ support is enabled." }, "moduleNamePrefix": { "type": "string", "description": "Used when generating IntelliJ project modules files, this value specifies a string to prepend to a package's IntelliJ module name.\n\nThe default is 'melos_'." }, "executeInTerminal": { "type": "boolean", "description": "Whether to execute the script in a terminal.\n\nThe default is true." }, "generateAppRunConfigs": { "type": "boolean", "description": "Whether to generate the run configurations for running Flutter apps and the executables of Dart packages.\n\nThe default is true." }, "scriptNamePrefix": { "type": "string", "description": "The text prepended to generated IntelliJ run configuration names for Melos scripts.\n\nThe default is 'Melos Run -> '. Set this to an empty string to omit the prefix." }, "runArguments": { "type": "object", "description": "The run configurations to generate per Flutter app package, by package name. A package with a configured entry point that exists is treated as a Flutter app.", "patternProperties": { "^x-": {} }, "additionalProperties": { "type": "array", "items": { "type": "object", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "name": { "type": "string", "description": "The display name suffix and output file name of the run configuration." }, "entryPoint": { "type": "string", "description": "The Dart file to run, relative to the package root.\n\nThe default is 'lib/main.dart'." }, "args": { "type": "string", "description": "Additional arguments to pass to 'flutter run'." }, "default": { "type": "boolean", "description": "Whether the entry replaces the default run configuration of the package." } } } } } } } ] } } }, "command": { "type": "object", "description": "Command-specific configurations.\n\nThis allows customizing the default behavior of melos commands.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "bootstrap": { "type": "object", "description": "The bootstrap command configuration.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "runPubGetInParallel": { "type": "boolean", "description": "Has no effect. Bootstrap runs a single `pub get` at the workspace root." }, "runPubGetOffline": { "type": "boolean", "description": "Whether to attempt to run `pub get` in offline mode during bootstrapping." }, "enforceLockfile": { "type": "boolean", "description": "Whether `pubspec.lock` is enforced when running `pub get` or not.\nUseful when you want to ensure the same versions of dependencies are used across different environments/machines.\n\nDefaults to false." }, "noExample": { "type": "boolean", "description": "Whether `pub get` is run with `--no-example`, so the example directory of a package is not resolved.\n\nDefaults to false." }, "noPub": { "type": "boolean", "description": "Whether to skip running `pub get`. Shared dependencies, dependency overrides and IDE files are still applied.\n\nDefaults to false." }, "pubGetArgs": { "type": "array", "description": "Additional arguments to pass to `pub get` during bootstrapping.", "items": { "type": "string" } }, "hooks": { "description": "Hooks to run at certain points of the command lifecycle.", "allOf": [{ "$ref": "#/$defs/commonHooks" }] }, "dependencyOverridePaths": { "type": "array", "description": "A list of paths to local packages relative to the workspace directory that should be added to each workspace package's dependency overrides. Each entry can be a specific path or a glob pattern.", "items": { "type": "string" } }, "dependencyOverrides": { "type": "object", "description": "Dependencies that should be added to each workspace package's dependency overrides." }, "environment": { "type": "object", "description": "Environment configuration to be synced between all packages." }, "dependencies": { "type": "object", "description": "Dependencies to be synced between all packages." }, "dev_dependencies": { "type": "object", "description": "Dev dependencies to be synced between all packages." }, "markSharedDependencies": { "type": "boolean", "description": "Whether the entries that are synced from `environment`, `dependencies` and `dev_dependencies` are marked with a comment in the `pubspec.yaml` files of the packages.\n\nDefaults to false." } } }, "publish": { "type": "object", "description": "The publish command configuration.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "dryRun": { "type": "boolean", "description": "Whether packages are validated but not actually published.\n\nDefaults to true." }, "gitTagVersion": { "type": "boolean", "description": "Whether to add any missing tags for the published release. Tags are only created when `dryRun` is disabled.\n\nDefaults to false." }, "force": { "type": "boolean", "description": "Whether to skip the confirmation prompt when `dryRun` is disabled.\n\nDefaults to false." }, "skipValidation": { "type": "boolean", "description": "Whether packages are published without validation and resolution, forwarded to `dart pub publish --skip-validation`.\n\nDefaults to false." }, "pubServer": { "type": "string", "description": "The URL of the package server to publish to. When not set, the per-package `publish_to` field is used." }, "hooks": { "type": "object", "description": "Hooks to run at certain points of the command lifecycle.", "properties": { "pre": { "type": "string", "description": "Hook to run before publishing." }, "post": { "type": "string", "description": "Hook to run after publishing." } } } } }, "version": { "type": "object", "description": "The version command configuration.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "updateChangelog": { "type": "boolean", "description": "Whether to update the CHANGELOG.md files of the versioned packages.\n\nDefaults to true." }, "updateDependentsConstraints": { "type": "boolean", "description": "Whether to update the dependency version constraints of packages that depend on any of the packages that are versioned.\n\nDefaults to true." }, "updateDependentsVersions": { "type": "boolean", "description": "Whether to make a new patch version and changelog entry in packages that are updated because of `updateDependentsConstraints`.\n\nDefaults to true." }, "gitTagVersion": { "type": "boolean", "description": "Whether to tag the release.\n\nDefaults to true." }, "gitCommitVersion": { "type": "boolean", "description": "Whether to commit the changes made to the pubspec.yaml and changelog files. Disabling this also disables `gitTagVersion`.\n\nDefaults to true." }, "signOff": { "type": "boolean", "description": "Whether to add a `Signed-off-by` trailer to the version commit.\n\nDefaults to false." }, "force": { "type": "boolean", "description": "Whether to skip the confirmation prompt.\n\nDefaults to false." }, "versionPrivatePackages": { "type": "boolean", "description": "Whether to also version private packages, which are skipped by default.\n\nDefaults to false." }, "preid": { "type": "string", "description": "The prerelease identifier to use when versioning packages as a prerelease." }, "dependentPreid": { "type": "string", "description": "The prerelease identifier to use for packages that are versioned because of a change in a dependency version. Falls back to `preid`." }, "message": { "type": "string", "description": "A custom header for the generated CHANGELOG.md." }, "includeScopes": { "type": "string", "description": "Whether to include conventional commit scopes in the generated CHANGELOG.md." }, "linkToCommits": { "type": "boolean", "description": "Whether to add links to commits in the generated CHANGELOG.md.\n\nDisabled by default." }, "workspaceChangelog": { "type": "boolean", "description": "Whether to additionally generate a summary CHANGELOG.md at the root of the workspace." }, "branch": { "type": "string", "description": "If specified, prevents `melos version` from being used inside branches other than the one specified." }, "updateGitTagRefs": { "type": "boolean", "description": "Whether to also update pubspec with git referenced packages." }, "releaseUrl": { "type": "boolean", "description": "Whether to generate and print a link to the prefilled release creation page for each package after versioning.\n\nDisabled by default." }, "smartDependents": { "type": "boolean", "description": "Whether to only bump dependent versions and update constraints when declared SemVer constraints do not allow the updated version.\n\nDisabled by default." }, "mode": { "type": "string", "enum": ["independent", "fixed"], "description": "The mode in which packages in the workspace are versioned. In \"fixed\" mode (also known as lockstep versioning), every versioning run bumps all packages to the same new version, which is determined by the most significant change across the whole workspace.\n\nDefaults to \"independent\"." }, "workspaceTag": { "type": "boolean", "description": "Whether to tag releases with a single plain version tag for the whole workspace, e.g. \"v1.2.3\", instead of one tag per package, e.g. \"package_name-v1.2.3\". Only supported when \"mode\" is \"fixed\".\n\nDefaults to false." }, "fetchTags": { "type": "boolean", "description": "Whether to fetch tags from the origin remote before versioning.\n\nDefaults to true." }, "changelogFormat": { "type": "object", "description": "Configure the format of the generated CHANGELOG.md.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "includeDate": { "type": "boolean", "description": "Whether to include the date in the changelog entry in the `yyyy-MM-dd` format.\n\nDisabled by default." }, "groupByType": { "type": "boolean", "description": "Whether to group changelog entries by their conventional commit type (e.g. all features under a \"Features\" header and all fixes under a \"Bug Fixes\" header).\n\nDisabled by default." } } }, "hooks": { "description": "Hooks to run at certain points of the command lifecycle.", "allOf": [ { "$id": "#/$defs/commonHooks" }, { "type": "object", "properties": { "preCommit": { "$ref": "#/$defs/script" } } } ] } } }, "clean": { "type": "object", "description": "The clean command configuration.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "hooks": { "description": "Hooks to run at certain points of the command lifecycle.", "allOf": [{ "$ref": "#/$defs/commonHooks" }] } } } , "analyze": { "type": "object", "description": "The analyze command configuration.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "concurrency": { "type": "integer", "description": "The number of packages to analyze concurrently.\n\nDefaults to 1." }, "fatalInfos": { "type": "boolean", "description": "Whether info level issues are treated as fatal errors.\n\nDefaults to true." }, "fatalWarnings": { "type": "boolean", "description": "Whether warnings are treated as fatal errors." }, "noPub": { "type": "boolean", "description": "Whether `--no-pub` is passed to `flutter analyze`, to skip the implicit pub get. Has no effect on `dart analyze`.\n\nDefaults to false." } } }, "exec": { "type": "object", "description": "The exec command configuration. Also used as the defaults for the exec options of scripts.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "concurrency": { "type": "integer", "description": "The number of packages to run the command in concurrently.\n\nDefaults to the number of processors." }, "failFast": { "type": "boolean", "description": "Whether to stop executing the command in further packages as soon as it fails in one package.\n\nDefaults to false." }, "orderDependents": { "type": "boolean", "description": "Whether to order the execution of the command based on the dependency graph of the packages.\n\nDefaults to false." }, "groupLogs": { "type": "boolean", "description": "Whether the output of each package is buffered and printed grouped per package.\n\nDefaults to false." }, "ignoreSources": { "type": "boolean", "description": "Whether the sources of commands are ignored, so that they run in every package without calculating or storing checksums.\n\nDefaults to false." } } }, "format": { "type": "object", "description": "The format command configuration.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "concurrency": { "type": "integer", "description": "The number of packages to format concurrently.\n\nDefaults to 1." }, "setExitIfChanged": { "type": "boolean", "description": "Whether to return exit code 1 if there are any formatting changes.\n\nDefaults to false." }, "output": { "type": "string", "enum": ["json", "none", "show", "write"], "description": "Where `dart format` writes its output to.\n\nDefaults to write." }, "lineLength": { "type": "integer", "description": "The line length to format the code to." } } }, "list": { "type": "object", "description": "The list and changed command configuration.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "long": { "type": "boolean", "description": "Whether to show extended information.\n\nDefaults to false." }, "relativePaths": { "type": "boolean", "description": "Whether to print package paths relative to the root of the workspace.\n\nDefaults to false." }, "format": { "type": "string", "enum": ["column", "parsable", "json", "graph", "gviz", "mermaid"], "description": "The output format.\n\nDefaults to column." } } }, "run": { "type": "object", "description": "The run command configuration.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "noSelect": { "type": "boolean", "description": "Whether to skip the prompt that asks which package to run a script in, when the script defines packageFilters.\n\nDefaults to false." } } }, "test": { "type": "object", "description": "The test command configuration.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "concurrency": { "type": "integer", "description": "The number of packages to run tests in concurrently.\n\nDefaults to 1." }, "noPub": { "type": "boolean", "description": "Whether `--no-pub` is passed to `flutter test`, to skip the implicit pub get. Has no effect on `dart test`.\n\nDefaults to false." } } } } }, "scripts": { "type": "object", "description": "A list of scripts that can be executed with `melos run` or will be executed before/after some specific melos commands.", "patternProperties": { "^x-": {} }, "additionalProperties": { "$ref": "#/$defs/script" } } }, "$defs": { "script": { "anyOf": [ { "type": "string", "description": "The command to execute." }, { "allOf": [ { "if": { "type": "object", "required": ["stdio"], "properties": { "stdio": { "const": "inherit" } } }, "then": { "allOf": [ { "not": { "required": ["exec"] } }, { "not": { "required": ["steps"] } } ] } }, { "not": { "required": ["run", "exec"] } }, { "not": { "required": ["exec", "steps"] } }, { "anyOf": [ { "type": "object", "required": ["run"] }, { "type": "object", "required": ["exec"] }, { "type": "object", "required": ["steps"] }, { "type": "object", "required": ["dependsOn"] } ] }, { "type": "object", "description": "The script definition.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "name": { "type": "string", "description": "A unique identifier for the script." }, "description": { "type": "string", "description": "A short description, shown when using `melos run` with no argument." }, "run": { "type": "string", "description": "The command to execute." }, "exec": { "anyOf": [ { "type": "string", "description": "The command to execute in multiple packages." }, { "type": "object", "description": "The command to execute in multiple packages, and the options to pass to `exec`.", "required": ["command"], "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "command": { "type": "string", "description": "The command to execute in multiple packages." }, "concurrency": { "type": "integer", "description": "The number of packages to execute the command in concurrently." }, "failFast": { "type": "boolean", "description": "Whether exec should fail fast and not execute the script in further packages if the script fails in a individual package." }, "orderDependents": { "type": "boolean", "description": "Whether exec should order the execution of the script based on the dependency graph of the packages." }, "groupLogs": { "type": "boolean", "description": "Whether the output of each package should be buffered and printed grouped per package once every package has finished, with failed packages printed last." }, "sources": { "type": "array", "items": { "type": "string" }, "description": "Globs relative to the root of each package. The script is skipped in the packages in which the matching files, and those of their dependencies in the workspace, did not change since the script last succeeded." } } } ] }, "steps": { "type": "array", "description": "Scripts, or commands, to run one after the other.", "items": { "type": "string" } }, "dependsOn": { "type": "array", "description": "The names of the scripts that have to run successfully before this script runs.", "items": { "type": "string" } }, "private": { "type": "boolean", "description": "Whether the script is hidden from `melos run`, so that it can only be referenced as a step of another script." }, "groups": { "type": "array", "description": "The groups to list the script under when running `melos run` with no argument.", "items": { "type": "string" } }, "stdio": { "description": "How the standard streams of the script's process are wired to melos. Use `inherit` to give the script a real terminal. The default is `pipe`.", "enum": ["pipe", "inherit"] }, "env": { "type": "object", "description": "Environment variables that will be passed to the command to execute.", "additionalProperties": { "anyOf": [ { "type": "string" }, { "type": "number" }, { "type": "integer" }, { "type": "boolean" }, { "type": "null" } ], "description": "The value of the environment variable." } }, "packageFilters": { "$ref": "#/$defs/packageFilters" } } } ] } ] }, "packageFilters": { "type": "object", "description": "If the command to execute is a melos command, allows filtering packages that will execute the command.", "patternProperties": { "^x-": {} }, "additionalProperties": false, "properties": { "scope": { "description": "Patterns for including packages by name.", "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ] }, "ignore": { "description": "Patterns for excluding packages by name.", "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ] }, "category": { "description": "Patterns for including packages by category.", "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ] }, "dirExists": { "description": "Include a package only if a given directory exists.", "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ] }, "fileExists": { "description": "Include a package only if a given file exists.", "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ] }, "dependsOn": { "description": "Include only packages that depend on a specific package.", "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ] }, "noDependsOn": { "description": "Include only packages that do not depend on a specific package.", "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ] }, "diff": { "type": "string", "description": "Filter packages based on whether there were changes between a commit and the current HEAD or within a range of commits. A range of commits can be specified using the git short hand syntax `..` and `...." }, "private": { "type": "boolean", "description": "Include packages with `publish_to: none`." }, "noPrivate": { "type": "boolean", "description": "Exclude packages with `publish_to: none`." }, "published": { "type": "boolean", "description": "Include/Exclude packages that are up-to-date on pub.dev." }, "flutter": { "type": "boolean", "description": "Include/Exclude packages that are Flutter packages." }, "includeDependents": { "type": "boolean", "description": "Include all transitive dependents for each package that matches the other filters." }, "includeDependencies": { "type": "boolean", "description": "Include all transitive dependencies for each package that matches the other filters." }, "postFilters": { "description": "Filters that are applied to all packages after the dependents and dependencies have been included. Supports the same filters as `packageFilters`, except `includeDependents`, `includeDependencies` and `postFilters`.", "allOf": [ { "$ref": "#/$defs/packageFilters" }, { "not": { "anyOf": [ { "required": ["includeDependents"] }, { "required": ["includeDependencies"] }, { "required": ["postFilters"] } ] } } ] } } }, "commonHooks": { "type": "object", "properties": { "pre": { "$ref": "#/$defs/script" }, "post": { "$ref": "#/$defs/script" } } } } }