Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const customConfig = async (): Promise => {
const connectorKeys: inquirer.ChoiceType[] = getInstalledResources(ResourceType.connector).concat(getCoreResources(ResourceType.connector));
const formattersKeys: inquirer.ChoiceType[] = getInstalledResources(ResourceType.formatter).concat(getCoreResources(ResourceType.formatter));
const parsersKeys: inquirer.ChoiceType[] = getInstalledResources(ResourceType.parser).concat(getCoreResources(ResourceType.parser));
const hintsKeys: inquirer.ChoiceType[] = getInstalledResources(ResourceType.hint).concat(getCoreResources(ResourceType.hint));
if (!anyResources(connectorKeys, ResourceType.connector) ||
!anyResources(formattersKeys, ResourceType.formatter) ||
!anyResources(hintsKeys, ResourceType.hint)) {
return null;
}
const customQuestions: inquirer.Question[] = [
{
choices: connectorKeys,
message: 'What connector do you want to use?',
name: 'connector',
type: 'list'
const customConfig = async (): Promise => {
const connectorKeys: inquirer.ChoiceType[] = getInstalledResources(ResourceType.connector).concat(getCoreResources(ResourceType.connector));
const formattersKeys: inquirer.ChoiceType[] = getInstalledResources(ResourceType.formatter).concat(getCoreResources(ResourceType.formatter));
const parsersKeys: inquirer.ChoiceType[] = getInstalledResources(ResourceType.parser).concat(getCoreResources(ResourceType.parser));
const hintsKeys: inquirer.ChoiceType[] = getInstalledResources(ResourceType.hint).concat(getCoreResources(ResourceType.hint));
if (!anyResources(connectorKeys, ResourceType.connector) ||
!anyResources(formattersKeys, ResourceType.formatter) ||
!anyResources(hintsKeys, ResourceType.hint)) {
return null;
}
const customQuestions: inquirer.Question[] = [
{
choices: connectorKeys,
message: 'What connector do you want to use?',
name: 'connector',
type: 'list'
},
{
choices: formattersKeys,
default: defaultFormatter,
message: 'What formatter do you want to use?',
let connector: IConnectorConstructor | null = null;
const connectorName = config.connector && config.connector.name || '';
try {
connector = loadResource(connectorName, ResourceType.connector, config.extends, true);
} catch (e) {
debug(e);
if (e.status === ResourceErrorStatus.DependencyError) {
throw e;
}
}
const { incompatible: incompatibleHints, resources: hints, missing: missingHints } = loadListOfResources(config.hints, ResourceType.hint, config.extends);
const { incompatible: incompatibleParsers, resources: parsers, missing: missingParsers } = loadListOfResources(config.parsers, ResourceType.parser, config.extends);
const { incompatible: incompatibleFormatters, resources: formatters, missing: missingFormatters } = loadListOfResources(config.formatters, ResourceType.formatter, config.extends);
const missing = ([] as string[]).concat(missingHints, missingParsers, missingFormatters);
const incompatible = ([] as string[]).concat(incompatibleFormatters, incompatibleParsers, incompatibleHints);
if (!connector) {
missing.push(`${ResourceType.connector}-${connectorName || config.connector}`);
}
return {
connector,
formatters,
hints,
incompatible,
missing,
parsers
};
};