Skip to content

Commit

Permalink
fix: add version in afterPublish hook (#608)
Browse files Browse the repository at this point in the history
* fix: add `version` in `afterPublish` hook

* test: update tests

Co-authored-by: Eunjae Lee <[email protected]>
  • Loading branch information
2 people authored and Eunjae Lee committed Jan 14, 2020
1 parent 14ebf38 commit 76c5591
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/shipjs/src/flow/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async function release({ help = false, dir = '.', dryRun = false }) {
runBuild({ isYarn, config, dir, dryRun });
await runBeforePublish({ config, dir, dryRun });
runPublish({ isYarn, config, releaseTag, dir, dryRun });
await runAfterPublish({ config, dir, dryRun });
await runAfterPublish({ version, config, dir, dryRun });
const { tagName } = createGitTag({ version, config, dir, dryRun });
gitPush({ tagName, config, dir, dryRun });
await createGitHubRelease({ version, config, dir, dryRun });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ describe('runAfterPublish', () => {
it('works', async () => {
const afterPublish = jest.fn();
await runAfterPublish({
version: '1.2.3',
config: {
afterPublish,
},
Expand All @@ -17,6 +18,7 @@ describe('runAfterPublish', () => {
Object {
"dir": ".",
"exec": undefined,
"version": "1.2.3",
}
`);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/shipjs/src/step/release/runAfterPublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import runStep from '../runStep';
import { wrapExecWithDir, print } from '../../util';
import { info } from '../../color';

export default ({ config, dir, dryRun }) =>
export default ({ version, config, dir, dryRun }) =>
runStep(
{
title: 'Running "afterPublish" callback.',
Expand All @@ -14,6 +14,6 @@ export default ({ config, dir, dryRun }) =>
print(`-> execute ${info('afterPublish()')} callback.`);
return;
}
await config.afterPublish({ exec: wrapExecWithDir(dir), dir });
await config.afterPublish({ exec: wrapExecWithDir(dir), dir, version });
}
);

0 comments on commit 76c5591

Please sign in to comment.