remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development
http://nodemon.io/
MIT License
26.26k stars 1.72k forks source link

ignore everything except repeated specific sub directories #2145

Closed UROjQ6r80p closed 10 months ago

UROjQ6r80p commented 11 months ago

How to make nodemon ignore everything in a folder, except nested sub directories? I want to ignore everything in src folder except every folder with name components (nested etc.)

so src/file.js, src/something/nested/file.js should be ignored, but src/components/file.js, src/something/nested/components/file.js should not be ignored.

I tried ! but it doesn't work.

{
    "verbose": true,
    "ignore": [
        "vite.config.js.timestamp-*.mjs",
        "node_modules/",
        "src/!(**/components/**)",
        "dist/"
    ],
    "ext": "*"
}
github-actions[bot] commented 10 months ago

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3

remy commented 10 months ago

@UROjQ6r80p honestly I'm not sure what the right globbing pattern is, but underneath it all, nodemon uses Chokidar for watch and (some) ignoring and that uses code that follows minimatch syntax, so you're best referring to those docs: https://github.com/micromatch/picomatch#advanced-globbing (and if I were you, I'd probably get the minimatch in a repl and see if I can get something that matches).

UROjQ6r80p commented 10 months ago

Yup, thanks I'll try.