Skip to content

file-watcher

FileWatcher

The FileWatcher class provides functionalities to monitor files and directories for changes. It leverages the chokidar library to efficiently watch files and react to changes by updating the documentation accordingly.

Kind: global class

new FileWatcher(options)

Initializes a new instance of the FileWatcher class.

ParamTypeDescription
optionsPluginOptionsConfiguration options and plugin options.

fileWatcher.watch()

Starts the file watching process if the "watch" argument is provided. Outputs a message to the console indicating the start of the watching process.

Kind: instance method of FileWatcher

fileWatcher.setupFileWatcher() ⇒ chokidar.FSWatcher

Configures and returns a file watcher instance targeting the source folder and README files.

Kind: instance method of FileWatcher
Returns: chokidar.FSWatcher - An instance of the file watcher.

fileWatcher.handleFileChange(path)

Handles events when a file changes. It updates the documentation and outputs relevant messages to the console.

Kind: instance method of FileWatcher

ParamTypeDescription
pathstringThe path of the file that changed.

fileWatcher.clearConsole()

Clears the console to provide a clean output for subsequent messages.

Kind: instance method of FileWatcher

fileWatcher.isReadmeFile(path, srcFolder) ⇒ boolean

Determines if the specified file is a README file.

Kind: instance method of FileWatcher
Returns: boolean - True if the file is a README file, otherwise false.

ParamTypeDescription
pathstringThe path of the file to check.
srcFolderstringThe source directory path.

fileWatcher.updateDocumentationFile(file)

Processes and updates the documentation for the specified file.

Kind: instance method of FileWatcher

ParamTypeDescription
fileDirectoryFileDetails of the file to update.

Released under the MIT License.