Socket
Socket
Sign inDemoInstall

apollo-codegen

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-codegen - npm Package Compare versions

Comparing version 0.17.0-alpha.11 to 0.17.0-alpha.12

10

lib/generate.js

@@ -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);

7

lib/swift/codeGeneration.js
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc