Skip to content

Commit

Permalink
move build-contents to src
Browse files Browse the repository at this point in the history
  • Loading branch information
yo-iwamoto committed Apr 8, 2024
1 parent ae02cfe commit 7df6196
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.1/schema.json",
"files": {
"ignore": ["node_modules", ".next", "src/contents/**/*"]
"ignore": ["node_modules", ".next", "src/contents.json"]
},
"organizeImports": {
"enabled": true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dev": "next dev",
"build": "pnpm build:content && pnpm build:next",
"build:next": "next build",
"build:content": "tsx scripts/build-contents.ts",
"build:content": "tsx src/scripts/build-contents.ts",
"start": "next start",
"check": "biome check .",
"check:apply": "biome check --apply .",
Expand Down
9 changes: 7 additions & 2 deletions src/contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"slug": "vitest-restore-mocks",
"title": "Vitest の restoreMocks はとりあえず true でいいと思います",
"publishedAt": "2023-12-29",
"tags": ["vitest", "testing"]
"tags": [
"vitest",
"testing"
]
}
},
{
Expand All @@ -14,7 +17,9 @@
"slug": "route-handlers",
"title": "appDir の Route Handlers を使う・API Routes からの変更点",
"publishedAt": "2023-04-22",
"tags": ["nextjs"]
"tags": [
"nextjs"
]
}
}
]
4 changes: 2 additions & 2 deletions scripts/build-contents.ts → src/scripts/build-contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import remarkParse from "remark-parse";
import remarkRehype from "remark-rehype";
import { unified } from "unified";
import { z } from "zod";
import { transformArticleHtml } from "../src/lib/transform-article-html";
import { transformArticleHtml } from "../lib/transform-article-html";

async function parseMarkdown(markdownString: string) {
return unified()
Expand Down Expand Up @@ -64,7 +64,7 @@ async function main() {
const allEntries = await getAllEntries();
fs.writeFileSync(
"src/contents.json",
JSON.stringify(allEntries, null, 2),
`${JSON.stringify(allEntries, null, 2)}\n`,
"utf-8",
);
}
Expand Down

0 comments on commit 7df6196

Please sign in to comment.