-
Notifications
You must be signed in to change notification settings - Fork 62
Plans for a watch switch/config? #81
Comments
Yes, that has been on my mind for a while. Also see #78. If you or someone else feels like helping me out with this, that would be great. |
I'm game to help. Do you think it's worth trying to find the individual endpoints that change with a file modification to replace each, or just reload the entire service? If you can point me to a good spot for the following, I can look at getting started:
I have an idea for each, but want to make sure. Also, do you have any suggestions for setting up a test for this? I'm thinking someway to kick off the service creation (with all the endpoints), edit a file's path property, then verify the new path is loaded into the service (after some delay maybe). Does that sound plausible? |
Great! My first thought was that it would be nice to watch the stubs directory and reload only the modified module (having one or more endpoints). But I also had situations where files in that directory where dependencies of others (not necessarily exporting endpoints), so I guess it's best to just reload everything. Some pointers (other ideas welcome!):
|
OK. Thanks for the tips and direction. I'll see where this gets me when I get some time. ;-) |
@webpro, I just wanted to post an update on this to save you some time/effort on my PR. I switched over to nodemon to get restarts on changes with Dyson. It works really well and doesn't require any changes to the Dyson codebase. That said, if you want me to cancel the PR, I will; otherwise, feel free to just kill it. Maybe you could add some documentation on how to use nodemon with Dyson for others. To get things working properly, I installed nodemon and changed my NPM script to something like the following:
This command tells nodemon to watch the api sub-directory recursively (it defaults to the CWD), and to wrap/execute "dyson api". I had to use the --exec switch when Dyson is only installed locally as a dev dependency; otherwise, you don't need that switch. |
Thanks a ton for this and the PR, @ventaur! Very valuable to find out that the npm script is probably the best way to go. I've just updated the readme (with a maintenance release). |
Are there any plans to implement a "watch" switch/config to detect changes to the endpoint files?
The text was updated successfully, but these errors were encountered: