Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

Commit 6ab254d

Browse files
committed
Update packages, strip out unnecessary content
1 parent 40e746e commit 6ab254d

33 files changed

+15095
-46566
lines changed
-63.3 KB
Binary file not shown.

content/blog/hello-world/index.md

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

content/blog/test-post/.gitkeep

Whitespace-only changes.

gatsby-browser.js

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

gatsby-config.js

Lines changed: 58 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,73 @@
1-
/**
2-
* Configure your Gatsby site with this file.
3-
*
4-
* See: https://www.gatsbyjs.com/docs/gatsby-config/
5-
*/
1+
/** @type import("gatsby-transformer-remark").RemarkConfig */
2+
const transformerRemark = {
3+
resolve: `gatsby-transformer-remark`,
4+
options: {
5+
plugins: [
6+
{
7+
resolve: "gatsby-remark-embed-video",
8+
options: {
9+
width: 800,
10+
ratio: 1.77, // Optional: Defaults to 16/9 = 1.77
11+
height: 400, // Optional: Overrides optional.ratio
12+
related: false, //Optional: Will remove related videos from the end of an embedded YouTube video.
13+
noIframeBorder: true, //Optional: Disable insertion of <style> border: 0
14+
loadingStrategy: "lazy", //Optional: Enable support for lazy-load offscreen iframes. Default is disabled.
15+
urlOverrides: [
16+
{
17+
id: "youtube",
18+
embedURL: videoId =>
19+
`https://www.youtube-nocookie.com/embed/${videoId}`,
20+
},
21+
], //Optional: Override URL of a service provider, e.g to enable youtube-nocookie support
22+
containerClass: "embedVideo-container", //Optional: Custom CSS class for iframe container, for multiple classes separate them by space
23+
iframeId: false, //Optional: if true, iframe's id will be set to what is provided after 'video:' (YouTube IFrame player API requires iframe id)
24+
},
25+
},
26+
{
27+
resolve: `gatsby-remark-responsive-iframe`,
28+
options: {
29+
wrapperStyle: `margin-bottom: 1.0725rem`,
30+
},
31+
},
32+
`gatsby-remark-prismjs`,
33+
{
34+
resolve: `gatsby-remark-relative-images`,
35+
options: {
36+
staticFolderName: "static",
37+
include: ["featuredImage"],
38+
},
39+
},
40+
{
41+
resolve: `gatsby-remark-images`,
42+
options: {
43+
maxWidth: 630,
44+
},
45+
},
46+
`gatsby-remark-copy-linked-files`,
47+
`gatsby-remark-smartypants`,
48+
],
49+
},
50+
};
651

