backport
Version:
A CLI tool that automates the process of backporting commits
34 lines • 1.37 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRepoPath = exports.getGlobalConfigPath = exports.getLogfilePath = exports.getBackportDirPath = void 0;
const os_1 = require("os");
const path_1 = __importDefault(require("path"));
function getBackportDirPath() {
return path_1.default.join((0, os_1.homedir)(), '.backport');
}
exports.getBackportDirPath = getBackportDirPath;
function getLogfilePath({ logFilePath, logLevel, }) {
if (logFilePath) {
return path_1.default.resolve(logFilePath);
}
return path_1.default.join((0, os_1.homedir)(), '.backport', `backport.${logLevel}.log`);
}
exports.getLogfilePath = getLogfilePath;
function getGlobalConfigPath(globalConfigFile) {
if (globalConfigFile) {
return path_1.default.resolve(globalConfigFile);
}
return path_1.default.join((0, os_1.homedir)(), '.backport', 'config.json');
}
exports.getGlobalConfigPath = getGlobalConfigPath;
function getRepoPath({ repoOwner, repoName, dir }) {
if (dir) {
return dir;
}
return path_1.default.join((0, os_1.homedir)(), '.backport', 'repositories', repoOwner, repoName);
}
exports.getRepoPath = getRepoPath;
//# sourceMappingURL=env.js.map