Skip to content

Commit cd62287

Browse files
ydfzgyjardatanorta
authored
官网重构 (#104)
* sync 20201029 * cherrypick: Gatsby Migration * cherrypick: More changes * Fix Learn sidebar * Fix issues * Fix search bar jumping issue * Fix links at home page * Add netlify.toml file * Fix key prop issues * bring back notes * Fix search for gatsby site * move Chinese to new index page * site meta * Merge pull request graphql#940 from ardatan/update-dependencies Update dependencies * chore(deps): update dependencies * Sync 20201112 Co-authored-by: Arda TANRIKULU <[email protected]> Co-authored-by: Orta <[email protected]>
1 parent c98e519 commit cd62287

File tree

272 files changed

+16597
-3691
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

272 files changed

+16597
-3691
lines changed

.gitignore

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,70 @@
1-
*.swp
2-
*~
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
old
9+
# Runtime data
10+
pids
11+
*.pid
12+
*.seed
13+
*.pid.lock
14+
15+
# Directory for instrumented libs generated by jscoverage/JSCover
16+
lib-cov
17+
18+
# Coverage directory used by tools like istanbul
19+
coverage
20+
21+
# nyc test coverage
22+
.nyc_output
23+
24+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
25+
.grunt
26+
27+
# Bower dependency directory (https://bower.io/)
28+
bower_components
29+
30+
# node-waf configuration
31+
.lock-wscript
32+
33+
# Compiled binary addons (http://nodejs.org/api/addons.html)
34+
build/Release
35+
36+
# Dependency directories
37+
node_modules/
38+
jspm_packages/
39+
40+
# Typescript v1 declaration files
41+
typings/
42+
43+
# Optional npm cache directory
44+
.npm
45+
46+
# Optional eslint cache
47+
.eslintcache
48+
49+
# Optional REPL history
50+
.node_repl_history
51+
52+
# Output of 'npm pack'
53+
*.tgz
54+
55+
# dotenv environment variable files
56+
.env*
57+
58+
# gatsby files
59+
.cache/
60+
public
61+
62+
# Mac files
363
.DS_Store
4-
.nvmrc
5-
node_modules
6-
npm-debug.log
764

8-
/build/
9-
.tmp.*
10-
package-lock.json
65+
# Yarn
66+
yarn-error.log
67+
.pnp/
68+
.pnp.js
69+
# Yarn Integrity file
70+
.yarn-integrity

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.cache
2+
package.json
3+
package-lock.json
4+
public

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"arrowParens": "avoid",
3+
"semi": false
4+
}

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1+
# Source Repository for graphql.org
2+
This repository contains the source code of https://graphql.org website.
3+
14
# Contributing
25
[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors)
36

47
Organization gh-pages deploy the `master` branch, so active development occurs
58
on this `source` branch.
69

7-
The site is written in JS and Markdown files in `site/`.
8-
9-
The site chrome are all in JS files in `site/_core/`.
10-
1110
### Making changes
1211

1312
The first time, get all the dependencies loaded via
@@ -18,13 +17,23 @@ Then, run the server via
1817

1918
`$ npm start` or `$ yarn start`
2019

21-
Open [http://localhost:8444](http://localhost:8444) to view it in the browser.
20+
Open [http://localhost:8000](http://localhost:8000) to view it in the browser.
2221
Anytime you make some changes, refresh the page to see the updates.
2322

24-
### Publish the Website
23+
### Folder structure
2524

26-
Once pushed to the `source` branch, Travis CI will publish http://graphql.org/
25+
- `static` folder contains the files that will be copied directly to `public` folder which will contain the output files to be served by a static HTTP server.
26+
27+
- `src` folder contains markdown and TypeScript/JavaScript files used to generate the website;
28+
- - `assets` folder contains `less` files and those files contain stylesheets
29+
- - `components` and `Containers` folders contains React components that are used in layouts and pages
30+
- - `content` folder contains markdown files for the content of pages
31+
- - `templates` contains the layout templates
32+
- - `utils` contains helper functions
33+
34+
### Publish the Website
2735

36+
Once pushed to the `source` branch, CI will publish http://graphql.cn/
2837

2938
## Contributors
3039

gatsby-config.js

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
module.exports = {
2+
siteMetadata: {
3+
title: "一种为你的 API 而生的查询语言",
4+
description:
5+
"GraphQL 提供了 API 中数据的完整描述,提供让客户端能够准确地获取需要的数据而不包含任何冗余的能力,让 API 更加容易随着时间推移而演进,并提供强大的开发者工具。",
6+
siteUrl: "http://graphql.cn/",
7+
},
8+
9+
plugins: [
10+
"gatsby-plugin-react-helmet",
11+
'gatsby-plugin-anchor-links',
12+
{
13+
resolve: "gatsby-source-filesystem",
14+
options: {
15+
name: "content",
16+
path: `${__dirname}/src/content`,
17+
},
18+
},
19+
`gatsby-transformer-remark`,
20+
{
21+
resolve: `gatsby-plugin-webfonts`,
22+
options: {
23+
fonts: {
24+
google: [
25+
{
26+
family: `Rubik`,
27+
variants: [`300`],
28+
},
29+
{
30+
family: `Roboto Mono`,
31+
variants: [`400`, `400i`, `600`],
32+
},
33+
{
34+
family: `Roboto`,
35+
variants: [`300`],
36+
},
37+
],
38+
},
39+
},
40+
},
41+
`gatsby-plugin-less`,
42+
`gatsby-plugin-react-helmet`,
43+
{
44+
resolve: `gatsby-plugin-google-analytics`,
45+
options: {
46+
trackingId: "UA-44373548-16",
47+
},
48+
},
49+
{
50+
resolve: "gatsby-plugin-feed",
51+
options: {
52+
query: `
53+
{
54+
site {
55+
siteMetadata {
56+
siteUrl
57+
}
58+
}
59+
}
60+
`,
61+
feeds: [
62+
{
63+
serialize: ({ query: { site, allMarkdownRemark } }) =>
64+
allMarkdownRemark.edges.map(
65+
({
66+
node: {
67+
excerpt,
68+
frontmatter: { title, date, permalink, byline },
69+
},
70+
}) => ({
71+
title,
72+
date,
73+
url: site.siteMetadata.siteUrl + permalink,
74+
description: excerpt,
75+
author: byline,
76+
})
77+
),
78+
query: `
79+
{
80+
allMarkdownRemark(
81+
filter: {frontmatter: {layout: {eq: "blog"}}},
82+
sort: { order: DESC, fields: [frontmatter___date] }
83+
) {
84+
edges {
85+
node {
86+
excerpt
87+
frontmatter {
88+
title
89+
date
90+
permalink
91+
byline
92+
}
93+
}
94+
}
95+
}
96+
}
97+
`,
98+
output: "/blog/rss.xml",
99+
title: "Blog | GraphQL",
100+
feed_url: "http://graphql.org/blog/rss.xml",
101+
site_url: "http://graphql.org",
102+
},
103+
],
104+
},
105+
},
106+
],
107+
}

0 commit comments

Comments
 (0)