approvers / OreOreBot2

限界開発鯖を代表する BOT はらちょ を TypeScript+discord.js で作り直し。 オレオレ BOT です。別に詐欺とかはしません。
https://haracho.approvers.dev
MIT License
13 stars 2 forks source link

refactor: 自作 DI コンテナドライバの追加 #1271

Closed MikuroXina closed 9 months ago

MikuroXina commented 9 months ago

close #1270.

Type of Change:

リファクタリング

Details of implementation (実施内容)

新しく src/driver/ フォルダを追加しました. これはドライバ層という名前を付けたモジュールに相当するもので, runner, service, model などのアプリケーションの下位層がさらに依存する土台として用意しました.

これに DepRegistry クラスと型情報追加用の Dep0, ヘルパーの型エイリアスである GetDep0 などを追加して下位層を全体的にリファクタリングしました. また, 併せてテストコードも動作するように修正しました.

これによりエントリポイント側の注入処理に必要な引数が少なくなり, コードの見通しがかなり良くなったと思います.

Additional Information (追加情報)

モジュールの追加に伴い開発者向けドキュメントの更新が必要になるかもしれません. 要調査です.

cloudflare-workers-and-pages[bot] commented 9 months ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7d6e247
Status: ✅  Deploy successful!
Preview URL: https://6984f127.oreorebot2.pages.dev
Branch Preview URL: https://feat-1270.oreorebot2.pages.dev

View logs

codecov[bot] commented 9 months ago

Codecov Report

Attention: 172 lines in your changes are missing coverage. Please review.

:exclamation: No coverage uploaded for pull request base (main@7acae13). Click here to learn what that means.

:exclamation: Current head 26223cc differs from pull request most recent head 7d6e247. Consider uploading reports for the commit 7d6e247 to get more accurate results

Files Patch % Lines
packages/bot/src/server/index.ts 0.00% 58 Missing :warning:
packages/bot/src/service/command.ts 0.00% 39 Missing and 1 partial :warning:
packages/bot/src/driver/dep-registry.ts 68.88% 8 Missing and 6 partials :warning:
packages/bot/src/service/command/kaere.ts 71.79% 6 Missing and 5 partials :warning:
packages/bot/src/adaptor/discord/member-stats.ts 0.00% 8 Missing :warning:
packages/bot/src/service/command/help.ts 0.00% 4 Missing and 1 partial :warning:
packages/bot/src/service/command/typo-record.ts 85.18% 0 Missing and 4 partials :warning:
packages/bot/src/service/index.ts 0.00% 3 Missing and 1 partial :warning:
packages/bot/src/model/random-generator.ts 95.16% 1 Missing and 2 partials :warning:
packages/bot/src/service/command/judging.ts 57.14% 1 Missing and 2 partials :warning:
... and 17 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1271 +/- ## ======================================= Coverage ? 58.94% ======================================= Files ? 112 Lines ? 7325 Branches ? 530 ======================================= Hits ? 4318 Misses ? 2478 Partials ? 529 ``` | [Flag](https://app.codecov.io/gh/approvers/OreOreBot2/pull/1271/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=approvers) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/approvers/OreOreBot2/pull/1271/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=approvers) | `58.94% <72.48%> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=approvers#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.