Skip to content

Commit ab8c409

Browse files
Migrate to Gatsby 🚀 (#896)
Co-authored-by: Ravi Teja Kumar Isetty <iravitejakumar@gmail.com>
1 parent a9312f7 commit ab8c409

File tree

270 files changed

+22152
-8857
lines changed

Some content is hidden

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

270 files changed

+22152
-8857
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
public
2+
node_modules

.eslintrc

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es6": true,
5+
"node": true
6+
},
7+
"extends": ["airbnb"],
8+
"parser": "babel-eslint",
9+
"rules": {
10+
"array-bracket-spacing": ["error","always"],
11+
"computed-property-spacing": ["error","always"],
12+
"func-names": ["error","never"],
13+
"semi": ["error","never"],
14+
"semi-style": ["error","first"],
15+
"import/extensions": 0,
16+
"import/no-unresolved": 0,
17+
"import/prefer-default-export": 0,
18+
"jsx-a11y/anchor-is-valid": 0,
19+
"import/no-extraneous-dependencies": 0,
20+
"linebreak-style": 0,
21+
"no-await-in-loop": 0,
22+
"no-loop-func": 0,
23+
"no-restricted-syntax": 0,
24+
"no-shadow": 0,
25+
"no-unused-vars": 1,
26+
"react/jsx-filename-extension": 0,
27+
"react/state-in-constructor": 0,
28+
"react/jsx-props-no-spreading": 0,
29+
"react/sort-comp": 0,
30+
"react/jsx-one-expression-per-line": 0,
31+
"space-in-parens": [
32+
"error",
33+
"always",
34+
{
35+
"exceptions": [
36+
"empty"
37+
]
38+
}
39+
],
40+
"object-curly-newline": [
41+
"error",
42+
{
43+
"consistent": true
44+
}
45+
],
46+
"arrow-parens": [
47+
"error",
48+
"as-needed",
49+
{
50+
"requireForBlockBody": false
51+
}
52+
]
53+
}
54+
}

.gitignore

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

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

.travis.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

LICENSE

Lines changed: 0 additions & 26 deletions
This file was deleted.

README.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
# Contributing
22

3-
Organization gh-pages deploy the `master` branch, so active development occurs
4-
on this `source` branch.
3+
Created using [`gastby-starter-default`](https://github.com/gatsbyjs/gatsby-starter-default)
54

6-
The site is written in JS and Markdown files in `site/`.
5+
### Prerequisites
6+
* [Git](https://git-scm.com/)
7+
* [Node.JS](https://nodejs.org/en/) x64, version `>= 12.x`
78

8-
The site chrome are all in JS files in `site/_core/`.
9+
## Development Setup
10+
* Install dependencies:
11+
```
12+
npm install
13+
```
14+
* Run the development server
15+
```
16+
npm start
17+
```
18+
:rocket: Development server -> http://localhost:8000
919
10-
### Making changes
1120
12-
The first time, get all the dependencies loaded via
21+
All the docs live in `src/content`. Relative paths can be used for images.
1322
14-
`$ npm install` or `$ yarn install`
15-
16-
Then, run the server via
17-
18-
`$ npm start` or `$ yarn start`
19-
20-
Open [http://localhost:8444](http://localhost:8444) to view it in the browser.
21-
Anytime you make some changes, refresh the page to see the updates.
22-
23-
### Publish the Website
24-
25-
Once pushed to the `source` branch, Travis CI will publish http://graphql.org
23+
`src/img` has sub-directories to help organize images.

gatsby-browser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './src/css/style.less'

gatsby-config.js

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
module.exports = {
2+
siteMetadata: {
3+
title: 'GraphQL',
4+
description: 'Gatsby Site for GraphQL.org',
5+
siteUrl: 'http://graphql.org',
6+
},
7+
plugins: [
8+
'gatsby-plugin-react-helmet',
9+
'gatsby-plugin-less',
10+
{
11+
resolve: 'gatsby-source-filesystem',
12+
options: {
13+
name: 'images',
14+
path: `${__dirname}/src/img`,
15+
},
16+
},
17+
{
18+
resolve: 'gatsby-source-filesystem',
19+
options: {
20+
name: 'content',
21+
path: `${__dirname}/src/content`,
22+
},
23+
},
24+
'gatsby-transformer-sharp',
25+
'gatsby-plugin-sharp',
26+
{
27+
resolve: 'gatsby-plugin-manifest',
28+
options: {
29+
name: 'graphql-docs',
30+
short_name: 'graphql',
31+
start_url: '/',
32+
icon: 'src/img/favicon.png',
33+
},
34+
},
35+
{
36+
resolve: 'gatsby-transformer-remark',
37+
options: {
38+
plugins: [
39+
'gatsby-remark-autolink-headers',
40+
{
41+
resolve: 'gatsby-remark-prismjs',
42+
options: {
43+
classPrefix: 'prism language-',
44+
},
45+
},
46+
{
47+
resolve: 'gatsby-remark-images-anywhere',
48+
options: {
49+
staticDir: 'src/img',
50+
},
51+
},
52+
],
53+
},
54+
},
55+
{
56+
resolve: 'gatsby-plugin-feed',
57+
options: {
58+
query: `
59+
{
60+
site {
61+
siteMetadata {
62+
siteUrl
63+
}
64+
}
65+
}
66+
`,
67+
feeds: [
68+
{
69+
serialize: ( {
70+
query: { site, allMarkdownRemark },
71+
} ) => allMarkdownRemark.edges.map( ( {
72+
node: {
73+
excerpt,
74+
frontmatter: { title, date, permalink, byline },
75+
},
76+
} ) => ( {
77+
title,
78+
date,
79+
url: site.siteMetadata.siteUrl + permalink,
80+
description: excerpt,
81+
author: byline,
82+
} ) ),
83+
query: `
84+
{
85+
allMarkdownRemark(
86+
filter: {frontmatter: {layout: {eq: "BlogPostLayout"}}},
87+
sort: { order: DESC, fields: [frontmatter___date] }
88+
) {
89+
edges {
90+
node {
91+
excerpt
92+
frontmatter {
93+
title
94+
date
95+
permalink
96+
byline
97+
}
98+
}
99+
}
100+
}
101+
}
102+
`,
103+
output: '/blog/rss.xml',
104+
title: 'Blog | GraphQL',
105+
feed_url: 'http://graphql.org/blog/rss.xml',
106+
site_url: 'http://graphql.org',
107+
},
108+
],
109+
},
110+
},
111+
],
112+
}

gatsby-node.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const path = require( 'path' )
2+
3+
exports.createPages = async ( { actions, graphql, reporter } ) => {
4+
const { createPage } = actions
5+
6+
const result = await graphql( `
7+
query AllContentPages {
8+
allMarkdownRemark {
9+
edges {
10+
node {
11+
id
12+
frontmatter {
13+
layout
14+
permalink
15+
}
16+
}
17+
}
18+
}
19+
}
20+
` )
21+
22+
if ( result.errors ) reporter.panicOnBuild( '🚨 ERROR: Loading "createPages" query' )
23+
24+
const pages = result.data.allMarkdownRemark.edges
25+
26+
// Call `createPage` for each page
27+
pages
28+
.filter( ( { node: { frontmatter: { layout } } } ) => layout )
29+
.forEach( ( { node: {
30+
id,
31+
frontmatter: { layout, permalink },
32+
} } ) => {
33+
createPage( {
34+
path: permalink,
35+
component: path.resolve( `src/templates/${layout}.js` ),
36+
context: { id },
37+
} )
38+
} )
39+
}

0 commit comments

Comments
 (0)