@topgroup/diginext
Version:
A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.
31 lines (30 loc) • 1.28 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkMonorepo = void 0;
const log_1 = require("diginext-utils/dist/xconsole/log");
const fs_1 = require("fs");
const path_1 = __importDefault(require("path"));
/**
* Check if this project is a monorepo
* @param {InputOptions} options
* @returns {{error:string, appPath:string, appDirectory:string, isMonorepo:boolean}}
*/
function checkMonorepo(options) {
// * Check if this is a MONOREPO -> select app to deploy
let message = "", isMonorepo = false, appPath = "", appDirectory = options.targetDirectory;
if ((0, fs_1.existsSync)(path_1.default.resolve(options.targetDirectory, "turbo.json"))) {
if (!options.app) {
message = `[ERROR] Monorepo -> không xác định được "app" để deploy`;
(0, log_1.logWarn)(message);
return { error: message };
}
appPath = `apps/${options.app}/`;
appDirectory = path_1.default.resolve(appDirectory, appPath);
isMonorepo = true;
}
return { appPath, appDirectory, isMonorepo };
}
exports.checkMonorepo = checkMonorepo;