UNPKG

compose-as-code

Version:

Provides a module to express docker compose files as code

26 lines (25 loc) 1.05 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.loadConfiguration = void 0; const fs_1 = __importDefault(require("fs")); const loadConfiguration = () => { var _a; const configurationStr = fs_1.default.readFileSync('./cac.config.json', { encoding: 'utf-8', }); const configuration = JSON.parse(configurationStr); if (!configuration.entrypoint && !(typeof configuration.entrypoint === 'string')) { throw new Error('Your configuration has an invalid entrypoint'); } if (configuration.outputDir && !(typeof configuration.outputDir === 'string')) { throw new Error('Your configuration has an invalid type for outputDir'); } configuration.outputDir = (_a = configuration.outputDir) !== null && _a !== void 0 ? _a : './out'; return configuration; }; exports.loadConfiguration = loadConfiguration;