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

Make CartonFrontend dev's file-watching opt-in to easily use it as a standalone CLI #433

Merged
merged 2 commits into from
May 17, 2024

Conversation

omochi
Copy link
Contributor

@omochi omochi commented May 15, 2024

課題

現状、CartonFrontend devコマンドを単体で使う事ができません。
devコマンドのwatch機能が、devプラグインから呼び出されることに依存しているからです。

具体的には、devコマンドが変更検知をしてリビルドをする際には、
devプラグインが用意した名前付きパイプを使って依頼するからです。

提案

しかし、 devコマンドが単体で使えると便利です。
devコマンドの サーバ機能の動作だけを単体テストしやすくなるからです。

そこで、devコマンドにwatch対象を指定しなかった場合は、
watch機能を無効化して動作するようにします。

将来の目標

testコマンドが test.js~/.carton から配送しようとして失敗しているバグがあります。
この変更を活用して、これを自動テストするつもりです。

実装

b48eb77

watchするときにその対象がターミナルに出力されるが、
その処理をdevコマンドから Server に移す。
実際に watch処理をやっているのは Serverであるため。

こうすると、他の箇所からも Server を利用してwatchする場合にログが出て便利。
なお、現状は他の利用箇所はない。

93dcdf5

パイプを受け取るコマンド引数をオプショナルにします。
ただし、watch対象ディレクトリが指定されている場合は省略を禁じます。

@omochi omochi force-pushed the optin-watch-frontend-devserver branch from c74faf8 to b48eb77 Compare May 15, 2024 15:37
@omochi omochi changed the title CartonFrontend dev の watch 機能をオプトインにして、コマンド単体で利用可能にする [enhancement] CartonFrontend dev の watch 機能をオプトインにして、コマンド単体で利用可能にする May 15, 2024
@omochi omochi marked this pull request as ready for review May 15, 2024 16:03
@omochi omochi changed the title [enhancement] CartonFrontend dev の watch 機能をオプトインにして、コマンド単体で利用可能にする CartonFrontend dev の watch 機能をオプトインにして、コマンド単体で利用可能にする May 15, 2024
@kateinoigakukun kateinoigakukun added the enhancement New feature or request label May 17, 2024
@kateinoigakukun kateinoigakukun merged commit 9a0675f into swiftwasm:main May 17, 2024
2 of 4 checks passed
@omochi omochi deleted the optin-watch-frontend-devserver branch May 17, 2024 03:46
@kateinoigakukun kateinoigakukun changed the title CartonFrontend dev の watch 機能をオプトインにして、コマンド単体で利用可能にする Make CartonFrontend dev's file-watching opt-in to easily use it as a standalone CLI May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants