Skip to content

Commit ccbe864

Browse files
authored
chore: include prebuilt sample apps in tsky docs (#86)
1 parent 75f767b commit ccbe864

File tree

10 files changed

+98
-36
lines changed

10 files changed

+98
-36
lines changed

docs/.vitepress/config.mts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import typedocSidebar from '../api/typedoc-sidebar.json';
55
export default defineConfig({
66
title: 'tsky',
77
description: 'A Bluesky API client for nimble apps and tools',
8+
ignoreDeadLinks: [/\/examples\//],
89
themeConfig: {
910
nav: [
1011
{ text: 'Home', link: '/' },

docs/examples.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ outline: deep
44

55
# Examples
66

7-
TODO: Add examples here
7+
- [User profile](/examples/user-profile/){target="_self"}

docs/package.json

+6
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@
33
"version": "1.0.0",
44
"private": true,
55
"main": "index.js",
6+
"type": "module",
67
"scripts": {
78
"predev": "typedoc",
89
"dev": "vitepress dev",
910
"prebuild": "typedoc",
1011
"build": "vitepress build",
12+
"postbuild": "pnpm build:examples && pnpm copy-example-apps",
13+
"build:examples": "pnpm --filter 'examples-*' build",
14+
"copy-example-apps": "tsx scripts/copy-example-apps.ts",
1115
"preview": "vitepress preview",
1216
"test": "echo \"Error: no test specified\""
1317
},
1418
"devDependencies": {
19+
"@types/node": "^22.13.10",
20+
"tsx": "^4.19.2",
1521
"typedoc": "^0.27.1",
1622
"typedoc-plugin-markdown": "^4.3.0",
1723
"typedoc-vitepress-theme": "^1.1.0",

docs/scripts/copy-example-apps.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import fs from 'node:fs/promises';
2+
3+
const apps = await fs.readdir('../examples');
4+
5+
for (const app of apps) {
6+
console.log(`copying example app ${app} ...`);
7+
fs.cp(`../examples/${app}/dist`, `./.vitepress/dist/examples/${app}`, {
8+
recursive: true,
9+
});
10+
}

docs/tsconfig.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ESNext",
4+
"lib": ["ESNext", "DOM"],
5+
"moduleDetection": "force",
6+
"useDefineForClassFields": false,
7+
"experimentalDecorators": true,
8+
"baseUrl": ".",
9+
"module": "ESNext",
10+
"moduleResolution": "bundler",
11+
"resolveJsonModule": true,
12+
"allowJs": true,
13+
"strict": true,
14+
"noFallthroughCasesInSwitch": true,
15+
"noImplicitOverride": true,
16+
"noImplicitReturns": true,
17+
"noUnusedLocals": true,
18+
"noImplicitAny": true,
19+
"noUnusedParameters": true,
20+
"declaration": false,
21+
"noEmit": true,
22+
"outDir": "dist/",
23+
"sourceMap": true,
24+
"esModuleInterop": true,
25+
"forceConsistentCasingInFileNames": true,
26+
"isolatedModules": true,
27+
"verbatimModuleSyntax": true,
28+
"skipLibCheck": true
29+
},
30+
"include": ["./scripts/**/*"],
31+
}

examples/user-profile/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "user-profile",
2+
"name": "examples-user-profile",
33
"private": true,
44
"version": "0.0.0",
55
"type": "module",
@@ -25,4 +25,4 @@
2525
"typescript-eslint": "^8.24.1",
2626
"vite": "^6.2.0"
2727
}
28-
}
28+
}

examples/user-profile/src/App.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function App() {
5454
rel="noreferrer"
5555
>
5656
<img
57-
src="/tsky-logo.png"
57+
src="/examples/user-profile/tsky-logo.png"
5858
alt="tsky logo"
5959
className="size-9 min-w-9 rounded"
6060
/>

examples/user-profile/vite.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ import tailwindcss from '@tailwindcss/vite';
55
// https://vite.dev/config/
66
export default defineConfig({
77
plugins: [react(), tailwindcss()],
8+
base: '/examples/user-profile/',
89
});

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
"biome check --write --"
3636
]
3737
}
38-
}
38+
}

pnpm-lock.yaml

+44-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)