feat(Smartchok): Migrate to chokidar 4.x with picomatch glob support, update documentation and tests

This commit is contained in:
Juergen Kunz
2025-06-26 23:15:42 +00:00
parent 3444b7c74d
commit d7a05abfa2
9 changed files with 8633 additions and 4030 deletions

View File

@ -13,7 +13,7 @@ This command adds `@push.rocks/smartchok` to your project's dependencies, ensuri
## Usage
The `@push.rocks/smartchok` package provides a convenient and smart wrapper around the popular `chokidar` library for file watching with enhanced features such as observable support for filesystem events. This guide will introduce you to the usage of `@push.rocks/smartchok`, leveraging TypeScript for type safety and better developer experience.
The `@push.rocks/smartchok` package provides a convenient and smart wrapper around the popular `chokidar` library (v4.x) for file watching with enhanced features such as observable support for filesystem events and glob pattern matching support. This guide will introduce you to the usage of `@push.rocks/smartchok`, leveraging TypeScript for type safety and better developer experience.
### Setting Up Your Project
@ -93,7 +93,7 @@ changeObservable.subscribe({
});
```
Supported events include 'add', 'change', 'unlink' (for deletions), and others. Refer to the chokidar documentation for a full list of events.
Supported events include 'add', 'change', 'unlink' (for deletions), 'addDir', 'unlinkDir', 'error', 'ready', and 'raw'. Since chokidar 4.x no longer supports glob patterns natively, smartchok handles glob pattern matching internally using picomatch.
#### Stopping the Watcher
@ -109,7 +109,7 @@ Beyond the basics, `smartchok` allows for more complex monitoring scenarios, suc
### Conclusion
`@push.rocks/smartchok` provides a robust, observable-based wrapper around `chokidar`, making it an excellent choice for projects requiring efficient and flexible file monitoring. Its integration with RxJS opens up a wide array of possibilities for handling file system events in a reactive manner, making your code more concise, readable, and maintainable.
`@push.rocks/smartchok` provides a robust, observable-based wrapper around `chokidar` 4.x, making it an excellent choice for projects requiring efficient and flexible file monitoring. Its integration with RxJS opens up a wide array of possibilities for handling file system events in a reactive manner, making your code more concise, readable, and maintainable. The package maintains backward compatibility by implementing glob pattern support that was removed in chokidar 4.x.
By following the guidelines provided in this document, you should now be equipped to integrate `@push.rocks/smartchok` into your TypeScript project, enhancing its capabilities with efficient file system monitoring.