Skip to content

官网重构 #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 68 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,70 @@
*.swp
*~
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

old
# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# dotenv environment variable files
.env*

# gatsby files
.cache/
public

# Mac files
.DS_Store
.nvmrc
node_modules
npm-debug.log

/build/
.tmp.*
package-lock.json
# Yarn
yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.cache
package.json
package-lock.json
public
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"arrowParens": "avoid",
"semi": false
}
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Source Repository for graphql.org
This repository contains the source code of https://graphql.org website.

# Contributing
[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors)

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

The site is written in JS and Markdown files in `site/`.

The site chrome are all in JS files in `site/_core/`.

### Making changes

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

`$ npm start` or `$ yarn start`

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

### Publish the Website
### Folder structure

Once pushed to the `source` branch, Travis CI will publish http://graphql.org/
- `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.

- `src` folder contains markdown and TypeScript/JavaScript files used to generate the website;
- - `assets` folder contains `less` files and those files contain stylesheets
- - `components` and `Containers` folders contains React components that are used in layouts and pages
- - `content` folder contains markdown files for the content of pages
- - `templates` contains the layout templates
- - `utils` contains helper functions

### Publish the Website

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

## Contributors

Expand Down
107 changes: 107 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
module.exports = {
siteMetadata: {
title: "一种为你的 API 而生的查询语言",
description:
"GraphQL 提供了 API 中数据的完整描述,提供让客户端能够准确地获取需要的数据而不包含任何冗余的能力,让 API 更加容易随着时间推移而演进,并提供强大的开发者工具。",
siteUrl: "http://graphql.cn/",
},

plugins: [
"gatsby-plugin-react-helmet",
'gatsby-plugin-anchor-links',
{
resolve: "gatsby-source-filesystem",
options: {
name: "content",
path: `${__dirname}/src/content`,
},
},
`gatsby-transformer-remark`,
{
resolve: `gatsby-plugin-webfonts`,
options: {
fonts: {
google: [
{
family: `Rubik`,
variants: [`300`],
},
{
family: `Roboto Mono`,
variants: [`400`, `400i`, `600`],
},
{
family: `Roboto`,
variants: [`300`],
},
],
},
},
},
`gatsby-plugin-less`,
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-plugin-google-analytics`,
options: {
trackingId: "UA-44373548-16",
},
},
{
resolve: "gatsby-plugin-feed",
options: {
query: `
{
site {
siteMetadata {
siteUrl
}
}
}
`,
feeds: [
{
serialize: ({ query: { site, allMarkdownRemark } }) =>
allMarkdownRemark.edges.map(
({
node: {
excerpt,
frontmatter: { title, date, permalink, byline },
},
}) => ({
title,
date,
url: site.siteMetadata.siteUrl + permalink,
description: excerpt,
author: byline,
})
),
query: `
{
allMarkdownRemark(
filter: {frontmatter: {layout: {eq: "blog"}}},
sort: { order: DESC, fields: [frontmatter___date] }
) {
edges {
node {
excerpt
frontmatter {
title
date
permalink
byline
}
}
}
}
}
`,
output: "/blog/rss.xml",
title: "Blog | GraphQL",
feed_url: "http://graphql.org/blog/rss.xml",
site_url: "http://graphql.org",
},
],
},
},
],
}
Loading