@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
29 lines • 1.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAllCacheConfigsFromConfig = void 0;
const index_1 = require("../../utils/index");
const transformLegacyJobCache_1 = require("./transformLegacyJobCache");
const getAllCacheConfigsFromConfig = (context, configWithCache) => {
return [
...("jobCache" in configWithCache
? (0, transformLegacyJobCache_1.transformLegacyJobCache)(configWithCache.jobCache)
: []),
...(0, index_1.ensureArray)(configWithCache.cache),
...(context.type === "workspace"
? // also add cache configs of the components of that workspace
// FIXNME: this only works currently for the build config
// we would probably need to introduce a path to the right config property (build-->test or so)
context.components.flatMap((componentContext) => {
var _a;
return componentContext.build.type !== "disabled"
? ((_a = (0, index_1.ensureArray)(componentContext.build.config.cache).map((c) => ({
...c,
baseDir: componentContext.build.dir,
}))) !== null && _a !== void 0 ? _a : [])
: [];
})
: []),
];
};
exports.getAllCacheConfigsFromConfig = getAllCacheConfigsFromConfig;
//# sourceMappingURL=getAllCacheConfigsFromConfig.js.map