UNPKG

@catladder/cli

Version:

Panter cli tool for cloud CI/CD and DevOps

31 lines 1.35 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getLabels = void 0; const slugify_1 = __importDefault(require("slugify")); const sanitize = (value) => { if (!value) return value; //"The value can only contain lowercase letters, numeric characters, underscores and dashes. The value can be at most 63 characters long. International characters are allowed." // slugify should do the job return (0, slugify_1.default)(value).toLowerCase(); }; const getLabels = (context) => { var _a, _b; const labels = { "customer-name": sanitize(context.fullConfig.customerName), "component-name": sanitize(context.name), "app-name": sanitize(context.fullConfig.appName), "env-type": sanitize(context.environment.envType), "env-name": sanitize(context.env), "build-type": context.build.type === "disabled" ? "disabled" : sanitize(context.build.buildType), ...((_b = (_a = context.fullConfig.meta) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : {}), }; return labels; }; exports.getLabels = getLabels; //# sourceMappingURL=getLabels.js.map