Skip to content

Commit c91b4ab

Browse files
committed
feat(core): add version in afterVersion hook
1 parent 77b5b04 commit c91b4ab

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,10 @@ export interface IAutoHooks {
264264
]
265265
>;
266266
/** Ran after the package has been versioned. */
267-
afterVersion: AsyncSeriesHook<[DryRunOption]>;
267+
afterVersion: AsyncSeriesHook<[DryRunOption & {
268+
/** The version to release, if any */
269+
version?: string;
270+
}]>;
268271
/** Publish the package to some package distributor. You must push the tags to github! */
269272
publish: AsyncSeriesHook<
270273
[
@@ -1777,7 +1780,7 @@ export default class Auto {
17771780
const releaseArgs = await this.makeReleaseContext();
17781781

17791782
this.logger.verbose.info("Calling after version hook");
1780-
await this.hooks.afterVersion.promise({ dryRun: options.dryRun });
1783+
await this.hooks.afterVersion.promise({ dryRun: options.dryRun, version: releaseArgs.newVersion });
17811784

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

0 commit comments

Comments
 (0)