Conversation
|
🚀 Deployed on https://deploy-preview-1777--utelecon.netlify.app |
There was a problem hiding this comment.
Pull request overview
This PR migrates the codebase to use Astro's Content Collections feature with Zod schema validation, replacing the deprecated Astro.glob() API. This change provides type safety, runtime validation, and better data management for various content types including notices, events, navigation, good practices, and emergency notifications.
Key changes:
- Introduction of a centralized
src/content.config.tswith Zod schemas for all content collections - Migration from
Astro.glob()and direct YAML imports togetCollection()andgetEntry()APIs - Moved utility functions from
src/data/utils/notices.tstosrc/lib/util.tsfor better organization - Enhanced validation with warnings for notices missing bilingual titles
Reviewed changes
Copilot reviewed 14 out of 16 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
src/content.config.ts |
New centralized configuration defining all content collections with Zod schemas for emergencies, events, notices, navigation, pages, and interviews |
src/pages/good-practice/index.mdx |
Updated to use Content Collections API instead of the deleted _Loader.astro component |
src/pages/good-practice/_Loader.astro |
Deleted file - functionality moved inline to index.mdx |
src/lib/util.ts |
Added date formatting utility functions moved from the deleted notices utility file |
src/layouts/Header/Navigation.astro |
Changed from direct YAML import to getEntry() API for navigation data |
src/layouts/Footer/Navigation.astro |
Changed from direct YAML import to getEntry() API for navigation data |
src/layouts/Emergency.astro |
Updated to use Content Collections with getCollection() and render() APIs |
src/emergencies/sample.md |
Added dummy emergency entry to avoid empty collection warnings |
src/data/utils/notices.ts |
Deleted - utilities moved to src/lib/util.ts and ID generation moved to content.config.ts |
src/data/schemas/notice.d.ts |
Deleted TypeScript type definitions, replaced by Zod schema inference |
src/data/schemas/nav.d.ts |
Deleted TypeScript type definitions, replaced by Zod schema inference |
src/components/pages/rss.ts |
Updated to use getEntry() API for retrieving notices |
src/components/pages/Sitemap.astro |
Updated to use getCollection() and getEntry() APIs for pages and navigation |
src/components/pages/Notice.astro |
Updated to use getEntry() API and import utilities from new location |
src/components/pages/GoodPractice.tsx |
Added missing filter options (TeX, Mathematica, UTAS, etc.) and exported constants for use in content.config.ts |
src/components/pages/Events.astro |
Updated to use getCollection() API instead of Astro.glob() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .transform( | ||
| (v) => new RegExp(v) | ||
| ) | ||
| }) |
There was a problem hiding this comment.
Missing space after closing brace in the object literal. This is inconsistent with the formatting used elsewhere in the file.
| (v) => new RegExp(v) | ||
| ) | ||
| }) | ||
| }) |
There was a problem hiding this comment.
Missing space after closing brace in the object literal. This is inconsistent with the formatting used elsewhere in the file.
| }) | |
| } ) |
| ) | ||
| }) | ||
| ) | ||
| }) |
There was a problem hiding this comment.
Missing space after closing brace in the object literal. This is inconsistent with the formatting used elsewhere in the file.
| return { ...notice, id }; | ||
| }).toReversed(); | ||
| }) | ||
| }) |
There was a problem hiding this comment.
Missing space after closing brace in the object literal. This is inconsistent with the formatting used elsewhere in the file.
| tools: z.string() | ||
| }) | ||
| }) | ||
| }) |
There was a problem hiding this comment.
Missing space after closing brace in the object literal. This is inconsistent with the formatting used elsewhere in the file.
| }) | |
| } ) |
arx-ein
left a comment
There was a problem hiding this comment.
レビューしました。全体として基本的に問題なく想定通りに動作しており、diffを確認しても非自明な変更はありませんでした。
軽微な変更をいくつかコミットしておきました。以下に変更点を各コミット順に示します。
- コーディングスタイルの修正。文末のセミコロン追加やカッコ周りのスペースなど、Copilotに文句を出された箇所のうち適切だろうと思われるところを適用しました。
Sitemap.astroから不必要となったnullチェック (if (!url) continue;) と非nullアサーション!.を除去しました。- 緊急のお知らせのダミーエントリに、その旨が分かるようにコメントを追加しておきました。
- 1つ目のコミットで入れ忘れていたセミコロンを回収しました。
概要
Astro.glob()を使っている箇所の改修も兼ねています変更対象
Astro.glob()やimport foo from "foo.yml";などの方法で取得されていたものです(Markdown / MDX、YAML)変更対象の一覧・留意点
src/emergencies/sample.md)を追加しています 805b228idを付与する処理をZodの.transform()内に移した結果、src/data/utils/notice.tsにはユーティリティ関数のみが残ったため、削除してsrc/lib/util.tsに移動しました e0cf9desrc/pages/good-practice/_Loader.astroを消してsrc/pages/good-practice/index.tsxにまとめました今後の見通し
/events)は、現在は手書きだが、お知らせページと同様にYAMLから生成できそう