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

build: パッケージ依存管理部分を melos -> pub workspaces へ移行 #371

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tatsutakein
Copy link
Member

@tatsutakein tatsutakein commented Jan 13, 2025

概要

パッケージ依存管理部分を melos -> pub workspaces へ移行します。
また、すぐに安定版になると見込み pub workspaces と親和性が高くなる melos 7.0.0-dev.3 へも併せて移行します。

やったこと

  • theme_extensions_builder 4.0.0-> 3.1.0 にダウングレード
    • 間接的に依存している source_gen のメジャーバージョンが異なっていたため
  • パッケージ依存管理部分を melos -> pub workspaces へ移行
  • melos ^6.3.0 -> ^7.0.0-dev.3 にバージョンアップ

レビュー観点

  • コードに違和感がないか
  • 変更内容に過不足がないか

レビューレベル

  • Lv1: ぱっとみて違和感がないかチェックして Approve する
  • Lv2: 仕様レベルまで理解して、仕様通りに動くかある程度検証して Approve する
  • Lv3: 実際に環境で動作確認したうえで Approve する

レビュー優先度

  • すぐに見てもらいたい ( hotfix など ) 🚀
  • 今日中に見てもらいたい 🚗
  • 今日〜明日中で見てもらいたい 🚶
  • 数日以内で見てもらいたい 🐢

画像 / 動画

  • 見た目に関する変更がないため省略します。

確認したこと

  • Android, iOS 向けの apps/app ビルドが実行できること
  • Web, MacOS 向けの apps/catalog ビルドが実行できること

動作確認手順

  1. 以下のコマンドを実行して melos 6 系までで生成される pubspec_overrides.yaml を削除
find . -name "pubspec_overrides.yaml" -type f -delete
  1. 以下のコマンドを実行して melos 7 系の cli を activate
dart pub global activate melos 7.0.0-dev.3 
  1. 以下のコマンドを実行して melos bootstrap を実行
melos bs
  1. 以下のビルドができることの確認
  • Android, iOS 向けの apps/app ビルド
  • Web, MacOS 向けの apps/catalog ビルド

備考

以下を参考に実装しています。

@github-actions github-actions bot added @apps/app Application development @apps/catalog Catalog development @packages/cores/core packages cores core package @packages/cores/data packages cores data package @packages/cores/designsystem packages cores designsystem package @packages/features/debug_mode packages features debug_mode package @packages/samples/github_repository packages samples github_repository package @packages/features/setting packages features setting package @packages/features/webview packages features webview package @samples/github_app samples github_app package @apps/website apps website package @packages/features/maintain packages features maintain package @packages/features/force_update packages features force_update package @packages/cores/model packages cores model package @packages/cores/ui packages cores ui package labels Jan 13, 2025
Copy link

github-actions bot commented Jan 13, 2025

Visit the preview URL for this PR (updated for commit f6ec41f):

https://flutter-mobile-project-template-catalog--pr371-feature-8yzuc9lv.web.app

