Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit 6655234

Browse files
committed
Removed apis folder 🚀
1 parent b30000e commit 6655234

File tree

6 files changed

+0
-437
lines changed

6 files changed

+0
-437
lines changed

gatsby-node.ts

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
import { GatsbyNode } from "gatsby";
22
import readingTime from "reading-time";
33
import * as path from "path";
4-
import * as fs from "fs";
54
import { createFilePath } from "gatsby-source-filesystem";
65
import { generatePostSlug, generateTagSlug, slugs } from "./src/logic/slug";
7-
import {
8-
artApiAdapter,
9-
blogAuthorsApiAdapter,
10-
blogPostDetailsApiAdapter,
11-
blogPostsApiAdapter,
12-
projectsApiAdapter,
13-
} from "./src/logic/api/api-adapters";
146

157
export const createPages: GatsbyNode["createPages"] = async ({
168
graphql,
@@ -100,91 +92,3 @@ export const onCreateNode: GatsbyNode["onCreateNode"] = ({
10092
});
10193
}
10294
};
103-
104-
export const onPostBuild: GatsbyNode["onPostBuild"] = async ({ graphql }) => {
105-
console.log("onPostBuild: generating API...");
106-
107-
const apiBasePath = "/api";
108-
const apiFolder = `./public${apiBasePath}`;
109-
110-
if (!fs.existsSync(apiFolder)) {
111-
fs.mkdirSync(apiFolder);
112-
}
113-
114-
const blogPostsQuery = (
115-
await graphql<Queries.BlogPostsApiQuery>(`
116-
query BlogPostsApi {
117-
allMarkdownRemark(sort: { frontmatter: { date: DESC } }, limit: 1000) {
118-
edges {
119-
node {
120-
fields {
121-
slug
122-
readingTime {
123-
text
124-
}
125-
}
126-
frontmatter {
127-
title
128-
description
129-
authors
130-
tags
131-
math
132-
date(formatString: "DD MMM YYYY")
133-
image {
134-
publicURL
135-
}
136-
}
137-
html
138-
}
139-
}
140-
}
141-
}
142-
`)
143-
).data!;
144-
145-
const imagesApiQuery = (
146-
await graphql<Queries.ImagesApiQuery>(`
147-
query ImagesApi {
148-
allFile(
149-
filter: {
150-
relativeDirectory: { in: ["projects", "authors", "art"] }
151-
extension: { regex: "/(jpg)|(jpeg)|(png)/" }
152-
}
153-
) {
154-
edges {
155-
node {
156-
publicURL
157-
name
158-
}
159-
}
160-
}
161-
}
162-
`)
163-
).data!;
164-
165-
const authorsApi = blogAuthorsApiAdapter(imagesApiQuery);
166-
const blogPostsApi = blogPostsApiAdapter(
167-
apiBasePath,
168-
blogPostsQuery,
169-
authorsApi,
170-
);
171-
const blogPostDetailApis = blogPostDetailsApiAdapter(
172-
blogPostsQuery,
173-
authorsApi,
174-
);
175-
const projectsApi = projectsApiAdapter(imagesApiQuery);
176-
const artApi = artApiAdapter(imagesApiQuery);
177-
178-
fs.writeFileSync(`${apiFolder}/posts.json`, JSON.stringify(blogPostsApi));
179-
fs.writeFileSync(`${apiFolder}/authors.json`, JSON.stringify(authorsApi));
180-
Object.keys(blogPostDetailApis).forEach((key) => {
181-
fs.writeFileSync(
182-
`${apiFolder}/${key}.json`,
183-
JSON.stringify(blogPostDetailApis[key]),
184-
);
185-
});
186-
fs.writeFileSync(`${apiFolder}/projects.json`, JSON.stringify(projectsApi));
187-
fs.writeFileSync(`${apiFolder}/art.json`, JSON.stringify(artApi));
188-
189-
console.log("onPostBuild: API generation completed.");
190-
};

package-lock.json

Lines changed: 0 additions & 105 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@
106106
"babel-jest": "^29.7.0",
107107
"babel-loader": "^9.2.1",
108108
"babel-preset-gatsby": "^3.14.0",
109-
"babel-preset-react-app": "^10.0.1",
110109
"eslint": "^8.52.0",
111110
"eslint-config-prettier": "^9.1.0",
112111
"eslint-plugin-prettier": "^5.2.1",

src/gatsby-types.d.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2941,15 +2941,5 @@ type BlogPostsQueryVariables = Exact<{ [key: string]: never; }>;
29412941

29422942
type BlogPostsQuery = { readonly allMarkdownRemark: { readonly edges: ReadonlyArray<{ readonly node: { readonly fields: { readonly slug: string | null } | null } }> }, readonly tagsGroup: { readonly group: ReadonlyArray<{ readonly fieldValue: string | null }> } };
29432943

2944-
type BlogPostsApiQueryVariables = Exact<{ [key: string]: never; }>;
2945-
2946-
2947-
type BlogPostsApiQuery = { readonly allMarkdownRemark: { readonly edges: ReadonlyArray<{ readonly node: { readonly html: string | null, readonly fields: { readonly slug: string | null, readonly readingTime: { readonly text: string | null } | null } | null, readonly frontmatter: { readonly title: string | null, readonly description: string | null, readonly authors: ReadonlyArray<string | null> | null, readonly tags: ReadonlyArray<string | null> | null, readonly math: boolean | null, readonly date: string | null, readonly image: { readonly publicURL: string | null } | null } | null } }> } };
2948-
2949-
type ImagesApiQueryVariables = Exact<{ [key: string]: never; }>;
2950-
2951-
2952-
type ImagesApiQuery = { readonly allFile: { readonly edges: ReadonlyArray<{ readonly node: { readonly publicURL: string | null, readonly name: string } }> } };
2953-
29542944

29552945
}

0 commit comments

Comments
 (0)