UNPKG

humpty

Version:

Makes sure your changelogs mention your breaking changes

78 lines (59 loc) 2.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _getExportsAndCommits = require("./getExportsAndCommits"); var _getExportsAndCommits2 = _interopRequireDefault(_getExportsAndCommits); var _findApiChanges = require("./findApiChanges"); var _findApiChanges2 = _interopRequireDefault(_findApiChanges); var _findUnmentionedChanges = require("./findUnmentionedChanges"); var _findUnmentionedChanges2 = _interopRequireDefault(_findUnmentionedChanges); var _printResults = require("./printResults"); var _printResults2 = _interopRequireDefault(_printResults); var _exitWithCode = require("./exitWithCode"); var _exitWithCode2 = _interopRequireDefault(_exitWithCode); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } // @flow exports.default = (() => { var _ref = _asyncToGenerator(function* ({ 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 } = yield (0, _getExportsAndCommits2.default)({ oldApi, newApi, gitRepo }); const changedExports = (0, _findApiChanges2.default)({ oldExports, newExports }); const { unmentionedChanges, unmentionedChangeCount } = (0, _findUnmentionedChanges2.default)(commitMessages, changedExports); (0, _printResults2.default)({ unmentionedChanges, unmentionedChangeCount, oldApi, newApi }, wantsJson); (0, _exitWithCode2.default)(unmentionedChangeCount === 0 ? 0 : 1); }); function App(_x) { return _ref.apply(this, arguments); } return App; })();