Skip to content

Commit

Permalink
fix(options): Document negated boolean options explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed Jan 15, 2019
1 parent 80092e5 commit 8bc9669
Show file tree
Hide file tree
Showing 12 changed files with 207 additions and 117 deletions.
10 changes: 7 additions & 3 deletions commands/add/command.js
Expand Up @@ -38,11 +38,15 @@ exports.builder = yargs => {
type: "string",
requiresArg: true,
},
bootstrap: {
"no-bootstrap": {
group: "Command Options:",
describe: "Automatically chain `lerna bootstrap`.\nPass --no-bootstrap to avoid this.",
describe: "Do not automatically chain `lerna bootstrap` after changes are made.",
type: "boolean",
},
bootstrap: {
// proxy for --no-bootstrap
hidden: true,
type: "boolean",
defaultDescription: "true",
},
})
.example(
Expand Down
5 changes: 5 additions & 0 deletions commands/exec/README.md
Expand Up @@ -72,3 +72,8 @@ $ lerna exec --no-bail <command>

By default, `lerna exec` will exit with an error if _any_ execution returns a non-zero exit code.
Pass `--no-bail` to disable this behavior, executing in _all_ packages regardless of exit code.

### `--no-prefix`

Disable package name prefixing when output is streaming (`--stream` _or_ `--parallel`).
This option can be useful when piping results to other processes, such as editor plugins.
28 changes: 18 additions & 10 deletions commands/exec/command.js
Expand Up @@ -22,28 +22,36 @@ exports.builder = yargs => {
type: "string",
})
.options({
bail: {
stream: {
group: "Command Options:",
describe: "Stop when the command fails in a package.\nPass --no-bail to continue despite failure.",
defaultDescription: "true",
describe: "Stream output with lines prefixed by originating package name.",
type: "boolean",
},
stream: {
parallel: {
group: "Command Options:",
describe: "Stream output with lines prefixed by package.",
describe: "Execute command with unlimited concurrency, streaming prefixed output.",
type: "boolean",
},
parallel: {
"no-bail": {
group: "Command Options:",
describe: "Run command in all packages with unlimited concurrency, streaming prefixed output",
describe: "Continue executing command despite non-zero exit in a given package.",
type: "boolean",
},
bail: {
// proxy for --no-bail
hidden: true,
type: "boolean",
},
// This option controls prefix for stream output so that it can be disabled to be friendly
// to tools like Visual Studio Code to highlight the raw results
prefix: {
"no-prefix": {
group: "Command Options:",
describe: "Pass --no-prefix to disable prefixing of streamed output.",
defaultDescription: "true",
describe: "Do not prefix streaming output.",
type: "boolean",
},
prefix: {
// proxy for --no-prefix
hidden: true,
type: "boolean",
},
});
Expand Down
18 changes: 18 additions & 0 deletions commands/publish/README.md
Expand Up @@ -48,6 +48,7 @@ This is useful when a previous `lerna publish` failed to publish all packages to
- [`--dist-tag <tag>`](#--dist-tag-tag)
- [`--no-git-reset`](#--no-git-reset)
- [`--no-verify-access`](#--no-verify-access)
- [`--preid`](#--preid)
- [`--registry <url>`](#--registry-url)
- [`--temp-tag`](#--temp-tag)
- [`--yes`](#--yes)
Expand Down Expand Up @@ -116,6 +117,23 @@ If you are using a third-party registry that does not support `npm access ls-pac

> Please use with caution
### `--preid`

Unlike the `lerna version` option of the same name, this option only applies to [`--canary`](#--canary) version calculation.

```sh
lerna publish --canary
# uses the next semantic prerelease version, e.g.
# 1.0.0 => 1.0.1-alpha.0

lerna publish --canary --preid next
# uses the next semantic prerelease version with a specific prerelease identifier, e.g.
# 1.0.0 => 1.0.1-next.0
```

When run with this flag, `lerna publish --canary` will increment `premajor`, `preminor`, `prepatch`, or `prerelease` semver
bumps using the specified [prerelease identifier](http://semver.org/#spec-item-9).

### `--registry <url>`

When run with this flag, forwarded npm commands will use the specified registry for your package(s).
Expand Down
16 changes: 12 additions & 4 deletions commands/publish/command.js
Expand Up @@ -44,19 +44,27 @@ exports.builder = yargs => {
describe: "Execute ./scripts/prepublish.js and ./scripts/postpublish.js, relative to package root.",
type: "boolean",
},
"no-git-reset": {
describe: "Do not reset changes to working tree after publishing is complete.",
type: "boolean",
},
"git-reset": {
describe: "Reset the git working tree.\nPass --no-git-reset to disable.",
// proxy for --no-git-reset
hidden: true,
type: "boolean",
defaultDescription: "true",
},
"temp-tag": {
describe: "Create a temporary tag while publishing.",
type: "boolean",
},
"no-verify-access": {
describe: "Do not verify package read-write access for current npm user.",
type: "boolean",
},
"verify-access": {
describe: "Verify package read-write access for current npm user.\nPass --no-verify-access to disable.",
// proxy for --no-verify-access
hidden: true,
type: "boolean",
defaultDescription: "true",
},
// y: {
// describe: "Skip all confirmation prompts.",
Expand Down
5 changes: 5 additions & 0 deletions commands/run/README.md
Expand Up @@ -75,3 +75,8 @@ $ lerna run --no-bail test

By default, `lerna run` will exit with an error if _any_ script run returns a non-zero exit code.
Pass `--no-bail` to disable this behavior, running the script in _all_ packages that contain it regardless of exit code.

### `--no-prefix`

Disable package name prefixing when output is streaming (`--stream` _or_ `--parallel`).
This option can be useful when piping results to other processes, such as editor plugins.
38 changes: 23 additions & 15 deletions commands/run/command.js
Expand Up @@ -17,28 +17,14 @@ exports.builder = yargs => {
type: "string",
})
.options({
bail: {
group: "Command Options:",
describe: "Stop when the script fails in a package.\nPass --no-bail to continue despite failure.",
defaultDescription: "true",
type: "boolean",
},
stream: {
group: "Command Options:",
describe: "Stream output with lines prefixed by package.",
type: "boolean",
},
parallel: {
group: "Command Options:",
describe: "Run script in all packages with unlimited concurrency, streaming prefixed output.",
type: "boolean",
},
// This option controls prefix for stream output so that it can be disabled to be friendly
// to tools like Visual Studio Code to highlight the raw results
prefix: {
group: "Command Options:",
describe: "Pass --no-prefix to disable prefixing of streamed output.",
defaultDescription: "true",
describe: "Run script with unlimited concurrency, streaming prefixed output.",
type: "boolean",
},
"npm-client": {
Expand All @@ -48,6 +34,28 @@ exports.builder = yargs => {
type: "string",
requiresArg: true,
},
"no-bail": {
group: "Command Options:",
describe: "Continue running script despite non-zero exit in a given package.",
type: "boolean",
},
bail: {
// proxy for --no-bail
hidden: true,
type: "boolean",
},
// This option controls prefix for stream output so that it can be disabled to be friendly
// to tools like Visual Studio Code to highlight the raw results
"no-prefix": {
group: "Command Options:",
describe: "Do not prefix streaming output.",
type: "boolean",
},
prefix: {
// proxy for --no-prefix
hidden: true,
type: "boolean",
},
});

return filterable(yargs);
Expand Down
98 changes: 48 additions & 50 deletions commands/version/README.md
Expand Up @@ -27,7 +27,7 @@ lerna version [major | minor | patch | premajor | preminor | prepatch | prerelea
# uses the next semantic version(s) value and this skips `Select a new version for...` prompt
```

When run with this flag, `lerna version` will skip the version selection prompt and [increment](https://github.com/npm/node-semver#functions) the version by that keyword.
When this positional parameter is passed, `lerna version` will skip the version selection prompt and [increment](https://github.com/npm/node-semver#functions) the version by that keyword.
You must still use the `--yes` flag to avoid all prompts.

#### "Graduating" prereleases
Expand All @@ -38,22 +38,22 @@ If you have any packages with a prerelease version number (e.g. `2.0.0-beta.3`)

- [`--allow-branch`](#--allow-branch-glob)
- [`--amend`](#--amend)
- [`--commit-hooks`](#--commit-hooks)
- [`--conventional-commits`](#--conventional-commits)
- [`--changelog-preset`](#--changelog-preset)
- [`--no-changelog`](#--no-changelog)
- [`--exact`](#--exact)
- [`--force-publish`](#--force-publish)
- [`--ignore-changes`](#--ignore-changes)
- [`--git-remote`](#--git-remote-name)
- [`--git-tag-version`](#--git-tag-version)
- [`--ignore-changes`](#--ignore-changes)
- [`--include-merged-tags`](#--include-merged-tags)
- [`--message`](#--message-msg)
- [`--no-changelog`](#--no-changelog)
- [`--no-commit-hooks`](#--no-commit-hooks)
- [`--no-git-tag-version`](#--no-git-tag-version)
- [`--no-push`](#--no-push)
- [`--preid`](#--preid)
- [`--push`](#--push)
- [`--sign-git-commit`](#--sign-git-commit)
- [`--sign-git-tag`](#--sign-git-tag)
- [`--yes`](#--yes)
- [`--include-merged-tags`](#--include-merged-tags)

### `--allow-branch <glob>`

Expand Down Expand Up @@ -105,21 +105,15 @@ This is useful during [Continuous integration (CI)](https://en.wikipedia.org/wik

In order to prevent unintended overwrites, this command will skip `git push` (i.e., it implies `--no-push`).

### `--commit-hooks`

Run git commit hooks when committing the version changes.

Defaults to `true`. Pass `--no-commit-hooks` to disable.

This option is analogous to the `npm version` [option](https://docs.npmjs.com/misc/config#commit-hooks) of the same name.

### `--conventional-commits`

```sh
lerna version --conventional-commits
```

When run with this flag, `lerna version` will use the [Conventional Commits Specification](https://conventionalcommits.org/) to [determine the version bump](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-recommended-bump) and [generate CHANGELOG](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli)
When run with this flag, `lerna version` will use the [Conventional Commits Specification](https://conventionalcommits.org/) to [determine the version bump](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-recommended-bump) and [generate CHANGELOG.md files](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli).

Passing [`--no-changelog`](#--no-changelog) will disable the generation (or updating) of `CHANGELOG.md` files.

### `--changelog-preset`

Expand All @@ -134,14 +128,6 @@ Presets are names of built-in or installable configuration for conventional chan
Presets may be passed as the full name of the package, or the auto-expanded suffix
(e.g., `angular` is expanded to `conventional-changelog-angular`).

### `--no-changelog`

```sh
lerna version --conventional-commits --no-changelog
```

When using `conventional-commits`, do not generate any `CHANGELOG.md` files.

### `--exact`

```sh
Expand All @@ -165,6 +151,14 @@ When run with this flag, `lerna version` will force publish the specified packag

> This will skip the `lerna changed` check for changed packages and forces a package that didn't have a `git diff` change to be updated.
### `--git-remote <name>`

```sh
lerna version --git-remote upstream
```

When run with this flag, `lerna version` will push the git changes to the specified remote instead of `origin`.

### `--ignore-changes`

Ignore changes in files matched by glob(s) when detecting changed packages.
Expand All @@ -188,21 +182,13 @@ Pass `--no-ignore-changes` to disable any existing durable configuration.
> 1. The latest release of the package is a `prerelease` version (i.e. `1.0.0-alpha`, `1.0.0–0.3.7`, etc.).
> 2. One or more linked dependencies of the package have changed.
### `--git-remote <name>`
### `--include-merged-tags`

```sh
lerna version --git-remote upstream
lerna version --include-merged-tags
```

When run with this flag, `lerna version` will push the git changes to the specified remote instead of `origin`.

### `--git-tag-version`

Commit and tag versioned changes.

Defaults to `true`. Pass `--no-git-tag-version` to disable.

This option is analogous to the `npm version` [option](https://docs.npmjs.com/misc/config#git-tag-version) of the same name.
When run with this flag, `lerna version` will also consider tags of merged branches during package change detection.

### `--message <msg>`

Expand Down Expand Up @@ -243,6 +229,33 @@ This can be configured in lerna.json, as well:
}
```

### `--no-changelog`

```sh
lerna version --conventional-commits --no-changelog
```

When using `conventional-commits`, do not generate any `CHANGELOG.md` files.

### `--no-commit-hooks`

By default, `lerna version` will allow git commit hooks to run when committing version changes.
Pass `--no-commit-hooks` to disable this behavior.

This option is analogous to the `npm version` option [`--commit-hooks`](https://docs.npmjs.com/misc/config#commit-hooks), just inverted.

### `--no-git-tag-version`

By default, `lerna version` will commit changes to package.json files and tag the release.
Pass `--no-git-tag-version` to disable the behavior.

This option is analogous to the `npm version` option [`--git-tag-version`](https://docs.npmjs.com/misc/config#git-tag-version), just inverted.

### `--no-push`

By default, `lerna version` will push the committed and tagged changes to the configured [git remote](#--git-remote-name).
Pass `--no-push` to disable this behavior.

### `--preid`

```sh
Expand All @@ -258,12 +271,6 @@ lerna version prepatch --preid next
When run with this flag, `lerna version` will increment `premajor`, `preminor`, `prepatch`, or `prerelease` semver
bumps using the specified [prerelease identifier](http://semver.org/#spec-item-9).

### `--push`

Push the committed and tagged changes to the configured [git remote](https://github.com/lerna/lerna/tree/master/commands/version#--git-remote-name)

Pass `--no-push` to disable.

### `--sign-git-commit`

This option is analogous to the `npm version` [option](https://docs.npmjs.com/misc/config#sign-git-commit) of the same name.
Expand All @@ -282,15 +289,6 @@ lerna version --yes
When run with this flag, `lerna version` will skip all confirmation prompts.
Useful in [Continuous integration (CI)](https://en.wikipedia.org/wiki/Continuous_integration) to automatically answer the publish confirmation prompt.

### `--include-merged-tags`

```sh
lerna version --include-merged-tags
```

When run with this flag, `lerna version` will also consider tags of merged branches
while fetching changes for packages to update.

## Deprecated Options

### `--cd-version`
Expand Down

0 comments on commit 8bc9669

Please sign in to comment.