fix(core): Replace smartchok/smartfile with smartwatch/smartfs, update watcher and plugins, and bump dependencies
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tswatch',
|
||||
version: '2.2.1',
|
||||
version: '2.2.2',
|
||||
description: 'A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.'
|
||||
}
|
||||
|
||||
@@ -5,6 +5,19 @@ import * as interfaces from './interfaces/index.js';
|
||||
import { Watcher } from './tswatch.classes.watcher.js';
|
||||
import { logger } from './tswatch.logging.js';
|
||||
|
||||
// Create smartfs instance for directory operations
|
||||
const smartfs = new plugins.smartfs.SmartFs(new plugins.smartfs.SmartFsProviderNode());
|
||||
|
||||
/**
|
||||
* Lists all folders in a directory
|
||||
*/
|
||||
const listFolders = async (dirPath: string): Promise<string[]> => {
|
||||
const entries = await smartfs.directory(dirPath).list();
|
||||
return entries
|
||||
.filter((entry) => entry.isDirectory)
|
||||
.map((entry) => entry.name);
|
||||
};
|
||||
|
||||
export class TsWatch {
|
||||
public watchmode: interfaces.TWatchModes;
|
||||
public watcherMap = new plugins.lik.ObjectMap<Watcher>();
|
||||
@@ -79,7 +92,7 @@ export class TsWatch {
|
||||
);
|
||||
|
||||
// lets get the other ts folders
|
||||
let tsfolders = await plugins.smartfile.fs.listFolders(paths.cwd);
|
||||
let tsfolders = await listFolders(paths.cwd);
|
||||
tsfolders = tsfolders.filter(
|
||||
(itemArg) => itemArg.startsWith('ts') && itemArg !== 'ts_web',
|
||||
);
|
||||
@@ -125,7 +138,7 @@ export class TsWatch {
|
||||
bundler: 'esbuild',
|
||||
});
|
||||
};
|
||||
let tsfolders = await plugins.smartfile.fs.listFolders(paths.cwd);
|
||||
let tsfolders = await listFolders(paths.cwd);
|
||||
tsfolders = tsfolders.filter(
|
||||
(itemArg) => itemArg.startsWith('ts') && itemArg !== 'ts_web',
|
||||
);
|
||||
|
||||
@@ -20,7 +20,7 @@ export class Watcher {
|
||||
});
|
||||
|
||||
private currentExecution: plugins.smartshell.IExecResultStreaming;
|
||||
private smartchokWatcher = new plugins.smartchok.Smartchok([]);
|
||||
private smartwatchInstance = new plugins.smartwatch.Smartwatch([]);
|
||||
private options: IWatcherConstructorOptions;
|
||||
|
||||
constructor(optionsArg: IWatcherConstructorOptions) {
|
||||
@@ -34,9 +34,9 @@ export class Watcher {
|
||||
logger.log('info', `trying to start watcher for ${this.options.filePathToWatch}`);
|
||||
await this.setupCleanup();
|
||||
console.log(`Looking at ${this.options.filePathToWatch} for changes`);
|
||||
this.smartchokWatcher.add([this.options.filePathToWatch]); // __dirname refers to the directory of this very file
|
||||
await this.smartchokWatcher.start();
|
||||
const changeObservable = await this.smartchokWatcher.getObservableFor('change');
|
||||
this.smartwatchInstance.add([this.options.filePathToWatch]); // __dirname refers to the directory of this very file
|
||||
await this.smartwatchInstance.start();
|
||||
const changeObservable = await this.smartwatchInstance.getObservableFor('change');
|
||||
changeObservable.subscribe(() => {
|
||||
this.updateCurrentExecution();
|
||||
});
|
||||
@@ -99,7 +99,7 @@ export class Watcher {
|
||||
* stops the watcher
|
||||
*/
|
||||
public async stop() {
|
||||
await this.smartchokWatcher.stop();
|
||||
await this.smartwatchInstance.stop();
|
||||
if (this.currentExecution && !this.currentExecution.childProcess.killed) {
|
||||
this.currentExecution.kill();
|
||||
}
|
||||
|
||||
@@ -13,23 +13,23 @@ export { typedserver };
|
||||
|
||||
// @pushrocks scope
|
||||
import * as lik from '@push.rocks/lik';
|
||||
import * as smartchok from '@push.rocks/smartchok';
|
||||
import * as smartcli from '@push.rocks/smartcli';
|
||||
import * as smartdelay from '@push.rocks/smartdelay';
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as smartfs from '@push.rocks/smartfs';
|
||||
import * as smartlog from '@push.rocks/smartlog';
|
||||
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
|
||||
import * as smartshell from '@push.rocks/smartshell';
|
||||
import * as smartwatch from '@push.rocks/smartwatch';
|
||||
import * as taskbuffer from '@push.rocks/taskbuffer';
|
||||
|
||||
export {
|
||||
lik,
|
||||
smartchok,
|
||||
smartcli,
|
||||
smartdelay,
|
||||
smartfile,
|
||||
smartfs,
|
||||
smartlog,
|
||||
smartlogDestinationLocal,
|
||||
smartshell,
|
||||
smartwatch,
|
||||
taskbuffer,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user