@salesforce/plugin-settings
Version:
configure the Salesforce CLI
40 lines • 1.59 kB
JavaScript
/*
* Copyright 2025, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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