node-swatcher v1.1.12
node-swatcher
node-swatcher is a lightweight file-watching tool, designed to automatically restart or reload file/script when the specified file changes. This tool is ideal if you want a simple file sandbox where you want to save time by not manually re-executing your file every time you make a change.
Features
- Watches specified file for changes.
- Automatically restarts the application on file update.
- Has a cool json based config feature.
Installation
- npm i node-swatcher or npm install node-swatcher
- yarn add node-swatcher
- Add required script to your package.json
Usage
-Using Config File
- Create a swatcher.json file in the same directory as file to be run.
- Add the configurations as specified :
{
"serverRestartMessage": "The Server has been restarted",
"serverErrorMessage": "Try Fixing the error and then , retry",
"fileChangeMessage": "File has been changed!",
"filePath": "./demoFile.js",
"command": "node"
}
Here command refers to the program to be used for running the file specified in the filePath.
- Run the command:
- npm run swatch or yarn swatch
-Using CLI
First argument requied is the file path.
For running the node-swatcher using CLI we can pass the CLI equivalents of our json config as named args in the command.
For Example :
npm run swatch <filepath> --com=node
- Remember --com is a required named argument.
Customizations
- You can customize the restart,error and file change messages as required
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago