Skip to content

Commit 42b71a5

Browse files
committed
feat(core): add version in afterVersion hook
1 parent af51123 commit 42b71a5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

docs/pages/docs/plugins/release-lifecycle-hooks.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ _Examples:_
132132
- [brew](../generated/brew) - Create a new brew formula once the package a=has been versioned
133133

134134
```ts
135-
auto.hooks.afterVersion.tapPromise("NPM", async ({ dryRun }) => {});
135+
auto.hooks.afterVersion.tapPromise("NPM", async ({ dryRun, version }) => {});
136136
```
137137

138138
## publish

packages/core/src/auto.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,10 @@ export interface IAutoHooks {
262262
]
263263
>;
264264
/** Ran after the package has been versioned. */
265-
afterVersion: AsyncSeriesHook<[DryRunOption]>;
265+
afterVersion: AsyncSeriesHook<[DryRunOption & {
266+
/** The version to release, if any */
267+
version?: string;
268+
}]>;
266269
/** Publish the package to some package distributor. You must push the tags to github! */
267270
publish: AsyncSeriesHook<
268271
[
@@ -1763,7 +1766,7 @@ export default class Auto {
17631766
const releaseArgs = await this.makeReleaseContext();
17641767

17651768
this.logger.verbose.info("Calling after version hook");
1766-
await this.hooks.afterVersion.promise({ dryRun: options.dryRun });
1769+
await this.hooks.afterVersion.promise({ dryRun: options.dryRun, version: releaseArgs.newVersion });
17671770

17681771
if (!options.dryRun) {
17691772
this.logger.verbose.info("Calling publish hook");

0 commit comments

Comments
 (0)