Skip to content

Commit 3c2ded7

Browse files
authored
Rework (#355)
1 parent d9cf942 commit 3c2ded7

File tree

214 files changed

+22816
-26153
lines changed

Some content is hidden

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

214 files changed

+22816
-26153
lines changed

.eslintignore

-9
This file was deleted.

.eslintrc

-40
This file was deleted.

.github/workflows/pull_request.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Code quality
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
quality:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
- name: Setup Biome
13+
uses: biomejs/setup-biome@v2
14+
with:
15+
version: latest
16+
- name: Run Biome
17+
run: biome ci .

.github/workflows/website.yaml

-22
This file was deleted.

.prettierignore

-8
This file was deleted.

.prettierrc.json

-10
This file was deleted.

api/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
FROM oven/bun:1.0.29
16+
FROM oven/bun:1.1.3
1717

1818
ARG BUILD_SHA=default_value
1919
ENV __BUILD_SHA=$BUILD_SHA

api/bun.lockb

16.5 KB
Binary file not shown.

api/package.json

+56-55
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,58 @@
11
{
2-
"type": "module",
3-
"private": true,
4-
"name": "docs-page-api",
5-
"version": "1.0.0",
6-
"main": "src/app.ts",
7-
"author": "Invertase <[email protected]>",
8-
"license": "MIT",
9-
"dependencies": {
10-
"@code-hike/mdx": "0.7.2",
11-
"@mdx-js/mdx": "2.2.1",
12-
"@octokit/graphql": "5.0.0",
13-
"@types/cors": "^2.8.12",
14-
"@types/express": "^4.17.13",
15-
"@types/morgan": "^1.9.3",
16-
"@types/node": "^18.0.0",
17-
"a2a": "^0.2.0",
18-
"camelcase": "7.0.0",
19-
"cors": "2.8.5",
20-
"dotenv": "16.0.1",
21-
"esbuild": "0.14.47",
22-
"express": "4.18.1",
23-
"express-basic-auth": "^1.2.1",
24-
"gray-matter": "4.0.3",
25-
"hast-util-heading-rank": "2.1.1",
26-
"hast-util-parse-selector": "3.1.0",
27-
"is-badge": "^2.1.0",
28-
"js-yaml": "4.1.0",
29-
"mdx-bundler": "9.0.1",
30-
"morgan": "1.10.0",
31-
"node-fetch": "3.2.6",
32-
"pm2": "5.3.0",
33-
"probot": "12.2.8",
34-
"rehype-accessible-emojis": "0.3.2",
35-
"rehype-katex": "6.0.2",
36-
"rehype-slug": "5.0.1",
37-
"remark-comment": "1.0.0",
38-
"remark-gfm": "3.0.1",
39-
"remark-math": "5.1.1",
40-
"remark-parse": "10.0.1",
41-
"shiki": "1.1.7",
42-
"unist-util-visit": "4.1.0",
43-
"zod": "3.22.4",
44-
"zod-validation-error": "0.2.2"
45-
},
46-
"scripts": {
47-
"dev": "bun run src/app.ts --hot",
48-
"start": "bun run src/app.ts"
49-
},
50-
"devDependencies": {
51-
"@octokit/webhooks-types": "^6.2.4",
52-
"@types/js-yaml": "^4.0.5",
53-
"rollup": "3.9.1",
54-
"ts-node": "^10.8.1",
55-
"typescript": "4.7.4"
56-
}
2+
"type": "module",
3+
"private": true,
4+
"name": "docs-page-api",
5+
"version": "1.0.0",
6+
"main": "src/app.ts",
7+
"author": "Invertase <[email protected]>",
8+
"license": "MIT",
9+
"dependencies": {
10+
"@code-hike/mdx": "0.7.2",
11+
"@mdx-js/mdx": "2.2.1",
12+
"@octokit/graphql": "5.0.0",
13+
"@octokit/webhooks": "^13.2.7",
14+
"@types/express": "^4.17.13",
15+
"@types/morgan": "^1.9.3",
16+
"@types/node": "^18.0.0",
17+
"a2a": "^0.2.0",
18+
"camelcase": "7.0.0",
19+
"dotenv": "16.0.1",
20+
"esbuild": "0.14.47",
21+
"express": "4.18.1",
22+
"express-basic-auth": "^1.2.1",
23+
"gray-matter": "4.0.3",
24+
"hast-util-heading-rank": "2.1.1",
25+
"hast-util-parse-selector": "3.1.0",
26+
"is-badge": "^2.1.0",
27+
"js-yaml": "4.1.0",
28+
"lodash.get": "^4.4.2",
29+
"mdx-bundler": "9.0.1",
30+
"morgan": "1.10.0",
31+
"node-fetch": "3.2.6",
32+
"octokit": "^4.0.2",
33+
"rehype-accessible-emojis": "0.3.2",
34+
"rehype-katex": "6.0.2",
35+
"rehype-slug": "5.0.1",
36+
"remark-comment": "1.0.0",
37+
"remark-gfm": "3.0.1",
38+
"remark-math": "5.1.1",
39+
"remark-parse": "10.0.1",
40+
"shiki": "1.1.7",
41+
"unist-util-visit": "4.1.0",
42+
"zod": "3.22.4",
43+
"zod-to-json-schema": "^3.23.1",
44+
"zod-validation-error": "0.2.2"
45+
},
46+
"scripts": {
47+
"dev": "bun run src/app.ts --hot",
48+
"start": "bun run src/app.ts"
49+
},
50+
"devDependencies": {
51+
"@octokit/webhooks-types": "^6.2.4",
52+
"@types/js-yaml": "^4.0.5",
53+
"@types/lodash.get": "^4.4.9",
54+
"rollup": "3.9.1",
55+
"ts-node": "^10.8.1",
56+
"typescript": "5.5.2"
57+
}
5758
}

api/src/app.ts

+19-21
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
1-
import express, { Router, text } from 'express';
2-
import morgan from 'morgan';
3-
import cors from 'cors';
4-
import { config } from 'dotenv';
1+
import { config } from "dotenv";
2+
import express, { Router, text } from "express";
3+
import morgan from "morgan";
54

6-
import bundle from './routes/bundle';
7-
import preview from './routes/preview';
8-
import mdx from './routes/mdx';
9-
import probot from './probot';
10-
import { notFound } from './res';
5+
import { notFound } from "./res";
6+
import bundle from "./routes/bundle";
7+
import preview from "./routes/preview";
8+
import schema from "./routes/schema";
9+
import githubWebhook from "./routes/webhooks.github";
1110

1211
config();
1312

1413
const PORT = process.env.PORT || 8080;
1514
const app = express();
1615
app.use(text());
17-
app.use(cors());
18-
app.use(morgan('dev'));
16+
app.use(morgan("dev"));
1917
app.use(express.json());
2018
app.use(
21-
express.urlencoded({
22-
extended: true,
23-
}),
19+
express.urlencoded({
20+
extended: true,
21+
}),
2422
);
25-
app.use(probot);
2623

2724
const router = Router();
28-
router.get('/status', (_, res) => res.status(200).send('OK'));
29-
router.post('/preview', preview);
30-
router.get('/bundle', bundle);
31-
router.post('/mdx', mdx);
32-
router.all('*', (_, res) => notFound(res));
25+
router.get("/status", (_, res) => res.status(200).send("OK"));
26+
router.get("/schema.json", schema);
27+
router.post("/preview", preview);
28+
router.get("/bundle", bundle);
29+
router.post("/webhooks/github", githubWebhook);
30+
router.all("*", (_, res) => notFound(res));
3331
app.use(router);
3432

3533
app.listen(PORT, () => {
36-
console.log(`docs.page api server is running at http://localhost:${PORT}`);
34+
console.log(`docs.page api server is running at http://localhost:${PORT}`);
3735
});

api/src/bundler/error.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export class BundlerError extends Error {
2+
code: number;
3+
name: string;
4+
source?: string;
5+
6+
constructor({
7+
code,
8+
name,
9+
message,
10+
source,
11+
}: {
12+
code: number;
13+
name: string;
14+
message: string;
15+
source?: string;
16+
}) {
17+
super(message);
18+
this.code = code;
19+
this.name = name;
20+
this.message = message;
21+
this.source = source;
22+
}
23+
}

0 commit comments

Comments
 (0)