Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Add Node debugger support
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Crete committed Jun 22, 2018
1 parent 679d429 commit a932973
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 8 deletions.
14 changes: 14 additions & 0 deletions docs/docs/configuration-noderize.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,20 @@ File to run when using `start` or `watch` command.

This is relative to your project root. Add `dist/` before.

### `inspect`

[boolean] Default: `false`

Start the [Node debugger](https://nodejs.org/api/debugger.html) with Noderize.

### `inspectChrome`

[number] Default: _none_

Start the [Chrome DevTools (Node) debugger](https://nodejs.org/api/debugger.html#debugger_v8_inspector_integration_for_node_js) with Noderize.

Number given will be used as port to listen on.

## Other Options

### `env`
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packages": [
"packages/*"
],
"version": "0.7.1",
"version": "0.7.2",
"npmClient": "yarn",
"useWorkspaces": true
}
6 changes: 3 additions & 3 deletions packages/create/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/Cretezy/Noderize.git"
},
"version": "0.7.1",
"version": "0.7.2",
"license": "MIT",
"bin": "dist/index.js",
"files": [
Expand All @@ -26,13 +26,13 @@
"prepack": "npm run clean && npm run build -- --env production"
},
"dependencies": {
"@noderize/runtime": "^0.7.1",
"@noderize/runtime": "^0.7.2",
"consola": "^1.3.0",
"fs-extra": "^5.0.0",
"minimist": "^1.2.0"
},
"devDependencies": {
"@noderize/scripts": "^0.7.1",
"@noderize/scripts": "^0.7.2",
"source-map-support": "^0.5.5"
}
}
2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/Cretezy/Noderize.git"
},
"version": "0.7.1",
"version": "0.7.2",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.0.0-beta.46"
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/Cretezy/Noderize.git"
},
"version": "0.7.1",
"version": "0.7.2",
"license": "MIT",
"bin": {
"noderize-scripts": "dist/index.js"
Expand Down
8 changes: 8 additions & 0 deletions packages/scripts/src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ export function getOptions(rawArgs, env = null) {
type: Object,
default: {}
},
inspect: {
type: Boolean,
default: false
},
inspectChrome: {
type: Number,
default: false
},
target: {
type: String,
default: "node",
Expand Down
19 changes: 17 additions & 2 deletions packages/scripts/src/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,23 @@ export async function start(options, nodePath = process.argv[0]) {
return;
}

const child = spawn(nodePath, [options.startFile, ...options.args._], {
execArgv: ["-r", "source-map-support/register"],
const args = [options.startFile, ...options.args._];
const execArgv = ["-r", "source-map-support/register"];

// Enable V8 debugger
if (options.inspect) {
args.unshift("inspect");
}
// Enable Chrome DevTools debugger
if (options.inspectChrome) {
execArgv.push(
`--inspect=${options.inspectChrome}`
);

}
console.log([...execArgv,...args])

const child = spawn(nodePath,[...execArgv,...args], {
cwd: appDirectory,
stdio: "inherit"
});
Expand Down

0 comments on commit a932973

Please sign in to comment.