Skip to content

Commit d8b8a0b

Browse files
authored
Merge pull request #12 from open-rpc/feat/workspace
Feat/workspace
2 parents 146f6ec + a5976f0 commit d8b8a0b

Some content is hidden

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

65 files changed

+7969
-144
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,5 @@ vite.config.ts.timestamp-*
142142

143143
# LLMLOG.MD
144144
LLMLOG.MD
145-
coverage
145+
coverage
146+
**/*/docs/api-reference

bun.lock

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

eslint.config.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,19 @@ export default [
2828
"vitest.config.ts",
2929
"vite.config.ts",
3030
"build.ts",
31-
"bun.lockb"
31+
"**/build.ts",
32+
"bun.lockb",
33+
"packages/example-site/",
3234
]
3335
},
36+
3437
{
3538
files: ['**/*.{ts,tsx}'],
3639
languageOptions: {
3740
parser: tsParser,
3841
parserOptions: {
39-
project: ['./tsconfig.json'],
42+
project: ['./packages/markdown-generator/tsconfig.json', './packages/docusaurus-plugin/tsconfig.json'],
43+
4044
tsconfigRootDir: __dirname,
4145
ecmaVersion: 2022,
4246
sourceType: 'module',

package.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,31 @@
1414
"files": [
1515
"dist"
1616
],
17-
"private": false,
17+
"private": true,
18+
"workspaces": [
19+
"packages/*"
20+
],
1821
"version": "0.0.0-development",
1922
"scripts": {
20-
"types": "tsc -p tsconfig.json",
23+
"types": "bun run types:md-gen && bun run types:plugin",
2124
"lint": "eslint .",
2225
"lint:fix": "eslint . --fix",
23-
"build": "bun build.ts"
26+
"build:md-gen": "bun run --cwd packages/markdown-generator build.ts",
27+
"build:plugin": "bun run --cwd packages/docusaurus-plugin build.ts",
28+
"types:md-gen": "bun run --cwd packages/markdown-generator tsc -p tsconfig.json",
29+
"types:plugin": "bun run --cwd packages/docusaurus-plugin tsc -p tsconfig.json"
2430
},
2531
"devDependencies": {
32+
"@eslint/js": "^9.39.1",
2633
"@types/bun": "^1.3.1",
2734
"@types/node": "22.13.5",
28-
"typescript": "5.9",
2935
"@typescript-eslint/eslint-plugin": "^8.46.2",
36+
"@typescript-eslint/parser": "^8.46.4",
3037
"eslint": "^9.38.0",
3138
"eslint-config-prettier": "^10.1.8",
32-
"eslint-plugin-prettier": "^5.5.4"
39+
"eslint-plugin-prettier": "^5.5.4",
40+
"globals": "^16.5.0",
41+
"typescript": "5.9"
3342
},
3443
"dependencies": {}
3544
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bun
2+
import { $ } from "bun";
3+
4+
// Build plugin entry only
5+
// Components are exported directly from src/ and transpiled by Docusaurus
6+
await Bun.build({
7+
entrypoints: ["./src/index.ts"],
8+
outdir: "./dist",
9+
target: "node",
10+
format: "esm",
11+
sourcemap: "external",
12+
external: ["@docusaurus/*", "react", "react-dom"],
13+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "@open-rpc/docusaurus-plugin",
3+
"version": "0.0.0-development",
4+
"private": false,
5+
"main": "./dist/index.js",
6+
"types": "./dist/index.d.ts",
7+
"exports": {
8+
".": "./dist/index.js",
9+
"./components": "./src/components.ts"
10+
},
11+
"files": [
12+
"dist",
13+
"src/components",
14+
"src/components.ts"
15+
],
16+
"dependencies": {
17+
"@docusaurus/core": "3.9.2",
18+
"@docusaurus/logger": "3.9.2",
19+
"@docusaurus/utils": "3.9.2",
20+
"@docusaurus/utils-common": "3.9.2",
21+
"@docusaurus/utils-validation": "3.9.2",
22+
"@open-rpc/meta-schema": "^1.14.9",
23+
"@open-rpc/schema-utils-js": "^2.1.2"
24+
},
25+
"devDependencies": {
26+
"@docusaurus/types": "3.9.2",
27+
"@types/react": "^19.2.4",
28+
"@types/react-dom": "^19.2.3"
29+
},
30+
"peerDependencies": {
31+
"react": "^19.0.0",
32+
"react-dom": "^19.0.0"
33+
}
34+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Separate entry point for components to avoid loading them during plugin initialization
2+
export {
3+
TwoColumnLayout,
4+
RequestExample,
5+
ResponseExample,
6+
} from "./components/ApiExamples";
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React, { type ReactNode } from "react";
2+
import styles from "./styles.module.css";
3+
4+
interface RequestExampleProps {
5+
code: string;
6+
language?: string;
7+
title?: string;
8+
}
9+
10+
export function RequestExample({
11+
code,
12+
language = "json",
13+
title = "Request",
14+
}: RequestExampleProps): ReactNode {
15+
return (
16+
<div className={styles.exampleBlock}>
17+
<div className={`${styles.exampleHeader} ${styles.requestHeader}`}>
18+
{title}
19+
</div>
20+
<div className={styles.exampleContent}>
21+
<pre>
22+
<code className={`language-${language}`}>{code}</code>
23+
</pre>
24+
</div>
25+
</div>
26+
);
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React, { type ReactNode } from "react";
2+
import styles from "./styles.module.css";
3+
4+
interface ResponseExampleProps {
5+
code: string;
6+
language?: string;
7+
title?: string;
8+
}
9+
10+
export function ResponseExample({
11+
code,
12+
language = "json",
13+
title = "Response",
14+
}: ResponseExampleProps): ReactNode {
15+
return (
16+
<div className={styles.exampleBlock}>
17+
<div className={`${styles.exampleHeader} ${styles.responseHeader}`}>
18+
{title}
19+
</div>
20+
<div className={styles.exampleContent}>
21+
<pre>
22+
<code className={`language-${language}`}>{code}</code>
23+
</pre>
24+
</div>
25+
</div>
26+
);
27+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React, { type ReactNode } from "react";
2+
import styles from "./styles.module.css";
3+
4+
interface TwoColumnLayoutProps {
5+
children: ReactNode;
6+
sidebar: ReactNode;
7+
}
8+
9+
export function TwoColumnLayout({
10+
children,
11+
sidebar,
12+
}: TwoColumnLayoutProps): ReactNode {
13+
return (
14+
<div className={styles.twoColumnLayout}>
15+
<div className={styles.mainContent}>{children}</div>
16+
<div className={styles.sidebar}>{sidebar}</div>
17+
</div>
18+
);
19+
}

0 commit comments

Comments
 (0)