Skip to content

Commit

Permalink
fix: pass nextVersion to beforeCommitChanges (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunjae Lee authored Nov 4, 2019
1 parent 08ae7d5 commit 903f569
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/shipjs-lib/src/lib/config/defaultConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {
installCommand: ({ isYarn }) =>
isYarn ? 'yarn install --silent' : 'npm install',
versionUpdated: ({ version, dir, exec }) => {},
beforeCommitChanges: ({ exec, dir }) => {},
beforeCommitChanges: ({ nextVersion, exec, dir }) => {},
getStagingBranchName: ({ nextVersion }) => `releases/v${nextVersion}`,
formatCommitMessage: ({ version, mergeStrategy, baseBranch }) =>
mergeStrategy.toSameBranch.includes(baseBranch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('commitChanges', () => {
},
dryRun: false,
dir: '.',
nextVersion: '1.2.3',
});

expect(wrapExecWithDir).toHaveBeenCalledTimes(1);
Expand All @@ -49,6 +50,7 @@ describe('commitChanges', () => {
expect.objectContaining({
exec: expect.any(Function),
dir: '.',
nextVersion: '1.2.3',
})
);
expect(run.mock.calls[0]).toMatchInlineSnapshot(`
Expand Down
2 changes: 1 addition & 1 deletion packages/shipjs/src/step/prepare/commitChanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default async ({ nextVersion, dir, config, baseBranch, dryRun }) =>
print(' |');
return;
}
await beforeCommitChanges({ exec: wrapExecWithDir(dir), dir });
await beforeCommitChanges({ nextVersion, exec: wrapExecWithDir(dir), dir });
const filePath = tempWrite.sync(message);
run({ command: 'git add .', dir });
run({ command: `git commit --file=${filePath}`, dir });
Expand Down

0 comments on commit 903f569

Please sign in to comment.