Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Refactor picking debug argument for different Node.js versions
Browse files Browse the repository at this point in the history
  • Loading branch information
simison committed Jun 13, 2017
1 parent 1b3c7cf commit 9f95959
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ var _ = require('lodash'),
webdriver_update = require('gulp-protractor').webdriver_update,
webdriver_standalone = require('gulp-protractor').webdriver_standalone,
del = require('del'),
KarmaServer = require('karma').Server;
KarmaServer = require('karma').Server,
semver = require('semver');

// Local settings
var changedTestFiles = [];
Expand All @@ -48,18 +49,8 @@ gulp.task('env:prod', function () {
// Nodemon task
gulp.task('nodemon', function () {

var nodeVersions = process.versions;
var debugArgument = '--debug';
switch (nodeVersions.node.substr(0, 1)) {
case '4':
case '5':
case '6':
debugArgument = '--debug';
break;
case '7':
debugArgument = '--inspect';
break;
}
// Node.js v7 and newer use different debug argument
var debugArgument = semver.satisfies(process.versions.node, '>=7.0.0') ? '--inspect' : '--debug';

return plugins.nodemon({
script: 'server.js',
Expand Down

0 comments on commit 9f95959

Please sign in to comment.