Skip to content

Commit

Permalink
feat(epic): 0.12.0 Plugin System and Internal Refactor (#242)
Browse files Browse the repository at this point in the history
See #242 for a full summary
  • Loading branch information
tgriesser authored Nov 7, 2019
1 parent b084837 commit 50bf298
Show file tree
Hide file tree
Showing 109 changed files with 11,145 additions and 2,889 deletions.
89 changes: 37 additions & 52 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
version: 2.1

jobs:
nexus:
executors:
node-10:
docker:
- image: circleci/node:10

commands:
test_example_project:
description: "Tests the compilation of a specified example"
parameters:
dir:
type: string
steps:
- checkout
- run: yarn --frozen-lockfile
- run: yarn link
- run: yarn --cwd=examples/<< parameters.dir >> --frozen-lockfile
- run: yarn --cwd=examples/<< parameters.dir >> link nexus
- run: yarn --cwd=examples/<< parameters.dir >> tsc

jobs:
nexus:
executor: node-10
steps:
- checkout
- run: yarn --frozen-lockfile
Expand All @@ -15,62 +33,35 @@ jobs:
path: coverage

example_apollo-fullstack:
docker:
- image: circleci/node:10
executor: node-10
steps:
- checkout
- run: yarn --frozen-lockfile
- run: yarn --cwd=examples/apollo-fullstack --frozen-lockfile
- run: yarn --cwd=examples/apollo-fullstack tsc
- test_example_project:
dir: "apollo-fullstack"

example_ghost:
docker:
- image: circleci/node:10
executor: node-10
steps:
- checkout
- run: yarn --frozen-lockfile
- run: yarn --cwd=examples/ghost --frozen-lockfile
- run: yarn --cwd=examples/ghost tsc
- test_example_project:
dir: "ghost"

example_githunt-api:
docker:
- image: circleci/node:8
steps:
- checkout
- run: yarn --frozen-lockfile
- run: yarn link
- run: yarn --cwd=examples/githunt-api --frozen-lockfile
- run: yarn --cwd=examples/githunt-api link nexus
- run: yarn --cwd=examples/githunt-api tsc
- test_example_project:
dir: "githunt-api"

example_kitchen-sink:
docker:
- image: circleci/node:10
steps:
- checkout
- run: yarn --frozen-lockfile
- run: yarn --cwd=examples/kitchen-sink --frozen-lockfile
- run: yarn --cwd=examples/kitchen-sink tsc

example_nexus-prisma:
docker:
- image: circleci/node:10
executor: node-10
steps:
- checkout
- run: yarn --frozen-lockfile
- run: yarn --cwd=examples/nexus-prisma --frozen-lockfile
- run: yarn --cwd=examples/nexus-prisma tsc
- test_example_project:
dir: "kitchen-sink"

example_star-wars:
docker:
- image: circleci/node:10
executor: node-10
steps:
- checkout
- run: yarn --frozen-lockfile
- run: yarn link
- run: yarn --cwd=examples/star-wars --frozen-lockfile
- run: yarn --cwd=examples/star-wars link nexus
- run: yarn --cwd=examples/star-wars tsc
- test_example_project:
dir: "star-wars"
- run:
command: |
rm examples/star-wars/src/star-wars-typegen.ts
Expand All @@ -79,15 +70,10 @@ jobs:
git diff --exit-code
example_ts-ast-reader:
docker:
- image: circleci/node:10
executor: node-10
steps:
- checkout
- run: yarn --frozen-lockfile
- run: yarn link
- run: yarn --cwd=examples/ts-ast-reader --frozen-lockfile
- run: yarn --cwd=examples/ts-ast-reader link nexus
- run: yarn --cwd=examples/ts-ast-reader tsc
- test_example_project:
dir: "ts-ast-reader"

workflows:
nexus:
Expand All @@ -97,6 +83,5 @@ workflows:
- example_ghost
- example_githunt-api
- example_kitchen-sink
- example_nexus-prisma
- example_star-wars
- example_ts-ast-reader
51 changes: 46 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,47 @@
# Changelog

### 0.12.0 (next)
### 0.12.0 final (unreleased)

- refactor: Remove NEXUS_SHOULD_GENERATE_ARTIFACTS env var
- feat: Add `shouldExitAfterGenerateArtifacts`
- Warn on missing `outputs` in `makeSchema` config

### 0.12.0-rc.2, rc.3

- fix: bug in nullability check plugin

### 0.12.0-rc

- feat(deps): Bumps the default minimum version of graphql-js to 14.5.0

Nexus uses the new [`extensions` property](https://github.com/graphql/graphql-js/pull/2097) on types to store metadata provided to Nexus types, in order to make them usable by plugins.

- feat: Adds "Plugins" API, [see the docs](docs/api-plugins.md) for more info on what all these can help accomplish

- feat(plugin): Add `nullabilityGuardPlugin`. See [the docs](docs/plugin-nullabilityGuard.md) for more info

- feat(plugin): Add `fieldAuthorizePlugin`. See [the docs](docs/plugin-fieldAuthorize.md) for more info

This is the same behavior as before, but implemented more flexibly as a plugin. This will be
automatically added if no plugins are specified, otherwise it will need to be imported & added
to `makeSchema`.

- feat(schema): Adds `shouldExitAfterGenerateArtifacts` option to `makeSchema`

The `shouldExitAfterGenerateArtifacts` makes it possible to exit after the types are generated,
useful if you do not check a schema artifact into source control, but wish to generate before the code runs.

- refactor: Removes `nexusWrappedType`

This was an internal implementation detail which should not affect end users

- refactor: Removes `t.modifyType` API

This may not have ever worked, it was only intended to modify fields on an `objectType` which were
originally implemented by an interface. Please open an issue if this is a breaking change for you, so we
can understand the use-case and design a better API.

- test: Improved code coverage, adds base threshold to new PRs

#### beta.14

Expand All @@ -13,18 +54,18 @@

#### beta.12

- feat(config): env var for should-generate-artifacts (#244)
- feat(config): <strike>env var for should-generate-artifacts (#244)

You can now set the `shouldGenerateArtifacts` config option by env var
`NEXUS_SHOULD_GENERATE_ARTIFACTS=true|false`.
`NEXUS_SHOULD_GENERATE_ARTIFACTS=true|false`.</strike> (removed, see 0.12 release notes)

- fix(typegen): delete prev file before writing next (#252)

Before, sometimes, you would have to open the typegen file to make VSCode pick
up its changed version. This change should reduce/remove the need for this
workaround.

* feat: by default typegen as an @types package (#230)
* feat: <strike>by default typegen as an @types package (#230)

BREAKING CHANGE

Expand All @@ -35,7 +76,7 @@

This is a breaking change because typegen is enabled even when config
`outputs` have not been configured (before, they were required). The
heuristics of `shouldGenerateArtifacts` remain unchanged.
heuristics of `shouldGenerateArtifacts` remain unchanged.</strike> (removed, see 0.12 release notes)

### 0.11.7

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h1 align="center">Nexus</h1>
</p>

[![CircleCI](https://img.shields.io/circleci/build/github/prisma-labs/nexus)](https://circleci.com/gh/prisma/nexus)
[![CircleCI](https://img.shields.io/circleci/build/github/prisma-labs/nexus)](https://circleci.com/gh/prisma-labs/nexus)
[![npm version](https://badge.fury.io/js/nexus.svg)](https://badge.fury.io/js/nexus)
[![Slack](https://slack.prisma.io/badge.svg)](https://slack.prisma.io/)

Expand Down Expand Up @@ -58,7 +58,7 @@ All examples of GraphQL Nexus can be found in the [`/examples`](./examples) dire
- [star-wars](./examples/star-wars)
- [kitchen-sink](./examples/kitchen-sink)

If you're interested in examples using the [`nexus-prisma`](https://github.com/prisma/nexus-prisma) plugin, check out the official [`prisma-examples`](https://github.com/prisma/prisma-examples/) repo:
If you're interested in examples using the [`nexus-prisma`](https://github.com/prisma-labs/nexus-prisma) plugin, check out the official [`prisma-examples`](https://github.com/prisma/prisma-examples/) repo:

- [GraphQL blogging app](https://github.com/prisma/prisma-examples/tree/master/typescript/graphql)
- [GraphQL blogging app with authentication & authorization](https://github.com/prisma/prisma-examples/tree/master/typescript/graphql-auth)
Expand All @@ -73,10 +73,10 @@ If you're interested in examples using the [`nexus-prisma`](https://github.com/p
- Interoperable with vanilla `graphql-js` types, and it's _just_ a [`GraphQLSchema`](https://graphql.org/graphql-js/type/#graphqlschema) so it fits in just fine with existing community solutions of `apollo-server`, `graphql-middleware`, etc.
- Inline function resolvers for when you need to do simple field aliasing
- Auto-generated graphql SDL schema, great for when seeing how any code changes affected the schema
- Lots of good [examples](https://github.com/prisma/nexus/tree/develop/examples) to get you started and thorough [API documentation](https://nexus.js.org/docs/api-core-concepts)
- Lots of good [examples](https://github.com/prisma-labs/nexus/tree/develop/examples) to get you started and thorough [API documentation](https://nexus.js.org/docs/api-core-concepts)
- Full type-safety for free
- Internal structure allows library authors to build more advanced abstractions
- Independent from Prisma, but integrates nicely using the [`nexus-prisma`](https://github.com/prisma/nexus-prisma) plugin
- Independent from Prisma, but integrates nicely using the [`nexus-prisma`](https://github.com/prisma-labs/nexus-prisma) plugin
- Allows code re-use by creating higher level "functions" which wrap common fields

## Documentation
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ coverage:
project: off
patch:
default:
target: 100
target: 95
Loading

0 comments on commit 50bf298

Please sign in to comment.