UNPKG

967 BJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6exports.getEditCommit = void 0;
7const top_level_1 = __importDefault(require("@commitlint/top-level"));
8const fs_extra_1 = __importDefault(require("fs-extra"));
9const get_edit_file_path_1 = require("./get-edit-file-path");
10// Get recently edited commit message
11async function getEditCommit(cwd, edit) {
12 const top = await (0, top_level_1.default)(cwd);
13 if (typeof top !== 'string') {
14 throw new TypeError(`Could not find git root from ${cwd}`);
15 }
16 const editFilePath = await (0, get_edit_file_path_1.getEditFilePath)(top, edit);
17 const editFile = await fs_extra_1.default.readFile(editFilePath);
18 return [`${editFile.toString('utf-8')}\n`];
19}
20exports.getEditCommit = getEditCommit;
21//# sourceMappingURL=get-edit-commit.js.map
\No newline at end of file