apollo-codegen
Advanced tools
Comparing version 0.17.0-alpha.11 to 0.17.0-alpha.12
@@ -21,4 +21,10 @@ "use strict"; | ||
const context = compiler_1.compileToIR(schema, document, options); | ||
const generatedFiles = swift_1.generateSource(context, outputPath, only); | ||
writeGeneratedFiles(generatedFiles, outputPath); | ||
const outputIndividualFiles = fs.existsSync(outputPath) && fs.statSync(outputPath).isDirectory(); | ||
const generator = swift_1.generateSource(context, outputIndividualFiles, only); | ||
if (outputIndividualFiles) { | ||
writeGeneratedFiles(generator.generatedFiles, outputPath); | ||
} | ||
else { | ||
fs.writeFileSync(outputPath, generator.output); | ||
} | ||
if (options.generateOperationIds) { | ||
@@ -25,0 +31,0 @@ writeOperationIdsMap(context); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
@@ -15,5 +14,5 @@ const graphql_1 = require("graphql"); | ||
require("../utilities/array"); | ||
function generateSource(context, outputPath, only) { | ||
function generateSource(context, outputIndividualFiles, only) { | ||
const generator = new SwiftAPIGenerator(context); | ||
if (fs.statSync(outputPath).isDirectory()) { | ||
if (outputIndividualFiles) { | ||
generator.withinFile(`Types.graphql.swift`, () => { | ||
@@ -68,3 +67,3 @@ generator.fileHeader(); | ||
} | ||
return generator.generatedFiles; | ||
return generator; | ||
} | ||
@@ -71,0 +70,0 @@ exports.generateSource = generateSource; |
{ | ||
"name": "apollo-codegen", | ||
"version": "0.17.0-alpha.11", | ||
"version": "0.17.0-alpha.12", | ||
"description": "Generate API code or type annotations based on a GraphQL schema and query documents", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -35,4 +35,13 @@ import * as fs from 'fs'; | ||
const context = compileToIR(schema, document, options); | ||
const generatedFiles = generateSwiftSource(context, outputPath, only); | ||
writeGeneratedFiles(generatedFiles, outputPath); | ||
const outputIndividualFiles = fs.existsSync(outputPath) && fs.statSync(outputPath).isDirectory(); | ||
const generator = generateSwiftSource(context, outputIndividualFiles, only); | ||
if (outputIndividualFiles) { | ||
writeGeneratedFiles(generator.generatedFiles, outputPath); | ||
} else { | ||
fs.writeFileSync(outputPath, generator.output); | ||
} | ||
if (options.generateOperationIds) { | ||
@@ -39,0 +48,0 @@ writeOperationIdsMap(context); |
@@ -1,2 +0,1 @@ | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
@@ -29,3 +28,2 @@ | ||
import '../utilities/array'; | ||
import { GeneratedFile } from '../utilities/CodeGenerator'; | ||
@@ -40,8 +38,8 @@ export interface Options { | ||
context: CompilerContext, | ||
outputPath: string, | ||
outputIndividualFiles: boolean, | ||
only?: string | ||
): { [fileName: string]: GeneratedFile } { | ||
): SwiftAPIGenerator { | ||
const generator = new SwiftAPIGenerator(context); | ||
if (fs.statSync(outputPath).isDirectory()) { | ||
if (outputIndividualFiles) { | ||
generator.withinFile(`Types.graphql.swift`, () => { | ||
@@ -106,3 +104,3 @@ generator.fileHeader(); | ||
return generator.generatedFiles; | ||
return generator; | ||
} | ||
@@ -109,0 +107,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
461801
8115
7