Essentially I’m trying to do something like nodemon and forever but just a lot simpler and that will suit my needs better
Running Dev
Clone the GitHub Repo, and then install the app dependencies and install the application globally
Next we can link NPM to our actual package instead of the global version with
What’s Happening Here
Getting Started
We have a simple node app that is running globally, but linked to our application’s index.js file with the following
Define Run Command
Next we the startover command linked in our package.json as follows
This will allow us to run th index.js file which is done by simply running the following command
Parsing Command Line Arguments
We make use of the commander package to parse CLI arguments, we do this from the index.js file and parses the various parameters
We can also get help and information on the commands with
Watcher Events
I then defined the events for the file watcher as well as the configuration
And finally added a function to carry out the custom command that I need to be run
Run Startover
We can run startover once it is installed with the following command
It is important to remember that the command/commands we are running from the -c option must be compatible with the system/shell we are running startover in and they will run one after the other
Resources
I’ve made use of a few different resources for the application as follows