Monoweave

View GitHub Project

Configuring Monoweave

For a full list of CLI arguments, run:

yarn monoweave --help

To fine-tune monoweave, create a

monoweave.config.js
file and invoke monoweave via:

yarn monoweave --config-file monoweave.config.js

Monoweave natively supports:

.js
,
.json
,
.jsonc
,
.json5
,
.yml
, and
.yaml
file extensions. If no configuration file is specified, monoweave will look for the files in no particular order so make sure you don't have duplicate configuration files.

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

yarn monoweave --dry-run --preset monoweave/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 monoweave configuration. You can also use any of the built-in presets.

yarn monoweave --preset monoweave/preset-recommended

The "recommended" preset does not currently differ from the defaults much. It may be expanded in the future.

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
).

/** @type {import('@monoweave/types').MonoweaveConfigFile} */
module.exports = {
preset: 'monoweave/preset-recommended',
// Aggregates changelog entries to a single file instead of the "recommended"
// default of per-workspace.
changelogFilename: 'CHANGELOG.md',
}

monoweave/preset-legacy

This is the old behaviour if coming from the predecessor of monoeave: monodeploy.

yarn monoweave --preset monoweave/preset-legacy

The "legacy" preset differs from the monoweave default in that:

  • It will not modify your package.json files.
  • Auto commit and push are disabled.
  • No changelog filename is specified (so changelogs are disabled).

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.

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 monoweave 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 | false | { name: string, key: string }

Default: Partial internal implementation (not recommended)

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

Set explicitly to false to disable conventional changelog mode and enter a "manual" mode that determines versions based on version files.

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: true

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: "os.availableParallelism()"

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, Monoweave 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, Monoweave 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 Monoweave plugins. See the plugin section of the documentation for more information.

prerelease
boolean

Default: false

Whether to run Monoweave 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.