Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0dee896201 | |||
| 29f7283f7a | |||
| 3eb99e1f08 | |||
| ad41fe876d | |||
| d6f3381e71 | |||
| bcbf6fc139 | |||
| f73ca7ac2f | |||
| 75acc4b768 | |||
| 83cf8594ab | |||
| 417dc4c763 | |||
| 64a86f7af3 |
BIN
.serena/cache/typescript/document_symbols_cache_v23-06-25.pkl
vendored
Normal file
BIN
.serena/cache/typescript/document_symbols_cache_v23-06-25.pkl
vendored
Normal file
Binary file not shown.
68
.serena/project.yml
Normal file
68
.serena/project.yml
Normal file
@@ -0,0 +1,68 @@
|
||||
# language of the project (csharp, python, rust, java, typescript, go, cpp, or ruby)
|
||||
# * For C, use cpp
|
||||
# * For JavaScript, use typescript
|
||||
# Special requirements:
|
||||
# * csharp: Requires the presence of a .sln file in the project folder.
|
||||
language: typescript
|
||||
|
||||
# whether to use the project's gitignore file to ignore files
|
||||
# Added on 2025-04-07
|
||||
ignore_all_files_in_gitignore: true
|
||||
# list of additional paths to ignore
|
||||
# same syntax as gitignore, so you can use * and **
|
||||
# Was previously called `ignored_dirs`, please update your config if you are using that.
|
||||
# Added (renamed) on 2025-04-07
|
||||
ignored_paths: []
|
||||
|
||||
# whether the project is in read-only mode
|
||||
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
|
||||
# Added on 2025-04-18
|
||||
read_only: false
|
||||
|
||||
|
||||
# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
|
||||
# Below is the complete list of tools for convenience.
|
||||
# To make sure you have the latest list of tools, and to view their descriptions,
|
||||
# execute `uv run scripts/print_tool_overview.py`.
|
||||
#
|
||||
# * `activate_project`: Activates a project by name.
|
||||
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
|
||||
# * `create_text_file`: Creates/overwrites a file in the project directory.
|
||||
# * `delete_lines`: Deletes a range of lines within a file.
|
||||
# * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
|
||||
# * `execute_shell_command`: Executes a shell command.
|
||||
# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
|
||||
# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
|
||||
# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
|
||||
# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
|
||||
# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
|
||||
# * `initial_instructions`: Gets the initial instructions for the current project.
|
||||
# Should only be used in settings where the system prompt cannot be set,
|
||||
# e.g. in clients you have no control over, like Claude Desktop.
|
||||
# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
|
||||
# * `insert_at_line`: Inserts content at a given line in a file.
|
||||
# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
|
||||
# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
|
||||
# * `list_memories`: Lists memories in Serena's project-specific memory store.
|
||||
# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
|
||||
# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
|
||||
# * `read_file`: Reads a file within the project directory.
|
||||
# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
|
||||
# * `remove_project`: Removes a project from the Serena configuration.
|
||||
# * `replace_lines`: Replaces a range of lines within a file with new content.
|
||||
# * `replace_symbol_body`: Replaces the full definition of a symbol.
|
||||
# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
|
||||
# * `search_for_pattern`: Performs a search for a pattern in the project.
|
||||
# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
|
||||
# * `switch_modes`: Activates modes by providing a list of their names
|
||||
# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
|
||||
# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
|
||||
# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
|
||||
# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
|
||||
excluded_tools: []
|
||||
|
||||
# initial prompt for the project. It will always be given to the LLM upon activating the project
|
||||
# (contrary to the memories, which are loaded on demand).
|
||||
initial_prompt: ""
|
||||
|
||||
project_name: "tswatch"
|
||||
35
changelog.md
35
changelog.md
@@ -1,5 +1,40 @@
|
||||
# Changelog
|
||||
|
||||
## 2025-12-04 - 2.2.4 - fix(dependencies)
|
||||
Bump dependency versions: @api.global/typedserver, @git.zone/tsbundle, @push.rocks/smartfs, @push.rocks/taskbuffer
|
||||
|
||||
- Upgrade @api.global/typedserver from ^3.0.80 to ^7.4.1
|
||||
- Upgrade @git.zone/tsbundle from ^2.6.2 to ^2.6.3
|
||||
- Upgrade @push.rocks/smartfs from ^1.1.3 to ^1.2.0
|
||||
- Upgrade @push.rocks/taskbuffer from ^3.4.0 to ^3.5.0
|
||||
|
||||
## 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)
|
||||
Replace smartchok/smartfile with smartwatch/smartfs, update watcher and plugins, and bump dependencies
|
||||
|
||||
- Replaced @push.rocks/smartchok with @push.rocks/smartwatch and updated Watcher to use Smartwatch (add/start/stop/getObservableFor).
|
||||
- Replaced @push.rocks/smartfile with @push.rocks/smartfs and added SmartFs usage (SmartFsProviderNode) plus a listFolders helper used by TsWatch.
|
||||
- Updated tswatch.plugins.ts to export smartfs and smartwatch and removed smartchok/smartfile exports.
|
||||
- Updated tswatch.classes.watcher.ts and tswatch.classes.tswatch.ts to use the new smartwatch/smartfs APIs and adjusted directory listing and watcher logic accordingly.
|
||||
- Bumped several devDependencies and dependencies in package.json (tsbuild, tstest, @api.global/typedserver, @git.zone/tsbundle, @git.zone/tsrun, @push.rocks/* packages).
|
||||
- Documentation updates: readme.md and readme.hints.md include migration notes and Issue Reporting & Security section.
|
||||
|
||||
## 2025-07-29 - 2.2.1 - fix(exports)
|
||||
Fix package.json exports field syntax
|
||||
|
||||
- Fixed exports field syntax from "./" to "." for proper module resolution
|
||||
|
||||
## 2025-07-29 - 2.2.0 - feat(exports)
|
||||
Modernize package exports and expose watcher class
|
||||
|
||||
- Updated package.json to use modern exports field instead of main/typings
|
||||
- Exposed TsWatch watcher class through index exports
|
||||
|
||||
## 2025-07-29 - 2.1.3 - fix(documentation)
|
||||
Update and align documentation with internal CLI and project structure
|
||||
|
||||
|
||||
31
package.json
31
package.json
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"name": "@git.zone/tswatch",
|
||||
"version": "2.1.3",
|
||||
"version": "2.2.4",
|
||||
"private": false,
|
||||
"description": "A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"exports": {
|
||||
".": "./dist_ts/index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
@@ -17,24 +18,24 @@
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@git.zone/tsbuild": "^2.6.4",
|
||||
"@git.zone/tstest": "^2.3.1",
|
||||
"@types/node": "^24.0.4"
|
||||
"@git.zone/tsbuild": "^3.1.2",
|
||||
"@git.zone/tstest": "^3.1.3",
|
||||
"@types/node": "^24.10.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@api.global/typedserver": "^3.0.74",
|
||||
"@git.zone/tsbundle": "^2.5.1",
|
||||
"@git.zone/tsrun": "^1.3.3",
|
||||
"@api.global/typedserver": "^7.4.1",
|
||||
"@git.zone/tsbundle": "^2.6.3",
|
||||
"@git.zone/tsrun": "^2.0.0",
|
||||
"@push.rocks/early": "^4.0.4",
|
||||
"@push.rocks/lik": "^6.2.2",
|
||||
"@push.rocks/smartchok": "^1.1.1",
|
||||
"@push.rocks/smartcli": "^4.0.11",
|
||||
"@push.rocks/smartcli": "^4.0.19",
|
||||
"@push.rocks/smartdelay": "^3.0.5",
|
||||
"@push.rocks/smartfile": "^11.2.5",
|
||||
"@push.rocks/smartlog": "^3.1.8",
|
||||
"@push.rocks/smartfs": "^1.2.0",
|
||||
"@push.rocks/smartlog": "^3.1.10",
|
||||
"@push.rocks/smartlog-destination-local": "^9.0.2",
|
||||
"@push.rocks/smartshell": "^3.2.3",
|
||||
"@push.rocks/taskbuffer": "^3.1.7"
|
||||
"@push.rocks/smartshell": "^3.3.0",
|
||||
"@push.rocks/smartwatch": "^5.0.0",
|
||||
"@push.rocks/taskbuffer": "^3.5.0"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
|
||||
5090
pnpm-lock.yaml
generated
5090
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,8 @@
|
||||
6. **echo**: Test mode that runs `npm -v` (for testing)
|
||||
|
||||
## Key Implementation Details
|
||||
- Uses `@push.rocks/smartchok` for file watching
|
||||
- Uses `@push.rocks/smartwatch` (v5.x) for file watching - class is `Smartwatch`
|
||||
- Uses `@push.rocks/smartfs` (v1.x) for directory operations - uses `SmartFs` with `SmartFsProviderNode`
|
||||
- Uses `@git.zone/tsbundle` for bundling with esbuild
|
||||
- Uses `@api.global/typedserver` for development server in element mode
|
||||
- Element/website modes watch multiple `ts*/` directories
|
||||
@@ -41,4 +42,10 @@
|
||||
## Common Issues to Watch For
|
||||
- The test mode runs `test2` script, not `test`
|
||||
- Website mode restarts the entire server process on backend changes
|
||||
- Element mode rebuilds and reloads on any ts* folder change
|
||||
- Element mode rebuilds and reloads on any ts* folder change
|
||||
|
||||
## Migration Notes (v2.2.x)
|
||||
- Replaced `@push.rocks/smartchok` with `@push.rocks/smartwatch` (v5.x)
|
||||
- Replaced `@push.rocks/smartfile` with `@push.rocks/smartfs` for directory listing
|
||||
- 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
|
||||
|
||||
66
readme.md
66
readme.md
@@ -2,6 +2,10 @@
|
||||
|
||||
A TypeScript file watcher that automatically recompiles and executes your project when files change. Designed to streamline development workflows for various TypeScript project types.
|
||||
|
||||
## Issue Reporting and Security
|
||||
|
||||
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
|
||||
|
||||
## Features
|
||||
|
||||
- 🔄 **Automatic recompilation** on file changes
|
||||
@@ -11,11 +15,6 @@ A TypeScript file watcher that automatically recompiles and executes your projec
|
||||
- 🛠️ **Flexible CLI and programmatic API**
|
||||
- 📦 **Zero configuration** for standard project structures
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Node.js (v14 or higher)
|
||||
- pnpm (recommended) or npm
|
||||
|
||||
## Installation
|
||||
|
||||
Install `@git.zone/tswatch` globally or as a development dependency:
|
||||
@@ -44,6 +43,7 @@ tswatch service
|
||||
## CLI Commands
|
||||
|
||||
### `tswatch` or `tswatch npm`
|
||||
|
||||
Watches TypeScript files and runs `npm test` on changes. This is the default mode.
|
||||
|
||||
```bash
|
||||
@@ -53,6 +53,7 @@ tswatch npm
|
||||
```
|
||||
|
||||
### `tswatch element`
|
||||
|
||||
Sets up a development environment for web components/elements:
|
||||
- Starts a dev server on port 3002
|
||||
- Bundles TypeScript to `dist_watch/`
|
||||
@@ -64,6 +65,7 @@ tswatch element
|
||||
```
|
||||
|
||||
### `tswatch service`
|
||||
|
||||
Watches TypeScript files in `./ts/` and runs `npm run startTs` on changes. Ideal for backend services.
|
||||
|
||||
```bash
|
||||
@@ -71,6 +73,7 @@ tswatch service
|
||||
```
|
||||
|
||||
### `tswatch website`
|
||||
|
||||
Full website development mode:
|
||||
- Bundles TypeScript files to `dist_serve/`
|
||||
- Processes HTML files
|
||||
@@ -82,6 +85,7 @@ tswatch website
|
||||
```
|
||||
|
||||
### `tswatch test`
|
||||
|
||||
Runs `npm run test2` whenever files change. Useful for projects with custom test scripts.
|
||||
|
||||
```bash
|
||||
@@ -93,6 +97,7 @@ tswatch test
|
||||
tswatch expects certain project structures depending on the mode:
|
||||
|
||||
### NPM/Node Projects
|
||||
|
||||
```
|
||||
project/
|
||||
├── ts/ # TypeScript source files
|
||||
@@ -101,6 +106,7 @@ project/
|
||||
```
|
||||
|
||||
### Element Projects
|
||||
|
||||
```
|
||||
project/
|
||||
├── ts/ # Backend TypeScript
|
||||
@@ -111,6 +117,7 @@ project/
|
||||
```
|
||||
|
||||
### Website Projects
|
||||
|
||||
```
|
||||
project/
|
||||
├── ts/ # Backend TypeScript
|
||||
@@ -137,8 +144,23 @@ await watcher.start();
|
||||
await watcher.stop();
|
||||
```
|
||||
|
||||
### Available Watch Modes
|
||||
|
||||
The `TsWatch` class accepts the following modes:
|
||||
|
||||
| Mode | Description |
|
||||
|------|-------------|
|
||||
| `node` | Runs `npm test` on changes (default) |
|
||||
| `test` | Runs `npm run test2` on changes |
|
||||
| `element` | Web component development with dev server |
|
||||
| `service` | Runs `npm run startTs` for services |
|
||||
| `website` | Full website mode with bundling |
|
||||
| `echo` | Test mode that runs `npm -v` |
|
||||
|
||||
### Custom Watchers
|
||||
|
||||
For more granular control, use the `Watcher` class directly:
|
||||
|
||||
```typescript
|
||||
import { Watcher } from '@git.zone/tswatch';
|
||||
|
||||
@@ -154,6 +176,8 @@ await customWatcher.start();
|
||||
### Using Function Callbacks
|
||||
|
||||
```typescript
|
||||
import { Watcher } from '@git.zone/tswatch';
|
||||
|
||||
const watcher = new Watcher({
|
||||
filePathToWatch: './src',
|
||||
functionToCall: async () => {
|
||||
@@ -161,8 +185,19 @@ const watcher = new Watcher({
|
||||
// Your custom logic here
|
||||
}
|
||||
});
|
||||
|
||||
await watcher.start();
|
||||
```
|
||||
|
||||
### Watcher Options
|
||||
|
||||
| Option | Type | Description |
|
||||
|--------|------|-------------|
|
||||
| `filePathToWatch` | `string` | Path to watch for changes |
|
||||
| `commandToExecute` | `string` | Shell command to run on changes |
|
||||
| `functionToCall` | `() => Promise<any>` | Async function to call on changes |
|
||||
| `timeout` | `number` | Optional timeout in milliseconds |
|
||||
|
||||
## Development Server
|
||||
|
||||
Element mode includes a built-in development server:
|
||||
@@ -178,6 +213,7 @@ Access your project at `http://localhost:3002` when running in element mode.
|
||||
1. **TypeScript Config**: Ensure your `tsconfig.json` is properly configured for your target environment
|
||||
2. **Package Scripts**: Define appropriate scripts in `package.json`:
|
||||
- `test`: For npm mode
|
||||
- `test2`: For test mode
|
||||
- `startTs`: For service/website modes
|
||||
- `build`: For general compilation
|
||||
|
||||
@@ -186,44 +222,54 @@ Access your project at `http://localhost:3002` when running in element mode.
|
||||
## Common Use Cases
|
||||
|
||||
### Developing a Node.js Library
|
||||
|
||||
```bash
|
||||
tswatch npm
|
||||
```
|
||||
|
||||
Automatically runs tests when you modify source files.
|
||||
|
||||
### Building a Web Component
|
||||
|
||||
```bash
|
||||
tswatch element
|
||||
```
|
||||
|
||||
Get instant feedback with live reload while developing custom elements.
|
||||
|
||||
### Creating a Backend Service
|
||||
|
||||
```bash
|
||||
tswatch service
|
||||
```
|
||||
|
||||
Automatically restart your service on code changes.
|
||||
|
||||
### Full-Stack Web Application
|
||||
|
||||
```bash
|
||||
tswatch website
|
||||
```
|
||||
|
||||
Handle both frontend and backend compilation with asset processing.
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.
|
||||
|
||||
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||
|
||||
### Trademarks
|
||||
|
||||
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
|
||||
|
||||
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
||||
|
||||
### Company Information
|
||||
|
||||
Task Venture Capital GmbH
|
||||
Registered at District court Bremen HRB 35230 HB, Germany
|
||||
Task Venture Capital GmbH
|
||||
Registered at District Court Bremen HRB 35230 HB, Germany
|
||||
|
||||
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||
For any legal inquiries or further information, please contact us via email at hello@task.vc.
|
||||
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tswatch',
|
||||
version: '2.1.3',
|
||||
version: '2.2.4',
|
||||
description: 'A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.'
|
||||
}
|
||||
|
||||
@@ -3,3 +3,5 @@ early.start('tswatch');
|
||||
export * from './tswatch.classes.tswatch.js';
|
||||
export * from './tswatch.cli.js';
|
||||
early.stop();
|
||||
|
||||
export * from './tswatch.classes.watcher.js';
|
||||
@@ -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,13 @@ 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');
|
||||
// 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();
|
||||
const changeObservable = await this.smartwatchInstance.getObservableFor('change');
|
||||
changeObservable.subscribe(() => {
|
||||
this.updateCurrentExecution();
|
||||
});
|
||||
@@ -99,7 +103,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