relay-enum-generator
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

relay-enum-generator

NPM version NPM downloads

A package which generates enums from a generated schema file as unions.

For more options, check out this awesome packages: graphql-code-generator

Install

$ yarn add relay-enum-generator

Usage

$ yarn relay-enum-generator [options]

options:
--name                  Name of your generated file [default: 'enums.ts']
--path                  Path where your file will be generated in [default: './src/__generated__']
--schema                Path of schema to read from. Default value is read from relay.config file [default: read from relay.config]
--noFutureProofEnums    This option controls whether or not a catch-all entry is added to enum type definitions for values that may be added in the future. [default: read from relay.config]

Example

$ yarn relay-enum-generator --name enums
// src/__generated__/enums.ts

export type Evaluation =
  | 'NEEDS_IMPROVEMENT'
  | 'MEETS_EXPECTATIONS'
  | 'EXCEEDS_EXPECTATIONS'
  | 'SUPERB'
  | '%future added value';

export type State = 'TODO' | 'DOING' | 'DONE' | '%future added value';

export type Phase =
  | 'SELF_REVIEW'
  | 'PEER_REVIEW'
  | 'MANAGER_REVIEW'
  | 'RESULTS'
  | 'IDLE'
  | '%future added value';

Acknowledgments

It is inspired by @zth code which he had done for Reason language, also thanks to @smmoosavi for his contributions.

Package Sidebar

Install

npm i relay-enum-generator

Weekly Downloads

218

Version

0.0.4

License

MIT

Unpacked Size

42.8 kB

Total Files

20

Last publish

Collaborators

  • c0m1t