@releaseotto/core
Version:
OTTO performs your action on new versioning of APIs, packages, schemas, etc. Keepings things nice and neatly automated.
71 lines • 3.65 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.check = exports.start = void 0;
const meta_1 = require("./utils/meta");
const npm_1 = require("./commands/npm");
const location_1 = require("./utils/location");
const versionStrategies_1 = require("./utils/versionStrategies");
function start(config) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
const metaLocation = (0, location_1.fetchLocation)(config);
const metaInfo = (0, meta_1.loadMetaConfig)(metaLocation);
const versionDiffs = yield (0, versionStrategies_1.getVersionDiffs)(config, metaInfo);
const versionChangeToDo = (0, versionStrategies_1.getVersionChangeToDo)(config, versionDiffs);
if (versionChangeToDo !== null && config.location != undefined) {
if (((_a = config.action) === null || _a === void 0 ? void 0 : _a.type) && ((_b = config.action) === null || _b === void 0 ? void 0 : _b.type) === 'package') {
(0, npm_1.runAction)(config, config.action.config);
}
//Save new config file
(0, meta_1.writeMetaInformation)({
config,
versionDiffs
});
// for (const postAction of config.postMinusAction || []) {
// if (postAction?.type && postAction?.type === 'git-commit') {
// const commitConfig = GitCommit.unmarshal(JSON.stringify(postAction.config));
// let formattedCommit = commitConfig.commitMinusMessage;
// if (commitConfig.commitMinusType === 'conventional-commits') {
// formattedCommit = formatCommit(
// {
// rawCommitMessage: formattedCommit,
// context: {
// commit: toConventionalCommit({ semver: versionChangeToDo }),
// commitSentence: `${versionChangeToDo} version change`
// }
// });
// }
// commit({
// commitMessage: formattedCommit,
// location: path.dirname(metaLocation)
// // push: {
// // branch: location.branch,
// // origin: 'origin'
// // }
// });
// }
// }
}
});
}
exports.start = start;
function check(config) {
return __awaiter(this, void 0, void 0, function* () {
const metaLocation = (0, location_1.fetchLocation)(config);
const metaInfo = (0, meta_1.loadMetaConfig)(metaLocation);
const versionDiffs = yield (0, versionStrategies_1.getVersionDiffs)(config, metaInfo);
const versionChangeToDo = (0, versionStrategies_1.getVersionChangeToDo)(config, versionDiffs);
return versionChangeToDo !== null;
});
}
exports.check = check;
//# sourceMappingURL=index.js.map