Skip to content

Commit

Permalink
fix(generated): auto-write the generated index file (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
goldcaddy77 authored Jan 12, 2019
1 parent 1575329 commit bf09179
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 26 deletions.
2 changes: 1 addition & 1 deletion examples/1-simple-model/generated/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './classes';
export * from './classes';
12 changes: 0 additions & 12 deletions examples/1-simple-model/generated/schema.ts

This file was deleted.

1 change: 0 additions & 1 deletion examples/2-complex-example/generated/index.ts

This file was deleted.

12 changes: 0 additions & 12 deletions examples/2-complex-example/generated/schema.ts

This file was deleted.

10 changes: 10 additions & 0 deletions src/core/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,21 @@ export class App {
});
}

async writeGeneratedIndexFile() {
// Write schema to dist folder so that it's available in package
const contents = `export * from './classes';`;
return writeFileSync(path.join(this.generatedFolder, 'index.ts'), contents, {
encoding: 'utf8',
flag: 'w'
});
}

async start() {
await this.establishDBConnection();
await this.generateTypes();
await this.buildGraphQLSchema();
await this.writeSchemaFile();
await this.writeGeneratedIndexFile();
await this.generateBinding();

this.graphQLServer = new ApolloServer({
Expand Down

0 comments on commit bf09179

Please sign in to comment.