humpty
Version:
Makes sure your changelogs mention your breaking changes
55 lines (49 loc) • 1.24 kB
JavaScript
// @flow
import getExportsAndCommits from "./getExportsAndCommits";
import findApiChanges from "./findApiChanges";
import findUnmentionedChanges from "./findUnmentionedChanges";
import printResults from "./printResults";
import exitWithCode from "./exitWithCode";
export default async function App({
oldApi,
newApi,
gitRepo,
json: wantsJson
}) {
if (!oldApi) {
console.error("Error: --oldApi flag required. See --help for more info.");
process.exit(1);
}
if (!newApi) {
console.error("Error: --newApi flag required. See --help for more info.");
process.exit(1);
}
if (!gitRepo) {
console.error("Error: --gitRepo flag required. See --help for more info.");
process.exit(1);
}
const {
commitMessages,
oldExports,
newExports
} = await getExportsAndCommits({
oldApi,
newApi,
gitRepo
});
const changedExports = findApiChanges({ oldExports, newExports });
const { unmentionedChanges, unmentionedChangeCount } = findUnmentionedChanges(
commitMessages,
changedExports
);
printResults(
{
unmentionedChanges,
unmentionedChangeCount,
oldApi,
newApi
},
wantsJson
);
exitWithCode(unmentionedChangeCount === 0 ? 0 : 1);
}