Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 96b4419

Browse files
committed
style: format codebase
1 parent 7c7e94b commit 96b4419

56 files changed

Lines changed: 494 additions & 1006 deletions

Some content is hidden

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

package.json

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
11
{
2-
"name": "cho.sh",
3-
"version": "0.1.0",
4-
"private": true,
5-
"type": "module",
6-
"packageManager": "pnpm@10.32.1",
7-
"scripts": {
8-
"dev": "vp dev",
9-
"build:assets": "tsx scripts/build-static-assets.ts",
10-
"build:assets:fast": "tsx scripts/build-static-assets.ts --skip-og",
11-
"build:vite": "vp build",
12-
"build": "pnpm run build:assets && pnpm run build:vite",
13-
"preview": "vp preview",
14-
"lint": "vp lint",
15-
"format": "vp fmt . --write",
16-
"assign-hex": "tsx scripts/assign-hex-slugs.ts",
17-
"sync:last-modified": "tsx scripts/sync-last-modified.ts",
18-
"type-check": "tsc --noEmit",
19-
"check": "pnpm run type-check && pnpm run lint",
20-
"fix": "vp lint --fix"
21-
},
22-
"dependencies": {
23-
"@base-ui/react": "^1.3.0",
24-
"@hugeicons/core-free-icons": "^4.0.0",
25-
"@hugeicons/react": "^1.1.6",
26-
"@resvg/resvg-js": "^2.6.2",
27-
"@shikijs/langs": "^4.0.2",
28-
"@shikijs/themes": "^4.0.2",
29-
"@streamdown/cjk": "^1.0.2",
30-
"@streamdown/math": "^1.0.2",
31-
"@tanstack/react-router": "^1.167.4",
32-
"@tanstack/react-start": "^1.166.15",
33-
"@tanstack/start-static-server-functions": "^1.166.14",
34-
"class-variance-authority": "^0.7.1",
35-
"clsx": "^2.1.1",
36-
"cobe": "^0.6.5",
37-
"eiab": "^0.4.2",
38-
"gray-matter": "^4.0.3",
39-
"motion": "^12.38.0",
40-
"motion-plus": "^1.5.1",
41-
"react": "19.2.4",
42-
"react-dom": "19.2.4",
43-
"satori": "^0.25.0",
44-
"shiki": "^4.0.2",
45-
"streamdown": "^2.4.0",
46-
"tailwind-merge": "^3.4.0",
47-
"tw-animate-css": "^1.4.0",
48-
"zod": "^4.3.5",
49-
"zustand": "^5.0.12"
50-
},
51-
"devDependencies": {
52-
"@rolldown/plugin-babel": "0.2.1",
53-
"@tailwindcss/vite": "^4",
54-
"@types/node": "^25.5.0",
55-
"@types/react": "^19",
56-
"@types/react-dom": "^19",
57-
"@vitejs/plugin-react": "^6.0.1",
58-
"babel-plugin-react-compiler": "1.0.0",
59-
"lefthook": "^2.1.4",
60-
"nitro": "^3.0.260311-beta",
61-
"tailwindcss": "^4",
62-
"tsx": "^4.20.6",
63-
"typescript": "^5.9.3",
64-
"vite": "^8.0.0",
65-
"vite-plus": "0.1.12"
66-
}
2+
"name": "cho.sh",
3+
"version": "0.1.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vp dev",
8+
"build:assets": "tsx scripts/build-static-assets.ts",
9+
"build:assets:fast": "tsx scripts/build-static-assets.ts --skip-og",
10+
"build:vite": "vp build",
11+
"build": "pnpm run build:assets && pnpm run build:vite",
12+
"preview": "vp preview",
13+
"lint": "vp lint",
14+
"format": "vp fmt . --write",
15+
"assign-hex": "tsx scripts/assign-hex-slugs.ts",
16+
"sync:last-modified": "tsx scripts/sync-last-modified.ts",
17+
"type-check": "tsc --noEmit",
18+
"check": "pnpm run type-check && pnpm run lint",
19+
"fix": "vp lint --fix"
20+
},
21+
"dependencies": {
22+
"@base-ui/react": "^1.3.0",
23+
"@hugeicons/core-free-icons": "^4.0.0",
24+
"@hugeicons/react": "^1.1.6",
25+
"@resvg/resvg-js": "^2.6.2",
26+
"@shikijs/langs": "^4.0.2",
27+
"@shikijs/themes": "^4.0.2",
28+
"@streamdown/cjk": "^1.0.2",
29+
"@streamdown/math": "^1.0.2",
30+
"@tanstack/react-router": "^1.167.4",
31+
"@tanstack/react-start": "^1.166.15",
32+
"@tanstack/start-static-server-functions": "^1.166.14",
33+
"class-variance-authority": "^0.7.1",
34+
"clsx": "^2.1.1",
35+
"cobe": "^0.6.5",
36+
"eiab": "^0.4.2",
37+
"gray-matter": "^4.0.3",
38+
"motion": "^12.38.0",
39+
"motion-plus": "^1.5.1",
40+
"react": "19.2.4",
41+
"react-dom": "19.2.4",
42+
"satori": "^0.25.0",
43+
"shiki": "^4.0.2",
44+
"streamdown": "^2.4.0",
45+
"tailwind-merge": "^3.4.0",
46+
"tw-animate-css": "^1.4.0",
47+
"zod": "^4.3.5",
48+
"zustand": "^5.0.12"
49+
},
50+
"devDependencies": {
51+
"@rolldown/plugin-babel": "0.2.1",
52+
"@tailwindcss/vite": "^4",
53+
"@types/node": "^25.5.0",
54+
"@types/react": "^19",
55+
"@types/react-dom": "^19",
56+
"@vitejs/plugin-react": "^6.0.1",
57+
"babel-plugin-react-compiler": "1.0.0",
58+
"lefthook": "^2.1.4",
59+
"nitro": "^3.0.260311-beta",
60+
"tailwindcss": "^4",
61+
"tsx": "^4.20.6",
62+
"typescript": "^5.9.3",
63+
"vite": "^8.0.0",
64+
"vite-plus": "0.1.12"
65+
},
66+
"packageManager": "pnpm@10.32.1"
6767
}

