How to use the nodemon._init function in nodemon

To help you get started, we’ve selected a few nodemon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github open-intent-io / open-intent / bindings / nodejs / lib / project / project.js View on Github external
if (typeof options.debug === 'string') {
                debugArg += '=' + options.debug;
            }
            nodemonOpts.nodeArgs.push(debugArg);
        }
        if (options.nodeArgs) {
            nodemonOpts.nodeArgs = nodemonOpts.nodeArgs.concat(options.nodeArgs.split(' '));
        }

        var nodemon = require('nodemon');

        // hack to enable proxyquire stub for testing...
        if (_.isFunction(nodemon)) {
            nodemon(nodemonOpts);
        } else {
            nodemon._init(nodemonOpts, cb);
        }
        nodemon.on('start', function () {
            console.log('  project will restart on model changes.');

            if (options.open) {
                setTimeout(function() {
                    open(directory, options, cb);
                }, 500);
            }
        }).on('restart', function (files) {
            console.log('Project restarted. Files changed: ' + files);
        }).on('quit', function () {
            process.exit(0);
        }).on('readable', function() { // the `readable` event indicates that data is ready to pick up
            this.stdout.pipe(process.stdout);
            this.stderr.pipe(process.stderr);
github apigee-127 / a127 / lib / commands / project / project.js View on Github external
nodemonOpts.nodeArgs = '--debug-brk';
      if (typeof(options.debugBrk == 'String')) {
        nodemonOpts.nodeArgs += '=' + options.debugBrk;
      }
    }
    if (options.debug) {
      nodemonOpts.nodeArgs = '--debug';
      if (typeof(options.debug == 'String')) {
        nodemonOpts.nodeArgs += '=' + options.debug;
      }
    }
    // hack to enable proxyquire stub for testing...
    if (_.isFunction(nodemon)) {
      nodemon(nodemonOpts);
    } else {
      nodemon._init(nodemonOpts, cb);
    }
    nodemon.on('start', function () {
      emit('  project started here: ' + project.api.localUrl);
      emit('  project will restart on changes.');
      emit('  to restart at any time, enter `rs`');

      if (options.open) {
        setTimeout(function() {
          open(directory, options, cb);
        }, 500);
      }
    }).on('quit', function () {
      emit('Project quit.');
      account.removeDeploymentFiles(project);
    }).on('restart', function (files) {
      emit('Project restarted. Files changed: ', files);
github swagger-api / swagger-node / lib / commands / project / project.js View on Github external
if (options.nodeArgs) {
      nodemonOpts.nodeArgs = nodemonOpts.nodeArgs.concat(options.nodeArgs.split(' '));
    }
    // https://www.npmjs.com/package/cors
    nodemonOpts.env = {
      swagger_corsOptions: '{}' // enable CORS so editor "try it" function can work
    };
    if (options.mock) {
      nodemonOpts.env.swagger_mockMode = true
    }
    var nodemon = require('nodemon');
    // hack to enable proxyquire stub for testing...
    if (_.isFunction(nodemon)) {
      nodemon(nodemonOpts);
    } else {
      nodemon._init(nodemonOpts, cb);
    }
    nodemon.on('start', function () {
      emit('  project started here: ' + project.api.localUrl);
      emit('  project will restart on changes.');
      emit('  to restart at any time, enter `rs`');

      if (options.open) {
        setTimeout(function() {
          open(directory, options, cb);
        }, 500);
      }
    }).on('restart', function (files) {
      emit('Project restarted. Files changed: ', files);
    }).on('quit', function () {
      process.exit(0);
    });

nodemon

Simple monitor script for use during development of a Node.js app.

MIT
Latest version published 1 month ago

Package Health Score

97 / 100
Full package analysis