在node-supervisor中,如何查看目录中的所有内容以进行更改? [英] In node-supervisor, how do I watch everything in a directory for changes?

查看:111
本文介绍了在node-supervisor中,如何查看目录中的所有内容以进行更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

https://github.com/isaacs/node-supervisor

我想在api目录及其所有子目录(递归)中查看所有内容。我怎么能这样做?

I want to watch everything inside the "api" directory and all its subdirectories (recursively). How can I do that?

sudo supervisor -w app.js,api app.js

这似乎不起作用。它只监视api目录,而不是它的子目录。

This doesn't seem to work. It only watches the "api" directory, not its subdirectories.

推荐答案

似乎正在工作并为我检测变化。

Seems to be working and detect changes for me.

如果我用它来加载文件:

If I use this to load the file:

var module = require("./folder/test/variables.js")

并且有一个主节点文件:

And Have a main node file:

var module = require("./folder/test/variables.js")
var http = require('http');

http.createServer(function (request, response) {
   response.writeHead(200, {'Content-Type': 'text/plain'});
   response.end('The variable is '+ module.variable)
}).listen(7777);

然后,只需使用:

supervisor myApp.js

将检测文件夹/测试中的变化/ variables,这是一个子文件夹。

is going to detect changes in folder/test/variables, which is a subfolder.

实际上,主管说它正在监控当前文件夹:

Actually, supervisor says it is monitoring the current folder:

DEBUG: Running node-supervisor with
DEBUG:   program 'myApp.js'
DEBUG:   --watch '.'
DEBUG:   --extensions 'node|js'
DEBUG:   --exec 'node'

它还在重装文件在文件夹/测试中如果我使用:

It is also reloading the files in folder/test if I use:

supervisor -w folder myApp.js

所以,我猜你可能有不同版本的主管?我正在使用 0.2

So, I guess you may have a different version of supervisor ? I am using 0.2

这篇关于在node-supervisor中,如何查看目录中的所有内容以进行更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