Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cwd: projectPath,
absolute: true,
});
const schemaPath = path.join(projectPath, cfg.schema);
const target = cfg.amplifyExtension.codeGenTarget;
const outputPath = path.join(projectPath, generatedFileName);
let region;
if (!withoutInit) {
({ region } = cfg.amplifyExtension);
await ensureIntrospectionSchema(context, schemaPath, apis[0], region, forceDownloadSchema);
}
const codeGenSpinner = new Ora(constants.INFO_MESSAGE_CODEGEN_GENERATE_STARTED);
codeGenSpinner.start();
try {
generate(queries, schemaPath, path.join(projectPath, generatedFileName), '', target, '', {
addTypename: true,
complexObjectSupport: 'auto',
});
codeGenSpinner.succeed(`${constants.INFO_MESSAGE_CODEGEN_GENERATE_SUCCESS} ${path.relative(path.resolve('.'), outputPath)}`);
} catch (err) {
codeGenSpinner.fail(err.message);
}
});
} catch (err) {