Giter VIP home page Giter VIP logo

Comments (8)

aseemk avatar aseemk commented on July 27, 2024

A requirement from the node-supervisor executable for this would be actually the opposite of issue #14: instead of an option to restart only on watch changes (not on crashes), this would need an option to restart only on crashes (and not watch anything, except I suppose the entry file, e.g. app.js).

from node-supervisor.

aseemk avatar aseemk commented on July 27, 2024

FYI, I prototyped this in our current project and it seems to work great. Here's the full source code to the helper script that we require() before requiring any of our regular source code:

https://gist.github.com/1053401

And we changed our node-supervisor usage to now specify that only the entry file (e.g. app.js in our case) should be watched, instead of the entire current directory.

The result: all false positives and false negatives eliminated, and a slight startup performance boost. Suh-weet!

Would be awesome to get this into node-supervisor directly. Let me know what you think of this.

from node-supervisor.

gasi avatar gasi commented on July 27, 2024

+1

from node-supervisor.

devinrhode2 avatar devinrhode2 commented on July 27, 2024

I think perhaps we should default to only watching to app.js or server.js file passed in... but I'm not sure. Should /node_modules also be watched?

That means doing supervisor app.js will default to watching only that file

I'm going to do this on my fork

from node-supervisor.

iangreenleaf avatar iangreenleaf commented on July 27, 2024

I think it would be very cool if we can do this without making folks change their source in any way. Maybe supervisor could sneakily prepend some code to what it is running. Or maybe we could use something like node-detective to analyse the file prior to runtime.

from node-supervisor.

aseemk avatar aseemk commented on July 27, 2024

FWIW, we long ago switched to @fgnass's excellent node-dev, which does this perfectly. No code changes, just node-dev foo.js arg1 arg2 instead of node foo.js arg1 arg2, and it watches only and all require()'d files.

from node-supervisor.

diwu1989 avatar diwu1989 commented on July 27, 2024

This ticket should be closed because node-dev already does it.

from node-supervisor.

iangreenleaf avatar iangreenleaf commented on July 27, 2024

Closing as this is probably unlikely to happen. It would a great feature to have if it didn't involve a lot of added complication and extra code, but I'll leave the messy stuff to other packages that want to deal with it. Supervisor is and will remain fairly simple.

from node-supervisor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.