UNPKG

sfdx-experiences-plugin

Version:
29 lines 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const fs_1 = require("fs"); const fs_extra_1 = require("fs-extra"); const path_1 = require("path"); const get_config_path_1 = require("./get-config-path"); /** * Returns the site configuration from the given bundle path. * * @param {string} bundlePath Path to the bundle. * @returns {SiteConfig} Site configuration from the bundle. */ function getSiteConfig(bundlePath) { const configPath = get_config_path_1.default(bundlePath); if (!fs_1.existsSync(configPath)) { throw new Error(`Config directory does not exist: ${configPath}`); } const configFiles = fs_1.readdirSync(configPath).filter(file => file.toLowerCase().endsWith('.json')); for (const configFile of configFiles) { const filePath = path_1.resolve(configPath, configFile); const fileContent = fs_extra_1.readJsonSync(filePath); if (fileContent.type === 'site') { return { filePath, content: fileContent }; } } throw new Error(`Site config file not found in bundle directory: ${bundlePath}`); } exports.default = getSiteConfig; //# sourceMappingURL=get-site-config.js.map