Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- `apollo-codegen-scala`
- <First `apollo-codegen-scala` related entry goes here>
- `apollo-codegen-swift`
- <First `apollo-codegen-swift` related entry goes here>
- Append terminating newline character to generated files [#531](https://github.com/apollographql/apollo-ios/issues/531)
- `apollo-codegen-typescript`
- <First `apollo-codegen-typescript` related entry goes here>
- `apollo-env`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ public final class SimpleQueryQuery: GraphQLQuery {
}
}
}
}"
}
"
`;

exports[`client:codegen writes swift types from local schema in a graphql file 1`] = `
Expand Down Expand Up @@ -249,7 +250,8 @@ public final class SimpleQueryQuery: GraphQLQuery {
}
}
}
}"
}
"
`;

exports[`client:codegen writes types for query with only client-side data 1`] = `
Expand Down
9 changes: 5 additions & 4 deletions packages/apollo/src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ export default function generate(
const generator = generateSwiftSource(context, outputIndividualFiles, only);

if (outputIndividualFiles) {
writeGeneratedFiles(generator.generatedFiles, outputPath);
writeGeneratedFiles(generator.generatedFiles, outputPath, "\n");
writtenFiles += Object.keys(generator.generatedFiles).length;
} else {
fs.writeFileSync(outputPath, generator.output);
fs.writeFileSync(outputPath, generator.output.concat("\n"));
writtenFiles += 1;
}

Expand Down Expand Up @@ -215,12 +215,13 @@ export default function generate(

function writeGeneratedFiles(
generatedFiles: { [fileName: string]: BasicGeneratedFile },
outputDirectory: string
outputDirectory: string,
terminator: string = ""
) {
for (const [fileName, generatedFile] of Object.entries(generatedFiles)) {
fs.writeFileSync(
path.join(outputDirectory, fileName),
generatedFile.output
generatedFile.output.concat(terminator)
);
}
}
Expand Down