Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function generate(
document: DocumentNode,
schema: GraphQLSchema,
outputPath: string,
only: string | undefined,
target: TargetType,
tagName: string,
nextToSources: boolean | string,
options: GenerationOptions
): number {
let writtenFiles = 0;
validateQueryDocument(schema, document);
const { rootPath = process.cwd() } = options;
if (outputPath.split(".").length <= 1 && !fs.existsSync(outputPath)) {
fs.mkdirSync(outputPath);
}
if (target === "swift") {
options.addTypename = true;
const context = compileToIR(schema, document, options);
const outputIndividualFiles =
fs.existsSync(outputPath) && fs.statSync(outputPath).isDirectory();
const suppressSwiftMultilineStringLiterals = Boolean(
options.suppressSwiftMultilineStringLiterals
);