Skip to content

Commit

Permalink
4.3.0
Browse files Browse the repository at this point in the history
- bumps to GraphQL Code Generator v1
- adds GraphQL named fragment support
- removes `webpack-node-externals`, in favour of building a single `server.js` bundle
- updates README for GraphQL Code Generator v1
- bumps NPM packages:
 @emotion/core                              ^10.0.7  →   ^10.0.10
 @emotion/styled                            ^10.0.7  →   ^10.0.10
 apollo-cache-inmemory                       ^1.4.3  →     ^1.5.1
 apollo-client                              ^2.4.13  →     ^2.5.1
 apollo-link                                 ^1.2.8  →    ^1.2.11
 apollo-link-error                           ^1.1.7  →    ^1.1.10
 apollo-link-http                           ^1.5.11  →    ^1.5.14
 apollo-link-ws                             ^1.0.14  →    ^1.0.17
 apollo-utilities                            ^1.1.3  →     ^1.2.1
 cross-fetch                                 ^3.0.1  →     ^3.0.2
 dotenv                                      ^6.2.0  →     ^7.0.0
 emotion                                    ^10.0.7  →    ^10.0.9
 graphql                                    ^14.1.1  →    ^14.2.1
 history                                     ^4.7.2  →     ^4.9.0
 ora                                         ^3.1.0  →     ^3.4.0
 react                                      ^16.8.2  →    ^16.8.6
 react-apollo                                ^2.4.1  →     ^2.5.3
 react-dom                                  ^16.8.2  →    ^16.8.6
 react-hot-loader                            ^4.7.0  →     ^4.8.2
 react-router-dom                            ^4.3.1  →     ^5.0.0
 subscriptions-transport-ws                 ^0.9.15  →    ^0.9.16
 @babel/core                                 ^7.3.3  →     ^7.4.3
 @hot-loader/react-dom                      ^16.8.2  →    ^16.8.6
 @types/koa-router                          ^7.0.39  →    ^7.0.40
 @types/koa-send                             ^4.1.1  →     ^4.1.2
 @types/lodash                            ^4.14.121  →  ^4.14.123
 @types/node                                ^11.9.4  →   ^11.13.0
 @types/ora                                  ^3.0.0  →     ^3.2.0
 @types/prop-types                          ^15.5.9  →    ^15.7.0
 @types/react                               ^16.8.3  →   ^16.8.12
 @types/react-dom                           ^16.8.2  →    ^16.8.3
 @types/source-map-support                   ^0.4.2  →     ^0.5.0
 @types/webpack                             ^4.4.24  →    ^4.4.27
 @types/webpack-dev-server                   ^3.1.2  →     ^3.1.5
 babel-plugin-emotion                       ^10.0.7  →    ^10.0.9
 css-hot-loader                              ^1.4.3  →     ^1.4.4
 css-loader                                  ^2.1.0  →     ^2.1.1
 koa-webpack                                 ^5.2.1  →     ^5.2.2
 lint-staged                                 ^8.1.4  →     ^8.1.5
 postcss-preset-env                          ^6.5.0  →     ^6.6.0
 resolve-url-loader                          ^3.0.1  →     ^3.1.0
 source-map-support                         ^0.5.10  →    ^0.5.11
 ts-node                                     ^8.0.2  →     ^8.0.3
 tslint                                     ^5.12.1  →    ^5.15.0
 typescript                                  ^3.3.3  →     ^3.4.1
 webpack                                    ^4.29.5  →    ^4.29.6
  • Loading branch information
leebenson committed Apr 5, 2019
1 parent 0320332 commit 34eee85
Show file tree
Hide file tree
Showing 11 changed files with 1,609 additions and 2,597 deletions.
15 changes: 15 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# git
.github
**/.gitattributes

# editors
.vscode
*.un~
*.swp

# NPM
**/node_modules

# ext to ignore
**/*.svg
**/.DS_Store
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ https://reactql.org
- [Emotion](https://emotion.sh/) CSS-in-JS, with inline `<style>` tag generation that contains only the CSS that needs to be rendered.
- [Sass](https://sass-lang.com/), [Less](http://lesscss.org/) and [PostCSS](https://postcss.org/) when importing `.css/.scss/.less` files.
- [React Router 4](https://reacttraining.com/react-router/) for declarative browser + server routes.
- [GraphQL Code Generator](https://graphql-code-generator.com/) for parsing remote GraphQL server schemas, for automatically building fully-typed Apollo React HOCs instead of writing `<Query>` / `<Mutation>` queries manually
- [GraphQL Code Generator v1](https://graphql-code-generator.com/) for parsing remote GraphQL server schemas, for automatically building fully-typed Apollo React HOCs instead of writing `<Query>` / `<Mutation>` queries manually
- Declarative/dynamic `<head>` section, using [react-helmet](https://github.com/nfl/react-helmet).

### Server-side rendering
Expand Down Expand Up @@ -92,18 +92,18 @@ You can then import the query like we do in the [HackerNews demo component](src/

```ts
// Query to get top stories from HackerNews
import { GetHackerNewsTopStories } from "@/graphql";
import { GetHackerNewsTopStoriesComponent } from "@/graphql";
```

And use it as follows:

```ts
<GetHackerNewsTopStories.Component>
<GetHackerNewsTopStoriesComponent>
{({ data, loading, error }) => (...)
</GetHackerNewsTopStories.Component>
</GetHackerNewsTopStoriesComponent>
```
To get access to the underlying `gql`-templated query (in case you need it for refetching, etc), in this case it'd be `GetHackerNewsTopStories.Document`.
To get access to the underlying `gql`-templated query (in case you need it for refetching, etc), in this case it'd be `GetHackerNewsTopStoriesDocument`.
See [GraphQL Code Generator](https://graphql-code-generator.com/) for more details on how it works.
Expand Down
9 changes: 6 additions & 3 deletions codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ documents: "src/**/*.graphql"
generates:
src/graphql/index.tsx:
plugins:
- "typescript-common"
- "typescript-client"
- "typescript-react-apollo"
- typescript
- typescript-operations
- typescript-react-apollo
src/graphql/fragments.tsx:
plugins:
- fragment-matcher
Loading

0 comments on commit 34eee85

Please sign in to comment.