Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(async () => {
const programVariables = await cosmiconfig(MODULE_NAME).search();
if (!programVariables) {
spinner.fail('no config file found.');
return;
}
if (programVariables.isEmpty) {
spinner.fail('config file is empty.');
}
spinner.info('config file found.');
spinner.info('comparing schemas...');
const diffs = await await graphqlSchemaDiff.getDiff(
programVariables.config.leftSchema,
programVariables.config.rightSchema || programVariables.config.leftSchema,
programVariables.config.options || {}
);
if (!diffs) {
spinner.succeed('Schemas are identical, no message to send! 0/').stop();
return;
}
spinner.info('creating message with differences...');
const allChanges = [...diffs.dangerousChanges, ...diffs.breakingChanges];
const mountedMessage = message.mountMessage(
allChanges,
programVariables.config
);