一些比较好的第三方包

一、nodemon

自动监视文件变更,并自动重启项目.

var nodemon = require('nodemon');
nodemon({
  script: './server',
  ignore: ['webroot/*', '*.test.*', 'tests/*', '*.spec.*', 'resources/*', 'bootstrap/*', 'webpack.config.js'],
  watch: ['./server/']
});

nodemon
  .on('start', function () {
    console.info('Main process started. watching...');
  })
  .on('crash', function () {
   console.info('Main process crashed.');
  })
  .on('quit', function () {
    process.exit();
  })
  .on('restart', function (files) {
    if (files) {
      files = files.map(function (file) {
        var _file = path.relative(cwd, file);
        return _file.indexOf('..') === 0 ? file : _file;
      });
      if (files.length) files = files[0];
    }
     console.info({changed: files}, 'Main process is going to restart...');
  })
  .on('config:update', function (config) {
    config = config || {};
    var options = config.options || {};
    console.info('Nodemon configured.');
    console.info('输入`' + (options.restartable || 'rs') + '\'回车以手动重启进程');
  })
;

你可能感兴趣的:(一些比较好的第三方包)