fix(tswatch.classes.watcher): Convert directory watch paths to glob patterns for smartwatch compatibility
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-12-04 - 2.2.3 - fix(tswatch.classes.watcher)
|
||||||
|
Convert directory watch paths to glob patterns for smartwatch compatibility
|
||||||
|
|
||||||
|
- Watcher: convert directory paths to recursive glob patterns before adding them to Smartwatch so directories are watched recursively (e.g. /path/to/dir/ -> /path/to/dir/**/*).
|
||||||
|
- Readme: added migration note explaining that directory paths are converted to glob patterns for smartwatch compatibility.
|
||||||
|
|
||||||
## 2025-12-01 - 2.2.2 - fix(core)
|
## 2025-12-01 - 2.2.2 - fix(core)
|
||||||
Replace smartchok/smartfile with smartwatch/smartfs, update watcher and plugins, and bump dependencies
|
Replace smartchok/smartfile with smartwatch/smartfs, update watcher and plugins, and bump dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -48,3 +48,4 @@
|
|||||||
- Replaced `@push.rocks/smartchok` with `@push.rocks/smartwatch` (v5.x)
|
- Replaced `@push.rocks/smartchok` with `@push.rocks/smartwatch` (v5.x)
|
||||||
- Replaced `@push.rocks/smartfile` with `@push.rocks/smartfs` for directory listing
|
- Replaced `@push.rocks/smartfile` with `@push.rocks/smartfs` for directory listing
|
||||||
- Class names: `Smartwatch` for file watching, `SmartFs` + `SmartFsProviderNode` for filesystem ops
|
- Class names: `Smartwatch` for file watching, `SmartFs` + `SmartFsProviderNode` for filesystem ops
|
||||||
|
- Directory paths are converted to glob patterns (`/path/to/dir/` → `/path/to/dir/**/*`) for smartwatch compatibility
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/tswatch',
|
name: '@git.zone/tswatch',
|
||||||
version: '2.2.2',
|
version: '2.2.3',
|
||||||
description: 'A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.'
|
description: 'A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,11 @@ export class Watcher {
|
|||||||
logger.log('info', `trying to start watcher for ${this.options.filePathToWatch}`);
|
logger.log('info', `trying to start watcher for ${this.options.filePathToWatch}`);
|
||||||
await this.setupCleanup();
|
await this.setupCleanup();
|
||||||
console.log(`Looking at ${this.options.filePathToWatch} for changes`);
|
console.log(`Looking at ${this.options.filePathToWatch} for changes`);
|
||||||
this.smartwatchInstance.add([this.options.filePathToWatch]); // __dirname refers to the directory of this very file
|
// Convert directory path to glob pattern for smartwatch
|
||||||
|
const watchPath = this.options.filePathToWatch.endsWith('/')
|
||||||
|
? `${this.options.filePathToWatch}**/*`
|
||||||
|
: `${this.options.filePathToWatch}/**/*`;
|
||||||
|
this.smartwatchInstance.add([watchPath]);
|
||||||
await this.smartwatchInstance.start();
|
await this.smartwatchInstance.start();
|
||||||
const changeObservable = await this.smartwatchInstance.getObservableFor('change');
|
const changeObservable = await this.smartwatchInstance.getObservableFor('change');
|
||||||
changeObservable.subscribe(() => {
|
changeObservable.subscribe(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user