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

Commit

Permalink
feat(serve): add option to specify debug port
Browse files Browse the repository at this point in the history
  • Loading branch information
capfsb authored and thetutlage committed Jun 3, 2018
1 parent 8b7b190 commit c0735ff
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Commands/Serve/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Serve extends Command {
{ --dev : Start development server }
{ -w, --watch=@value : A custom set of only files to watch },
{ -p, --polling : Use polling to find file changes. Also required when using Docker }
{ --debug: Start server in debug mode }
{ --debug?=@value: Start server in debug mode }
{ -d, --domain=@value: Register hotel .dev domain. Value must be in (name@url) format }
`
}
Expand Down Expand Up @@ -173,12 +173,23 @@ class Serve extends Command {
*/
const watchDirs = watch || (dev ? [process.cwd(), '.env'] : [])

/**
* Custom debug port
*/
let execJsCommand = 'node'
if (debug) {
execJsCommand += ' --inspect'
if (typeof (debug) === 'string') {
execJsCommand += '=' + debug
}
}

const nodemon = require('nodemon')

nodemon({
script: appFile,
execMap: {
js: debug ? 'node --inspect' : 'node'
js: execJsCommand
},
ext: ext,
legacyWatch: !!polling,
Expand Down

0 comments on commit c0735ff

Please sign in to comment.