Skip to content

Commit 2eea32e

Browse files
committed
Initial file addition
1 parent c095ab5 commit 2eea32e

29 files changed

+17493
-2
lines changed

Diff for: .eslintrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

Diff for: .gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.DS_Store
2+
.env
3+
.yarn-integrity
4+
yarn-debug.log
5+
yarn-error.log
6+
7+
node_modules/
8+
typings/
9+
10+
# Gatsby files
11+
.cache/
12+
public

Diff for: .vscode/settings.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"files.exclude": {
3+
".git/": true,
4+
"node_modules/": false,
5+
"dist/": false
6+
},
7+
"search.exclude": {
8+
"**/node_modules": true,
9+
"**/dist": true
10+
},
11+
"editor.rulers": [80],
12+
"editor.tabSize": 2,
13+
"editor.formatOnSave": true,
14+
"[json]": {
15+
"editor.formatOnSave": false
16+
},
17+
"tslint.autoFixOnSave": true,
18+
"typescript.tsdk": "./node_modules/typescript/lib",
19+
"debug.node.autoAttach": "on"
20+
}

Diff for: LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 Art.sy Inc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

Diff for: README.md

+53-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,53 @@
1-
# gatsby-typescript-netlify-starter
2-
My default Gatsby setup
1+
# Gatsby Starter
2+
3+
- TypeScript
4+
- Styled Components
5+
- Rebass
6+
- MDX
7+
- NetlifyCMS, with local file-system and MDX support
8+
- Lint Staged
9+
- Prettier
10+
11+
## WIP
12+
13+
### Development
14+
15+
```sh
16+
yarn start
17+
yarn clean
18+
yarn type-check
19+
```
20+
21+
During development Gatsby is booted with `nodemon` so that server-side changes
22+
are detected and the server restarts.
23+
24+
### Deployment
25+
26+
```sh
27+
yarn build
28+
```
29+
30+
<details>
31+
<summary>Gatsby API Details</summary>
32+
33+
1. **`gatsby-browser.js`**: This file is where Gatsby expects to find any usage
34+
of the [Gatsby browser APIs](https://www.gatsbyjs.org/docs/browser-apis/)
35+
(if any). These allow customization/extension of default Gatsby settings
36+
affecting the browser.
37+
1. **`gatsby-config.js`**: This is the main configuration file for a Gatsby
38+
site. This is where you can specify information about your site (metadata)
39+
like the site title and description, which Gatsby plugins you’d like to
40+
include, etc. (Check out the
41+
[config docs](https://www.gatsbyjs.org/docs/gatsby-config/) for more
42+
detail).
43+
1. **`gatsby-node.js`**: This file is where Gatsby expects to find any usage of
44+
the [Gatsby Node APIs](https://www.gatsbyjs.org/docs/node-apis/) (if any).
45+
These allow customization/extension of default Gatsby settings affecting
46+
pieces of the site build process.
47+
1. **`gatsby-ssr.js`**: This file is where Gatsby expects to find any usage of
48+
the
49+
[Gatsby server-side rendering APIs](https://www.gatsbyjs.org/docs/ssr-apis/)
50+
(if any). These allow customization of default Gatsby settings affecting
51+
server-side rendering.
52+
53+
</details>

Diff for: content/blog/2019-01-25-hello.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
templateKey: blog-post
3+
title: Hello
4+
date: 2019-01-26T05:15:24.699Z
5+
description: How are you
6+
tags:
7+
- and
8+
- some
9+
- tags
10+
---
11+
Some content

Diff for: content/docs/hello.mdx

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: mdx support 2
3+
---
4+
### This
5+
6+
<h1>is some jsx</h1>

Diff for: gatsby-browser.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @ts-check
2+
3+
/**
4+
* Implement Gatsby's Browser APIs in this file.
5+
*
6+
* See: https://www.gatsbyjs.org/docs/browser-apis/
7+
*/
8+
9+
import { Boot } from "./src/Boot"
10+
11+
export const wrapRootElement = Boot

Diff for: gatsby-config.js

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// @ts-check
2+
3+
const fsExpressAPI = require("netlify-cms-backend-fs/dist/fs")
4+
const playgroundHastPlugin = require("./src/utils/playgroundHastPlugin")
5+
6+
module.exports = {
7+
siteMetadata: {
8+
title: "Gatsby Starter",
9+
description: "-- placeholder --",
10+
author: "[email protected]",
11+
},
12+
13+
// Add the file-system api as an api proxy:
14+
// https://www.gatsbyjs.org/docs/api-proxy/#advanced-proxying
15+
developMiddleware: fsExpressAPI,
16+
17+
plugins: [
18+
{
19+
resolve: "gatsby-mdx",
20+
options: {
21+
extensions: [".mdx", ".md"],
22+
23+
// Default layouts are meta wrappers around .mdx pages. Can be useful to
24+
// share queries across different types of pages.
25+
defaultLayouts: {
26+
default: require.resolve("./src/layouts/DefaultLayout.tsx"),
27+
},
28+
29+
// MDX AST transformers
30+
hastPlugins: [playgroundHastPlugin],
31+
32+
// Imports here are available globally to .mdx files, with the exception
33+
// of automatically created pages located in /pages. This is a bug in
34+
// gatsby-mdx. See https://github.com/ChristopherBiscardi/gatsby-mdx/issues/243
35+
// globalScope: ""
36+
37+
// mdPlugins: [],
38+
// gatsbyRemarkPlugins: [{}],
39+
},
40+
},
41+
{
42+
resolve: "gatsby-plugin-netlify-cms",
43+
options: {
44+
modulePath: `${__dirname}/src/cms/cms.jsx`,
45+
enableIdentityWidget: false,
46+
publicPath: "admin",
47+
htmlTitle: "Admin",
48+
manualInit: true,
49+
},
50+
},
51+
{
52+
resolve: "gatsby-source-filesystem",
53+
options: {
54+
name: "blog",
55+
path: `${__dirname}/content/blog/`,
56+
},
57+
},
58+
{
59+
resolve: "gatsby-source-filesystem",
60+
options: {
61+
name: "docs",
62+
path: `${__dirname}/content/docs/`,
63+
},
64+
},
65+
"gatsby-plugin-catch-links",
66+
"gatsby-plugin-styled-components",
67+
"gatsby-plugin-typescript",
68+
],
69+
}

Diff for: gatsby-node.js

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// @ts-check
2+
3+
/**
4+
* Implement Gatsby's Node APIs in this file.
5+
*
6+
* See: https://www.gatsbyjs.org/docs/node-apis/
7+
*/
8+
9+
const path = require("path")
10+
const WebpackNotifierPlugin = require("webpack-notifier")
11+
const WebpackShellPlugin = require("webpack-shell-plugin")
12+
const { createFilePath } = require("gatsby-source-filesystem")
13+
const { toLower } = require("lodash")
14+
15+
/**
16+
* Intercept and modify the GraphQL schema
17+
*/
18+
exports.onCreateNode = ({ node, getNode, actions }) => {
19+
if (node.internal.type === "Mdx") {
20+
const route = toLower(
21+
createFilePath({
22+
node,
23+
getNode,
24+
trailingSlash: false,
25+
})
26+
)
27+
28+
// Add a new field -- route -- which can be accessed from the schema under
29+
// fields { route }.
30+
actions.createNodeField({
31+
node,
32+
name: "route",
33+
value: route,
34+
})
35+
}
36+
}
37+
38+
/**
39+
* Dynamically create pages for all .mdx content.
40+
*
41+
* NOTE: Content located in /pages is created automatically but should be limited
42+
* to static pages like "About" or "Home", etc, and is subject data limitations
43+
* since query data resolved below cannot be injected in at build time.
44+
*/
45+
exports.createPages = ({ graphql, actions }) => {
46+
return new Promise((resolve, reject) => {
47+
resolve(
48+
graphql(`
49+
{
50+
allMdx {
51+
edges {
52+
node {
53+
id
54+
fields {
55+
route
56+
}
57+
}
58+
}
59+
}
60+
}
61+
`).then(result => {
62+
if (result.errors) {
63+
console.error(result.errors)
64+
reject(result.errors)
65+
}
66+
67+
result.data.allMdx.edges.forEach(({ node }) => {
68+
actions.createPage({
69+
// Encode the route
70+
path: node.fields.route,
71+
// Layout for the page
72+
component: path.resolve("./src/layouts/DefaultLayout.tsx"),
73+
// Values defined here are injected into the page as props and can
74+
// be passed to a GraphQL query as arguments
75+
context: {
76+
id: node.id,
77+
},
78+
})
79+
})
80+
})
81+
)
82+
})
83+
}
84+
85+
/**
86+
* Update default Webpack configuration
87+
*/
88+
exports.onCreateWebpackConfig = ({ actions }) => {
89+
actions.setWebpackConfig({
90+
plugins: [
91+
new WebpackNotifierPlugin({
92+
skipFirstNotification: true,
93+
}),
94+
95+
// FIXME: Investigate Apollo error
96+
// new WebpackShellPlugin({
97+
// onBuildEnd: ["yarn emit-graphql-types"],
98+
// }),
99+
],
100+
resolve: {
101+
modules: [path.resolve(__dirname, "src"), "node_modules"],
102+
},
103+
})
104+
}

Diff for: gatsby-ssr.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @ts-check
2+
3+
/**
4+
* Implement Gatsby's SSR (Server Side Rendering) APIs in this file.
5+
*
6+
* See: https://www.gatsbyjs.org/docs/ssr-apis/
7+
*/
8+
9+
import { Boot } from "./src/Boot"
10+
11+
export const wrapRootElement = Boot

0 commit comments

Comments
 (0)