@buildkitgg/dev-domains 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -1
- package/README.md +172 -125
- package/dist/cli/commands.d.ts +11 -0
- package/dist/cli/commands.js +13 -0
- package/dist/cli/main.js +3 -12
- package/dist/cli/terminal.d.ts +2 -1
- package/dist/cli/terminal.js +2 -0
- package/dist/config/load.js +1 -8
- package/dist/config/read.d.ts +3 -2
- package/dist/config/read.js +5 -4
- package/dist/project/detect.js +7 -2
- package/dist/project/discovery.js +1 -1
- package/dist/runtime/port.d.ts +3 -0
- package/dist/runtime/port.js +9 -4
- package/dist/webhooks/gateway.js +4 -3
- package/package.json +12 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
# Change Log - @buildkitgg/dev-domains
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Wed, 18 Nov 2026 02:20:14 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.1.4
|
|
8
|
+
|
|
9
|
+
Wed, 18 Nov 2026 02:20:14 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Accept a separate --cwd or --config value without a command name, and detect next dev --turbo servers (ajcraswell@gmail.com)
|
|
14
|
+
|
|
15
|
+
## 0.1.3
|
|
16
|
+
|
|
17
|
+
Tue, 03 Nov 2026 11:33:33 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- fix: pass the anti-slop lint rules (ajcraswell@gmail.com)
|
|
22
|
+
- Keep the command when publishing: npm dropped a bin path that started with ./ (ajcraswell@gmail.com)
|
|
23
|
+
|
|
7
24
|
## 0.1.2
|
|
8
25
|
|
|
9
26
|
Thu, 29 Oct 2026 04:54:16 GMT
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Stable local URLs for your app, Storybook, and end-to-end test servers, across r
|
|
|
5
5
|
`@buildkitgg/dev-domains` gives each server a predictable hostname and runs it through
|
|
6
6
|
[Portless](https://github.com/vercel-labs/portless). You can open `https://shop.localhost` in your primary checkout and
|
|
7
7
|
`https://shop-fix-login.localhost` in a worktree, with ports assigned automatically. A configuration file lets you
|
|
8
|
-
choose your own names, use a real domain,
|
|
8
|
+
choose your own names, use a real domain, list authentication callback URLs, and expose selected webhook routes.
|
|
9
9
|
|
|
10
10
|
Requires Node.js 24 or later. Supports Windows, macOS, and Linux.
|
|
11
11
|
|
|
@@ -43,16 +43,16 @@ routes served by the same process share that endpoint.
|
|
|
43
43
|
|
|
44
44
|
The package follows a few principles:
|
|
45
45
|
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
|
|
46
|
+
- Conventional setups work without a config file. Save a typed configuration when your project needs different names or
|
|
47
|
+
commands.
|
|
48
|
+
- Linked worktrees are named after their folders. The primary checkout gets no `main` label, and hostnames never carry
|
|
49
|
+
random hashes.
|
|
50
|
+
- [Portless](https://github.com/vercel-labs/portless) provides local routing and HTTPS. This package adds tool
|
|
51
|
+
detection, typed configuration, and consistent domains across apps and worktrees.
|
|
52
|
+
- A running endpoint keeps its hostname. Another process that wants the same name gets an error and must choose a
|
|
53
|
+
different one; it never takes over the route.
|
|
54
|
+
- Authentication providers, cloud resources, DNS administration, and deployment stay under your control. You don't need
|
|
55
|
+
a Buildkit account or hosted service.
|
|
56
56
|
|
|
57
57
|
Separate hostnames and ports do not isolate databases, storage, credentials, or framework build directories. This
|
|
58
58
|
package manages local server addresses and processes; resource isolation remains part of your application setup.
|
|
@@ -70,9 +70,10 @@ the root; installing it only in `apps/web` may not satisfy that import. A worksp
|
|
|
70
70
|
or owns its own typed configuration must also be able to resolve the package. Declare a dependency in that workspace
|
|
71
71
|
when your package manager isolates workspace dependencies.
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
The commands in this guide use `npx @buildkitgg/dev-domains`, which runs the locally installed CLI. Installing and
|
|
74
|
+
locking the dependency keeps the CLI and configuration helpers on the same version. Portless is a dependency of this
|
|
75
|
+
package, so you don't install it separately. Your application frameworks and any tunnel executable must already be
|
|
76
|
+
installed.
|
|
76
77
|
|
|
77
78
|
On Windows, Portless also requires OpenSSL on `PATH`. Initial HTTPS setup can require permission to trust a local
|
|
78
79
|
certificate authority, bind the proxy port, or update the hosts file. Run setup interactively on each development
|
|
@@ -114,12 +115,19 @@ Run the wizard when you want to choose and save your endpoints:
|
|
|
114
115
|
npx @buildkitgg/dev-domains init
|
|
115
116
|
```
|
|
116
117
|
|
|
117
|
-
The wizard
|
|
118
|
-
optional authentication callback paths, a dedicated Playwright server, and webhook tunneling. Detected E2E servers start
|
|
119
|
-
unchecked. Review the resulting domains before saving `dev-domains.json` at the checkout root.
|
|
118
|
+
The wizard walks through these steps:
|
|
120
119
|
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
1. Confirm the project name and the local domain suffix.
|
|
121
|
+
2. Select which detected servers get domains. Detected E2E servers start unchecked. If nothing is detected, enter a
|
|
122
|
+
server command as a JSON argument array instead.
|
|
123
|
+
3. Set the primary-checkout and worktree name templates for each endpoint.
|
|
124
|
+
4. For each app endpoint, optionally add authentication callback paths, a dedicated Playwright server, or a webhook
|
|
125
|
+
tunnel.
|
|
126
|
+
5. Review the resulting domains and save `dev-domains.json` at the checkout root.
|
|
127
|
+
|
|
128
|
+
Use arrow keys to move, Space to toggle a selection, and Enter to continue. Ctrl+C cancels, and cancelling writes
|
|
129
|
+
nothing. If the checkout root already has a dev-domains config, `init` stops without changing it. It never rewrites
|
|
130
|
+
package scripts.
|
|
123
131
|
|
|
124
132
|
For noninteractive setup:
|
|
125
133
|
|
|
@@ -128,33 +136,35 @@ npx @buildkitgg/dev-domains init --yes --dry-run
|
|
|
128
136
|
npx @buildkitgg/dev-domains init --yes --project shop --domain localhost
|
|
129
137
|
```
|
|
130
138
|
|
|
131
|
-
`--yes` accepts detected ordinary servers and omits optional E2E servers.
|
|
132
|
-
without saving it. Without `--yes`, a dry run still uses the interactive
|
|
133
|
-
hostname layouts also require the name templates described under
|
|
139
|
+
`--yes` accepts detected ordinary servers and omits optional E2E servers. Without a terminal, `init` requires `--yes`.
|
|
140
|
+
`--dry-run` prints the proposed configuration without saving it. Without `--yes`, a dry run still uses the interactive
|
|
141
|
+
wizard. `--domain` changes the suffix; custom hostname layouts also require the name templates described under
|
|
142
|
+
[Domain naming](#domain-naming).
|
|
134
143
|
|
|
135
144
|
## Zero-configuration behavior
|
|
136
145
|
|
|
137
146
|
When no configuration file is found, these conventions determine the candidates:
|
|
138
147
|
|
|
139
|
-
| Concern | Behavior
|
|
140
|
-
| ---------------------- |
|
|
141
|
-
| Project root | The current Git checkout root; outside Git, the current directory or `--cwd`
|
|
142
|
-
| Project name | Root `package.json` name, otherwise the root folder name, normalized as described below
|
|
143
|
-
| Package manager | Root `packageManager`, then `devEngines.packageManager`, then lockfiles, then installation metadata; npm if none is found
|
|
144
|
-
| Workspace packages | Root plus declared `pnpm-workspace.yaml` packages or `package.json` workspaces; without declarations, packages found recursively below the root
|
|
145
|
-
| App server | The package's `dev` script,
|
|
146
|
-
| Storybook server | A script containing `storybook dev`; otherwise a discovered `.storybook/main.*` config
|
|
147
|
-
| Playwright candidate | A `playwright.config.*` file, an `@playwright/test` dependency, or a `playwright test` script, together with an app dev script in the same package
|
|
148
|
-
| Framework |
|
|
149
|
-
| Local proxy | HTTPS on port 443, suffix `localhost`, hosts synchronization enabled
|
|
150
|
-
| Auth and public access | No callback paths or tunnels are inferred
|
|
148
|
+
| Concern | Behavior |
|
|
149
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
150
|
+
| Project root | The current Git checkout root; outside Git, the current directory or `--cwd` |
|
|
151
|
+
| Project name | Root `package.json` name, otherwise the root folder name, normalized as described below |
|
|
152
|
+
| Package manager | Root `packageManager`, then `devEngines.packageManager`, then lockfiles, then installation metadata; npm if none is found |
|
|
153
|
+
| Workspace packages | Root plus declared `pnpm-workspace.yaml` packages or `package.json` workspaces; without declarations, packages found recursively below the root |
|
|
154
|
+
| App server | The package's `dev` script, unless it runs `storybook dev` or `playwright test`; other script names require explicit configuration |
|
|
155
|
+
| Storybook server | A script containing `storybook dev`; otherwise a discovered `.storybook/main.*` config |
|
|
156
|
+
| Playwright candidate | A `playwright.config.*` file, an `@playwright/test` dependency, or a `playwright test` script, together with an app dev script in the same package |
|
|
157
|
+
| Framework | A script that starts with `next dev`, `vite`, or `storybook dev` and contains no `;`, `&`, `\|`, `#`, or standalone `--` gets framework flags; anything else is `custom` |
|
|
158
|
+
| Local proxy | HTTPS on port 443, suffix `localhost`, hosts synchronization enabled |
|
|
159
|
+
| Auth and public access | No callback paths or tunnels are inferred |
|
|
151
160
|
|
|
152
161
|
Package-manager detection stays at the selected project root. A declaration takes precedence over stale lockfiles.
|
|
153
162
|
Conflicting lockfiles without a declaration require you to choose a manager in `package.json` or an explicit config.
|
|
154
163
|
|
|
155
|
-
Scripts that
|
|
156
|
-
|
|
157
|
-
script
|
|
164
|
+
Scripts that contain the word `dev-domains`, `portless`, `run-p`, or `concurrently`, or that run the `turbo` command,
|
|
165
|
+
are excluded from detection. A `--turbo` flag doesn't count, so `next dev --turbo` is still detected as a Next.js
|
|
166
|
+
server. Point configuration at the underlying server script when an aggregate or wrapper command is involved. A
|
|
167
|
+
`playwright test` script is never used as the app server.
|
|
158
168
|
|
|
159
169
|
There is no universally required development script name. `dev` is the default convention; scripts with any other name
|
|
160
170
|
work through an explicit `script` setting. Detection does not guess whether `start`, `serve`, or a custom script is a
|
|
@@ -162,24 +172,35 @@ development server, production server, or build task.
|
|
|
162
172
|
|
|
163
173
|
### Storybook and Playwright discovery
|
|
164
174
|
|
|
165
|
-
Discovery
|
|
166
|
-
`cjs`, `tsx`,
|
|
167
|
-
|
|
175
|
+
Discovery makes one walk through the project, looking for `.storybook/main.*` and `playwright.config.*` files with a
|
|
176
|
+
`ts`, `mts`, `cts`, `js`, `mjs`, `cjs`, `tsx`, or `jsx` extension. It finds them without importing or running them.
|
|
177
|
+
|
|
178
|
+
- A config belongs to its nearest package, including nested paths such as `tests/playwright.config.ts`. A config inside
|
|
179
|
+
a package that your workspace declarations leave out is ignored.
|
|
180
|
+
- The walk honors workspace exclusions. It skips symlinks, `node_modules`, generated output (`dist`, `build`, `out`,
|
|
181
|
+
`coverage`, `storybook-static`, `playwright-report`, and `test-results`), and hidden directories other than
|
|
182
|
+
`.storybook`.
|
|
183
|
+
- Use explicit configuration for unusual layouts, or when discovery reports too many packages or directories.
|
|
184
|
+
|
|
185
|
+
For Storybook:
|
|
186
|
+
|
|
187
|
+
- A script containing `storybook dev` takes precedence over a config file.
|
|
188
|
+
- With one config and no such script, the candidate runs the installed binary as `storybook dev --config-dir`, followed
|
|
189
|
+
by the config's directory. Nothing is downloaded.
|
|
190
|
+
- Several Storybook scripts in one package, or several configs without a script, require explicit configuration.
|
|
191
|
+
- An empty `.storybook` folder or a Storybook dependency alone doesn't make a runnable server.
|
|
168
192
|
|
|
169
|
-
|
|
170
|
-
|
|
193
|
+
Finding Playwright doesn't reveal which server your tests need, so the suggested E2E endpoint keeps to the package's own
|
|
194
|
+
dev server:
|
|
171
195
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
196
|
+
- It starts a separate copy of the package's `dev` server. It doesn't read Playwright's `webServer` configuration.
|
|
197
|
+
- It's named `app-e2e`, or `<package>-app-e2e` in a workspace package.
|
|
198
|
+
- `init --yes` omits it, and the wizard lists it unchecked. Select it there, or run it by name when using zero
|
|
199
|
+
configuration.
|
|
176
200
|
|
|
177
|
-
|
|
178
|
-
package
|
|
179
|
-
|
|
180
|
-
`init --yes` omits it. A dependency on the `playwright` browser library alone does not imply an E2E test setup. Separate
|
|
181
|
-
test-only packages and cross-package server relationships need explicit configuration. See [Playwright](#playwright)
|
|
182
|
-
before running an E2E server alongside your app.
|
|
201
|
+
A dependency on the `playwright` browser library alone doesn't count as an E2E test setup. Separate test-only packages
|
|
202
|
+
and cross-package server relationships need explicit configuration. See [Playwright](#playwright) before running an E2E
|
|
203
|
+
server alongside your app.
|
|
183
204
|
|
|
184
205
|
## Domain naming
|
|
185
206
|
|
|
@@ -248,7 +269,8 @@ export default defineConfig({
|
|
|
248
269
|
```
|
|
249
270
|
|
|
250
271
|
Use `domain: "example.com"` with `primaryName: "local"` to get the bare `local.example.com` address. Setting only
|
|
251
|
-
`domain: "local.example.com"`
|
|
272
|
+
`domain: "local.example.com"` keeps the name template's prefix, such as `shop.local.example.com` for a detected root
|
|
273
|
+
app.
|
|
252
274
|
|
|
253
275
|
The same convention can cover additional servers you configure:
|
|
254
276
|
|
|
@@ -407,18 +429,18 @@ Names, paths, and templates are validated when the config is loaded or resolved.
|
|
|
407
429
|
|
|
408
430
|
Each entry in `endpoints` has these fields. Set **exactly one** of `script` or `command`.
|
|
409
431
|
|
|
410
|
-
| Field | Type | Default or requirement | Description
|
|
411
|
-
| ------------- | ------------------------------------------------ | ---------------------------------- |
|
|
412
|
-
| `kind` | `"app"`, `"storybook"`, or `"e2e"` | `"app"` | Endpoint purpose; the Playwright helper requires `"e2e"`
|
|
413
|
-
| `cwd` | `string` | `"."` | Server working directory, relative to the configuration root
|
|
414
|
-
| `primaryName` | `string` | `"{project}-{service}"` | Name template used in the primary checkout
|
|
415
|
-
| `name` | `string` | `"{project}-{worktree}-{service}"` | Name template used in a linked worktree
|
|
416
|
-
| `script` | Nonempty string | Required unless `command` is set | Script from `cwd`'s `package.json`;
|
|
417
|
-
| `command` | Nonempty string array | Required unless `script` is set | Executable followed by arguments; each element must be nonempty and contain no NUL character
|
|
418
|
-
| `framework` | `"next"`, `"vite"`, `"storybook"`, or `"custom"` | `"custom"` | Selects host and port flag adaptation; it is independent of `kind`
|
|
419
|
-
| `env` | Record of string values | `{}` | Additional child-process environment variables; supports templates
|
|
420
|
-
| `auth` | String array | `[]` | Callback paths included in the `urls` output
|
|
421
|
-
| `tunnel` | Object | Omitted | Optional public webhook tunnel settings below
|
|
432
|
+
| Field | Type | Default or requirement | Description |
|
|
433
|
+
| ------------- | ------------------------------------------------ | ---------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
434
|
+
| `kind` | `"app"`, `"storybook"`, or `"e2e"` | `"app"` | Endpoint purpose; the Playwright helper requires `"e2e"` |
|
|
435
|
+
| `cwd` | `string` | `"."` | Server working directory, relative to the configuration root |
|
|
436
|
+
| `primaryName` | `string` | `"{project}-{service}"` | Name template used in the primary checkout |
|
|
437
|
+
| `name` | `string` | `"{project}-{worktree}-{service}"` | Name template used in a linked worktree |
|
|
438
|
+
| `script` | Nonempty string | Required unless `command` is set | Script from `cwd`'s `package.json`; it must exist and must not call `dev-domains` or `portless` |
|
|
439
|
+
| `command` | Nonempty string array | Required unless `script` is set | Executable followed by arguments; each element must be nonempty and contain no NUL character |
|
|
440
|
+
| `framework` | `"next"`, `"vite"`, `"storybook"`, or `"custom"` | `"custom"` | Selects host and port flag adaptation; it is independent of `kind` |
|
|
441
|
+
| `env` | Record of string values | `{}` | Additional child-process environment variables; supports templates |
|
|
442
|
+
| `auth` | String array | `[]` | Callback paths included in the `urls` output |
|
|
443
|
+
| `tunnel` | Object | Omitted | Optional public webhook tunnel settings below |
|
|
422
444
|
|
|
423
445
|
Environment keys must start with a letter or underscore and contain only letters, digits, and underscores. `PORT`,
|
|
424
446
|
`HOST`, keys starting with `PORTLESS`, and keys starting with `BUILDKIT_` are reserved. Keep secrets in your environment
|
|
@@ -428,11 +450,11 @@ or your application's secret-loading mechanism rather than committing them to th
|
|
|
428
450
|
|
|
429
451
|
These fields apply only when an endpoint has a `tunnel` object:
|
|
430
452
|
|
|
431
|
-
| Field | Type | Default or requirement | Description
|
|
432
|
-
| ------------------ | --------------------- | ---------------------- |
|
|
433
|
-
| `tunnel.command` | Nonempty string array | Required | Tunnel executable and arguments; must contain `{url}
|
|
434
|
-
| `tunnel.paths` | Nonempty string array | Required | Exact allowed POST paths
|
|
435
|
-
| `tunnel.publicUrl` | HTTPS origin string | Optional | An existing stable public origin, used for display and `urls` output; it does not provision a tunnel
|
|
453
|
+
| Field | Type | Default or requirement | Description |
|
|
454
|
+
| ------------------ | --------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
455
|
+
| `tunnel.command` | Nonempty string array | Required | Tunnel executable and arguments; one argument must contain `{url}`, the local gateway's address, or the tunnel won't start |
|
|
456
|
+
| `tunnel.paths` | Nonempty string array | Required | Exact allowed POST paths |
|
|
457
|
+
| `tunnel.publicUrl` | HTTPS origin string | Optional | An existing stable public origin, used for display and `urls` output; it does not provision a tunnel |
|
|
436
458
|
|
|
437
459
|
`auth` and `tunnel.paths` values must begin with one `/`. They cannot include query strings, fragments, backslashes,
|
|
438
460
|
percent encoding, or `.` / `..` path segments. Tunnel paths are exact matches, not wildcard patterns. `tunnel.publicUrl`
|
|
@@ -468,6 +490,15 @@ For example, an endpoint can set `env: { APP_URL: "{origin}", AUTH_REDIRECT_URI:
|
|
|
468
490
|
process environment variables are inherited. The runtime values listed above take precedence over same-named values
|
|
469
491
|
inherited from the shell or supplied through `env`.
|
|
470
492
|
|
|
493
|
+
The server also receives a few variables for its tools:
|
|
494
|
+
|
|
495
|
+
- `__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS` lists the endpoint's hostnames, so Vite accepts them without allowed-hosts
|
|
496
|
+
configuration.
|
|
497
|
+
- With HTTPS, `NODE_EXTRA_CA_CERTS` points at Portless's local certificate authority, so Node.js code in the server
|
|
498
|
+
trusts the local origins. A value you already set is kept.
|
|
499
|
+
- `PORTLESS_URL` holds the origin.
|
|
500
|
+
- `BUILDKIT_ACTIVE` makes a nested `dev-domains run` inside the server stop with a recursion error.
|
|
501
|
+
|
|
471
502
|
## Server commands and frameworks
|
|
472
503
|
|
|
473
504
|
Use `script` to run an existing package script, or `command` for an executable and argument array. Arguments remain
|
|
@@ -503,8 +534,8 @@ command directly, such as `command: ["vite"]` and `framework: "vite"`. Pointing
|
|
|
503
534
|
would start the CLI again and is rejected. You do not need a second package script with a special name.
|
|
504
535
|
|
|
505
536
|
Your framework still controls allowed hosts, development origins, and output directories. Add your generated hostnames
|
|
506
|
-
to its configuration where required. When a server exits, its exit code is
|
|
507
|
-
port conflict rather than silently switching ports.
|
|
537
|
+
to its configuration where required; Vite reads them from the environment. When a server exits, its exit code is
|
|
538
|
+
propagated. Custom servers must fail on a port conflict rather than silently switching ports.
|
|
508
539
|
|
|
509
540
|
## Playwright
|
|
510
541
|
|
|
@@ -533,11 +564,11 @@ export default defineConfig({
|
|
|
533
564
|
})
|
|
534
565
|
```
|
|
535
566
|
|
|
536
|
-
`playwrightServer(
|
|
537
|
-
`webServer` configuration that runs the endpoint, waits up to 120
|
|
538
|
-
add other Playwright `use` or `webServer` options, merge those
|
|
539
|
-
monorepo, use the exact configured endpoint key, such as
|
|
540
|
-
dev-domains config can be found.
|
|
567
|
+
`playwrightServer(service, cwd?)` loads the project from `cwd` or `process.cwd()`. It returns `use.baseURL` and a
|
|
568
|
+
`webServer` configuration that runs `dev-domains run` for the endpoint from the configuration root, waits up to 120
|
|
569
|
+
seconds, and sets `reuseExistingServer: false`. If you add other Playwright `use` or `webServer` options, merge those
|
|
570
|
+
nested objects so you preserve the helper's values. In a monorepo, use the exact configured endpoint key, such as
|
|
571
|
+
`web-app-e2e`, and a working directory from which the intended dev-domains config can be found.
|
|
541
572
|
|
|
542
573
|
The endpoint's script must start a server, not run `playwright test`. The helper does not install Playwright or edit its
|
|
543
574
|
configuration. Run `npx @buildkitgg/dev-domains setup` before the test run on a development machine.
|
|
@@ -614,11 +645,17 @@ No separate webhook subdomain is required. A quick tunnel URL may change after r
|
|
|
614
645
|
configure a stable tunnel with your provider and optionally record its HTTPS origin in `tunnel.publicUrl`. That property
|
|
615
646
|
reports an existing address; it does not reserve a domain or configure the tunnel command.
|
|
616
647
|
|
|
617
|
-
The tunnel
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
648
|
+
The tunnel reaches your app through a restricted local gateway, which:
|
|
649
|
+
|
|
650
|
+
- Accepts only POST requests whose path exactly matches an entry in `tunnel.paths`, and answers anything else with 404.
|
|
651
|
+
- Preserves query strings, raw request bytes, and signature headers.
|
|
652
|
+
- Strips hop-by-hop headers and the inbound `Forwarded`, `X-Forwarded-For`, and `X-Forwarded-Host` headers.
|
|
653
|
+
- Rejects request bodies over 1 MiB with 413.
|
|
654
|
+
- Answers 502 when the app can't be reached or doesn't respond within 15 seconds, and 503 when the endpoint has stopped.
|
|
655
|
+
- Never logs or stores payloads.
|
|
656
|
+
|
|
657
|
+
Your application must validate provider signatures. Providers that require a GET verification challenge need a different
|
|
658
|
+
ingress arrangement, because this gateway is POST-only.
|
|
622
659
|
|
|
623
660
|
Install and authenticate the tunnel executable separately. It runs from the configuration root and inherits the shell
|
|
624
661
|
environment, rather than the endpoint's server `env` overrides. Keep credentials in the provider's login store or
|
|
@@ -627,8 +664,23 @@ running. A hosted receiver, durable delivery, and replay are not included.
|
|
|
627
664
|
|
|
628
665
|
## Sharing a proxy across projects
|
|
629
666
|
|
|
630
|
-
One
|
|
631
|
-
|
|
667
|
+
One Portless proxy can serve every project on a machine, each with its own domain: `local.example.com` and
|
|
668
|
+
`local.example.org` can run together on the same proxy. Starting an endpoint leaves other servers running. Projects that
|
|
669
|
+
share the proxy follow these rules:
|
|
670
|
+
|
|
671
|
+
- Every project must use the same proxy port and TLS setting. If the running proxy differs, startup stops with an error
|
|
672
|
+
and leaves the proxy running.
|
|
673
|
+
- Hosts synchronization is set when the proxy starts. If it started with synchronization disabled, `syncHosts: true`
|
|
674
|
+
cannot change that running process; coordinate proxy configuration or configure DNS yourself. Either way, every custom
|
|
675
|
+
hostname must resolve to loopback.
|
|
676
|
+
- A collision means the **complete hostname** is occupied, not just the endpoint name. A running server keeps its
|
|
677
|
+
hostname; choose another name if the CLI reports a collision.
|
|
678
|
+
- Backend ports are assigned automatically. After a port conflict, startup can run the server command up to three times,
|
|
679
|
+
so server commands should be safe to repeat.
|
|
680
|
+
|
|
681
|
+
`npx @buildkitgg/dev-domains doctor` helps diagnose the current state.
|
|
682
|
+
|
|
683
|
+
To give one project's endpoints additional aliases, configure an explicit list:
|
|
632
684
|
|
|
633
685
|
```ts
|
|
634
686
|
// Root configuration fields, alongside project and endpoints.
|
|
@@ -641,34 +693,26 @@ proxy: {
|
|
|
641
693
|
}
|
|
642
694
|
```
|
|
643
695
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
each endpoint under those suffixes only; `domain` selects its canonical origin. A collision means the **complete
|
|
647
|
-
hostname** is occupied, not just the endpoint name.
|
|
648
|
-
|
|
649
|
-
Projects sharing one proxy must agree on its port and TLS settings. Starting an endpoint leaves other servers running.
|
|
650
|
-
DNS must resolve every custom hostname to loopback; either use Portless's hosts synchronization or configure DNS
|
|
651
|
-
yourself. If the existing proxy was started with hosts synchronization disabled, `syncHosts: true` cannot change that
|
|
652
|
-
running process. Coordinate proxy configuration or configure DNS separately. `npx @buildkitgg/dev-domains doctor` helps
|
|
653
|
-
diagnose the current state.
|
|
654
|
-
|
|
655
|
-
Backend ports are assigned automatically. Startup may be retried after a port conflict, so server commands should be
|
|
656
|
-
safe to repeat. A running server keeps its hostname; choose another name if the CLI reports a collision.
|
|
696
|
+
An explicit list registers each endpoint under those suffixes only, and `domain` selects its canonical origin. Leave
|
|
697
|
+
`proxy.domains` unset unless this project's endpoints need aliases.
|
|
657
698
|
|
|
658
699
|
## CI usage
|
|
659
700
|
|
|
660
701
|
Commit a configuration and use explicit endpoint names in noninteractive jobs. The Playwright helper can start a
|
|
661
702
|
dedicated test server, or you can keep your existing loopback-based Playwright setup.
|
|
662
703
|
|
|
663
|
-
For jobs that use Portless
|
|
664
|
-
a CI config can use `proxy: { https: false, port: 8080, syncHosts: false }`. Ensure generated hostnames resolve to
|
|
665
|
-
loopback in the runner when hosts synchronization is disabled. HTTP avoids a certificate-trust step; HTTPS requires the
|
|
666
|
-
runner to trust the local certificate authority. Select a complete CI config through the normal file-loading rules or
|
|
667
|
-
`--config` for CLI commands; there is no implicit environment-specific config merge.
|
|
704
|
+
For jobs that use Portless:
|
|
668
705
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
706
|
+
- Set a job-specific `PORTLESS_STATE_DIR` and choose an unprivileged proxy port. For example, a CI config can use
|
|
707
|
+
`proxy: { https: false, port: 8080, syncHosts: false }`.
|
|
708
|
+
- With hosts synchronization disabled, make sure generated hostnames resolve to loopback on the runner.
|
|
709
|
+
- HTTP avoids a certificate-trust step; HTTPS requires the runner to trust the local certificate authority.
|
|
710
|
+
- Select a complete CI config through the normal file-loading rules, or with `--config` for CLI commands. There is no
|
|
711
|
+
implicit environment-specific config merge.
|
|
712
|
+
- The Playwright helper uses normal config discovery from its `cwd` and doesn't accept the CLI's `--config` option. If
|
|
713
|
+
you use the helper, place the CI config where that lookup finds it.
|
|
714
|
+
- Concurrent jobs sharing a machine need compatible shared proxy settings or distinct proxy ports. A separate state
|
|
715
|
+
directory alone doesn't free a bound port.
|
|
672
716
|
|
|
673
717
|
## Command reference
|
|
674
718
|
|
|
@@ -677,7 +721,7 @@ first.
|
|
|
677
721
|
|
|
678
722
|
| Command | Purpose | Supported project options |
|
|
679
723
|
| ----------------------------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
680
|
-
| `npx @buildkitgg/dev-domains` |
|
|
724
|
+
| `npx @buildkitgg/dev-domains` | Same as `run` with no endpoint name; select an endpoint if several exist | `--cwd`, `--config` |
|
|
681
725
|
| `npx @buildkitgg/dev-domains run [endpoint]` | Start one detected or configured endpoint | `--cwd`, `--config` |
|
|
682
726
|
| `npx @buildkitgg/dev-domains init` | Run the setup wizard and save `dev-domains.json` | `--cwd`, `--yes`, `--dry-run`, `--project`, `--domain` |
|
|
683
727
|
| `npx @buildkitgg/dev-domains detect` | Print detected candidates as JSON, ignoring saved dev-domains config | `--cwd` |
|
|
@@ -689,26 +733,29 @@ first.
|
|
|
689
733
|
| `npx @buildkitgg/dev-domains schema` | Print the configuration JSON Schema | None |
|
|
690
734
|
|
|
691
735
|
`--cwd` defaults to the current directory. `--config` is a file path relative to `--cwd`. Use `--help` on a command for
|
|
692
|
-
its options. `run` and `tunnel` require an endpoint name in noninteractive sessions when more than one candidate exists
|
|
736
|
+
its options. `run` and `tunnel` require an endpoint name in noninteractive sessions when more than one candidate exists;
|
|
737
|
+
`tunnel` only offers endpoints that have a `tunnel` object. Put options after the command name.
|
|
693
738
|
|
|
694
|
-
The CLI never rewrites package scripts. It propagates server exit codes
|
|
695
|
-
server stops normally. The shared proxy stays available
|
|
696
|
-
and stop any remaining server process you own before
|
|
697
|
-
directory; most consumers should keep the default shared
|
|
739
|
+
The CLI never rewrites package scripts. It propagates server exit codes, exits with 1 on an error and 130 when you
|
|
740
|
+
cancel a prompt, and releases the endpoint's hostname when the server stops normally. The shared proxy stays available
|
|
741
|
+
for other servers. After a forced termination, check `status` and stop any remaining server process you own before
|
|
742
|
+
restarting it. `PORTLESS_STATE_DIR` can select a separate state directory; most consumers should keep the default shared
|
|
743
|
+
state.
|
|
698
744
|
|
|
699
745
|
## Troubleshooting
|
|
700
746
|
|
|
701
|
-
| Symptom | What to check
|
|
702
|
-
| ---------------------------------------------------- |
|
|
703
|
-
| No endpoints were detected | Run `detect`; check the app script conventions or add an explicit `command` / `script` endpoint
|
|
704
|
-
| A wrapped script is rejected | Set `command` to the server executable, or reference a script that starts the server directly
|
|
705
|
-
| An endpoint name is ambiguous | Use `urls` for configured names or `detect` for discovered names, then pass one to `run`
|
|
706
|
-
| Multiple configs or Storybook candidates were found | Keep one dev-domains config per directory; select the intended Storybook script or config directory explicitly
|
|
707
|
-
| The wrong package manager is used | In a saved config, set `packageManager`; during discovery, check the root declaration and conflicting lockfiles
|
|
708
|
-
| A hostname is already in use | Check `status`, then choose a distinct name or stop the server you own; do not take over another process's route
|
|
709
|
-
| The proxy has different settings | Align port and TLS settings with the existing shared proxy before restarting your endpoint
|
|
710
|
-
| The hostname does not resolve or HTTPS is untrusted | Run `doctor`; check loopback DNS or hosts synchronization and complete Portless certificate setup
|
|
711
|
-
| The framework rejects the hostname | Configure its allowed hosts or development origins for your generated domains
|
|
712
|
-
| App and E2E servers conflict despite different ports | Configure separate framework build/output directories or caches
|
|
713
|
-
| A webhook returns 404 | Confirm it is a POST request to an exact allowed path; GET verification challenges are not supported by this gateway
|
|
714
|
-
| A webhook
|
|
747
|
+
| Symptom | What to check |
|
|
748
|
+
| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
749
|
+
| No endpoints were detected | Run `detect`; check the app script conventions or add an explicit `command` / `script` endpoint |
|
|
750
|
+
| A wrapped script is rejected | Set `command` to the server executable, or reference a script that starts the server directly |
|
|
751
|
+
| An endpoint name is ambiguous | Use `urls` for configured names or `detect` for discovered names, then pass one to `run` |
|
|
752
|
+
| Multiple configs or Storybook candidates were found | Keep one dev-domains config per directory; select the intended Storybook script or config directory explicitly |
|
|
753
|
+
| The wrong package manager is used | In a saved config, set `packageManager`; during discovery, check the root declaration and conflicting lockfiles |
|
|
754
|
+
| A hostname is already in use | Check `status`, then choose a distinct name or stop the server you own; do not take over another process's route |
|
|
755
|
+
| The proxy has different settings | Align port and TLS settings with the existing shared proxy before restarting your endpoint |
|
|
756
|
+
| The hostname does not resolve or HTTPS is untrusted | Run `doctor`; check loopback DNS or hosts synchronization and complete Portless certificate setup |
|
|
757
|
+
| The framework rejects the hostname | Configure its allowed hosts or development origins for your generated domains |
|
|
758
|
+
| App and E2E servers conflict despite different ports | Configure separate framework build/output directories or caches |
|
|
759
|
+
| A webhook returns 404 | Confirm it is a POST request to an exact allowed path; GET verification challenges are not supported by this gateway |
|
|
760
|
+
| A webhook returns 502, 503, or 413 | 502: the app couldn't be reached or didn't respond within 15 seconds; 503: start the endpoint again; 413: the body exceeds 1 MiB |
|
|
761
|
+
| A webhook cannot reach the app | Start the target endpoint first, verify the provider's current public URL, and check the tunnel process |
|
package/dist/cli/commands.d.ts
CHANGED
|
@@ -123,3 +123,14 @@ export declare const commands: {
|
|
|
123
123
|
}>;
|
|
124
124
|
schema: import("citty").CommandDef<import("citty").ArgsDef>;
|
|
125
125
|
};
|
|
126
|
+
export declare const cli: import("citty").CommandDef<{
|
|
127
|
+
readonly cwd: {
|
|
128
|
+
readonly type: "string";
|
|
129
|
+
readonly description: "Project directory";
|
|
130
|
+
readonly default: ".";
|
|
131
|
+
};
|
|
132
|
+
readonly config: {
|
|
133
|
+
readonly type: "string";
|
|
134
|
+
readonly description: "Explicit config file (relative to cwd)";
|
|
135
|
+
};
|
|
136
|
+
}>;
|
package/dist/cli/commands.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { defineCommand as defineRootCommand } from "citty";
|
|
1
3
|
import { z } from "zod";
|
|
2
4
|
import { loadProject } from "../config/load.js";
|
|
3
5
|
import { configSchema } from "../config/schema.js";
|
|
@@ -97,3 +99,14 @@ export const commands = {
|
|
|
97
99
|
}
|
|
98
100
|
})
|
|
99
101
|
};
|
|
102
|
+
const { version } = z
|
|
103
|
+
.object({ version: z.string() })
|
|
104
|
+
.parse(JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")));
|
|
105
|
+
export const cli = defineRootCommand({
|
|
106
|
+
meta: { name: "dev-domains", version, description: "Stable local domains for every app and checkout" },
|
|
107
|
+
// Without a command name the CLI runs `run`. Citty only skips an option's separate value (`--cwd apps/web`) when
|
|
108
|
+
// looking for a command name if the option is declared here.
|
|
109
|
+
args: location,
|
|
110
|
+
default: "run",
|
|
111
|
+
subCommands: commands
|
|
112
|
+
});
|
package/dist/cli/main.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { commands } from "./commands.js";
|
|
6
|
-
const { version } = z
|
|
7
|
-
.object({ version: z.string() })
|
|
8
|
-
.parse(JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")));
|
|
9
|
-
await runMain(defineCommand({
|
|
10
|
-
meta: { name: "dev-domains", version, description: "Stable local domains for every app and checkout" },
|
|
11
|
-
default: "run",
|
|
12
|
-
subCommands: commands
|
|
13
|
-
}));
|
|
2
|
+
import { runMain } from "citty";
|
|
3
|
+
import { cli } from "./commands.js";
|
|
4
|
+
await runMain(cli);
|
package/dist/cli/terminal.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export declare class Cancelled extends Error {
|
|
|
3
3
|
}
|
|
4
4
|
export declare function answer<T>(value: T): Exclude<T, symbol>;
|
|
5
5
|
export declare function intro(): void;
|
|
6
|
-
|
|
6
|
+
/** Prints any value the CLI reports, as JSON. */
|
|
7
|
+
export declare function output<T>(value: T): void;
|
|
7
8
|
export declare function text(value: string): void;
|
|
8
9
|
export declare function chooseEndpoint(names: {
|
|
9
10
|
service: string;
|
package/dist/cli/terminal.js
CHANGED
|
@@ -6,6 +6,7 @@ export class Cancelled extends Error {
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
export function answer(value) {
|
|
9
|
+
// oxlint-disable-next-line anti-slop/no-runtime-typeof -- a prompt answers with a symbol when it is cancelled
|
|
9
10
|
if (typeof value === "symbol") {
|
|
10
11
|
throw new Cancelled();
|
|
11
12
|
}
|
|
@@ -14,6 +15,7 @@ export function answer(value) {
|
|
|
14
15
|
export function intro() {
|
|
15
16
|
prompts.intro(`${styleText(["bgBlue", "white"], " BUILDKIT ")} / Development domains`);
|
|
16
17
|
}
|
|
18
|
+
/** Prints any value the CLI reports, as JSON. */
|
|
17
19
|
export function output(value) {
|
|
18
20
|
process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
|
|
19
21
|
}
|
package/dist/config/load.js
CHANGED
|
@@ -43,15 +43,8 @@ export async function loadProject(cwd, explicitFile) {
|
|
|
43
43
|
const file = explicitFile
|
|
44
44
|
? await realpath(path.resolve(cwd, explicitFile))
|
|
45
45
|
: await findConfig(await realpath(cwd), identity.root);
|
|
46
|
-
let input;
|
|
47
46
|
const root = file ? path.dirname(file) : identity.root;
|
|
48
|
-
|
|
49
|
-
input = await readConfigFile(file);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
input = await detectConfig(root);
|
|
53
|
-
}
|
|
54
|
-
const result = configSchema.safeParse(input);
|
|
47
|
+
const result = file ? await readConfigFile(file, configSchema) : configSchema.safeParse(await detectConfig(root));
|
|
55
48
|
if (!result.success) {
|
|
56
49
|
throw new Error(`Invalid dev-domains configuration:\n${result.error.issues.map((issue) => `${issue.path.join(".") || "config"}: ${issue.message}`).join("\n")}`);
|
|
57
50
|
}
|
package/dist/config/read.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
/** c12 is deliberately limited to the selected local file. What the file exports is checked against `schema`. */
|
|
3
|
+
export declare function readConfigFile<T>(file: string, schema: z.ZodType<T>): Promise<z.ZodSafeParseResult<T>>;
|
package/dist/config/read.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { loadConfig } from "c12";
|
|
3
|
-
/** c12 is deliberately limited to the selected local file. */
|
|
4
|
-
export async function readConfigFile(file) {
|
|
5
|
-
|
|
3
|
+
/** c12 is deliberately limited to the selected local file. What the file exports is checked against `schema`. */
|
|
4
|
+
export async function readConfigFile(file, schema) {
|
|
5
|
+
const { config } = await loadConfig({
|
|
6
6
|
cwd: path.dirname(file),
|
|
7
7
|
configFile: file,
|
|
8
8
|
configFileRequired: true,
|
|
@@ -15,5 +15,6 @@ export async function readConfigFile(file) {
|
|
|
15
15
|
omit$Keys: false,
|
|
16
16
|
extend: false,
|
|
17
17
|
giget: false
|
|
18
|
-
})
|
|
18
|
+
});
|
|
19
|
+
return schema.safeParse(config);
|
|
19
20
|
}
|
package/dist/project/detect.js
CHANGED
|
@@ -6,7 +6,8 @@ import { discoverProjects } from "./discovery.js";
|
|
|
6
6
|
import { slug } from "./identity.js";
|
|
7
7
|
import { readManifest, workspaceList } from "./manifest.js";
|
|
8
8
|
import { detectPackageManager } from "./package-manager.js";
|
|
9
|
-
|
|
9
|
+
// `turbo` counts only as a command (`turbo dev`, `pnpm turbo dev`); `next dev --turbo` is still an app server.
|
|
10
|
+
const wrappers = /\b(?:dev-domains|portless|run-p|concurrently)\b|(?:^|[\s/;&|(])turbo(?=$|[\s@;&|)])/;
|
|
10
11
|
const storybookDev = /\bstorybook\s+dev\b/;
|
|
11
12
|
const playwrightTest = /\bplaywright\s+test\b/;
|
|
12
13
|
function frameworkFor(source) {
|
|
@@ -33,7 +34,11 @@ export async function detectConfig(root) {
|
|
|
33
34
|
const workspaceFile = path.join(root, "pnpm-workspace.yaml");
|
|
34
35
|
try {
|
|
35
36
|
await readFile(workspaceFile);
|
|
36
|
-
|
|
37
|
+
const workspace = await readConfigFile(workspaceFile, z.object({ packages: workspaceList.optional() }));
|
|
38
|
+
if (!workspace.success) {
|
|
39
|
+
throw workspace.error;
|
|
40
|
+
}
|
|
41
|
+
workspaces = workspace.data.packages;
|
|
37
42
|
}
|
|
38
43
|
catch (error) {
|
|
39
44
|
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) {
|
|
@@ -17,7 +17,7 @@ const playwrightConfig = new RegExp(`^playwright\\.config\\.${configExtension}$`
|
|
|
17
17
|
export async function discoverProjects(root, workspaces) {
|
|
18
18
|
const projects = [];
|
|
19
19
|
const included = workspaces?.filter((pattern) => !pattern.startsWith("!"));
|
|
20
|
-
const excluded = workspaces?.
|
|
20
|
+
const excluded = workspaces?.flatMap((pattern) => (pattern.startsWith("!") ? [pattern.slice(1)] : [])) ?? [];
|
|
21
21
|
let visited = 0;
|
|
22
22
|
const matches = (directory, pattern) => path.matchesGlob(directory, pattern.replace(/\/$/, ""));
|
|
23
23
|
async function walk(directory, parent) {
|
package/dist/runtime/port.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { type Server } from "node:net";
|
|
2
|
+
/** The TCP port a server listens on. A server on a pipe, or one that isn't listening, has none. */
|
|
3
|
+
export declare function listeningPort(server: Pick<Server, "address">): number | undefined;
|
|
1
4
|
/** Hold an OS-assigned port until its route is registered, then hand it to the server. */
|
|
2
5
|
export declare function reservePort(): Promise<{
|
|
3
6
|
port: number;
|
package/dist/runtime/port.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { createServer } from "node:net";
|
|
2
2
|
import { routeStore } from "./state.js";
|
|
3
|
+
/** The TCP port a server listens on. A server on a pipe, or one that isn't listening, has none. */
|
|
4
|
+
export function listeningPort(server) {
|
|
5
|
+
const address = server.address();
|
|
6
|
+
return address instanceof Object ? address.port : undefined;
|
|
7
|
+
}
|
|
3
8
|
/** Hold an OS-assigned port until its route is registered, then hand it to the server. */
|
|
4
9
|
export async function reservePort() {
|
|
5
10
|
for (let attempt = 0; attempt < 20; attempt++) {
|
|
@@ -8,12 +13,12 @@ export async function reservePort() {
|
|
|
8
13
|
server.once("error", reject);
|
|
9
14
|
server.listen({ host: "127.0.0.1", port: 0, exclusive: true }, resolve);
|
|
10
15
|
});
|
|
11
|
-
const
|
|
16
|
+
const port = listeningPort(server);
|
|
12
17
|
let released;
|
|
13
18
|
const release = () => (released ??= new Promise((resolve, reject) => {
|
|
14
19
|
server.close((error) => (error ? reject(error) : resolve()));
|
|
15
20
|
}));
|
|
16
|
-
if (
|
|
21
|
+
if (port === undefined) {
|
|
17
22
|
await release();
|
|
18
23
|
throw new Error("Could not reserve a local server port");
|
|
19
24
|
}
|
|
@@ -22,7 +27,7 @@ export async function reservePort() {
|
|
|
22
27
|
try {
|
|
23
28
|
if (routeStore()
|
|
24
29
|
.loadRoutes()
|
|
25
|
-
.some((route) => route.port ===
|
|
30
|
+
.some((route) => route.port === port)) {
|
|
26
31
|
await release();
|
|
27
32
|
continue;
|
|
28
33
|
}
|
|
@@ -31,7 +36,7 @@ export async function reservePort() {
|
|
|
31
36
|
await release();
|
|
32
37
|
throw error;
|
|
33
38
|
}
|
|
34
|
-
return { port
|
|
39
|
+
return { port, release };
|
|
35
40
|
}
|
|
36
41
|
throw new Error("Could not reserve an unused local server port. Try again.");
|
|
37
42
|
}
|
package/dist/webhooks/gateway.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createServer, request } from "node:http";
|
|
2
2
|
import { pipeline } from "node:stream";
|
|
3
|
+
import { listeningPort } from "../runtime/port.js";
|
|
3
4
|
function headersForUpstream(headers, host) {
|
|
4
5
|
const clean = { ...headers, host };
|
|
5
6
|
const excluded = [
|
|
@@ -85,12 +86,12 @@ export async function startGateway(options) {
|
|
|
85
86
|
server.once("error", reject);
|
|
86
87
|
server.listen(0, "127.0.0.1", resolve);
|
|
87
88
|
});
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
89
|
+
const port = listeningPort(server);
|
|
90
|
+
if (port === undefined) {
|
|
90
91
|
throw new Error("Cannot resolve webhook gateway address");
|
|
91
92
|
}
|
|
92
93
|
return {
|
|
93
|
-
url: `http://127.0.0.1:${
|
|
94
|
+
url: `http://127.0.0.1:${port}`,
|
|
94
95
|
close: async () => {
|
|
95
96
|
server.closeAllConnections();
|
|
96
97
|
await new Promise((resolve, reject) => server.close((error) => (error ? reject(error) : resolve())));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buildkitgg/dev-domains",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -16,20 +16,20 @@
|
|
|
16
16
|
"zod": "4.6.7"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@
|
|
20
|
-
"@repo/typescript-config": "0.0.0",
|
|
19
|
+
"@buildkitgg/typescript-config": "0.0.0",
|
|
21
20
|
"@types/cross-spawn": "^6.0.6",
|
|
22
|
-
"@types/node": "24.
|
|
21
|
+
"@types/node": "24.19.2",
|
|
23
22
|
"@vitest/coverage-v8": "5.0.5",
|
|
24
23
|
"typescript": "7.0.2",
|
|
25
|
-
"vitest": "5.0.5"
|
|
24
|
+
"vitest": "5.0.5",
|
|
25
|
+
"vite-plus": "1.4.0"
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": ">=24"
|
|
30
30
|
},
|
|
31
31
|
"bin": {
|
|
32
|
-
"dev-domains": "
|
|
32
|
+
"dev-domains": "dist/cli/main.js"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"dist/**/*.js",
|
|
@@ -54,15 +54,14 @@
|
|
|
54
54
|
},
|
|
55
55
|
"repository": {
|
|
56
56
|
"type": "git",
|
|
57
|
-
"url": "https://github.com/
|
|
57
|
+
"url": "git+https://github.com/betterapps-hq/buildkit.git",
|
|
58
58
|
"directory": "packages/tooling/dev-domains"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsc -p tsconfig.build.json",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"test": "
|
|
65
|
-
"
|
|
66
|
-
"test:integration": "pnpm build && vitest run --config vitest.integration.config.ts"
|
|
62
|
+
"test": "vp test run",
|
|
63
|
+
"test:coverage": "vp test run --coverage",
|
|
64
|
+
"test:integration": "pnpm build && vp test run --config vitest.integration.config.ts",
|
|
65
|
+
"prepack": "pnpm build"
|
|
67
66
|
}
|
|
68
|
-
}
|
|
67
|
+
}
|