Skip to content

Commit 7fb5e37

Browse files
authored
sync 20200415 (xitu#103)
1 parent bb58b24 commit 7fb5e37

File tree

39 files changed

+517
-130
lines changed

39 files changed

+517
-130
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ node_modules
66
npm-debug.log
77

88
/build/
9-
.tmp.*
9+
.tmp.*
10+
package-lock.json

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,14 @@ The site chrome are all in JS files in `site/_core/`.
1212

1313
The first time, get all the dependencies loaded via
1414

15-
```
16-
npm install
17-
```
15+
`$ npm install` or `$ yarn install`
1816

1917
Then, run the server via
2018

21-
```
22-
npm start
23-
Open http://localhost:8444/
24-
```
19+
`$ npm start` or `$ yarn start`
2520

26-
Anytime you change the contents, just refresh the page and it's going to be updated.
21+
Open [http://localhost:8444](http://localhost:8444) to view it in the browser.
22+
Anytime you make some changes, refresh the page to see the updates.
2723

2824
### Publish the Website
2925

site/_core/HeaderLinks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const links = [
1515
{ section: 'spec', text: '规范', href: 'https://spec.graphql.cn/' },
1616
{ section: 'codeofconduct', text: '行为守则', href: '/codeofconduct/' },
1717
{ section: 'foundation', text: '基金会', href: 'https://foundation.graphql.org/' },
18+
{ section: 'landscape', text: '社区总览', href: 'https://l.graphql.org/' },
1819
{ section: 'principles', text: '开发原则', href: 'https://principles.graphql.cn/' },
1920
];
2021

site/_core/Redirect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
var React = require('react');
1010

1111
export default ({ to }) =>
12-
<html>
12+
<html lang="zh-Hans-CN">
1313
<head>
1414
<meta charset="UTF-8" />
1515
<meta http-equiv="refresh" content={'1;url=' + to} />

site/_core/Search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ var React = require('react');
1010

1111
export default () =>
1212
<div className="algolia-search-wrapper">
13-
<input id="algolia-search-input" type="text" placeholder="搜索文档..." />
13+
<input id="algolia-search-input" type="text" placeholder="搜索文档..." aria-label="搜索文档" />
1414
</div>

site/_core/Site.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var Search = require('./Search');
1212
var SiteData = require('./SiteData');
1313

1414
export default ({ page, category, title, section, className, noSearch, children }) =>
15-
<html>
15+
<html lang="zh-Hans-CN">
1616
<head>
1717
<meta charSet="utf-8" />
1818
<meta httpEquiv="X-UA-Compatible" content="IE=edge,chrome=1" />
@@ -22,6 +22,7 @@ export default ({ page, category, title, section, className, noSearch, children
2222
`GraphQL | ${SiteData.description}`}
2323
</title>
2424
<meta name="viewport" content="width=640" />
25+
<meta name="description" content="GraphQL 提供了 API 中数据的完整描述,提供让客户端能够准确地获取需要的数据而不包含任何冗余的能力,让 API 更加容易随着时间推移而演进,并提供强大的开发者工具。" />
2526
<meta property="og:title" content="GraphQL: 一种用于 API 的查询语言。" />
2627
<meta property="og:description" content="GraphQL 提供了 API 中数据的完整描述,提供让客户端能够准确地获取需要的数据而不包含任何冗余的能力,让 API 更加容易随着时间推移而演进,并提供强大的开发者工具。" />
2728
<meta property="og:type" content="website" />
@@ -45,7 +46,7 @@ export default ({ page, category, title, section, className, noSearch, children
4546
<header>
4647
<section>
4748
<a className="nav-home" href="/">
48-
<img className="nav-logo" src="/img/logo.svg" width="30" height="30" />
49+
<img className="nav-logo" src="/img/logo.svg" alt="GraphQL Logo" width="30" height="30" />
4950
GraphQL
5051
</a>
5152
<HeaderLinks section={section} />
@@ -57,7 +58,7 @@ export default ({ page, category, title, section, className, noSearch, children
5758

5859
<footer>
5960
<section className="sitemap">
60-
<a href="/" className="nav-home" />
61+
<a href="/" className="nav-home" aria-label="主页" />
6162
<div>
6263
<h5><a href="/learn/">学习</a></h5>
6364
<a href="/learn/">入门</a>
@@ -88,19 +89,21 @@ export default ({ page, category, title, section, className, noSearch, children
8889
</div>
8990
</section>
9091
<section className="copyright">
91-
Copyright © 2019 GraphQL 基金会。保留所有权利。Linux 基金会已经注册了商标和使用商标。有关 Linux 基金会的商标清单,请参阅我们的 <a href="https://www.linuxfoundation.org/trademark-usage">商标使用</a> 页面。Linux 是 Linus Torvalds 的注册商标。<a href="http://www.linuxfoundation.org/privacy">隐私政策</a><a href="http://www.linuxfoundation.org/terms">使用条款</a>
92+
Copyright © {`${new Date().getFullYear()}`} GraphQL 基金会。保留所有权利。Linux 基金会已经注册了商标和使用商标。有关 Linux 基金会的商标清单,请参阅我们的 <a href="https://www.linuxfoundation.org/trademark-usage">商标使用</a> 页面。Linux 是 Linus Torvalds 的注册商标。<a href="http://www.linuxfoundation.org/privacy">隐私政策</a><a href="http://www.linuxfoundation.org/terms">使用条款</a>
9293
</section>
9394
</footer>
9495

9596
<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
96-
<script dangerouslySetInnerHTML={{__html: `
97+
<script dangerouslySetInnerHTML={{
98+
__html: `
9799
docsearch({
98100
apiKey: 'd103541f3e6041148aade2e746ed4d61',
99101
indexName: 'graphql',
100102
inputSelector: '#algolia-search-input'
101103
});
102104
`}} />
103-
<script dangerouslySetInnerHTML={{__html: `
105+
<script dangerouslySetInnerHTML={{
106+
__html: `
104107
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
105108
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
106109
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)

site/_css/codemirror.less

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
178178
z-index: 6;
179179
display: none;
180180
}
181-
.CodeMirror-vscrollbar {
182-
right: 0; top: 0;
183-
overflow-x: hidden;
184-
overflow-y: scroll;
185-
}
186-
.CodeMirror-hscrollbar {
187-
bottom: 0; left: 0;
188-
overflow-y: hidden;
189-
overflow-x: scroll;
181+
.CodeMirror-scroll {
182+
overflow: hidden;
190183
}
191184
.CodeMirror-scrollbar-filler {
192185
right: 0; bottom: 0;

site/_redirects

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
1-
/swapi-graphql https://graphql.github.io/swapi-graphql/ 200
2-
/swapi-graphql/* https://graphql.github.io/swapi-graphql/:splat 200
1+
# 200 = reverse proxy rules
2+
# https://www.netlify.com/docs/redirects/#rewrites-and-proxying
3+
4+
/swapi-graphql https://graphql.github.io/swapi-graphql/ 200
5+
/swapi-graphql/* https://graphql.github.io/swapi-graphql/:splat 200
6+
7+
# 301 = permanent redirects
8+
# https://www.netlify.com/docs/redirects/#http-status-codes
9+
10+
/docs/api-reference-errors /graphql-js/error/ 301
11+
/docs/api-reference-execution /graphql-js/exection/ 301
12+
/docs/api-reference-express-graphql /graphql-js/express-graphql/ 301
13+
/docs/api-reference-graphql /graphql-js/graphql/ 301
14+
/docs/api-reference-language /graphql-js/language/ 301
15+
/docs/api-reference-type-system /graphql-js/type/ 301
16+
/docs/api-reference-type-utilities /graphql-js/utilities/ 301
17+
/docs/api-reference-type-validation /graphql-js/validation/ 301
18+
/docs/getting-started /learn/ 301
19+
/docs/intro /learn/ 301
20+
/docs/introspection /learn/introspection/ 301
21+
/docs/queries /learn/queries/ 301
22+
/docs/typesystem /learn/schema/ 301
23+
/docs/validation /learn/validation/ 301
24+
/docs/videos /community/#videos 301
25+
/help /community/ 301

site/code/index.html.js

Lines changed: 110 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ GraphQL 已有多种编程语言支持。下表包含一些流行的服务端框
3434
- [Java](#java)
3535
- [JavaScript](#javascript)
3636
- [Kotlin](#kotlin)
37+
- [Perl](#perl)
3738
- [PHP](#php)
3839
- [Python](#python)
3940
- [Ruby](#ruby)
4041
- [Rust](#rust)
41-
- [Scala](#scala)]
42+
- [Scala](#scala)
4243
- [Swift](#swift)
4344
4445
### C# / .NET
@@ -154,11 +155,10 @@ $ curl -XPOST "http://0:3000" -H'Content-Type: application/json' -d'{
154155
155156
- [graphql-go](https://github.com/graphql-go/graphql):一个 Go/Golang 的 GraphQL 实现。
156157
- [graph-gophers/graphql-go](https://github.com/graph-gophers/graphql-go):一个活跃的 Golang GraphQL 实现。
157-
- [GQLGen](https://github.com/99designs/gqlgen):生成基于 graphql 的服务器的库。
158+
- [99designs/gqlgen](https://github.com/99designs/gqlgen):生成基于 graphql 的服务器的库。
158159
- [graphql-relay-go](https://github.com/graphql-go/relay):一个用于帮助构建 graphql-go 服务器的 Go/Golang 库,支持 react-relay 。
159160
- [machinebox/graphql](https://github.com/machinebox/graphql):用于 GraphQL 的一个优雅的底层 HTTP 客户端。
160161
- [samsarahq/thunder](https://github.com/samsarahq/thunder):可轻松进行 schema 构建、实时查询和批处理的 GraphQL 实现。
161-
- [99designs/gqlgen](https://github.com/99designs/gqlgen):一个 schema 优先的 GraphQL 服务器生成。
162162
- [appointy/jaal](https://github.com/appointy/jaal):在 Go 中开发符合规范的 GraphQL 服务器。
163163
164164
### Groovy
@@ -324,19 +324,28 @@ app.listen({ port: 4000 }, () =>
324324
);
325325
\`\`\`
326326
327-
Apollo Server 也支持所有的 Node.js HTTP 服务器框架:Express、Connect、HAPI 和 Koa
327+
Apollo Server 也支持所有的 Node.js HTTP 服务器框架:Express、Connect、HAPI、KoaNestJs
328328
329329
### Kotlin
330330
331331
- [graphql-kotlin](https://github.com/ExpediaGroup/graphql-kotlin/):一组用于在 Kotlin 中运行 GraphQL 服务器的库。
332332
333+
### Perl
334+
335+
- [graphql-perl](https://github.com/graphql-perl/graphql-perl):GraphQL 参考实现的 Perl 移植版本
336+
- [MetaCPAN documentation](https://metacpan.org/pod/GraphQL)
337+
- [Mojolicious-Plugin-GraphQL](https://github.com/graphql-perl/Mojolicious-Plugin-GraphQL):将你的 GraphQL 服务连接到 Mojolicious 应用
338+
- [GraphQL-Plugin-Convert-DBIC](https://github.com/graphql-perl/GraphQL-Plugin-Convert-DBIC):自动将你的 DBIx::Class schema 连接到 GraphQL
339+
- [GraphQL-Plugin-Convert-OpenAPI](https://github.com/graphql-perl/GraphQL-Plugin-Convert-OpenAPI):自动将任何 OpenAPI 服务(本地或远程的 Mojolicious)连接到GraphQL
333340
334341
### PHP
335342
336343
- [graphql-php](https://github.com/webonyx/graphql-php):GraphQL 参考实现的 PHP 移植版本。
337344
- [graphql-relay-php](https://github.com/ivome/graphql-relay-php):一个用于辅助构建 graphql-php 服务器的库,支持 react-relay。
345+
- [Railt](https://github.com/railt/railt):一个 PHP GraphQL 框架。
338346
- [Lighthouse](https://github.com/nuwave/lighthouse):一个用于 Laravel 的 GraphQL 服务器
339347
- [GraphQLBundle](https://github.com/overblog/GraphQLBundle):一个用于 Symfony 的 GraphQL 服务器
348+
- [WPGraphQL](https://github.com/wp-graphql/wp-graphql):一个免费的开源 WordPress 插件,可为任何 WordPress 网站提供可扩展的 GraphQL schema 和 API
340349
341350
#### [API Platform](https://api-platform.com) ([github](https://github.com/api-platform/api-platform))
342351
@@ -376,6 +385,43 @@ class Greeting
376385
377386
API Platform 的其他功能还包括数据验证、身份验证、授权、弃用、缓存和 GraphiQL 集成。
378387
388+
#### [GraphQLite](https://graphqlite.thecodingmachine.io) ([github](https://github.com/thecodingmachine/graphqlite))
389+
390+
GraphQLite 是一个为 GraphQL schema 定义提供基于注释的语法的库。
391+
它与框架无关,可用于 Symfony 和 Laravel。
392+
393+
以下的代码声明了一个 “product” 查询和一个 “Product” 类型:
394+
395+
\`\`\`php
396+
class ProductController
397+
{
398+
/**
399+
* @Query()
400+
*/
401+
public function product(string $id): Product
402+
{
403+
// Some code that looks for a product and returns it.
404+
}
405+
}
406+
407+
/**
408+
* @Type()
409+
*/
410+
class Product
411+
{
412+
/**
413+
* @Field()
414+
*/
415+
public function getName(): string
416+
{
417+
return $this->name;
418+
}
419+
// ...
420+
}
421+
\`\`\`
422+
423+
GraphQLite 的其他功能包括验证、安全性、错误处理、通过数据加载器模式加载……
424+
379425
#### [Siler](https://siler.leocavalcante.com/graphql/) ([github](https://github.com/leocavalcante/siler))
380426
381427
Siler 是一个具有高级抽象功能,可与 GraphQL 搭配使用的 PHP 库。
@@ -485,6 +531,40 @@ puts Schema.execute('{ hello }').to_json
485531
486532
其也有对于 Relay 和 Rails 的良好绑定。
487533
534+
#### [Agoo](https://github.com/ohler55/agoo)
535+
536+
一个支持 GraphQL 的高性能 Web 服务器。Agoo 致力于为 GraphQL 提供一个简单易用的 API。
537+
538+
\`\`\`ruby
539+
require 'agoo'
540+
541+
class Query
542+
def hello
543+
'hello'
544+
end
545+
end
546+
547+
class Schema
548+
attr_reader :query
549+
550+
def initialize
551+
@query = Query.new()
552+
end
553+
end
554+
555+
Agoo::Server.init(6464, 'root', thread_count: 1, graphql: '/graphql')
556+
Agoo::Server.start()
557+
Agoo::GraphQL.schema(Schema.new) {
558+
Agoo::GraphQL.load(%^type Query { hello: String }^)
559+
}
560+
sleep
561+
562+
# To run this GraphQL example type the following then go to a browser and enter
563+
# a URL of localhost:6464/graphql?query={hello}
564+
#
565+
# ruby hello.rb
566+
\`\`\`
567+
488568
### Rust
489569
490570
- [graphql-rust/juniper](https://github.com/graphql-rust/juniper):用于 Rust 的 GraphQL 服务端库
@@ -515,12 +595,15 @@ Executor.execute(schema, query) map println
515595
516596
- [C# / .NET](#c-net-1)
517597
- [Clojurescript](#clojurescript-1)
598+
- [Elm](#elm)
518599
- [Flutter](#flutter)
519600
- [Go](#go-1)
520601
- [Java / Android](#java-android)
521602
- [JavaScript](#javascript-1)
603+
- [Julia](#julia)
522604
- [Swift / Objective-C iOS](#swift-objective-c-ios)
523605
- [Python](#python-1)
606+
- [R](#r)
524607
525608
### C# / .NET
526609
@@ -532,6 +615,10 @@ Executor.execute(schema, query) map println
532615
533616
- [re-graph](https://github.com/oliyh/re-graph/):一个在 Clojurescript 中实现的 GraphQL 客户端,支持 websockets。
534617
618+
### Elm
619+
620+
- [dillonkearns/elm-graphql](https://github.com/dillonkearns/elm-graphql):一个库和命令行代码生成器,用于为 GraphQL 入口端点创建类型安全的 Elm 代码。
621+
535622
### Flutter
536623
537624
- [graphql](https://github.com/zino-app/graphql-flutter#readme):一个 Flutter 中的 GraphQL 客户端实现。
@@ -556,35 +643,51 @@ Executor.execute(schema, query) map println
556643
- [AWS Amplify](https://aws.github.io/aws-amplify):使用云服务进行应用开发的 JavaScript 库,支持 GraphQL 后端和用于处理 GraphQL 数据的 React 组件。
557644
- [Grafoo](https://github.com/grafoojs/grafoo):一个通用的 GraphQL 客户端,具有仅 1.6kb 的多框架的视图层集成。
558645
- [urql](https://formidable.com/open-source/urql/) ([github](https://github.com/FormidableLabs/urql)):一个用于 React 的高度可定制且用途广泛的 GraphQL 客户端。
646+
- [graphqurl](https://github.com/hasura/graphqurl) ([npm](https://www.npmjs.com/package/graphqurl)):带有自动完成功能、订阅和 GraphiQL 的 curl。也是一个简单通用的 javascript GraphQL 客户端。
647+
648+
### Julia
649+
650+
- [Diana.jl](https://github.com/codeneomatrix/Diana.jl):一个 Julia GraphQL 服务端实现.
559651
560652
### Swift / Objective-C iOS
561653
562654
- [Apollo iOS](https://www.apollographql.com/docs/ios/) ([github](https://github.com/apollographql/apollo-ios)):一个用于 iOS 的 GraphQL 客户端,返回查询特定的 Swift 类型,与 Xcode 集成后可以分屏显示你的 Swift 源代码和 GraphQL,并能在行内展示验证错误。
563655
- [GraphQL iOS](https://github.com/funcompany/graphql-ios):一个用于 iOS 的 Objective-C GraphQL 客户端。
656+
- [Graphaello](https://github.com/nerdsupremacist/Graphaello):一个使用 GraphQL 和 Apollo 在 SwiftUI 中编写声明式、类型安全和数据驱动的应用程序的工具
564657
565658
### Python
566659
567660
- [GQL](https://github.com/graphql-python/gql):一个 Python 中的 GraphQL 客户端。
568661
- [python-graphql-client](https://github.com/prisma/python-graphql-client):适用于 Python 2.7+ 的简单 GraphQL 客户端。
569662
- [sgqlc](https://github.com/profusion/sgqlc):一个简单的 Python GraphQL 客户端。支持为 GraphQL schema 中定义的类型生成代码。
663+
664+
### R
665+
666+
- [ghql](https://github.com/ropensci/ghql):通用的 GraphQL R 客户端。
570667
571668
## 工具
572669
573670
- [graphiql](https://github.com/graphql/graphiql) ([npm](https://www.npmjs.com/package/graphiql)):一个交互式的运行于浏览器中的 GraphQL IDE.
574671
- [libgraphqlparser](https://github.com/graphql/libgraphqlparser):一个 C++ 版 GraphQL 查询语言分析器,提供 C 和 C++ API。
575672
- [Graphql Language Service](https://github.com/graphql/graphql-language-service):一个用于构建 IDE 的 GraphQL 语言服务(诊断、自动完成等)的接口。
576673
- [quicktype](https://quicktype.io) ([github](https://github.com/quicktype/quicktype)):在 TypeScript、Swift、golang、C#、C++ 等语言中为 GraphQL 查询生成类型。
674+
- [GraphQL Code Generator](https://graphql-code-generator.com):GraphQL 代码生成器具有对自定义插件和模板(如 Typescript 前端和后端、React Hooks、解析器签名等)的灵活支持。
675+
- [GraphQL Inspector](https://github.com/kamilkisiela/graphql-inspector):比较 schema,验证文档,查找重大更改,查找相似类型,schema 覆盖率等等。
676+
- [GraphQL Config](https://github.com/kamilkisiela/graphql-config):为你所有的 GraphQL 工具应用同一份配置(支持大多数工具、编辑器和 IDE)。
677+
- [GraphQL CLI](https://github.com/urigo/graphql-cli):用于常见 GraphQL 开发工作流程的命令行工具。
678+
- [GraphQL Scalars](https://github.com/Urigo/graphql-scalars):自定义 GraphQL 标量类型的库,用于创建精确的、类型安全的 GraphQL schema。
679+
- [GraphQL Toolkit](https://github.com/ardatan/graphql-toolkit):一组用于快速开发 GraphQL 工具的实用程序(schema 和文档加载,schema 合并等)。
680+
- [SOFA](https://github.com/Urigo/sofa):从你的 GraphQL API 生成 REST API。
577681
578682
## 服务
579683
580684
- [Apollo Graph Manage](http://engine.apollographql.com):一个用于监视 GraphQL 后端的性能和使用的云服务。
581685
- [GraphCMS](https://graphcms.com/):一个 BaaS(后端即服务),它为你配置了一个作为内容编辑工具来处理存储数据的 GraphQL 后端。
582686
- [Prisma](https://www.prisma.io) ([github](https://github.com/prisma)):一个 BaaS(后端即服务),它为你的应用程序提供了一个 GraphQL 后端,且具有用于管理数据库和存储数据的强大的 web ui。
583-
- [Reindex](https://www.reindex.io/baas/) ([github](https://github.com/reindexio/reindex-js)):一个 BaaS(后端即服务),它针对使用 React 和 Relay 的应用程序配置了 GraphQL 后端。
584-
- [Scaphold](https://scaphold.io) ([github](https://github.com/scaphold-io)):一个 BaaS(后端即服务),为你的应用程序配置了一个拥有多种不同集成的 GraphQL 后端。
585687
- [Tipe](https://tipe.io) ([github](https://github.com/tipeio)):一个 SaaS(软件即服务)内容管理系统,允许你使用强大的编辑工具创建你的内容,并通过 GraphQL 或 REST API 从任何地方访问它。
586688
- [AWS AppSync](https://aws.amazon.com/appsync/):完全托管的 GraphQL 服务,包含实时订阅、离线编程和同步、企业级安全特性以及细粒度的授权控制。
587-
- [Hasura](https://hasura.io):一个 BaaS(后端即服务),允许你在 Postgres 上创建数据表、定义权限并使用 GraphQL 接口查询和操作。
689+
- [Elide](https://elide.io):一个 Java 库,可以在任何关系数据库上将 JPA 注释的数据模型公开为 GraphQL 服务。
690+
- [Hasura](https://hasura.io) ([github](https://github.com/hasura)):Hasura 连接到你的数据库和微服务,并立即为你提供可用于生产的 GraphQL API。
588691
- [FaunaDB](https://docs.fauna.com/fauna/current/graphql):通过导入 gql schema 创建即时 GraphQL 后端。数据库将为你创建关系和索引,因此你无需编写任何数据库代码即可在几秒钟内查询。Serverless 定价可免费开始使用。
589692
590693
## 更多内容

0 commit comments

Comments
 (0)