52+
/** @type import("gatsby").GatsbyConfig */
753
module.exports = {
854
siteMetadata: {
955
siteUrl: "https://clowdr.org/",
1056
},
1157
plugins: [
1258
`gatsby-plugin-typescript`,
59+
{
60+
resolve: "gatsby-plugin-extract-schema",
61+
options: {
62+
dest: `${__dirname}/src/generated/gatsby-introspection.graphql`,
63+
},
64+
},
1365
`gatsby-plugin-react-helmet-async`,
1466
`gatsby-plugin-cname`,
1567
`@chakra-ui/gatsby-plugin`,
1668
`gatsby-plugin-image`,
1769
`gatsby-transformer-sharp`,
1870
`gatsby-plugin-sharp`,
19-
{
20-
resolve: `gatsby-source-filesystem`,
21-
options: {
22-
path: `${__dirname}/content/blog`,
23-
name: `blog`,
24-
},
25-
},
2671
{
2772
resolve: `gatsby-source-filesystem`,
2873
options: {
@@ -37,55 +82,7 @@ module.exports = {
3782
name: `images`,
3883
},
3984
},
40-
{
41-
resolve: `gatsby-transformer-remark`,
42-
options: {
43-
plugins: [
44-
{
45-
resolve: "gatsby-remark-embed-video",
46-
options: {
47-
width: 800,
48-
ratio: 1.77, // Optional: Defaults to 16/9 = 1.77
49-
height: 400, // Optional: Overrides optional.ratio
50-
related: false, //Optional: Will remove related videos from the end of an embedded YouTube video.
51-
noIframeBorder: true, //Optional: Disable insertion of <style> border: 0
52-
loadingStrategy: "lazy", //Optional: Enable support for lazy-load offscreen iframes. Default is disabled.
53-
urlOverrides: [
54-
{
55-
id: "youtube",
56-
embedURL: videoId =>
57-
`https://www.youtube-nocookie.com/embed/${videoId}`,
58-
},
59-
], //Optional: Override URL of a service provider, e.g to enable youtube-nocookie support
60-
containerClass: "embedVideo-container", //Optional: Custom CSS class for iframe container, for multiple classes separate them by space
61-
iframeId: false, //Optional: if true, iframe's id will be set to what is provided after 'video:' (YouTube IFrame player API requires iframe id)
62-
},
63-
},
64-
{
65-
resolve: `gatsby-remark-responsive-iframe`,
66-
options: {
67-
wrapperStyle: `margin-bottom: 1.0725rem`,
68-
},
69-
},
70-
`gatsby-remark-prismjs`,
71-
{
72-
resolve: `gatsby-remark-relative-images`,
73-
options: {
74-
staticFolderName: "static",
75-
include: ["featuredImage"],
76-
},
77-
},
78-
{
79-
resolve: `gatsby-remark-images`,
80-
options: {
81-
maxWidth: 630,
82-
},
83-
},
84-
`gatsby-remark-copy-linked-files`,
85-
`gatsby-remark-smartypants`,
86-
],
87-
},
88-
},
85+
transformerRemark,
8986
{
9087
resolve: `gatsby-plugin-google-fonts`,
9188
options: {
@@ -118,17 +115,5 @@ module.exports = {
118115
},
119116
},
120117
`gatsby-plugin-meta-redirect`,
121-
// Disable while plugin is broken
122-
// {
123-
// resolve: "gatsby-plugin-tinacms",
124-
// options: {
125-
// sidebar: {
126-
// hidden: process.env.NODE_ENV === "production",
127-
// position: "displace",
128-
// },
129-
// manualInit: true,
130-
// plugins: ["gatsby-tinacms-git", "gatsby-tinacms-remark"],
131-
// },
132-
// },
133118
],
134119
};

gatsby-node.js

Lines changed: 31 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
const path = require(`path`);
1+
const { default: gql } = require("fake-tag");
22
const { createFilePath } = require(`gatsby-source-filesystem`);
3+
const path = require("path");
34

5+
/** @type import('gatsby').GatsbyNode['onCreateWebpackConfig'] */
46
exports.onCreateWebpackConfig = ({ stage, actions }) => {
57
if (stage.startsWith("develop")) {
68
actions.setWebpackConfig({
@@ -16,36 +18,35 @@ exports.onCreateWebpackConfig = ({ stage, actions }) => {
1618
}
1719
};
1820

21+
/** @type import('gatsby').GatsbyNode['createPages'] */
1922
exports.createPages = async ({ graphql, actions, reporter }) => {
2023
const { createPage, createRedirect } = actions;
2124

2225
/// Create blog post pages
2326

2427
// Get all markdown blog posts sorted by date
25-
const allRemark = await graphql(
26-
`
27-
{
28-
allMarkdownRemark(
29-
sort: { fields: [frontmatter___date], order: ASC }
30-
limit: 1000
31-
) {
32-
edges {
33-
node {
34-
id
35-
fields {
36-
collection
37-
slug
38-
}
39-
frontmatter {
40-
slug
41-
title
42-
}
28+
const allRemark = await graphql(gql`
29+
{
30+
allMarkdownRemark(
31+
sort: { fields: [frontmatter___date], order: ASC }
32+
limit: 1000
33+
) {
34+
edges {
35+
node {
36+
id
37+
fields {
38+
collection
39+
slug
40+
}
41+
frontmatter {
42+
slug
43+
title
4344
}
4445
}
4546
}
4647
}
47-
`
48-
);
48+
}
49+
`);
4950

5051
if (allRemark.errors) {
5152
reporter.panicOnBuild(
@@ -57,34 +58,10 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
5758

5859
const allEdges = allRemark.data.allMarkdownRemark.edges;
5960

60-
const blogEdges = allEdges.filter(
61-
edge => edge.node.fields.collection === `blog`
62-
);
6361
const resourceEdges = allEdges.filter(
6462
edge => edge.node.fields.collection === `resources`
6563
);
6664

67-
console.log(
68-
`Blog edges: ${blogEdges.length}, resource edges: ${resourceEdges.length}`
69-
);
70-
71-
blogEdges.forEach((edge, index) => {
72-
const previous =
73-
index === blogEdges.length - 1 ? null : blogEdges[index + 1].node;
74-
const next = index === 0 ? null : blogEdges[index - 1].node;
75-
76-
createPage({
77-
path: `/blog/${edge.node.frontmatter.slug}`,
78-
component: path.resolve(`./src/templates/blog-post.tsx`),
79-
context: {
80-
id: edge.node.id,
81-
slug: edge.node.frontmatter.slug,
82-
previous,
83-
next,
84-
},
85-
});
86-
});
87-
8865
resourceEdges.forEach(edge => {
8966
createPage({
9067
path: `/resources/${edge.node.frontmatter.slug}`,
@@ -108,17 +85,18 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
10885
);
10986
};
11087

88+
/** @type import('gatsby').GatsbyNode['onCreateNode'] */
11189
exports.onCreateNode = ({ node, actions, getNode }) => {
11290
const { createNodeField } = actions;
11391

11492
if (node.internal.type === `MarkdownRemark`) {
115-
// const value = createFilePath({ node, getNode });
93+
const value = createFilePath({ node, getNode });
11694

117-
// createNodeField({
118-
// name: `slug`,
119-
// node,
120-
// value,
121-
// });
95+
createNodeField({
96+
name: `slug`,
97+
node,
98+
value,
99+
});
122100

123101
const parent = getNode(node.parent);
124102

@@ -130,6 +108,7 @@ exports.onCreateNode = ({ node, actions, getNode }) => {
130108
}
131109
};
132110

111+
/** @type import('gatsby').GatsbyNode['createSchemaCustomization'] */
133112
exports.createSchemaCustomization = ({ actions }) => {
134113
const { createTypes } = actions;
135114

@@ -139,7 +118,7 @@ exports.createSchemaCustomization = ({ actions }) => {
139118
// Also explicitly define the Markdown frontmatter
140119
// This way the "MarkdownRemark" queries will return `null` even when no
141120
// blog posts are stored inside "content/blog" instead of returning an error
142-
createTypes(`
121+
createTypes(gql`
143122
type SiteSiteMetadata {
144123
author: Author
145124
siteUrl: String

graphql-codegen.config.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/** @type import("@graphql-codegen/plugin-helpers").Types.Config */
2+
module.exports = {
3+
overwrite: true,
4+
schema: "./src/generated/gatsby-introspection.graphql",
5+
documents: [
6+
"src/**/*.tsx",
7+
"node_modules/gatsby-transformer-sharp/src/fragments.js",
8+
],
9+
pluckConfig: {
10+
modules: [
11+
{
12+
name: "gatsby",
13+
identifier: "graphql",
14+
},
15+
],
16+
},
17+
generates: {
18+
"./src/generated/graphql-types.d.ts": {
19+
plugins: ["typescript", "typescript-operations"],
20+
},
21+
// "./src/generated/graphql.json": {
22+
// plugins: ["introspection"],
23+
// },
24+
},
25+
};

graphql-codegen.yml

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

0 commit comments

Comments
 (0)