Skip to content

Commit

Permalink
Refactor TypeScript plugins (#1353)
Browse files Browse the repository at this point in the history
Related: #1350 

Planned in this PR:
- [x] Move all common code from `flow` to a common package.
- [x] Make sure `flow` plugin works.
- [x] Add the latest changes of `flow` plugin.
- [x] Create `typescript` package with the same features as `flow` package.
- [x] Write tests for `typescript` package.
 
- [x] Move all common code from `flow-documents` to a common package.
- [x] Make sure `flow-documents` plugin works.
- [x] Add the latest changes of `flow-documents` plugin.
- [x] Create `typescript-documents` package with the same features as `flow-documents` package.
- [x] Write tests for `typescript-documents` package.
- [x] Move all common code from `flow-resolvers` to a common package.
- [x] Make sure `flow-resolvers` plugin works.
- [x] Add the latest changes of `flow-resolvers` plugin.
- [x] Create `typescript-resolvers` package with the same features as `flow-resolvers` package.
- [x] Write tests for `typescript-resolvers` package.
- [x] Add missing features from previous `typescript` package.
- [x] Add missing features from previous `typescript-documents` package.
- [x] Add missing features from previous `typescript-resolvers` package.
- [x] Add introspection types @kamilkisiela  #1406
- [x] Implement `namingConvention` again @kamilkisiela  #1407
- [x] Fix issue with prefix @kamilkisiela #1407
- [x] Apply this: #1357 @ardatan 
- [x] Refactor `react-apollo` @dotansimha 
- [x] Refactor `apollo-angular` @dotansimha 
- [x] Apply fix to Flow plugins: #1413 @kamilkisiela 
- [x] Refactor `typescript-mongo` @dotansimha  
- [x] Refactor `stencil-apollo` @ardatan
- [x] Remove Handlebars compiler package from all plugins, and add support for tree shaking. @ardatan 
- [x] Make sure to update packages in `gql-gen init`  @kamilkisiela 
- [x] Rename `XXX-documents` to `XXX-operations`
- [x] Move all flatten utils from `core` to `plugin-helpers` and clean `core` package. @kamilkisiela 
- [x] Deprecate `buildTemplateContext` and `flattenTypes`. @kamilkisiela 
- [x] Repo cleanup
- [x] Update README @kamilkisiela  
- [x] Update docs @kamilkisiela  
- [x] Write docs about writing plugins with visitor @kamilkisiela 
- [x] Update examples
- [x] Change packages names @dotansimha
  • Loading branch information
dotansimha authored and kamilkisiela committed Mar 14, 2019
1 parent 28c537b commit 645c985
Show file tree
Hide file tree
Showing 404 changed files with 13,305 additions and 30,634 deletions.
377 changes: 1 addition & 376 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ If you don't want to use the wizard, create a basic `codegen.yml` configuration
schema: http://localhost:3000/graphql
generates:
src/types.ts:
- typescript-common
- typescript
- typescript-server
```
Expand Down
9 changes: 0 additions & 9 deletions dev-test/codegen-watch.yml

This file was deleted.

144 changes: 50 additions & 94 deletions dev-test/codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ generates:
schema: ./dev-test/test-schema/schema-text.js
plugins:
- add: // tslint:disable
- typescript-common
- typescript-server
- typescript
- typescript-resolvers
./dev-test/test-schema/flow-types.flow.js:
schema: ./dev-test/test-schema/schema.json
Expand All @@ -16,30 +15,26 @@ generates:
schema: ./dev-test/test-schema/schema-with-root.graphql
plugins:
- add: // tslint:disable
- typescript-common
- typescript-server
- typescript
- typescript-resolvers
./dev-test/test-schema/typings.ts:
schema: ./dev-test/test-schema/schema.json
plugins:
- add: // tslint:disable
- typescript-common
- typescript-server
- typescript
- typescript-resolvers
./dev-test/test-schema/typings.avoidOptionals.ts:
schema: ./dev-test/test-schema/schema.json
config:
avoidOptionals: true
plugins:
- typescript-common
- typescript-server
- typescript
./dev-test/test-schema/typings.immutableTypes.ts:
schema: ./dev-test/test-schema/schema.json
config:
imutableTypes: true
plugins:
- typescript-common
- typescript-server
- typescript
./dev-test/githunt/graphql-declared-modules.d.ts:
schema: ./dev-test/githunt/schema.json
documents: ./dev-test/githunt/**/*.graphql
Expand All @@ -51,153 +46,114 @@ generates:
documents: ./dev-test/githunt/**/*.graphql
plugins:
- flow
- flow-documents
- flow-operations
./dev-test/githunt/types.ts:
schema: ./dev-test/githunt/schema.json
documents: ./dev-test/githunt/**/*.graphql
plugins:
- typescript-common
- typescript-client
- typescript
- typescript-operations
./dev-test/githunt/types.enumsAsTypes.ts:
schema: ./dev-test/githunt/schema.json
documents: ./dev-test/githunt/**/*.graphql
config:
enumsAsTypes: true
plugins:
- typescript-common
- typescript-client
- typescript
- typescript-operations
./dev-test/githunt/types.d.ts:
schema: ./dev-test/githunt/schema.json
documents: ./dev-test/githunt/**/*.graphql
config:
enumsAsTypes: true
plugins:
- typescript-common
- typescript-client
- typescript
- typescript-operations
./dev-test/githunt/types.avoidOptionals.ts:
schema: ./dev-test/githunt/schema.json
documents: ./dev-test/githunt/**/*.graphql
config:
avoidOptionals: true
plugins:
- typescript-common
- typescript-client
- typescript
- typescript-operations
./dev-test/githunt/types.immutableTypes.ts:
schema: ./dev-test/githunt/schema.json
documents: ./dev-test/githunt/**/*.graphql
config:
immutableTypes: true
plugins:
- typescript-common
- typescript-client
./dev-test/githunt/types.noNamespaces.ts:
- typescript
- typescript-operations
./dev-test/githunt/types.reactApollo.tsx:
schema: ./dev-test/githunt/schema.json
documents: ./dev-test/githunt/**/*.graphql
config:
noNamespaces: true
plugins:
- typescript-common
- typescript-client
./dev-test/githunt/types.reactApollo.tsx:
- add: // tslint:disable
- typescript
- typescript-operations
- typescript-react-apollo
./dev-test/githunt/types.reactApollo.hooks.tsx:
schema: ./dev-test/githunt/schema.json
documents: ./dev-test/githunt/**/*.graphql
plugins:
- add: // tslint:disable
- typescript-common
- typescript-client
- typescript
- typescript-operations
- typescript-react-apollo
./dev-test/githunt/types.reactApollo.noNamespaces.tsx:
config:
withHooks: true
./dev-test/githunt/types.stencilApollo.tsx:
schema: ./dev-test/githunt/schema.json
documents: ./dev-test/githunt/**/*.graphql
config:
noNamespaces: true
plugins:
- add: // tslint:disable
- typescript-common
- typescript-client
- typescript-react-apollo
- typescript
- typescript-operations
- typescript-stencil-apollo
./dev-test/githunt/types.stencilApollo.class.tsx:
schema: ./dev-test/githunt/schema.json
documents: ./dev-test/githunt/**/*.graphql
plugins:
- add: // tslint:disable
- typescript
- typescript-operations
- typescript-stencil-apollo
config:
componentType: class
./dev-test/star-wars/types.ts:
schema: ./dev-test/star-wars/schema.json
documents: ./dev-test/star-wars/**/*.graphql
plugins:
- typescript-common
- typescript-client
./dev-test/star-wars/types.uppercase-enums.ts:
schema: ./dev-test/star-wars/schema.json
plugins:
- add: // tslint:disable
- typescript-common
- typescript-server
config:
namingConvention:
default: change-case#pascalCase
enumValues: change-case#upperCase
- typescript
- typescript-operations
./dev-test/star-wars/types.d.ts:
schema: ./dev-test/star-wars/schema.json
documents: ./dev-test/star-wars/**/*.graphql
config:
enumsAsTypes: true
plugins:
- typescript-common
- typescript-client
- typescript
- typescript-operations
./dev-test/star-wars/types.avoidOptionals.ts:
schema: ./dev-test/star-wars/schema.json
documents: ./dev-test/star-wars/**/*.graphql
config:
avoidOptionals: true
plugins:
- typescript-common
- typescript-client
- typescript
- typescript-operations
./dev-test/star-wars/types.immutableTypes.ts:
schema: ./dev-test/star-wars/schema.json
documents: ./dev-test/star-wars/**/*.graphql
config:
immutableTypes: true
plugins:
- typescript-common
- typescript-client
./dev-test/star-wars/types.noNamespaces.ts:
schema: ./dev-test/star-wars/schema.json
documents: ./dev-test/star-wars/**/*.graphql
config:
immutableTypes: true
plugins:
- typescript-common
- typescript-client
- typescript
- typescript-operations
./dev-test/star-wars/types.skipSchema.ts:
schema: ./dev-test/star-wars/schema.json
documents: ./dev-test/star-wars/**/*.graphql
plugins:
- typescript-common
- typescript-client
./dev-test/test-message/types.reactApollo.noNamespaces.tsx:
schema: ./dev-test/test-message/schema.graphql
documents: ./dev-test/test-message/documents.ts
config:
noNamespaces: true
plugins:
- add: // tslint:disable
- typescript-common
- typescript-client
- typescript-react-apollo
./dev-test/test-message/types.stencilApollo.noNamespaces.tsx:
schema: ./dev-test/test-message/schema.graphql
documents: ./dev-test/test-message/documents.ts
config:
noNamespaces: true
plugins:
- add: // tslint:disable
- typescript-common
- typescript-client
- typescript-stencil-apollo
./dev-test/test-mongodb/types.ts:
schema: ./dev-test/test-mongodb/schema.graphql
config:
scalars:
Date: Date
plugins:
- add: // tslint:disable
- typescript-common
- typescript-server
- typescript-mongodb
- typescript-resolvers
- typescript
- typescript-operations
2 changes: 1 addition & 1 deletion dev-test/generate-all.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#/bin/sh

node packages/graphql-codegen-cli/dist/cli.js --config ./dev-test/codegen.yml
node packages/graphql-codegen-cli/dist/commonjs/cli.js --config ./dev-test/codegen.yml
2 changes: 1 addition & 1 deletion dev-test/generate-watch.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#/bin/sh

node packages/graphql-codegen-cli/dist/cli.js --config ./dev-test/codegen-watch.yml
node packages/graphql-codegen-cli/dist/commonjs/cli.js --config ./dev-test/codegen.yml -w
Loading

0 comments on commit 645c985

Please sign in to comment.