Skip to content

Commit 5f660ff

Browse files
committed
ggt debugger
1 parent 604554e commit 5f660ff

File tree

15 files changed

+1558
-5
lines changed

15 files changed

+1558
-5
lines changed

.changeset/add-debugger.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
ggt: minor
3+
---
4+
5+
Add `ggt debugger` command.
6+
7+
- Debug Gadget via CDP on `localhost:9229` through `ggt`.
8+
- `--configure vscode` prepares a VS Code launch configuration and task.
9+
- Use inside an app directory initialized with `ggt dev`; run `ggt debugger` as a background task and attach your IDE to `localhost:9229`.

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup Node.js
1818
uses: actions/setup-node@v4
1919
with:
20-
node-version: 18
20+
node-version: 20
2121
cache: pnpm
2222

2323
- name: Install dependencies
@@ -38,7 +38,7 @@ jobs:
3838
- name: Setup Node.js
3939
uses: actions/setup-node@v4
4040
with:
41-
node-version: 18
41+
node-version: 20
4242
cache: pnpm
4343

4444
- name: Install dependencies
@@ -59,6 +59,7 @@ jobs:
5959
strategy:
6060
matrix:
6161
os: [ubuntu-latest, macos-latest, windows-latest]
62+
node: [20]
6263
runs-on: ${{ matrix.os }}
6364
steps:
6465
- name: Checkout repository
@@ -70,7 +71,7 @@ jobs:
7071
- name: Setup Node.js
7172
uses: actions/setup-node@v4
7273
with:
73-
node-version: 18
74+
node-version: ${{ matrix.node }}
7475
cache: pnpm
7576

7677
- name: Install dependencies

nix/flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
mkcert = pkgs.mkcert;
2020
nix-direnv = pkgs.nix-direnv;
2121
nixpkgs-fmt = pkgs.nixpkgs-fmt;
22-
nodejs = pkgs.nodejs-18_x;
22+
nodejs = pkgs.nodejs_20;
2323
yarn = pkgs.yarn.override { nodejs = flake.packages.nodejs; };
2424

2525
ggt = pkgs.writeShellScriptBin "ggt" ''

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"@types/pluralize": "^0.0.33",
6363
"@types/semver": "^7.5.8",
6464
"@types/set-cookie-parser": "^2.4.10",
65+
"@types/tcp-port-used": "^1.0.0",
6566
"@types/which": "^3.0.4",
6667
"@types/ws": "^8.5.14",
6768
"@typescript-eslint/eslint-plugin": "^8.11.0",
@@ -127,6 +128,7 @@
127128
"stdin-discarder": "^0.2.2",
128129
"string-width": "^7.2.0",
129130
"strip-ansi": "^7.1.0",
131+
"tcp-port-used": "^1.0.2",
130132
"terminal-link": "^4.0.0",
131133
"ts-dedent": "^2.2.0",
132134
"ts-node": "^10.9.2",
@@ -140,6 +142,6 @@
140142
},
141143
"packageManager": "[email protected]",
142144
"engines": {
143-
"node": ">=18.0.0"
145+
"node": ">=20.0.0"
144146
}
145147
}

pnpm-lock.yaml

Lines changed: 53 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/__support__/app.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,25 @@ export const testApp: Application = Object.freeze({
1717
id: 1n,
1818
name: "development",
1919
type: EnvironmentType.Development,
20+
nodeVersion: "22.15.0",
2021
},
2122
{
2223
id: 2n,
2324
name: "production",
2425
type: EnvironmentType.Production,
26+
nodeVersion: "22.15.0",
2527
},
2628
{
2729
id: 3n,
2830
name: "cool-environment-development",
2931
type: EnvironmentType.Development,
32+
nodeVersion: "22.15.0",
3033
},
3134
{
3235
id: 4n,
3336
name: "other-environment-development",
3437
type: EnvironmentType.Development,
38+
nodeVersion: "22.15.0",
3539
},
3640
],
3741
team: {

spec/commands/__snapshots__/root.spec.ts.snap

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,66 @@ Usage
112112
"
113113
`;
114114
115+
exports[`root > when debugger is given > prints the usage when --help is passed 1`] = `
116+
"Start a Chrome DevTools Protocol proxy server that connects to the Gadget debugger.
117+
This allows you to debug your Gadget app using VS Code, Chrome DevTools, or any other
118+
CDP-compatible debugger client.
119+
120+
Usage
121+
$ ggt debugger [DIRECTORY] [options]
122+
123+
DIRECTORY: The directory containing your Gadget app (default: current directory)
124+
125+
Options
126+
-e, --env <env_name> Selects the environment to debug. Default set on ".gadget/sync.json"
127+
-p, --port <port> Local port for the inspector proxy (default: 9229)
128+
--configure <editor> Configure debugger for vscode, cursor
129+
130+
Examples
131+
start debugger proxy for current environment
132+
$ ggt debugger
133+
134+
use a custom port
135+
$ ggt debugger --port 9230
136+
137+
debug a specific app and environment
138+
$ ggt debugger --app myApp --env development
139+
140+
configure VS Code debugger
141+
$ ggt debugger --configure vscode
142+
"
143+
`;
144+
145+
exports[`root > when debugger is given > prints the usage when -h is passed 1`] = `
146+
"Start a Chrome DevTools Protocol proxy server that connects to the Gadget debugger.
147+
This allows you to debug your Gadget app using VS Code, Chrome DevTools, or any other
148+
CDP-compatible debugger client.
149+
150+
Usage
151+
$ ggt debugger [DIRECTORY] [options]
152+
153+
DIRECTORY: The directory containing your Gadget app (default: current directory)
154+
155+
Options
156+
-e, --env <env_name> Selects the environment to debug. Default set on ".gadget/sync.json"
157+
-p, --port <port> Local port for the inspector proxy (default: 9229)
158+
--configure <editor> Configure debugger for vscode, cursor
159+
160+
Examples
161+
start debugger proxy for current environment
162+
$ ggt debugger
163+
164+
use a custom port
165+
$ ggt debugger --port 9230
166+
167+
debug a specific app and environment
168+
$ ggt debugger --app myApp --env development
169+
170+
configure VS Code debugger
171+
$ ggt debugger --configure vscode
172+
"
173+
`;
174+
115175
exports[`root > when deploy is given > prints the usage when --help is passed 1`] = `
116176
"Deploys your app to production.
117177

0 commit comments

Comments
 (0)