Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
);
const generator = generateSwiftSource(
context,
outputIndividualFiles,
suppressSwiftMultilineStringLiterals,
only
);
if (outputIndividualFiles) {
writeGeneratedFiles(generator.generatedFiles, outputPath, "\n");
writtenFiles += Object.keys(generator.generatedFiles).length;
} else {
fs.writeFileSync(outputPath, generator.output.concat("\n"));
writtenFiles += 1;
}
if (options.generateOperationIds) {
writeOperationIdsMap(context);