Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/add-debugger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
ggt: minor
---

Add `ggt debugger` command.

- Debug Gadget via CDP on `localhost:9229` through `ggt`.
- `--configure vscode` prepares a VS Code launch configuration and task.
- Use inside an app directory initialized with `ggt dev`; run `ggt debugger` as a background task and attach your IDE to `localhost:9229`.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@types/pluralize": "^0.0.33",
"@types/semver": "^7.7.1",
"@types/set-cookie-parser": "^2.4.10",
"@types/tcp-port-used": "^1.0.0",
"@types/which": "^3.0.4",
"@types/ws": "^8.5.14",
"@typescript-eslint/eslint-plugin": "^8.11.0",
Expand Down Expand Up @@ -127,6 +128,7 @@
"stdin-discarder": "^0.2.2",
"string-width": "^7.2.0",
"strip-ansi": "^7.1.0",
"tcp-port-used": "^1.0.2",
"terminal-link": "^4.0.0",
"ts-dedent": "^2.2.0",
"ts-node": "^10.9.2",
Expand Down
53 changes: 53 additions & 0 deletions pnpm-lock.yaml

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

4 changes: 4 additions & 0 deletions spec/__support__/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,25 @@ export const testApp: Application = Object.freeze({
id: 1n,
name: "development",
type: EnvironmentType.Development,
nodeVersion: "22.15.0",
},
{
id: 2n,
name: "production",
type: EnvironmentType.Production,
nodeVersion: "22.15.0",
},
{
id: 3n,
name: "cool-environment-development",
type: EnvironmentType.Development,
nodeVersion: "22.15.0",
},
{
id: 4n,
name: "other-environment-development",
type: EnvironmentType.Development,
nodeVersion: "22.15.0",
},
],
team: {
Expand Down
60 changes: 60 additions & 0 deletions spec/commands/__snapshots__/root.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,66 @@ Usage
"
`;

exports[`root > when debugger is given > prints the usage when --help is passed 1`] = `
"Start a Chrome DevTools Protocol proxy server that connects to the Gadget debugger.
This allows you to debug your Gadget app using VS Code, Chrome DevTools, or any other
CDP-compatible debugger client.

Usage
$ ggt debugger [DIRECTORY] [options]

DIRECTORY: The directory containing your Gadget app (default: current directory)

Options
-e, --env <env_name> Selects the environment to debug. Default set on ".gadget/sync.json"
-p, --port <port> Local port for the inspector proxy (default: 9229)
--configure <editor> Configure debugger for vscode, cursor

Examples
start debugger proxy for current environment
$ ggt debugger

use a custom port
$ ggt debugger --port 9230

debug a specific app and environment
$ ggt debugger --app myApp --env development

configure VS Code debugger
$ ggt debugger --configure vscode
"
`;

exports[`root > when debugger is given > prints the usage when -h is passed 1`] = `
"Start a Chrome DevTools Protocol proxy server that connects to the Gadget debugger.
This allows you to debug your Gadget app using VS Code, Chrome DevTools, or any other
CDP-compatible debugger client.

Usage
$ ggt debugger [DIRECTORY] [options]

DIRECTORY: The directory containing your Gadget app (default: current directory)

Options
-e, --env <env_name> Selects the environment to debug. Default set on ".gadget/sync.json"
-p, --port <port> Local port for the inspector proxy (default: 9229)
--configure <editor> Configure debugger for vscode, cursor

Examples
start debugger proxy for current environment
$ ggt debugger

use a custom port
$ ggt debugger --port 9230

debug a specific app and environment
$ ggt debugger --app myApp --env development

configure VS Code debugger
$ ggt debugger --configure vscode
"
`;

exports[`root > when deploy is given > prints the usage when --help is passed 1`] = `
"Deploys your app to production.

Expand Down
Loading