-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[refactor] projectのマイグレーションを関数切り出し #1967
The head ref may contain hidden characters: "project\u306E\u30DE\u30A4\u30B0\u30EC\u30FC\u30B7\u30E7\u30F3\u3092\u95A2\u6570\u5207\u308A\u51FA\u3057"
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ほぼ移動だけなのですが、関数化する方法とかで2箇所考慮事項が入ってます
/** | ||
* プロジェクトファイルのフォーマットエラー | ||
* FIXME: Result型にする | ||
*/ | ||
export class ProjectFileFormatError extends Error { | ||
constructor(message: string) { | ||
super(message); | ||
this.name = "ProjectFileFormatError"; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
エラーメッセージでエラー判断してたところを、ちゃんとエラークラスを定義するようにしました。
本当はResult型にした方が良さそうだけど、このエラーを受ける側も全部変えないといけないので、簡易的にエラークラスを作ることにしました。
export const migrateProjectFileObject = async ( | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
projectData: any, | ||
DI: { | ||
fetchMoraData: (payload: { | ||
accentPhrases: AccentPhrase[]; | ||
engineId: EngineId; | ||
styleId: StyleId; | ||
}) => Promise<AccentPhrase[]>; | ||
characterInfos: CharacterInfo[]; | ||
}, | ||
) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
エンジンを叩く関数と、エンジンから帰ってきたキャラクター情報が必要だったのでDIの形として渡すようにしました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@Segu-g レビューありがとうございます!!! マージします!! 追記:ちょっとちゃんとしたコンフリクト改修が必要でした 🙇 |
コンフリクト解消したのでマージします! |
内容
プロジェクトファイルのマイグレーションをファイル切り出ししてテスト可能にしたいです。
第2弾として、projectのマイグレーションを関数切り出しました。
の続きタスクです。
関連 Issue
その他
#1965 がマージされた後に
したら変更は移動だけなことがわかるかと!