BREAKING CHANGE(@push.rocks/smartwatch): Rename package and update branding/docs: switch from @push.rocks/smartchok to @push.rocks/smartwatch, update repository/homepage/bugs URLs and author, and refresh README examples and install instructions.
This commit is contained in:
22
readme.md
22
readme.md
@@ -1,4 +1,4 @@
|
||||
# @push.rocks/smartchok
|
||||
# @push.rocks/smartwatch
|
||||
|
||||
A lightweight, cross-runtime file watcher with glob pattern support for **Node.js**, **Deno**, and **Bun**. Zero heavyweight dependencies — just native file watching APIs for maximum performance. 🚀
|
||||
|
||||
@@ -9,9 +9,9 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install @push.rocks/smartchok
|
||||
npm install @push.rocks/smartwatch
|
||||
# or
|
||||
pnpm add @push.rocks/smartchok
|
||||
pnpm add @push.rocks/smartwatch
|
||||
```
|
||||
|
||||
## Features
|
||||
@@ -30,7 +30,7 @@ pnpm add @push.rocks/smartchok
|
||||
### Basic Setup
|
||||
|
||||
```typescript
|
||||
import { Smartwatch } from '@push.rocks/smartchok';
|
||||
import { Smartwatch } from '@push.rocks/smartwatch';
|
||||
|
||||
// Create a watcher with glob patterns
|
||||
const watcher = new Smartwatch([
|
||||
@@ -110,7 +110,7 @@ await watcher.stop();
|
||||
### Complete Example
|
||||
|
||||
```typescript
|
||||
import { Smartwatch } from '@push.rocks/smartchok';
|
||||
import { Smartwatch } from '@push.rocks/smartwatch';
|
||||
|
||||
async function watchProject() {
|
||||
// Initialize with patterns
|
||||
@@ -155,7 +155,7 @@ watchProject();
|
||||
|
||||
## How It Works
|
||||
|
||||
smartchok uses native file watching APIs for each runtime:
|
||||
smartwatch uses native file watching APIs for each runtime:
|
||||
|
||||
| Runtime | API Used |
|
||||
|-----------------|----------------------------------|
|
||||
@@ -165,7 +165,7 @@ smartchok uses native file watching APIs for each runtime:
|
||||
|
||||
### Under the Hood
|
||||
|
||||
Native file watching APIs don't support glob patterns directly, so smartchok handles pattern matching internally:
|
||||
Native file watching APIs don't support glob patterns directly, so smartwatch handles pattern matching internally:
|
||||
|
||||
1. **Base path extraction** — Extracts the static portion from each glob pattern (e.g., `./src/` from `./src/**/*.ts`)
|
||||
2. **Efficient watching** — Native watchers monitor only the base directories
|
||||
@@ -174,7 +174,7 @@ Native file watching APIs don't support glob patterns directly, so smartchok han
|
||||
|
||||
### Write Stabilization
|
||||
|
||||
smartchok includes built-in write stabilization (similar to chokidar's `awaitWriteFinish`). When a file is being written, events are held until the file size stabilizes, preventing multiple events for a single write operation.
|
||||
smartwatch includes built-in write stabilization (similar to chokidar's `awaitWriteFinish`). When a file is being written, events are held until the file size stabilizes, preventing multiple events for a single write operation.
|
||||
|
||||
Default settings:
|
||||
- **Stability threshold**: 300ms
|
||||
@@ -226,9 +226,9 @@ type TFsEvent = 'add' | 'addDir' | 'change' | 'error' | 'unlink' | 'unlinkDir' |
|
||||
type TSmartwatchStatus = 'idle' | 'starting' | 'watching';
|
||||
```
|
||||
|
||||
## Why smartchok?
|
||||
## Why smartwatch?
|
||||
|
||||
| Feature | smartchok | chokidar |
|
||||
| Feature | smartwatch | chokidar |
|
||||
|-------------------------|----------------------|--------------------|
|
||||
| Native API | ✅ Direct `fs.watch` | ❌ FSEvents bindings |
|
||||
| Cross-runtime | ✅ Node, Deno, Bun | ❌ Node only |
|
||||
@@ -237,7 +237,7 @@ type TSmartwatchStatus = 'idle' | 'starting' | 'watching';
|
||||
| Glob support | ✅ picomatch | ✅ anymatch |
|
||||
| Bundle size | ~15KB | ~200KB+ |
|
||||
|
||||
If you need a lightweight file watcher without native compilation headaches, smartchok has you covered.
|
||||
If you need a lightweight file watcher without native compilation headaches, smartwatch has you covered.
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
|
||||
Reference in New Issue
Block a user