scripts/assign-hex-slugs.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,13 @@ async function collectMarkdownFiles(root: string): Promise<string[]> {
2929
return files.concat(...subdirResults);
3030
}
3131

32-
function collectExistingSlugs(
33-
files: { path: string; content: string }[]
34-
): Set<string> {
32+
function collectExistingSlugs(files: { path: string; content: string }[]): Set<string> {
3533
const slugs = new Set<string>();
3634
for (const file of files) {
3735
const match = file.content.match(FRONTMATTER_RE);
3836
if (!match) continue;
3937
const frontmatter = match[1];
40-
const slugLine = frontmatter
41-
.split("\n")
42-
.find((l) => l.startsWith("slug:"));
38+
const slugLine = frontmatter.split("\n").find((l) => l.startsWith("slug:"));
4339
if (!slugLine) continue;
4440
const slug = slugLine
4541
.replace(/^slug:\s*/, "")
@@ -69,7 +65,7 @@ async function main() {
6965
allPaths.map(async (p) => ({
7066
path: p,
7167
content: await fs.readFile(p, "utf8"),
72-
}))
68+
})),
7369
);
7470

7571
const existingSlugs = collectExistingSlugs(allFiles);

scripts/build-static-assets.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ async function copyLocalAssets(notes: NoteEntry[]) {
116116
}
117117

118118
const assetFiles = entries.filter(
119-
(entry) =>
120-
entry.isFile() &&
121-
ASSET_EXTENSIONS.has(path.extname(entry.name).toLowerCase())
119+
(entry) => entry.isFile() && ASSET_EXTENSIONS.has(path.extname(entry.name).toLowerCase()),
122120
);
123121

124122
if (assetFiles.length === 0) continue;
@@ -140,13 +138,13 @@ async function copyLocalAssets(notes: NoteEntry[]) {
140138
copiedSourceDirs += 1;
141139
if (copiedSourceDirs % 100 === 0) {
142140
console.log(
143-
` Copied assets from ${copiedSourceDirs} source directories into ${copiedSlugDirs} note directories (${copiedFiles} files)`
141+
` Copied assets from ${copiedSourceDirs} source directories into ${copiedSlugDirs} note directories (${copiedFiles} files)`,
144142
);
145143
}
146144
}
147145

