@starship-ci/generator
Version:
Kubernetes manifest generator for Starship deployments
31 lines (30 loc) • 942 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChainBuilder = void 0;
const cosmos_1 = require("./cosmos");
const ethereum_1 = require("./ethereum");
const chainBuilderRegistry = {
ethereum: ethereum_1.EthereumBuilder
};
function createBuilder(chainName, config) {
const builder = chainBuilderRegistry[chainName] || cosmos_1.CosmosBuilder;
return new builder(config);
}
/**
* Main ChainBuilder that uses the factory pattern to create appropriate builders
*/
class ChainBuilder {
config;
generators = [];
constructor(config) {
this.config = config;
// Create builders for each chain
this.config.chains?.forEach((chain) => {
this.generators.push(createBuilder(chain.name, this.config));
});
}
generate() {
return this.generators.flatMap((generator) => generator.generate());
}
}
exports.ChainBuilder = ChainBuilder;