Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix step-debugging in Workerd #1480

Merged
merged 16 commits into from
Nov 15, 2023
Merged
31 changes: 31 additions & 0 deletions .changeset/silver-sheep-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
'@shopify/cli-hydrogen': minor
---

Enable debugger connections by passing `--debug` flag to the `h2 dev` command:

- Current default runtime (Node.js sandbox): `h2 dev --debug`.
- New Worker runtime: `h2 dev --debug --worker-unstable`.

You can then connect to the port `9229` (configurable with the new `--inspector-port` flag) to start step debugging.

For example, in Chrome you can go to `chrome://inspect` and make sure the inspector port is added to the network targets. In VSCode, you can add the following to your `.vscode/launch.json`:

```
{
"version": "0.2.0",
"configurations": [
{
"name": "Hydrogen",
"type": "node",
"request": "attach",
"port": 9229,
"cwd": "/",
"resolveSourceMapLocations": null,
"attachExistingChildren": false,
"autoAttachChildProcesses": false,
"restart": true
}
]
}
```
114 changes: 57 additions & 57 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"ci:checks": "turbo run lint test format:check typecheck",
"dev": "npm run dev:pkg",
"dev:pkg": "cross-env LOCAL_DEV=true turbo dev --parallel --filter=./packages/*",
"dev:app": "cd templates/skeleton && cross-env LOCAL_DEV=true npm run dev",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

"preview": "turbo build --filter=./packages/* && npm run preview -w demo-store",
"lint": "eslint --no-error-on-unmatched-pattern --ext .js,.ts,.jsx,.tsx ./packages & npm run lint -w demo-store",
"format": "prettier --write --ignore-unknown ./packages && npm run format -w demo-store",
Expand Down
22 changes: 21 additions & 1 deletion packages/cli/oclif.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,16 @@
"debug": {
"name": "debug",
"type": "boolean",
"description": "Attaches a Node inspector",
"description": "Enables inspector connections with a debugger.",
"allowNo": false
},
"inspector-port": {
"name": "inspector-port",
"type": "option",
"description": "Port where the inspector will be available.",
"multiple": false,
"default": 9229
},
"host": {
"name": "host",
"type": "option",
Expand Down Expand Up @@ -523,6 +530,19 @@
"char": "e",
"description": "Specify an environment's branch name when using remote environment variables.",
"multiple": false
},
"inspector-port": {
"name": "inspector-port",
"type": "option",
"description": "Port where the inspector will be available.",
"multiple": false,
"default": 9229
},
"debug": {
"name": "debug",
"type": "boolean",
"description": "Enables inspector connections with a debugger.",
"allowNo": false
}
},
"args": {}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"fs-extra": "^11.1.0",
"get-port": "^7.0.0",
"gunzip-maybe": "^1.4.2",
"miniflare": "3.20230918.0",
"miniflare": "3.20231016.0",
"prettier": "^2.8.4",
"semver": "^7.5.3",
"source-map": "^0.7.4",
Expand Down
Loading
Loading