Skip to content

refactor: TypeScript 6移行にともなうリファクタ/事前生成スクリプトをTypeScript化#102

Merged
kyonenya merged 26 commits into
mainfrom
refactor/ts-scripts
May 7, 2026
Merged

refactor: TypeScript 6移行にともなうリファクタ/事前生成スクリプトをTypeScript化#102
kyonenya merged 26 commits into
mainfrom
refactor/ts-scripts

Conversation

@kyonenya

@kyonenya kyonenya commented May 6, 2026

Copy link
Copy Markdown
Owner

No description provided.

@kyonenya
kyonenya marked this pull request as ready for review May 6, 2026 23:05
@kyonenya

kyonenya commented May 6, 2026

Copy link
Copy Markdown
Owner Author

@codex[agent] review

レビューは当該箇所一件一件に対してコメントを加えて

Co-authored-by: kyonenya <62150154+kyonenya@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78f9fa793e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread index.mjs Outdated
Comment on lines +42 to +49
(async () => {
await generatePosts();
await generateBibliography();
const posts = JSON.parse(
fs.readFileSync(path.resolve(__dirname, 'posts.json'), 'utf8'),
);
generateSitemap(posts);
generateStaticHTML();
})().catch((e) => console.error(e));
const posts = await generatePostsJson();
await Promise.all([
generateWorksJson(),
generateSitemap(posts),
generateStaticHtml(posts),
]);
})();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge [must] 起動時の生成処理失敗を必ず捕捉する

この非同期IIFEに .catch(...) が無いため、generatePostsJson / generateSitemap / generateStaticHtml のいずれかが reject すると未処理 Promise rejection となり、Node の既定挙動(--unhandled-rejections=throw)ではプロセス終了に繋がります。listen() 後にこの処理を実行しているため、MarkdownやJSONの一時的な不整合があるだけで開発サーバー自体が落ちる回帰になります。旧実装のように起動処理全体を捕捉してログ化するハンドリングを戻すべきです。

Useful? React with 👍 / 👎.

@Codex

Codex AI commented May 6, 2026

Copy link
Copy Markdown

@codex[agent] review

レビューは当該箇所一件一件に対してコメントを加えて

以下、箇所ごとにコメントします([must]/[recommend]/[nits])。

  • [must] /home/runner/work/kyonenya.github.io/kyonenya.github.io/index.mjs:17 process.env.WEB_APP_PORT は常に文字列なので、server.listen('3100') が「ポート」ではなく「UNIXソケットパス」扱いになります。数値化+フォールバックを入れて修正しました(commit 235169d)。
  • [recommend] /home/runner/work/kyonenya.github.io/kyonenya.github.io/src/scripts/worksJson.ts:4 citeproc@ts-ignore は局所的にはOKですが、ベストプラクティスとしては declare module 'citeproc'; のような型スタブ(例: src/types/citeproc.d.ts)で吸収すると、lint抑制を減らせます。
  • [recommend] /home/runner/work/kyonenya.github.io/kyonenya.github.io/src/scripts/sitemap.ts:14 getLatestModifiedAt() が毎回 sort() していて、tagHistory() からも繰り返し呼ばれるので計算量が増えます。reduce で最大日時を取る形(またはタグごとに1パスでmax集計)にすると素直です。
  • [nits] /home/runner/work/kyonenya.github.io/kyonenya.github.io/src/scripts/postsJson.ts:34 コールバック引数名 pathimport path from 'node:path' と同名で読み手が一瞬迷うので、filePath 等にすると読みやすいです。
  • [recommend] /home/runner/work/kyonenya.github.io/kyonenya.github.io/src/scripts/postsJson.ts:70 初回セットアップ等で posts.json が無い場合に readFile が落ちるので、ENOENT のときは [] 扱いにするのが堅いです(既存運用で必ず存在するなら現状でもOK)。

学習リソース:

  • Node.js net.Server.listen()(文字列引数はソケットパス)
  • TypeScript: ambient module declarations(declare module
  • import.meta.urlfileURLToPath のESMパターン

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@kyonenya kyonenya changed the title refactor: 事前生成スクリプトをTypeScript化 refactor: 事前生成スクリプトをTypeScript化/ほかリファクタ May 7, 2026
@kyonenya kyonenya changed the title refactor: 事前生成スクリプトをTypeScript化/ほかリファクタ refactor: TypeScript 6移行にともなうリファクタ/事前生成スクリプトをTypeScript化 May 7, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

Repository owner deleted a comment from Codex AI May 7, 2026
@kyonenya

kyonenya commented May 7, 2026

Copy link
Copy Markdown
Owner Author

@codex[agent] review

@Codex

Codex AI commented May 7, 2026

Copy link
Copy Markdown

@codex[agent] review

レビュー観点を指定してほしいです(例:TS/ESM移行、webpack設定、scriptsのI/O、生成物の差分、Code App互換など)。どのファイル(またはPRのどの差分)にインラインコメントで入れるのが希望か、対象を教えてください。

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@kyonenya
kyonenya merged commit e8712fd into main May 7, 2026
2 checks passed
@kyonenya
kyonenya deleted the refactor/ts-scripts branch May 7, 2026 01:41

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6375994d9a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread index.mjs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants