Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
writeGeneratedFiles(outFiles, outputPath);
writtenFiles += Object.keys(outFiles).length;
} else {
fs.writeFileSync(
outputPath,
generatedFiles.map(o => o.content.fileContents).join("\n") + common
);
writtenFiles += 1;
}
} else if (target === "typescript" || target === "ts") {
const context = compileToIR(schema, document, options);
const generatedFiles = generateTypescriptLocalSource(context);
const generatedGlobalFile = generateTypescriptGlobalSource(context);
const outFiles: {
[fileName: string]: BasicGeneratedFile;
} = {};
if (
nextToSources ||
(fs.existsSync(outputPath) && fs.statSync(outputPath).isDirectory())
) {
if (options.globalTypesFile) {
const globalTypesDir = path.dirname(options.globalTypesFile);
if (!fs.existsSync(globalTypesDir)) {
fs.mkdirSync(globalTypesDir);
}
} else if (nextToSources && !fs.existsSync(outputPath)) {