148146
console.log(
149-
` Local assets: ${copiedFiles} files from ${copiedSourceDirs} source directories into ${copiedSlugDirs} note directories`
147+
` Local assets: ${copiedFiles} files from ${copiedSourceDirs} source directories into ${copiedSlugDirs} note directories`,
150148
);
151149
}
152150

@@ -173,9 +171,7 @@ async function copySharedAssets() {
173171
async function generateOGImages(notes: NoteEntry[]) {
174172
await ensureDir(OG_DIR);
175173

176-
const { generateOGImage } = await import(
177-
"../src/lib/og/og-generator"
178-
);
174+
const { generateOGImage } = await import("../src/lib/og/og-generator");
179175

180176
let generated = 0;
181177
let skipped = 0;
@@ -214,12 +210,10 @@ async function generateOGImages(notes: NoteEntry[]) {
214210
console.error(`Failed to generate OG image for ${note.slug}:`, error);
215211
}
216212
}
217-
})
213+
}),
218214
);
219215

220-
console.log(
221-
`OG images: ${generated} generated, ${skipped} skipped (already exist)`
222-
);
216+
console.log(`OG images: ${generated} generated, ${skipped} skipped (already exist)`);
223217
}
224218

225219
async function main() {
@@ -229,7 +223,9 @@ async function main() {
229223
let stepStart = performance.now();
230224
console.log("Reading note entries...");
231225
const notes = await readNoteEntries();
232-
console.log(`Found ${notes.length} notes (${((performance.now() - stepStart) / 1000).toFixed(1)}s)`);
226+
console.log(
227+
`Found ${notes.length} notes (${((performance.now() - stepStart) / 1000).toFixed(1)}s)`,
228+
);
233229

234230
stepStart = performance.now();
235231
console.log("Copying local assets...");
@@ -250,7 +246,9 @@ async function main() {
250246
console.log("Skipping OG image generation (--skip-og)");
251247
}
252248

253-
console.log(`Static assets build complete in ${((performance.now() - totalStart) / 1000).toFixed(1)}s`);
249+
console.log(
250+
`Static assets build complete in ${((performance.now() - totalStart) / 1000).toFixed(1)}s`,
251+
);
254252
}
255253

256254
await main();

scripts/sync-last-modified.ts

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,7 @@ function parseBeforeArg() {
5454
}
5555

5656
function getGitPathCandidates(relativePath: string) {
57-
return Array.from(
58-
new Set([
59-
relativePath,
60-
relativePath.replace(LIBRARY_PREFIX_RE, "Research/"),
61-
])
62-
);
57+
return Array.from(new Set([relativePath, relativePath.replace(LIBRARY_PREFIX_RE, "Research/")]));
6358
}
6459

6560
function pickLastUpdatedFromLog(stdout: string): string | undefined {
@@ -100,24 +95,15 @@ function pickLastUpdatedFromLog(stdout: string): string | undefined {
10095

10196
async function getLastUpdatedForRelativePath(
10297
relativePath: string,
103-
before?: string
98+
before?: string,
10499
): Promise<string | undefined> {
105100
for (const candidate of getGitPathCandidates(relativePath)) {
106-
const candidateRoot = GIT_HISTORY_ROOTS.find((root) =>
107-
candidate.startsWith(`${root}/`)
108-
);
101+
const candidateRoot = GIT_HISTORY_ROOTS.find((root) => candidate.startsWith(`${root}/`));
109102
if (!candidateRoot) {
110103
continue;
111104
}
112105

113-
const args = [
114-
"-C",
115-
REPO_ROOT,
116-
"log",
117-
"--follow",
118-
"--name-status",
119-
"--format=__COMMIT__ %cs",
120-
];
106+
const args = ["-C", REPO_ROOT, "log", "--follow", "--name-status", "--format=__COMMIT__ %cs"];
121107

122108
if (before) {
123109
args.push(`--before=${before} 00:00:00`);
@@ -138,20 +124,15 @@ async function getLastUpdatedForRelativePath(
138124
return undefined;
139125
}
140126

141-
function upsertLastModified(
142-
source: string,
143-
lastModified: string
144-
): string | null {
127+
function upsertLastModified(source: string, lastModified: string): string | null {
145128
const match = source.match(FRONTMATTER_RE);
146129
if (!match) {
147130
return null;
148131
}
149132

150133
const lineEnding = source.includes("\r\n") ? "\r\n" : "\n";
151134
const frontmatterLines = match[1].split(LINE_SPLIT_RE);
152-
const existingIndex = frontmatterLines.findIndex((line) =>
153-
LAST_MODIFIED_RE.test(line)
154-
);
135+
const existingIndex = frontmatterLines.findIndex((line) => LAST_MODIFIED_RE.test(line));
155136
const newLine = `last_modified: ${lastModified}`;
156137

157138
if (existingIndex >= 0) {
@@ -164,17 +145,15 @@ function upsertLastModified(
164145
}
165146

166147
const rest = source.slice(match[0].length);
167-
const rebuiltFrontmatter = ["---", ...frontmatterLines, "---"].join(
168-
lineEnding
169-
);
148+
const rebuiltFrontmatter = ["---", ...frontmatterLines, "---"].join(lineEnding);
170149

171150
return `${rebuiltFrontmatter}${match[2]}${rest}`;
172151
}
173152

174153
async function runWithConcurrency<T>(
175154
items: T[],
176155
concurrency: number,
177-
worker: (item: T) => Promise<void>
156+
worker: (item: T) => Promise<void>,
178157
) {
179158
const queue = [...items];
180159

@@ -187,7 +166,7 @@ async function runWithConcurrency<T>(
187166
}
188167
await worker(item);
189168
}
190-
})
169+
}),
191170
);
192171
}
193172

@@ -200,10 +179,7 @@ async function main() {
200179

201180
await runWithConcurrency(files, 12, async (filePath) => {
202181
const relativePath = path.relative(REPO_ROOT, filePath);
203-
const lastModified = await getLastUpdatedForRelativePath(
204-
relativePath,
205-
before
206-
);
182+
const lastModified = await getLastUpdatedForRelativePath(relativePath, before);
207183

208184
if (!lastModified) {
209185
skippedCount += 1;
@@ -222,7 +198,7 @@ async function main() {
222198
});
223199

224200
console.log(
225-
`Updated ${updatedCount} files with last_modified${before ? ` before ${before}` : ""}. Skipped ${skippedCount} files without git history.`
201+
`Updated ${updatedCount} files with last_modified${before ? ` before ${before}` : ""}. Skipped ${skippedCount} files without git history.`,
226202
);
227203
}
228204

src/app/globals.css

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@
3535
--info-foreground: var(--color-blue-700);
3636
--input: --alpha(var(--color-black) / 10%);
3737
--muted: --alpha(var(--color-black) / 4%);
38-
--muted-foreground: color-mix(
39-
in srgb,
40-
var(--color-neutral-500) 90%,
41-
var(--color-black)
42-
);
38+
--muted-foreground: color-mix(in srgb, var(--color-neutral-500) 90%, var(--color-black));
4339
--popover: var(--color-white);
4440
--popover-foreground: var(--color-neutral-800);
4541
--primary: var(--color-neutral-800);
@@ -72,12 +68,10 @@
7268
--color-link: var(--link);
7369
--color-link-visited: var(--link-visited);
7470
--font-sans:
75-
"Sunghyun Sans KR Hanja", ui-sans-serif, -apple-system, BlinkMacSystemFont,
76-
"SF Pro", "Segoe UI", Roboto, "Pretendard Variable", Pretendard,
77-
"Pretendard JP", sans-serif;
71+
"Sunghyun Sans KR Hanja", ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro",
72+
"Segoe UI", Roboto, "Pretendard Variable", Pretendard, "Pretendard JP", sans-serif;
7873
--font-heading: var(--font-sans);
79-
--font-mono:
80-
ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
74+
--font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
8175
--color-warning-foreground: var(--warning-foreground);
8276
--color-warning: var(--warning);
8377
--color-success-foreground: var(--success-foreground);
@@ -122,11 +116,7 @@ body {
122116
--border: --alpha(var(--color-white) / 10%);
123117
--card: #0a0a0a;
124118
--card-foreground: var(--color-neutral-100);
125-
--destructive: color-mix(
126-
in srgb,
127-
var(--color-red-500) 90%,
128-
var(--color-white)
129-
);
119+
--destructive: color-mix(in srgb, var(--color-red-500) 90%, var(--color-white));
130120
--destructive-foreground: var(--color-red-400);
131121
--foreground: var(--color-neutral-100);
132122
--info: var(--color-blue-500);

0 commit comments

Comments
 (0)