Skip to content
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

[project-sequencer-statemachine] ファイルを分けて整理 #2504

Conversation

sigprogramming
Copy link
Contributor

@sigprogramming sigprogramming commented Jan 24, 2025

内容

ファイルを分けて整理します。

StateFactoriesのみ少し変更しています。(処理の変更はここのみで、あとは移動のみ行っています)

関連 Issue

その他

@sigprogramming sigprogramming requested a review from a team as a code owner January 24, 2025 13:14
@sigprogramming sigprogramming requested review from Hiroshiba and removed request for a team January 24, 2025 13:14
Comment on lines +88 to 92
type StateFactories<T extends StateDefinition[], Input, Context> = {
[U in StateId<T>]: (
args: FactoryArgs<T, U>,
) => State<T, Input, Context> & { readonly id: U };
};
Copy link
Contributor Author

@sigprogramming sigprogramming Jan 24, 2025

Choose a reason for hiding this comment

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

型引数U extends StateId<T>は無くても良さそうだったので無くしました。
(変更はこのファイルのみです)

@voicevox-preview-pages
Copy link

voicevox-preview-pages bot commented Jan 24, 2025

🚀 プレビュー用ページを作成しました 🚀

更新時点でのコミットハッシュ:680e79d

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

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

ファイル分けすごく良いと思いました!!
ちょっとファイルを配置するディレクトリだけ相談させてください! 🙇

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

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

LGTM!!

ちょっとこちら都合なのですが、sequencerStateMachine/useSequencerStateMachine.tsuseSequencerStateMachine/index.tsに変えさせていただこうと思います 🙇

こうするとこのコンポーザブルをインポートする時に

import { useSequencerStateMachine } from "@/composables/useSequencerStateMachine"

で行けるようになって、ディレクトリが透過?されて見た目は普通の関数ファイルと一緒になるから、使い手側に便利かなと・・・!

あとファイル整理して気づいたんですが、useSequencerStateMachineから使われるstatesとかはsrc/sing/SequencerStateMachineとかに配置しても良いかもと思いました。
コンポーザブルはそのステートマシンのVue用のインターフェースを提供するだけみたいな!

一旦今のままでも大丈夫ですし、そちらに変更もありだと思います!
コメントお待ちして、今のままでも大丈夫そうならマージさせていただこうと思います!

@sigprogramming
Copy link
Contributor Author

あとファイル整理して気づいたんですが、useSequencerStateMachineから使われるstatesとかはsrc/sing/SequencerStateMachineとかに配置しても良いかもと思いました。
コンポーザブルはそのステートマシンのVue用のインターフェースを提供するだけみたいな!

statesを使用してStateMachineを作成する部分もstatesと同じところにあった方が良いかなと思ったので、

src/composables/useSequencerStateMachine.ts
src/sing/SequencerStateMachine/common.ts
src/sing/SequencerStateMachine/states/
src/sing/SequencerStateMachine/index.ts

としました。

@Hiroshiba
Copy link
Member

良い形だと思います!!

ただステートマシンはsrc/singstoreに依存していて、物によってはstoresrc/singに依存している形になっているので、どうしても複雑度は上がってそうです・・・!
ただぶっちゃけやっぱりこれは今のディレクトリ構造だとどうしようもない!!
ステートマシンもコンポーザブルもコンポーネントも、全部一つのディレクトリの下にあった方が実装しやすそう!!

機会を見てディレクトリ構造を変更して行きたいと思いました!!

@Hiroshiba
Copy link
Member

色々ありがとうございました、マージします!

@Hiroshiba Hiroshiba merged commit 8c26457 into VOICEVOX:project-sequencer-statemachine Jan 27, 2025
10 checks passed
@sigprogramming sigprogramming deleted the separate_files branch January 28, 2025 13:14
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