dangcuuson / graphql-schema-typescript

Generate TypeScript from GraphQL's schema type definitions
191 stars 36 forks source link

Add option for prepending timestamp to generated file #9

Open brookback opened 6 years ago

brookback commented 6 years ago

I love this tool! 😍 It was exactly what I looked for. Thanks so much!

It would be cool though with an option (or even as a default) to have a timestamp added to the top of the generated types .ts file, in order to quickly diff the version at a glance.

Something like:

import { GraphQLResolveInfo } from 'graphql';

/**
 * This file is auto-generated by graphql-schema-typescript
 * Please note that any changes in this file may be overwritten
 *
 * Generated at 2018-07-20T23:01:01
 */

/* tslint:disable */ 
/*******************************
 *                             
 *          TYPE DEFS          
 *                             
 *******************************/

Let me know if I can provide a PR for this.

dangcuuson commented 6 years ago

Hi there,

Thank you for using and loving this small lib :smile: I agree that having the timestamp up there would make it easier to compare file changes.

I think having it in an option would be nice, since some people (like me) run the lib in prestart hook so it may be annoying to see the timestamp changes every time (not in my case since I git ignored it, but maybe some others don't).

PRs are always welcomed :+1:

brookback commented 6 years ago

Yep, agreed on opt-in. Perhaps an option in GenerateTypescriptOptions that can be configured on the command line, such as:

graphql-schema-typescript generate-ts --timestamp

I'd be happy to file a PR on this ❇️