(expires Fri, 24 Jan 2025 12:14:52 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 9ea56735a63d07a7cfe62eb204b0528284c37c23

Comment on lines +13 to +20
theme_extensions_builder_annotation: ^3.1.0

dev_dependencies:
build_runner: ^2.4.14
flutter_gen_runner: ^5.8.0
flutter_test:
sdk: flutter
theme_extensions_builder: ^4.0.0
theme_extensions_builder: ^3.1.0
Copy link
Member Author

Choose a reason for hiding this comment

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

memo-badge

間接的に依存している source_gen のメジャーバージョンが異なってしまうためダウングレードします。

-> flutter pub get                     
Resolving dependencies... 
Because cores_designsystem depends on theme_extensions_builder ^4.0.0 which depends on source_gen ^2.0.0, source_gen ^2.0.0 is required.
And because widgetbook_generator 3.9.1 depends on source_gen ^1.1.0, widgetbook_generator 3.9.1 is forbidden.
Because no versions of widgetbook_generator match >3.9.1 <4.0.0 and catalog depends on widgetbook_generator ^3.9.1, widgetbook_generator 3.9.1 is required.
Thus, version solving failed.
Failed to update packages.

dev_dependencies:
mason_cli: ^0.1.0-dev.55
melos: ^6.3.0
path: ^1.9.1
yaml: ^3.1.3
yaml_edit: ^2.2.2

dependency_overrides:
file: ^7.0.0
Copy link
Member Author

Choose a reason for hiding this comment

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

memo-badge

yumemi_lints と melos で競合していたため。

-> flutter pub get
Resolving dependencies... 
Because flutter_app depends on yumemi_lints ^2.2.0 and no versions of yumemi_lints match >2.2.0 <3.0.0, yumemi_lints 2.2.0 is required.
And because yumemi_lints 2.2.0 depends on file ^6.1.4 and melos 7.0.0-dev.3 depends on file ^7.0.0, melos 7.0.0-dev.3 is forbidden.
So, because no versions of melos match >7.0.0-dev.3 <8.0.0 and template_workspace depends on melos ^7.0.0-dev.3, version solving failed.
Failed to update packages.


dependency_overrides:
file: ^7.0.0
path: ^1.9.1
Copy link
Member Author

Choose a reason for hiding this comment

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

memo-badge

パッチバージョンのため問題なさそうだと思っています。

Comment on lines +3 to +4
/.flutter-plugins
/.flutter-plugins-dependencies
Copy link
Member Author

@tatsutakein tatsutakein Jan 13, 2025

Choose a reason for hiding this comment

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

memo-badge

melos bs 実行時に、実態として flutter pub get が実行されてファイルが生成されるため gitignore に追加します。

❯ melos bs
melos bootstrap
  └> /Users/xxxxx/flutter-mobile-project-template

Updating common dependencies in workspace packages...
  > SUCCESS

Running "/Users/xxxxx/flutter-mobile-project-template/.fvm/flutter_sdk/bin/flutter pub get" in workspace...
[template_workspace]: Resolving dependencies...
[template_workspace]: Downloading packages...
[template_workspace]:   _fe_analyzer_shared 76.0.0 (78.0.0 available)
[template_workspace]:   analyzer 6.11.0 (7.1.0 available)
[template_workspace]:   analyzer_plugin 0.11.3 (0.12.0 available)
[template_workspace]:   archive 3.6.1 (4.0.2 available)
[template_workspace]:   async 2.11.0 (2.12.0 available)
[template_workspace]:   boolean_selector 2.1.1 (2.1.2 available)
[template_workspace]:   characters 1.3.0 (1.4.0 available)
[template_workspace]:   clock 1.1.1 (1.1.2 available)
[template_workspace]:   collection 1.19.0 (1.19.1 available)
[template_workspace]:   custom_lint 0.7.0 (0.7.1 available)
[template_workspace]:   custom_lint_builder 0.7.0 (0.7.1 available)
[template_workspace]:   custom_lint_core 0.7.0 (0.7.1 available)
[template_workspace]:   custom_lint_visitor 1.0.0+6.11.0 (1.0.0+7.1.0 available)
[template_workspace]:   dart_style 2.3.7 (3.0.1 available)
[template_workspace]:   fake_async 1.3.1 (1.3.2 available)
[template_workspace]: ! file 7.0.1 (overridden)
[template_workspace]:   freezed 2.5.7 (2.5.8 available)
[template_workspace]:   image 4.3.0 (4.5.2 available)
[template_workspace]:   intl 0.19.0 (0.20.1 available)
[template_workspace]:   json_serializable 6.9.0 (6.9.2 available)
[template_workspace]:   leak_tracker 10.0.7 (10.0.8 available)
[template_workspace]:   leak_tracker_flutter_testing 3.0.8 (3.0.9 available)
[template_workspace]:   matcher 0.12.16+1 (0.12.17 available)
[template_workspace]:   material_color_utilities 0.11.1 (0.12.0 available)
[template_workspace]:   meta 1.15.0 (1.16.0 available)
[template_workspace]: ! path 1.9.1 (overridden)
[template_workspace]:   petitparser 6.0.2 (6.1.0 available)
[template_workspace]:   riverpod_analyzer_utils 0.5.8 (0.5.9 available)
[template_workspace]:   riverpod_generator 2.6.3 (2.6.4 available)
[template_workspace]:   riverpod_lint 2.6.3 (2.6.4 available)
[template_workspace]:   source_gen 1.5.0 (2.0.0 available)
[template_workspace]:   source_span 1.10.0 (1.10.1 available)
[template_workspace]:   stack_trace 1.12.0 (1.12.1 available)
[template_workspace]:   stream_channel 2.1.2 (2.1.4 available)
[template_workspace]:   string_scanner 1.3.0 (1.4.1 available)
[template_workspace]:   term_glyph 1.2.1 (1.2.2 available)
[template_workspace]:   test 1.25.8 (1.25.14 available)
[template_workspace]:   test_api 0.7.3 (0.7.4 available)
[template_workspace]:   test_core 0.6.5 (0.6.8 available)
[template_workspace]:   theme_extensions_builder 3.1.0 (4.0.1 available)
[template_workspace]:   theme_extensions_builder_annotation 3.1.0 (4.0.1 available)
[template_workspace]:   vm_service 14.3.0 (15.0.0 available)
[template_workspace]: Got dependencies!
[template_workspace]: 40 packages have newer versions incompatible with dependency constraints.
[template_workspace]: Try `flutter pub outdated` for more information.
  > SUCCESS

 -> 15 packages bootstrapped

Comment on lines -13 to -15
# Melos related
/pubspec_overrides.yaml

Copy link
Member Author

Choose a reason for hiding this comment

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

memo-badge

pubspec_overrides.yaml ファイルは生成されなくなるため gitignore からも削除。

Comment on lines +37 to +45
melos:
sdkPath: .fvm/flutter_sdk

ide:
intellij:
# Disabling IntelliJ's automatic configuration.
# This is to support different build configurations for environments.
enabled: false

Copy link
Member Author

@tatsutakein tatsutakein Jan 13, 2025

Choose a reason for hiding this comment

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

memo-badge

マイグレーションガイドに則り melos.yaml の内容をルートの pubspec.yaml に移動しています。

https://github.com/invertase/melos?tab=readme-ov-file#migrate-to-melos-7xx

以下の項目は移さずにいます。

  • name
  • packages

image

Copy link
Member Author

Choose a reason for hiding this comment

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

memo-badge

この PR の本質ではない部分で申し訳ないですが、ビルド検証時に生成されたためコミットしています 🙏

@tatsutakein tatsutakein marked this pull request as ready for review January 13, 2025 11:58
@yumemi-team-review-requester yumemi-team-review-requester bot requested review from a team and blendthink and removed request for a team January 13, 2025 11:58
Copy link

Ready for review 🚀

Comment on lines -46 to -48

# Melos related
/pubspec_overrides.yaml
Copy link
Member Author

Choose a reason for hiding this comment

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

memo-badge

c0697a9 の際に対応漏れしていた部分を追加でコミットしています。

@blendthink
Copy link
Member

@tatsutakein
すみません、、他のプルリクエストから先にマージしてしまってコンフリクトが発生してしまったので、ご対応お願いいたします 🙏

ただ、もうコンフリクト発生してしまったので #365 までマージしてからご対応していただけますでしょうか 🙇 🙇 🙇

@github-actions github-actions bot added the @packages/utils/pagination packages utils pagination package label Jan 17, 2025
@tatsutakein tatsutakein force-pushed the feature/GH-362 branch 2 times, most recently from 3336b8a to d663bb7 Compare January 17, 2025 12:02
Copy link
Member Author

@tatsutakein tatsutakein left a comment

Choose a reason for hiding this comment

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

@blendthink
f6ec41f にてコンフリクト解消いたしました!
お手数ですが、再度ご確認いただけますでしょうか 🙏

実態は 6 files です。

Comment on lines 46 to 49

# Ignore non-CI golden files and failures
test/**/goldens/**/*.*
test/**/failures/**/*.*
Copy link
Member Author

Choose a reason for hiding this comment

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

memo-badge

コンフリクト解消

image

Comment on lines 10 to 13
resolution: workspace

dependencies:
alchemist: ^0.11.0
Copy link
Member Author

Choose a reason for hiding this comment

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

memo-badge

コンフリクト解消

image

Comment on lines 26 to 27
utils_pagination:
path: ../../utils/pagination
Copy link
Member Author

Choose a reason for hiding this comment

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

memo-badge

コンフリクト解消

image

Comment on lines 9 to 10

resolution: workspace
Copy link
Member Author

Choose a reason for hiding this comment

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

memo-badge

コンフリクト解消

image

Copy link
Member Author

Choose a reason for hiding this comment

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

memo-badge

melos.yaml も含めたコンフリクト解消

Copy link
Member

@blendthink blendthink left a comment

Choose a reason for hiding this comment

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

@tatsutakein
ask-badge

手順通りに確認したところ、いくつか差分が発生してしまっているため、ご確認お願いできますでしょうか 🙏

image

@blendthink blendthink assigned blendthink and unassigned tatsutakein Feb 11, 2025
@blendthink
Copy link
Member

@blendthink が引き継ぐことになったためアサイン更新しました 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@apps/app Application development @apps/catalog Catalog development @apps/website apps website package @packages/cores/core packages cores core package @packages/cores/data packages cores data package @packages/cores/designsystem packages cores designsystem package @packages/cores/model packages cores model package @packages/cores/ui packages cores ui package @packages/features/debug_mode packages features debug_mode package @packages/features/force_update packages features force_update package @packages/features/maintain packages features maintain package @packages/features/setting packages features setting package @packages/features/webview packages features webview package @packages/samples/github_repository packages samples github_repository package @packages/utils/pagination packages utils pagination package @samples/github_app samples github_app package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Pub Workspace を使用する
2 participants