nodejs / nodejs/node

--watch should monitor replaced files

オープン
#51,621 コメント 12 件 リアクション 16 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature request watch-mode
主要言語
JavaScript
スター
122k
フォーク
37.4k
平均マージ
4日 3時間
マージ済み PR(30日)
272

説明

What is the problem this feature will solve?

Currently, --watch watches an inode and not necessarily what the user might consider a "file". This can cause confusion on systems that write to disk by deleting the old file and then creating a new one.

For example, when using Docker Compose's watch mode, the watched file is first deleted. When a new file is created Node currently fails to restart on file changes, as node is still watching the inode of the deleted file, and doesn't react to the new file being created.

What is the feature you are proposing to solve the problem?

While this behavior makes sense for the lower-level and more "raw" fs.watch(), perhaps the more general --watch behavior can be expanded to be smarter about detecting replaced files. Alternatively, a new flag can be introduced with this behavior.

What alternatives have you considered?

Other alternatives require using one of the different file watcher libs. That seems like a step down from the otherwise awesome native watch feature.

Docker Compose Issue: [BUG] Compose Watch With “node –watch” Only Reloads First Time
Docker Issue: node --watch doesn't work well within a container

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Node.js の --watch 実装と、issue に記載されている fs.watch の動作から始めます。Docker Compose スタイルの削除と再作成のシーケンスを再現し、その後、既存の動作を拡張すべきか、新しい flag を通じて公開すべきかを判断します。監視対象のファイルが置き換えられたときに --watch が確実に反応し、置き換えケースのテストカバレッジがあることを完了条件とします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, nodejs
領域
tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
説明が足りない
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。