Ignore "./*.json" should ignore json files from current working directory
See original GitHub issueHello,
Thanks for great software 😃 I noticed a problem with ignore files from current working directory. Nodeman restarts my application unexpectedly despite ignore “./*.json”.
nodemon -v: 2.0.5node -v: v12.18.4- Operating system/terminal environment:
Ubuntu 20.04.1 LTSon Kernel5.4.0-51-generic - Using Docker? What image:
andyrbell/mountebank:2.3.2with addedRUN npm install -g nodemonto localDockerfile - Command you ran:
nodemon --verbose config.json.ejs
nodeman.json
{
"_comment": "See https://github.com/remy/nodemon",
"ext": "js,json,ejs",
"ignore": [
"var/",
"./*.json"
],
"execMap": {
"ejs": "mb start --logfile=var/mb.log --pidfile=var/mb.pid --allowInjection --debug --configfile"
}
}
Expected behaviour
touch anyfile.json — nodeman should ignore this change
touch any-not-ignored-dir/anyfile.json — nodeman restarts mountebank as expected
Actual behaviour
touch anyfile.json — nodeman restarts mountebank unexpectedly
Logs present the problem
mountebank_1 | [nodemon] 2.0.5
mountebank_1 | [nodemon] reading config ./nodemon.json
mountebank_1 | [nodemon] to restart at any time, enter `rs`
mountebank_1 | [nodemon] or send SIGHUP to 1 to restart
mountebank_1 | [nodemon] ignoring: ./var/**/* ./*.json
mountebank_1 | [nodemon] watching path(s): *.*
mountebank_1 | [nodemon] watching extensions: js,json,ejs
mountebank_1 | [nodemon] starting `mb start --logfile=var/mb.log --pidfile=var/mb.pid --allowInjection --debug --configfile config.json.ejs`
mountebank_1 | [nodemon] spawning
mountebank_1 | [nodemon] child pid: 17
mountebank_1 | [nodemon] watching 6 files
mountebank_1 | warn: [mb:2525] Running with --allowInjection set. See http://localhost:2525/docs/security for security info
mountebank_1 | info: [mb:2525] mountebank v2.3.2 now taking orders - point your browser to http://localhost:2525/ for help
mountebank_1 | info: [mb:2525] PUT /imposters
mountebank_1 | info: [https:8443 nokia-altiplano] Open for business...
Now I’m execute this command: touch anyfile.json (nodeman restarts mountebank unexpectedly)
mountebank_1 | [nodemon] files triggering change check: anyfile.json
mountebank_1 | [nodemon] matched rule: **/*.*
mountebank_1 | [nodemon] changes after filters (before/after): 1/1
mountebank_1 | [nodemon] restarting due to changes...
mountebank_1 | [nodemon] anyfile.json
mountebank_1 |
mountebank_1 | [nodemon] starting `mb start --logfile=var/mb.log --pidfile=var/mb.pid --allowInjection --debug --configfile config.json.ejs`
mountebank_1 | [nodemon] spawning
mountebank_1 | [nodemon] child pid: 37
mountebank_1 | warn: [mb:2525] Running with --allowInjection set. See http://localhost:2525/docs/security for security info
mountebank_1 | info: [mb:2525] mountebank v2.3.2 now taking orders - point your browser to http://localhost:2525/ for help
mountebank_1 | info: [mb:2525] PUT /imposters
mountebank_1 | info: [https:8443 nokia-altiplano] Open for business...
Now I’m execute this command: touch any-not-ignored-dir/anyfile.json (nodeman restarts mountebank as expected)
mountebank_1 | [nodemon] files triggering change check: any-not-ignored-dir/anyfile.json
mountebank_1 | [nodemon] matched rule: **/*.*
mountebank_1 | [nodemon] changes after filters (before/after): 1/1
mountebank_1 | [nodemon] restarting due to changes...
mountebank_1 | [nodemon] any-not-ignored-dir/anyfile.json
mountebank_1 |
mountebank_1 | [nodemon] starting `mb start --logfile=var/mb.log --pidfile=var/mb.pid --allowInjection --debug --configfile config.json.ejs`
mountebank_1 | [nodemon] spawning
mountebank_1 | [nodemon] child pid: 52
mountebank_1 | warn: [mb:2525] Running with --allowInjection set. See http://localhost:2525/docs/security for security info
mountebank_1 | info: [mb:2525] mountebank v2.3.2 now taking orders - point your browser to http://localhost:2525/ for help
mountebank_1 | info: [mb:2525] PUT /imposters
mountebank_1 | info: [https:8443 nokia-altiplano] Open for business...
Regards Piotr Minkina
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Recursively ignore all files inside a specific directory except ...
In the gitignore documentation, they state: It is not possible to re-include a file if a parent directory of that file is excluded....
Read more >.gitignore File – How to Ignore Files and Folders in Git
In this article, you will learn what a .gitignore file is, how to create one, and how to use it to ignore files...
Read more >npm-ci
If set to false, then ignore package-lock.json files when installing. This will also prevent writing package-lock.json if save is true. This configuration does ......
Read more >Command Line Interface - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >User and Workspace Settings - Visual Studio Code
Here the line numbers in the editor for the settings.json file are now green. ... VS Code will warn you and then always...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This fix has been merged into master and is being built and deployed now. Look out for the next version shortly.
Exactly. This is because
mb saveby default createsmb.jsonat current working directory, so without ignore./*.jsonmountebank will be restarted by nodemon unexpectedly (e.g. all in memory data, including state will be lost).