-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
v1rtl
committed
Mar 20, 2021
1 parent
fdd4288
commit fb3a5c2
Showing
5 changed files
with
218 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: CI | ||
|
||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the master branch | ||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: denolib/setup-deno@v2 | ||
with: | ||
deno-version: v1.8 | ||
- name: Run tests | ||
run: deno test --unstable --coverage=coverage | ||
- name: Create coverage report | ||
run: deno --unstable coverage ./coverage --lcov > coverage.lcov | ||
- name: Collect coverage | ||
uses: codecov/codecov-action@v1.0.10 | ||
with: | ||
file: ./coverage.lcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,45 @@ | ||
# graphql-tag | ||
|
||
🦕 Deno port of `graphql-tag` library. | ||
[![GitHub release (latest by date)][releases]][releases-page] [![GitHub Workflow Status][gh-actions-img]][github-actions] | ||
[![Codecov][codecov-badge]][codecov] [![][docs-badge]][docs] | ||
|
||
> 🦕 Deno port of [graphql-tag](https://github.com/apollographql/graphql-tag) library. | ||
Create a GraphQL schema AST from template literal. | ||
|
||
## Example | ||
|
||
```ts | ||
import { buildASTSchema, graphql } from 'https://deno.land/x/graphql_deno@v15.0.0/mod.ts' | ||
import { gql } from 'https://deno.land/x/graphql_tag/mod.ts' | ||
|
||
const typeDefs = gql` | ||
type Query { | ||
hello: String | ||
} | ||
` | ||
|
||
const query = `{ hello }` | ||
|
||
const resolvers = { hello: () => 'world' } | ||
|
||
const schema = buildASTSchema(typeDefs) | ||
|
||
console.log(await graphql(schema, query, resolvers)) | ||
``` | ||
|
||
[releases]: https://img.shields.io/github/v/release/deno-libs/graphql-tag?style=flat-square | ||
[docs-badge]: https://img.shields.io/github/v/release/deno-libs/graphql_tag?color=yellow&label=Documentation&logo=deno&style=flat-square | ||
[docs]: https://doc.deno.land/https/deno.land/x/graphql_tag/mod.ts | ||
[releases-page]: https://github.com/deno-libs/graphql-tag/releases | ||
[gh-actions-img]: https://img.shields.io/github/workflow/status/deno-libs/graphql-tag/CI?style=flat-square | ||
[codecov]: https://codecov.io/gh/deno-libs/graphql-tag | ||
[github-actions]: https://github.com/deno-libs/graphql-tag/actions | ||
[codecov-badge]: https://img.shields.io/codecov/c/gh/deno-libs/graphql-tag?style=flat-square | ||
|
||
## Donate | ||
|
||
[![PayPal](https://img.shields.io/badge/PayPal-cyan?style=flat-square&logo=paypal)](https://paypal.me/v1rtl) [![ko-fi](https://img.shields.io/badge/kofi-pink?style=flat-square&logo=ko-fi)](https://ko-fi.com/v1rtl) [![Qiwi](https://img.shields.io/badge/qiwi-white?style=flat-square&logo=qiwi)](https://qiwi.com/n/V1RTL) [![Yandex Money](https://img.shields.io/badge/Yandex_Money-yellow?style=flat-square&logo=yandex)](https://money.yandex.ru/to/410014774355272) | ||
|
||
[![Bitcoin](https://badge-crypto.vercel.app/api/badge?coin=btc&address=3PxedDftWBXujWtr7TbWQSiYTsZJoMD8K5)](https://badge-crypto.vercel.app/btc/3PxedDftWBXujWtr7TbWQSiYTsZJoMD8K5) [![Ethereum](https://badge-crypto.vercel.app/api/badge?coin=eth&address=0x9d9236DC024958D7fB73Ad9B178BD5D372D82288) | ||
](https://badge-crypto.vercel.app/eth/0x9d9236DC024958D7fB73Ad9B178BD5D372D82288) [![ChainLink](https://badge-crypto.vercel.app/api/badge?coin=link&address=0x9d9236DC024958D7fB73Ad9B178BD5D372D82288)](https://badge-crypto.vercel.app/link/0xcd0da1c9b0DA7D2b862bbF813cB50f76F2fB4F5d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { buildASTSchema, graphql } from 'https://deno.land/x/graphql_deno@v15.0.0/mod.ts' | ||
import { gql } from './mod.ts' | ||
|
||
const typeDefs = gql` | ||
type Query { | ||
hello: String | ||
} | ||
` | ||
|
||
const query = ` | ||
{ | ||
hello | ||
} | ||
` | ||
|
||
const resolvers = { | ||
hello: () => 'world' | ||
} | ||
|
||
const schema = buildASTSchema(typeDefs) | ||
|
||
console.log(await graphql(schema, query, resolvers)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { DocumentNode, buildASTSchema, isSchema } from 'https://deno.land/x/graphql_deno@v15.0.0/mod.ts' | ||
import { describe, it, run, expect } from 'https://deno.land/x/wizard@0.1.3/mod.ts' | ||
import { gql } from './mod.ts' | ||
|
||
const typeDefs = gql` | ||
type Query { | ||
hello: String | ||
} | ||
` | ||
|
||
it('Returns a valid document node', () => { | ||
expect(typeDefs.kind).toBe('Document') | ||
}) | ||
|
||
it('Creates a valid schema from AST', () => { | ||
const schema = buildASTSchema(typeDefs) | ||
|
||
expect(isSchema(schema)).toBe(true) | ||
}) | ||
|
||
run() |