@starship-ci/generator
Version:
Kubernetes manifest generator for Starship deployments
42 lines (41 loc) • 1.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CosmosBuilder = void 0;
const scripts_1 = require("../../../scripts");
const configmap_1 = require("./configmap");
const service_1 = require("./service");
const statefulset_1 = require("./statefulset");
/**
* Main Cosmos builder
* Orchestrates ConfigMap, Service, and StatefulSet generation for all Cosmos chains
*/
class CosmosBuilder {
config;
scriptManager;
generators;
constructor(config) {
this.config = config;
this.scriptManager = new scripts_1.ScriptManager(undefined, config.configDir);
this.generators = [];
// Filter cosmos chains (exclude ethereum chains)
const cosmosChains = this.config.chains?.filter((chain) => chain.name !== 'ethereum' && typeof chain.id === 'string') || [];
if (cosmosChains.length === 0) {
return; // No cosmos chains to process
}
// Global ConfigMaps (keys, global scripts)
this.generators.push(new configmap_1.GlobalConfigMapGenerator(this.config));
// Per-chain generators
cosmosChains.forEach((chain) => {
// Services
this.generators.push(new service_1.CosmosServiceGenerator(chain, this.config));
// StatefulSets
this.generators.push(new statefulset_1.CosmosStatefulSetGenerator(chain, this.config, this.scriptManager));
// ConfigMaps
this.generators.push(new configmap_1.CosmosConfigMapGenerator(chain, this.config, this.scriptManager));
});
}
generate() {
return this.generators.flatMap((generator) => generator.generate());
}
}
exports.CosmosBuilder = CosmosBuilder;