refactor: プロジェクトファイル関連の型と関数をdomainディレクトリの外に出す - #2680
Conversation
|
🚀 プレビュー用ページを作成しました 🚀 更新時点でのコミットハッシュ: |
There was a problem hiding this comment.
Pull Request Overview
This PR separates project file (persistence) types and functions from the domain layer into a dedicated infrastructure layer and keeps the domain layer free of persistence concerns. Key changes:
- Moved domain-level types to
src/domain/project/type.tsand updated schemas insrc/domain/project/schema.ts - Added infrastructure files under
src/infrastructures/projectFile/for schema, types, migration, and validation - Updated imports across store modules, sing logic, and components to use the new domain and infrastructure types
Reviewed Changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/domain/project/type.ts | Introduce Note, Singer, Tempo, TimeSignature, Track, and related types |
| src/infrastructures/projectFile/schema.ts | Define projectFileSchema and serializableTrackSchema |
| src/infrastructures/projectFile/migration.ts | Refactor migration to use projectFileSchema and ProjectFileFormatError |
Various src/... import updates |
Switched imports from @/store/type/@/domain/project to new domain/infrastructure types |
| throw new Error("Track not found."); | ||
| } | ||
| const rawTrack = toRaw(selectedTrack); | ||
| // TODO: トラックの変換処理を関数化する |
There was a problem hiding this comment.
The track conversion logic is duplicated in multiple places and marked with TODO. Extract this into a shared utility function (e.g. convertDomainTrackToSerializable) to reduce repetition and improve maintainability.
There was a problem hiding this comment.
これは別PRで行います。
sevenc-nanashi
left a comment
There was a problem hiding this comment.
typosが通ればあとは大丈夫だとおもいます。
chore: typos:ignore-next-lineで無視できるようにする
|
typosのPRありがとうございます!マージしました! |
There was a problem hiding this comment.
LGTM!!
設計に関してはゴールがわからないのですが、ソングメンバーと僕と @sevenc-nanashi さんでなんか良い落とし所を探っていきたいですね・・・!
1点コメントしてますが、もし同感であれば変更いただければという感じです!
そのままマージしても、変更したあとにマージボタン押していただいても、どちらでも・・・!
📝 メモ
↑のissueではprojectFileをsrc/domainにまとめる案を書いてましたが、確かにインフラ層においたほうが良さそう・・・かも!!
でもたぶん、たぶんだけど、DDDアーキテクチャはクリエイター向けソフトウェアに合わないので、VSCodeのようにbase/platform/editor/workbenchに分けても良さそう。
そのときはどちらにせよbaseに移動になりそう!
|
レビューありがとうございます!マージします! |
内容
現在のmainブランチでは、プロジェクトファイル(永続化)に関わる型と関数が
domainディレクトリ内で定義されていますが、関心の分離が守られていない(ドメインレイヤー内に永続化に関する知識が入っている)という問題があります。プロジェクトファイル関連の型と関数を
domainディレクトリの外に出し、それらがドメインに依存するようにして、この問題を解決します。具体的には、以下を行います。
src/store/type.tsで定義されていた型)はsrc/domain/project/type.tsにsrc/infrastructures/projectFile/schema.tsにprojectSchemaからprojectFileSchemaに変更src/infrastructures/projectFile/type.tsにsrc/infrastructures/projectFile/migration.tsにsrc/infrastructures/projectFile/validation.tsにSerializableTrackとして定義新規追加の判定になっているファイルがいくつかありますが、追加したのは
SerializableTrackのみで、それ以外は移動です。関連 Issue
その他
typoのマイグレーションを行っているところでtypoのエラーが出ています…
(たぶんファイルを変更したから出たんだと思います)