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

Replace fswatch with spatie/file-system-watcher (#1) #16

Draft
wants to merge 1 commit into
base: 1.x
Choose a base branch
from

Conversation

herpaderpaldent
Copy link

@herpaderpaldent herpaderpaldent commented Nov 1, 2022

DRAFT: Replace fswatch

What do you think about this?

How about replacing fswatch with spatie/file-system-watcher? I know from discord that this has been a topic for quite some time. I'd be more then happy to outline the changes and challenges and functionality but before i do so, i'd like to gather some feedback.

Description (made by whatthediff.ai)

  • Update PHP version requirement to 8.1
  • Remove ReactPHP dependencies and replace with Symfony Process component
  • Replace fswatch dependency with spatie/file-system-watcher package (which uses inotify)
  • Add Termwind for pretty output when watching files, instead of using the default Pest console output which is not very readable on a terminal that supports ANSI colors

Motivation

if you search through the discourse you'll see many problems caused by fswatch f.e. it's not available on package managers for Windows. On Linux Systems the watcher plugin doesn't run at all even with fswatch installed. I was under the impression the move away from fswatch was on the bucket list for some time. @owenvoke might add to this?

Installation

In your project, you should have the JavaScript package chokidar installed. You can install it via npm

npm install chokidar

or Yarn

yarn add chokidar

usage

vendor/bin/pest --watch

you may specify a folder/file to test only. Upon saving the test will executed again.

vendor/bin/pest --watch tests/Unit/foo.php

Anything to consider? Code Style? Anything?

*  Update PHP version requirement to 8.1
* Remove ReactPHP dependencies and replace with Symfony Process component
* Replace fswatch dependency with spatie/file-system-watcher package (which uses inotify)
* Add Termwind for pretty output when watching files, instead of using the default Pest console output which is not very readable on a terminal that supports ANSI colors
@paulshryock
Copy link
Contributor

paulshryock commented Mar 23, 2023

@herpaderpaldent what would you think about using https://github.com/thecodeholic/php-file-watcher?

It looks like that would be a native PHP solution without requiring an external dependency like fswatch or node & chokidar.

It would be nice be able to run this on a php Docker container without needing to install Node, etc.

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