Skip to content

Commit

Permalink
fix: remove releaseStart hook for slack message (#703)
Browse files Browse the repository at this point in the history
Co-authored-by: shipjs <[email protected]>
  • Loading branch information
Eunjae Lee and shipjs authored Mar 6, 2020
1 parent de9083c commit 2a9502b
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ describe('mergeConfig', () => {
username: 'Ship.js',
},
prepared: () => {},
releaseStart: () => {},
releaseSuccess: () => {},
},
},
Expand All @@ -58,7 +57,6 @@ describe('mergeConfig', () => {
);
expect(config.slack.default.username).toEqual('Release');
expect(config.slack.prepared).toBeInstanceOf(Function);
expect(config.slack.releaseStart).toBeInstanceOf(Function);
expect(config.slack.releaseSuccess).toBeInstanceOf(Function);
});

Expand All @@ -70,19 +68,17 @@ describe('mergeConfig', () => {
username: 'Ship.js',
},
prepared: () => {},
releaseStart: () => {},
releaseSuccess: () => {},
},
},
{
slack: {
releaseStart: null,
releaseSuccess: null,
},
}
);
expect(config.slack.default.username).toEqual('Ship.js');
expect(config.slack.prepared).toBeInstanceOf(Function);
expect(config.slack.releaseStart).toBeNull();
expect(config.slack.releaseSuccess).toBeInstanceOf(Function);
expect(config.slack.releaseSuccess).toBeNull();
});
});
25 changes: 0 additions & 25 deletions packages/shipjs-lib/src/lib/config/defaultConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,31 +140,6 @@ export default {
},
],
}),
releaseStart: ({
appName,
version,
latestCommitHash,
latestCommitUrl,
}) => ({
pretext: `:rocket: Starting to release *${appName}@${version}*`,
fields: [
{
title: 'Branch',
value: 'master',
short: true,
},
{
title: 'Commit',
value: `*<${latestCommitUrl}|${latestCommitHash}>*`,
short: true,
},
{
title: 'Version',
value: version,
short: true,
},
],
}),
releaseSuccess: ({
appName,
version,
Expand Down
8 changes: 0 additions & 8 deletions packages/shipjs/src/flow/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import printHelp from '../step/release/printHelp';
import printDryRunBanner from '../step/printDryRunBanner';
import validate from '../step/release/validate';
import gatherRepoInfo from '../step/release/gatherRepoInfo';
import notifyReleaseStart from '../step/release/notifyReleaseStart';
import runTest from '../step/release/runTest';
import runBuild from '../step/release/runBuild';
import runBeforePublish from '../step/release/runBeforePublish';
Expand Down Expand Up @@ -37,13 +36,6 @@ async function release({ help = false, dir = '.', dryRun = false }) {
repoURL,
releaseTag,
} = gatherRepoInfo({ remote, version, dir });
await notifyReleaseStart({
config,
appName,
version,
latestCommitHash,
latestCommitUrl,
});
const isYarn = detectYarn(dir);
runTest({ isYarn, config, dir, dryRun });
runBuild({ isYarn, config, version, dir, dryRun });
Expand Down
28 changes: 0 additions & 28 deletions packages/shipjs/src/step/release/notifyReleaseStart.js

This file was deleted.

6 changes: 1 addition & 5 deletions packages/shipjs/src/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ export { default as exitProcess } from './exitProcess';
export { default as indentedPrint } from './indentedPrint';
export { default as print } from './print';
export { default as run } from './run';
export {
notifyPrepared,
notifyReleaseStart,
notifyReleaseSuccess,
} from './slack';
export { notifyPrepared, notifyReleaseSuccess } from './slack';
export { default as wrapExecWithDir } from './wrapExecWithDir';
export { default as wrapRun } from './wrapRun';
export { default as parseArgs } from './parseArgs';
24 changes: 0 additions & 24 deletions packages/shipjs/src/util/slack.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,6 @@ export async function notifyPrepared({
});
}

export async function notifyReleaseStart({
config,
appName,
version,
latestCommitHash,
latestCommitUrl,
}) {
const { slack = {} } = config;
const { releaseStart } = slack;
if (!releaseStart) {
return;
}

const sendArguments =
typeof releaseStart === 'function'
? releaseStart({ appName, version, latestCommitHash, latestCommitUrl })
: releaseStart;

await sendSlackMessage({
config,
sendArguments,
});
}

export async function notifyReleaseSuccess({
config,
appName,
Expand Down
Loading

0 comments on commit 2a9502b

Please sign in to comment.