dsherret / dsherret/ts-morph

Add file watching example

Open
#608 1 comment 3 reactions 0 assignees View on GitHub
domain: documentation
Dominant language
TypeScript
Stars
6.2k
Forks
238
Avg merge
2m
Merged PRs (30d)
1

Description

It would be beneficial to add a file watching example to help show people how to keep a project up to date with the file system.

---

I recommend using file watchers such as [chokidar](https://github.com/paulmillr/chokidar) alongside this.

Some methods that are helpful:

* `SourceFile#refreshFromFileSystem()`
* `SourceFile#remove()` - Removes a file from the project (not from the file system)
* `Directory#remove()` - Removes a directory from the project (not from the file system)
* `Project#addExistingSourceFileIfExists(filePath: string)` - Useful for adding a source file to the project, if it exists.

Working with directories is useful.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.