Monodeploy

View GitHub Project

Configuring Monodeploy

For a full list of CLI arguments, run:

yarn monodeploy --help

To fine-tune monodeploy, create a monodeploy.config.js file and invoke monodeploy via:

yarn monodeploy --config-file monodeploy.config.js

Note that monodeploy will automatically detect your monodeploy.config.js file if named correctly.

You can use a preset configuration as a basis for your monodeploy config, and add either additional config options or CLI flags to extend the preset. For example:

yarn monodeploy --dry-run --preset monodeploy/preset-recommended

Presets

A preset can be a filepath (relative or absolute) or the name of an installed npm package. You can pass a preset via the CLI argument or option directly in your config file. Other options are then merged with the values in the preset. In terms of precedence, CLI flags take highest precedence, followed by config file options, followed by preset values, and then finally the built-in defaults.

The preset should ultimately point to a file which exports a monodeploy configuration. You can also use any of the built-in presets.

yarn monodeploy --dry-run --preset monodeploy/preset-recommended

The "recommended" preset differs from the monodeploy default in that it will modify your package.json files, commit the changes, and then automatically push said changes to your remote git repository.

Configuration File

If you omit a property, a reasonable default will be used. Note that setting a property to null is not always the same as omitting the property (or setting it to undefined).

module.exports = {
preset: 'monodeploy/preset-recommended',
changelogFilename: 'CHANGELOG.md',
}

Schema

NameDescription
access
infer | public | restricted

Default: infer

This overrides the access defined in the publishConfig of individual workspaces. Set this to 'infer' to respect individual workspace configurations.

applyChangeset
boolean

Default: No Default

Whether to resume publishing from a changeset. This option can only be set from the command line, and cannot be provided via a monodeploy.config.js file. This feature is not available yet. If you're interested in this feature, please leave comments on the GitHub Issue.

autoCommit
boolean

Default: false

Whether to automatically create a release commit after a publish. If using autoCommit, you must also have one of 'persistVersions' or 'changelogFilename' set.

autoCommitMessage
string

Default: "chore: release [skip ci]"

The commit message to use when autoCommit is enabled.

changelogFilename
string

Default: No Default

The filename to write changelogs to, assuming a conventional changelog config has been set. Use '<packageDir>' to reference the cwd of an individual workspace. You should also enable 'autoCommit' when this is set so that the changelogs are committed to your repo.

changesetFilename
string

Default: No Default

The filename to write the changeset to. This is a metadata file which after a monodeploy run, will contain change history useful for external scripts. Set to '-' to write to stdout.

changesetIgnorePatterns
string[]

Default: []

An array of micromatch globs which will be used to filter out modified files. You can use this to skip modifications to 'test files' as part of the 'how this package changed' determination.

commitIgnorePatterns
string | RegExp[]

Default: []

An array of regular expressions which will be used to filter out commits from the explicit package bump detection. The patterns are matched against commits of the form: <sha> <newline> <body>

conventionalChangelogConfig
string | { name: string, key: string }

Default: Partial internal implementation (not recommended)

A conventional changelog config package name. This is required for changelog generation. This config determines the changelog format, as well as the version strategy determiner.

cwd
string

Default: cwd

The working directory to run all operations from. Defaults to the current working directory.

dryRun
boolean

Default: false

If enabled, any operation performing a destructive action on an external system is skipped over. This includes publishing to NPM, committing to git, and execution of lifecycle scripts. Use dry run to preview publish changes, and to validate your configuration.

forceWriteChangeFiles
boolean

Default: false

By default, the changeset and changelog files are not written in dry run mode, as they constitute a change to an external system. Enable force write to write these change files, which can be useful for generating publish previews.

git.baseBranch
string

Default: last tagged commit

The base git ref to using as the starting point of package change discovery. If not set, this will default to the last tagged commit. You usually do not want to set this.

git.commitSha
string

Default: HEAD

The git ref which marks the "end point" of package change discovery. This defaults to HEAD. You usually do not want to set this.

git.push
boolean

Default: false

Whether to push to the git remote. This works in conjunction with the git.tag and autoCommit options, thus allowing you to create the tags and release commit automatically while deferring the actual push.

git.remote
string

Default: origin

The git remote name to push tags and the release commit to. Defaults to origin.

git.tag
boolean

Default: true

Whether to create git tags to track the releases. It is useful to disable this when publishing to a test registry, where you do not want to modify the main git branch.

jobs
number

Default: 0 (No Limit)

The maximum number of packages whose lifecycle scripts can be run in parallel. Similar to concurrency in Lerna.

logLevel
null | 0 | 1 | 2 | 3

Default: 1

Log levels. Control verbosity of output.

DEBUG: 0 INFO: 1 WARNING: 2 ERROR: 3

maxConcurrentReads
number

Default: 0 (Internal Implementation Detail)

The maximum number of package metadata to read from the NPM registry simultaneously. If no default is set, or set to 0, Monodeploy will use its discretion.

maxConcurrentWrites
number

Default: 0 (Internal Implementation Detail)

The maximum number of packages to publish to the NPM registry simultaneously. We have seen issues in the past with too many concurrent writes for private registries. If no default is set, or set to 0, Monodeploy will use its discretion.

packageGroupManifestField
string

Default: No Default

The manifest field name to use in workspace grouping. All packages within a group will always have the same version and git tag. If unset, all packages are versioned independently. Since the group is used for the git tag, it must not contain any characters not supported in a git tag.

You can use a '.' to access nested properties in the manifest file. For example, you can use 'publishConfig.group' to access the group property in your publishConfig.

packageGroups
Record

Default: No Default

Package group specific settings. Note that if no packageGroupManifestField is set, each workspace is in its own group.

persistVersions
boolean

Default: false

Whether to persist package.json modifications, i.e. updating the dependency versions and the version field of each published workspace. Most publishing tools act as if this is enabled. It can be useful to disable version persistence if you do not want your CI environment to write back to your Git repository. Useful for runners like Jenkins. You should also enable 'autoCommit' when this is set so that the changelogs are committed to your repo.

plugins
string | ???[]

Default: []

An array of Monodeploy plugins. See the plugin section of the documentation for more information.

prerelease
boolean

Default: false

Whether to run Monodeploy in Prerelease mode. In prerelease mode, versions are not published to the latest npm dist tag. This is meant for release candidates, and beta versions. Version strategy behaviour is also impacted by this mode.

prereleaseId
string

Default: "rc"

The identifier to use in the prerelease tag. Defaults to 'rc' as in '1.0.0-rc.1'.

prereleaseNPMTag
string

Default: "next"

The npm dist-tag to publish to in prerelease mode. Defaults to 'next'.

registryMode
RegistryMode

Default: "npm"

By default the latest package versions upon which the version strategy is applied is taken from the NPM registry (npm mode). If registryMode is set to 'manifest' the latest version is instead taken from the package.json files. Note that 'manifest' mode is incompatible with prerelease mode.

Can be either 'npm' or 'manifest'.

registryUrl
string

Default: Yarn Configuration

The NPM registry URL for fetching package information, and publishing packages. Note that this overrides any publishConfig.registryUrl or Yarn RC configuration.

topological
boolean

Default: false

Whether to run the lifecycle scripts of the packages to publish in topological order, based on dependencies and peerDependencies. This excludes devDependencies from the graph.

topologicalDev
boolean

Default: false

Similar to topological, however also consider devDependencies.

versionStrategy
VersionStrategyConfiguration

Default: undefined

Customizations to the version strategy logic.