diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b3f785f3..f6107d12 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,7 +14,9 @@ "unifiedjs.vscode-mdx", "github.vscode-github-actions", "eliostruyf.vscode-front-matter", - "ms-azuretools.vscode-docker" + "ms-azuretools.vscode-docker", + "tamasfe.even-better-toml", + "redhat.vscode-yaml" ] } }, @@ -24,9 +26,7 @@ "onAutoForward": "openBrowserOnce" } }, - "forwardPorts": [ - 4321 - ], + "forwardPorts": [4321], "overrideCommand": true, "postCreateCommand": "/bin/sh .devcontainer/postCreateCommand.sh" } diff --git a/.github/ISSUE_TEMPLATE/01_basic.md b/.github/ISSUE_TEMPLATE/01_basic.md index d2fea0ab..4ca08be4 100644 --- a/.github/ISSUE_TEMPLATE/01_basic.md +++ b/.github/ISSUE_TEMPLATE/01_basic.md @@ -11,13 +11,11 @@ assignees: brklntmhwk - xxxxx ## As-is - -The as-is around this issue + - xxxxx ## To-be - -The to-be as a result of upcoming changes + - xxxxx diff --git a/.github/ISSUE_TEMPLATE/03_tweak.md b/.github/ISSUE_TEMPLATE/03_tweak.md index ea3148d1..64dee2ec 100644 --- a/.github/ISSUE_TEMPLATE/03_tweak.md +++ b/.github/ISSUE_TEMPLATE/03_tweak.md @@ -1,13 +1,12 @@ --- name: Tweak about: Use this when you want to make tweaks around -title: 'tweak A, B and C' +title: 'tweak' labels: 'tweak' assignees: brklntmhwk --- ## Tweaks to be made - -Specify what to tweak below. + - xxxxx diff --git a/.github/PULL_REQUEST_TEMPLATE/01_basic.md b/.github/PULL_REQUEST_TEMPLATE/01_basic.md index 0a9a46f4..d7f67f7e 100644 --- a/.github/PULL_REQUEST_TEMPLATE/01_basic.md +++ b/.github/PULL_REQUEST_TEMPLATE/01_basic.md @@ -1,17 +1,14 @@ ## Changes - -List up changes you've made below. + - xxxxx ## Checklist - -Let team members know what to check in the peer review process. + - xxxxx ## Notes - -Add whatever you want to let team members know about the changes. Write "Nothing" if you have nothing special. + - xxxxx diff --git a/.github/PULL_REQUEST_TEMPLATE/02_content.md b/.github/PULL_REQUEST_TEMPLATE/02_content.md index 952f37d0..06c94689 100644 --- a/.github/PULL_REQUEST_TEMPLATE/02_content.md +++ b/.github/PULL_REQUEST_TEMPLATE/02_content.md @@ -1,20 +1,17 @@ ## Changes - -List up changes you've made below. + - Add/Update/Delete an article - The title: xxxxx ## Checklist - -Let team members know what to check in the peer review process. + - Typos in the article - Missing info - Accuracy in the info provided in the article ## Notes - -Add whatever you want to let team members know about the changes. Write "Nothing" if you have nothing special. + - xxxxx diff --git a/.github/PULL_REQUEST_TEMPLATE/03_tweak.md b/.github/PULL_REQUEST_TEMPLATE/03_tweak.md index f29e0784..b0e9bb08 100644 --- a/.github/PULL_REQUEST_TEMPLATE/03_tweak.md +++ b/.github/PULL_REQUEST_TEMPLATE/03_tweak.md @@ -1,17 +1,14 @@ ## Changes - -List up changes you've made below. + - xxxxx ## Checklist - -Let team members know what to check in the peer review process. + - Potential side-effects arisen from the changes ## Notes - -Add whatever you want to let team members know about the changes. Write "Nothing" if you have nothing special. + - xxxxx diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 61ccdf3c..d6cc023c 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -4,6 +4,11 @@ on: pull_request: types: [edited, opened, reopened, synchronize] +permissions: + contents: read + pull-requests: write + statuses: write + jobs: danger: name: Run Danger JS on Pull Request diff --git a/README.md b/README.md index 68806993..b202911d 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,9 @@ This project adopts Issue-driven Development. > - After peer code reviews and passing your team's conventional rules, changes are finally merged into the main branch 1. On [the issue page](https://github.com/brklntmhwk/younagi.dev/issues), create an issue - - Preferably add a label that matches the purpose of your issue + - Select a template that matches the purpose of your issue + - Add a label that describes the purpose well on an as-needed basis + - Some templates has the default setting so you don't have to do so - In your issue, clarify the following points - The purpose - As-is @@ -91,20 +93,21 @@ This project adopts Issue-driven Development. - Hereafter, you're supposed to be at the project root 4. Execute `git pull origin [[the branch name]]` to keep your local up to date 5. Start coding! - 1. [Setup](#setup-for-coding) + 1. [Setup outside the container](#setup-for-coding) 2. Open the VSCode command palette 3. Select "Dev Containers: Reopen Container" - It starts rebuilding the container if needed - It might take longer the first time - 4. [Setup](#setup-for-coding) + 4. [Setup inside the container](#setup-for-coding) 6. After you're finished coding, execute `git add .` > `git cz`, add commit info answering prompts, and then execute `git push origin [[the branch name]]` 7. Go to [the project's repo](https://github.com/brklntmhwk/younagi.dev) and create a pull request for changes you've made - The title of pull requests must be in this format: `(): detailed descriptions here...` - Check the changelog config or dangerfile for allowed types & scopes - e.g., "feat(ui): 🆕 add a likes button" - - In your pull request, clarify the following points: - - Changes - - Checklist + - Use a template by hitting the URL like below + - `https://github.com/brklntmhwk/younagi.dev/compare/main...${BRANCH_NAME}?template=${TEMPLATE_NAME}` + - For the `TEMPLATE_NAME`, see under the ".github/PULL_REQUEST_TEMPLATE/" directory + - e.g., `...?template=01_basic.md` 8. Fix your code over the course of peer code review on an as-needed basis - Once the whole team gives you the green light, changes you've made will be merged into the main branch 9. Confirm if the merge is done without any problem and then delete the remote branch from [this page](https://github.com/brklntmhwk/younagi.dev/branches) @@ -122,4 +125,8 @@ This project adopts Issue-driven Development. 1. Set the `LOCAL_DB_PATH` var looking up the dir ".wrangler/state/v3/d1/miniflare-D1DatabaseObject/" 2. Run `bun dev --host` to start the dev server -3. Go to "http://localhost:4321/" +3. Access the localhost URL shown + +## License + +This project is licensed under the MIT License, see the [LICENSE](./LICENSE) file for more details. diff --git a/astro.config.ts b/astro.config.ts index 80dcbf4a..e2120b99 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -1,42 +1,42 @@ -import { defineConfig, passthroughImageService } from 'astro/config' -import cloudflare from '@astrojs/cloudflare' -import mdx from '@astrojs/mdx' -import sitemap from '@astrojs/sitemap' -import solidJs from '@astrojs/solid-js' -import purgecss from 'astro-purgecss' -import browserslist from 'browserslist' -import { browserslistToTargets } from 'lightningcss' -import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin' -import { h } from 'hastscript' -import remarkGfm from 'remark-gfm' -import remarkMath from 'remark-math' -import rehypeKatex from 'rehype-katex' +import cloudflare from '@astrojs/cloudflare'; +import mdx from '@astrojs/mdx'; +import sitemap from '@astrojs/sitemap'; +import solidJs from '@astrojs/solid-js'; +import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin'; +import purgecss from 'astro-purgecss'; +import { defineConfig, passthroughImageService } from 'astro/config'; +import browserslist from 'browserslist'; +import { h } from 'hastscript'; +import { browserslistToTargets } from 'lightningcss'; import rehypeAutolinkHeadings, { type Options as RehypeAutoLinkHeadingsOptions, -} from 'rehype-autolink-headings' -import rehypeSlug from 'rehype-slug' +} from 'rehype-autolink-headings'; +import rehypeKatex from 'rehype-katex'; import rehypePrettyCode, { type Options as RehypePrettyCodeOptions, -} from 'rehype-pretty-code' -import rehypeImageFigure from './src/plugins/rehype-image-figure' -import rehypePagefindIgnore from './src/plugins/rehype-pagefind-ignore' -import remarkCallout from './src/plugins/remark-callout' -import remarkAstroImageAssets from './src/plugins/remark-astro-image-assets' -import remarkFootnote from './src/plugins/remark-footnote' -import remarkLinkCard from './src/plugins/remark-link-card' -import remarkLineBreaks from './src/plugins/remark-line-breaks' +} from 'rehype-pretty-code'; +import rehypeSlug from 'rehype-slug'; +import remarkGfm from 'remark-gfm'; +import remarkMath from 'remark-math'; +import { iconNameTypes } from './src/lib/astro-integrations/icon-name-type'; +import { pagefind } from './src/lib/astro-integrations/pagefind'; +import { SITE_URL } from './src/lib/consts'; +import rehypeImageFigure from './src/plugins/rehype-image-figure'; +import rehypePagefindIgnore from './src/plugins/rehype-pagefind-ignore'; +import remarkAstroImageAssets from './src/plugins/remark-astro-image-assets'; +import remarkCallout from './src/plugins/remark-callout'; import remarkEmbed, { type RemarkEmbedOptions, -} from './src/plugins/remark-embed' +} from './src/plugins/remark-embed'; +import remarkFootnote from './src/plugins/remark-footnote'; +import remarkLineBreaks from './src/plugins/remark-line-breaks'; +import remarkLinkCard from './src/plugins/remark-link-card'; import { canvaTransformer, googleSlidesTransformer, - youTubeTransformer, oEmbedTransformer, -} from './src/plugins/transformers' -import { SITE_URL } from './src/lib/consts' -import { pagefind } from "./src/lib/astro-integrations/pagefind" -import { iconNameTypes } from "./src/lib/astro-integrations/icon-name-type" + youTubeTransformer, +} from './src/plugins/transformers'; // https://astro.build/config export default defineConfig({ @@ -59,7 +59,7 @@ export default defineConfig({ }), sitemap(), iconNameTypes(), - pagefind() + pagefind(), ], prefetch: { defaultStrategy: 'viewport', @@ -91,8 +91,8 @@ export default defineConfig({ server: { watch: { usePolling: true, - interval: 1000 - } + interval: 1000, + }, }, ssr: { external: ['node:fs', 'unfurl.js'], @@ -139,7 +139,7 @@ export default defineConfig({ { title: 'Anchor link', }, - ['#'] + ['#'], ), } satisfies RehypeAutoLinkHeadingsOptions, ], @@ -156,4 +156,4 @@ export default defineConfig({ rehypePagefindIgnore, ], }, -}) +}); diff --git a/changelog.config.cjs b/changelog.config.cjs index 46e25f95..8d8635ed 100644 --- a/changelog.config.cjs +++ b/changelog.config.cjs @@ -14,41 +14,63 @@ module.exports = { ], maxMessageLength: 72, minMessageLength: 3, - questions: ['type', 'scope', 'subject', 'body', 'breaking', 'issues', 'lerna'], - scopes: ['api', "cms", 'config', 'contents', 'db', 'deps', 'docker', 'i18n', 'none', 'ui', "utils"], + questions: [ + 'type', + 'scope', + 'subject', + 'body', + 'breaking', + 'issues', + 'lerna', + ], + scopes: [ + 'api', + 'cms', + 'config', + 'contents', + 'db', + 'deps', + 'docker', + 'i18n', + 'none', + 'overall', + 'ui', + 'utils', + ], types: { chore: { - description: "Build process or auxiliary tool changes", - emoji: "🤖", - value: "chore", + description: 'Build process or auxiliary tool changes', + emoji: '🤖', + value: 'chore', }, ci: { - description: "CI related changes", - emoji: "🎡", - value: "ci", + description: 'CI related changes', + emoji: '🎡', + value: 'ci', }, docs: { - description: "Doc or article tweaks only", - emoji: "📖", - value: "docs", + description: 'Doc or article tweaks only', + emoji: '📖', + value: 'docs', }, feat: { - description: "A new feature", - emoji: "🆕", - value: "feat", + description: 'A new feature', + emoji: '🆕', + value: 'feat', }, fix: { - description: "A bug fix", - emoji: "🐛", - value: "fix", + description: 'A bug fix', + emoji: '🐛', + value: 'fix', }, perf: { - description: "A code tweak for performance enhancement", - emoji: "⚡️", - value: "perf", + description: 'A code tweak for performance enhancement', + emoji: '⚡️', + value: 'perf', }, refactor: { - description: 'A code tweak that neither fixes a bug or adds a new feature(rename a variable etc...)', + description: + 'A code tweak that neither fixes a bug or adds a new feature(rename a variable etc...)', emoji: '✨', value: 'refactor', }, @@ -59,14 +81,14 @@ module.exports = { }, style: { description: - "Formatting tweaks(Markup, white-space, missing semi-colons etc...)", - emoji: "💄", - value: "style", + 'Formatting tweaks(Markup, white-space, missing semi-colons etc...)', + emoji: '💄', + value: 'style', }, test: { - description: "Tweaks for tests", - emoji: "✒️", - value: "test", + description: 'Tweaks for tests', + emoji: '✒️', + value: 'test', }, }, }; diff --git a/dangerfile.ts b/dangerfile.ts index f9db1629..27b8e025 100644 --- a/dangerfile.ts +++ b/dangerfile.ts @@ -1,7 +1,7 @@ -import {danger, fail, warn} from 'danger' +import { danger, fail, markdown, warn } from 'danger'; const checkPRTitle = () => { - const title = danger.github.pr.title + const title = danger.github.pr.title; // These must be consistent with those in the changelog config const typeAllowList = [ @@ -16,50 +16,65 @@ const checkPRTitle = () => { 'ci', 'perf', ]; - const scopeAllowList = ['api', "cms", 'config', 'contents', 'db', 'deps', 'docker', 'i18n', 'none', 'ui', "utils"] + const scopeAllowList = [ + 'api', + 'cms', + 'config', + 'contents', + 'db', + 'deps', + 'docker', + 'i18n', + 'none', + 'overall', + 'ui', + 'utils', + ]; const typePattern = typeAllowList.join('|'); const scopePattern = scopeAllowList.join('|'); const titleRegex = new RegExp(`^(${typePattern})\\((${scopePattern})\\): .+`); - if (!titleRegex.test(title)) { - fail( - `:x: Invalid PR title: ${title}\n` + - `Use either of the following type & scope instead.\n` + - `Allowed type list:\n` + - `${typeAllowList.join(",")}\n` + - `Allowed scope list:\n` + - `${scopeAllowList.join(",")}\n` + - `e.g., feat(ui): 🆕 add a likes button` - ) + fail(`**:x: Invalid PR title: ${title}**\n`); + markdown( + `Use either of the following type & scope instead.\n + **Allowed type list:**\n + - ${typeAllowList.join(',')}\n + **Allowed scope list:**\n + - ${scopeAllowList.join(',')}\n + e.g., feat(ui): 🆕 add a likes button\n`, + ); } -} +}; const warnLargePR = () => { - const changedFiles = danger.github.pr.changed_files - const changedLinesTotal = danger.github.pr.additions + danger.github.pr.deletions + const changedFiles = danger.github.pr.changed_files; + const changedLinesTotal = + danger.github.pr.additions + danger.github.pr.deletions; if (changedLinesTotal > 500 || changedFiles > 30) { - warn( - `:warning: PR size appears relatively large.\n` + - `Preferably, break changes into separate PRs for faster and easier code review.` - ) + warn('**:warning: PR size appears relatively large.**\n'); + markdown( + `Preferably, break changes into separate PRs for faster and easier code review.\n + - Changed files: ${changedFiles}\n + - Changed lines: ${changedLinesTotal}\n`, + ); } -} +}; const preventInconsistentDeps = () => { - const hasPackageChanges = danger.git.modified_files.includes('packge.json') - const hasLockfileChanges = danger.git.modified_files.includes("bun.lockb") + const hasPackageChanges = danger.git.modified_files.includes('packge.json'); + const hasLockfileChanges = danger.git.modified_files.includes('bun.lockb'); if (hasPackageChanges && !hasLockfileChanges) { fail( - ":x: Inconsistent deps changes detected.\n" + - "Make changes in package.json consistent with those in your lockfile." - ) + '**:x: Inconsistent deps changes detected.**\n' + + 'Make changes in package.json consistent with those in your lockfile.\n', + ); } -} +}; -checkPRTitle() -warnLargePR() -preventInconsistentDeps() +checkPRTitle(); +warnLargePR(); +preventInconsistentDeps(); diff --git a/drizzle.config.ts b/drizzle.config.ts index dab4b917..d2a250ff 100644 --- a/drizzle.config.ts +++ b/drizzle.config.ts @@ -1,22 +1,22 @@ -import type { Config } from "drizzle-kit"; +import type { Config } from 'drizzle-kit'; const { CLOUDFLARE_ACCOUNT_ID, D1_DB_ID, D1_DB_API_TOKEN, LOCAL_DB_PATH } = process.env; export default LOCAL_DB_PATH ? ({ - schema: "./src/db/schema/index.ts", - out: "./src/db/migrations", - dialect: "sqlite", + schema: './src/db/schema/index.ts', + out: './src/db/migrations', + dialect: 'sqlite', dbCredentials: { url: LOCAL_DB_PATH, }, } satisfies Config) : ({ - schema: "./src/db/schema/index.ts", - out: "./src/db/migrations", - dialect: "sqlite", - driver: "d1-http", + schema: './src/db/schema/index.ts', + out: './src/db/migrations', + dialect: 'sqlite', + driver: 'd1-http', dbCredentials: { accountId: CLOUDFLARE_ACCOUNT_ID!, databaseId: D1_DB_ID!, diff --git a/frontmatter.json b/frontmatter.json index a317b19a..b3d0edd6 100644 --- a/frontmatter.json +++ b/frontmatter.json @@ -7,25 +7,19 @@ { "title": "blog", "path": "[[workspace]]/src/content/blog", - "contentTypes": [ - "blog" - ], + "contentTypes": ["blog"], "defaultLocale": "en" }, { "title": "news", "path": "[[workspace]]/src/content/news", - "contentTypes": [ - "news" - ], + "contentTypes": ["news"], "defaultLocale": "en" }, { "title": "page", "path": "[[workspace]]/src/content/page", - "contentTypes": [ - "page" - ], + "contentTypes": ["page"], "defaultLocale": "en" } ], @@ -44,11 +38,7 @@ "frontMatter.content.draftField": { "name": "draft", "type": "choice", - "choices": [ - "draft", - "in progress", - "published" - ] + "choices": ["draft", "in progress", "published"] }, "frontMatter.taxonomy.seoTitleLength": 90, "frontMatter.taxonomy.contentTypes": [ @@ -233,11 +223,7 @@ "schema": { "title": "Categories", "type": "object", - "required": [ - "title", - "slug", - "color" - ], + "required": ["title", "slug", "color"], "properties": { "title": { "type": "string", @@ -259,11 +245,7 @@ "schema": { "title": "Tags", "type": "object", - "required": [ - "title", - "slug", - "color" - ], + "required": ["title", "slug", "color"], "properties": { "title": { "type": "string", @@ -320,11 +302,7 @@ }, "Code block with specified language": { "description": "Insert code block snippet", - "body": [ - "```[[language]] title=\"[[filename]]\"", - "", - "```" - ], + "body": ["```[[language]] title=\"[[filename]]\"", "", "```"], "fields": [ { "name": "language", @@ -360,10 +338,7 @@ }, "Callout": { "description": "Insert a callout", - "body": [ - "> [![[type]] ][[symbol]][[title]]", - "> [[content]]" - ], + "body": ["> [![[type]] ][[symbol]][[title]]", "> [[content]]"], "fields": [ { "name": "type", @@ -385,11 +360,7 @@ "name": "symbol", "title": "Symbol", "type": "choice", - "choices": [ - "+", - "-", - " " - ], + "choices": ["+", "-", " "], "single": true, "default": " " }, @@ -414,4 +385,4 @@ "frontMatter.framework.startCommand": "bun dev", "frontMatter.dashboard.openOnStart": false, "frontMatter.content.autoUpdateDate": true -} \ No newline at end of file +} diff --git a/package.json b/package.json index 32b00eeb..48127e29 100644 --- a/package.json +++ b/package.json @@ -109,9 +109,5 @@ "engines": { "bun": "^1.0.0" }, - "trustedDependencies": [ - "@biomejs/biome", - "esbuild", - "sharp" - ] + "trustedDependencies": ["@biomejs/biome", "esbuild", "sharp"] } diff --git a/src/content/page/ja/about.mdx b/src/content/page/ja/about.mdx index be7e4270..cdf81444 100644 --- a/src/content/page/ja/about.mdx +++ b/src/content/page/ja/about.mdx @@ -1,7 +1,7 @@ --- title: 運営者 type: page -modifiedAt: 2024-02-28T06:27:41.594Z +modifiedAt: 2024-08-08T00:51:50.229Z --- {/* textlint-disable ja-technical-writing/ja-no-weak-phrase */} @@ -19,7 +19,7 @@ modifiedAt: 2024-02-28T06:27:41.594Z - 自身が得た知見や情報を発信するだけでなく、現在進行形で挑戦していること、その学習過程についても取り上げる - **多言語で情報発信** - 読者層を広げるため、そして自身の語学学習の一環も兼ねて - - 多言語化には機械翻訳は使用せず、ほぼ全て手動で翻訳しています + - 多言語化には機械翻訳は使用せず、ほぼ全て手動で翻訳している - 言語の特性や各言語での読者の文化的なバックグラウンドの違い等から、意訳や全く違う表現を採用しているケースも多々ある ### 情報発信の指針 @@ -34,9 +34,10 @@ modifiedAt: 2024-02-28T06:27:41.594Z - 自分の信念や意見の正しさを主張する為にブログを書くわけではない - **刺激の強い言葉やセンシティブな話題は避ける** - 発信した内容を通して誰かを傷つけることは意図していない - - 人それぞれ基準にする物差しが違うので、意図せず傷つけてしまうことがあるかもしれません + - 人それぞれ基準にする物差しが違うので、意図せず傷つけてしまうことがあるかもしれない - **広告ゼロ** - 当サイトは**アフィリエイト広告を利用していません** + - 言ってみたかっただけ ## 運営者について diff --git a/src/lib/consts/index.ts b/src/lib/consts.ts similarity index 100% rename from src/lib/consts/index.ts rename to src/lib/consts.ts diff --git a/tsconfig.json b/tsconfig.json index 67d3e80a..77600562 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,14 +8,8 @@ "jsxImportSource": "solid-js", "baseUrl": ".", "paths": { - "@/*": [ - "./src/*" - ] + "@/*": ["./src/*"] } }, - "exclude": [ - "./dist", - "./node_modules", - "src/functions" - ] + "exclude": ["./dist", "./node_modules"] } diff --git a/worker-configuration.d.ts b/worker-configuration.d.ts index 5a412b11..5d0ba3ef 100644 --- a/worker-configuration.d.ts +++ b/worker-configuration.d.ts @@ -2,8 +2,8 @@ // by running `wrangler types` interface Env { - TURNSTILE_SECRET_KEY: string; - MY_CUSTOM_EMAIL_ADDRESS: string; - RESEND_API_KEY: string; - DB: D1Database; + TURNSTILE_SECRET_KEY: string; + MY_CUSTOM_EMAIL_ADDRESS: string; + RESEND_API_KEY: string; + DB: D1Database; }