UNPKG

@catladder/cli

Version:

Panter cli tool for cloud CI/CD and DevOps

36 lines 1.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createWorkspaceContext = void 0; const __1 = require(".."); const packageManager_1 = require("../pipeline/packageManager"); const utils_1 = require("../utils"); const lodash_1 = require("lodash"); async function createWorkspaceContext({ env, components, workspaceName, config, pipelineType, trigger, }) { var _a, _b; const workspaceConfigRaw = (_a = config.builds) === null || _a === void 0 ? void 0 : _a[workspaceName]; if (!workspaceConfigRaw) { throw new Error(`Workspace ${workspaceName} not found in config`); } const defaults = __1.WORKSPACE_BUILD_TYPES[workspaceConfigRaw.type].defaults(); const workspaceConfig = (0, utils_1.mergeWithMergingArrays)(defaults, workspaceConfigRaw); return { name: workspaceName, pipelineType, trigger, type: "workspace", workspaceConfig, env, components, fullConfig: config, packageManagerInfo: await (0, packageManager_1.getPackageManagerInfoBase)(), build: { type: "workspace", dir: (_b = workspaceConfig.dir) !== null && _b !== void 0 ? _b : ".", getComponentDirs: (mode) => (0, lodash_1.uniq)(components.flatMap((c) => c.build.getComponentDirs(mode))), buildType: workspaceConfig.type, config: workspaceConfig, }, }; } exports.createWorkspaceContext = createWorkspaceContext; //# sourceMappingURL=createWorkspaceContext.js.map