Skip to content

Commit

Permalink
Update docs on hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Feb 21, 2020
1 parent 644050a commit ba23829
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions README.md
Expand Up @@ -312,18 +312,20 @@ pre-releases. An example pre-release version is `2.0.0-beta.0`.

## Hooks

Use script hooks to run shell commands at any moment during the release process. The format is `[prefix]:[hook]` or
`[prefix]:[plugin]:[hook]`:
Use script hooks to run shell commands at any moment during the release process (such as `before:init` or
`after:release`).

| part | value |
| ------ | -------------------------------------------------------------------------- |
| prefix | `before` or `after` |
| plugin | `version`, `git`, `npm`, `github`, `gitlab` or `[plugin-name]` |
| hook | `init`, `beforeBump`, `bump`, `beforeRelease`, `release` or `afterRelease` |
The format is `[prefix]:[hook]` or `[prefix]:[plugin]:[hook]`:

Use the optional `plugin` to hook into a life cycle method before or after any plugin. The core plugins include
`version`, `git`, `npm`, `github`, `gitlab`. When using a custom plugin, the plugin name will also be available (e.g.
`@release-it/conventional-changelog` becomes `conventional-changelog`).
| part | value |
| ------ | ------------------------------------------- |
| prefix | `before` or `after` |
| plugin | `version`, `git`, `npm`, `github`, `gitlab` |
| hook | `init`, `bump`, `release` |

Use the optional `:plugin` part in the middle to hook into a life cycle method exactly before or after any plugin.

The core plugins include `version`, `git`, `npm`, `github`, `gitlab`.

See [execution order](./docs/plugins.md#execution-order) for more details on execution order of plugin lifecycle
methods.
Expand Down Expand Up @@ -354,10 +356,14 @@ name
repo.remote, repo.protocol, repo.host, repo.owner, repo.repository, repo.project
```

All variables are available in all hooks. The only exception is that the additional variables listed above are not
All variables are available in all hooks. The only exception is that the additional variables listed above are not yet
available in the `init` hook.

Use `--verbose` to also log the output of the commands.
Use `--verbose` to log the output of the commands.

For the sake of verbosity and to not complicate matters further, the above table is not complete. The full list of hooks
is actually: `init`, `beforeBump`, `bump`, `beforeRelease`, `release` or `afterRelease`. However, hooks like
`before:beforeRelease` look weird and are usually not useful in practice.

## Scripts (deprecated)

Expand Down Expand Up @@ -394,7 +400,7 @@ Use `--disable-metrics` to opt-out of sending some anonymous statistical data to
## Troubleshooting & debugging

- With `release-it --verbose` (or `-V`), release-it prints every custom script/hook and its output.
- With `release-it -VV`, release-it prints every command (also internal) and its output.
- With `release-it -VV`, release-it also prints every internal command and its output.
- Prepend `DEBUG=release-it:* release-it [...]` to print configuration and more error details.

## Use release-it programmatically
Expand Down

0 comments on commit ba23829

Please sign in to comment.