UNPKG

@salesforce/plugin-settings

Version:
31 lines 1.22 kB
/* * Copyright (c) 2020, salesforce.com, inc. * All rights reserved. * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import { ModuleLoader } from '@oclif/core'; const OCLIF_META_PJSON_KEY = 'configMeta'; const hook = async ({ config, context }) => { const flattenedConfigMetas = (await Promise.all((config.getPluginsList() || []).flatMap(async (plugin) => { const oclif = (plugin.pjson.oclif ?? {}); const configMetaPath = oclif[OCLIF_META_PJSON_KEY]; if (!configMetaPath) return; const module = await ModuleLoader.load(plugin, configMetaPath); const configMeta = module.default; if (!configMeta) { context.debug(`No config meta found for ${plugin.name}`); } return configMeta; }))) .flatMap((d) => d) .filter((d) => !!d); if (flattenedConfigMetas.length) { const { Config } = await import('@salesforce/core/config'); Config.addAllowedProperties(flattenedConfigMetas); } return Promise.resolve(); }; export default hook; //# sourceMappingURL=load_config_meta.js.map