diff --git a/packages/shipjs-lib/src/lib/config/defaultConfig.js b/packages/shipjs-lib/src/lib/config/defaultConfig.js index 0fc8be48..67dfded6 100644 --- a/packages/shipjs-lib/src/lib/config/defaultConfig.js +++ b/packages/shipjs-lib/src/lib/config/defaultConfig.js @@ -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) diff --git a/packages/shipjs/src/step/prepare/__tests__/commitChanges.spec.js b/packages/shipjs/src/step/prepare/__tests__/commitChanges.spec.js index 0f39d054..d275e8e2 100644 --- a/packages/shipjs/src/step/prepare/__tests__/commitChanges.spec.js +++ b/packages/shipjs/src/step/prepare/__tests__/commitChanges.spec.js @@ -40,6 +40,7 @@ describe('commitChanges', () => { }, dryRun: false, dir: '.', + nextVersion: '1.2.3', }); expect(wrapExecWithDir).toHaveBeenCalledTimes(1); @@ -49,6 +50,7 @@ describe('commitChanges', () => { expect.objectContaining({ exec: expect.any(Function), dir: '.', + nextVersion: '1.2.3', }) ); expect(run.mock.calls[0]).toMatchInlineSnapshot(` diff --git a/packages/shipjs/src/step/prepare/commitChanges.js b/packages/shipjs/src/step/prepare/commitChanges.js index 03c9419c..8e141219 100644 --- a/packages/shipjs/src/step/prepare/commitChanges.js +++ b/packages/shipjs/src/step/prepare/commitChanges.js @@ -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 });