@buildkitgg/dev-domains 0.1.1 → 0.1.3

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 CHANGED
@@ -1,9 +1,26 @@
1
1
  # Change Log - @buildkitgg/dev-domains
2
2
 
3
- <!-- This log was last generated on Thu, 22 Oct 2026 20:48:42 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Tue, 03 Nov 2026 11:28:14 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.1.3
8
+
9
+ Tue, 03 Nov 2026 11:28:14 GMT
10
+
11
+ ### Patches
12
+
13
+ - fix: pass the anti-slop lint rules (ajcraswell@gmail.com)
14
+ - Keep the command when publishing: npm dropped a bin path that started with ./ (ajcraswell@gmail.com)
15
+
16
+ ## 0.1.2
17
+
18
+ Thu, 29 Oct 2026 04:54:16 GMT
19
+
20
+ ### Patches
21
+
22
+ - Update portless to 0.15.12. (ajcraswell@gmail.com)
23
+
7
24
  ## 0.1.1
8
25
 
9
26
  Thu, 22 Oct 2026 20:48:42 GMT
package/dist/cli/main.js CHANGED
File without changes
@@ -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
- export declare function output(value: unknown): void;
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;
@@ -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
  }
@@ -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
- if (file) {
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
  }
@@ -1,2 +1,3 @@
1
- /** c12 is deliberately limited to the selected local file. */
2
- export declare function readConfigFile(file: string): Promise<unknown>;
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>>;
@@ -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
- return (await loadConfig({
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
- })).config;
18
+ });
19
+ return schema.safeParse(config);
19
20
  }
@@ -33,7 +33,11 @@ export async function detectConfig(root) {
33
33
  const workspaceFile = path.join(root, "pnpm-workspace.yaml");
34
34
  try {
35
35
  await readFile(workspaceFile);
36
- workspaces = z.object({ packages: workspaceList.optional() }).parse(await readConfigFile(workspaceFile)).packages;
36
+ const workspace = await readConfigFile(workspaceFile, z.object({ packages: workspaceList.optional() }));
37
+ if (!workspace.success) {
38
+ throw workspace.error;
39
+ }
40
+ workspaces = workspace.data.packages;
37
41
  }
38
42
  catch (error) {
39
43
  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?.filter((pattern) => pattern.startsWith("!")).map((pattern) => pattern.slice(1)) ?? [];
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) {
@@ -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;
@@ -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 address = server.address();
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 (!address || typeof address === "string") {
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 === address.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: address.port, release };
39
+ return { port, release };
35
40
  }
36
41
  throw new Error("Could not reserve an unused local server port. Try again.");
37
42
  }
@@ -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 address = server.address();
89
- if (!address || typeof address === "string") {
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:${address.port}`,
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.1",
3
+ "version": "0.1.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -12,24 +12,24 @@
12
12
  "citty": "0.2.2",
13
13
  "cross-spawn": "^7.0.6",
14
14
  "package-manager-detector": "1.9.0",
15
- "portless": "0.15.8",
15
+ "portless": "0.15.12",
16
16
  "zod": "4.6.7"
17
17
  },
18
18
  "devDependencies": {
19
- "@repo/oxlint-config": "0.0.0",
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.13.2",
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": "./dist/cli/main.js"
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/AndrewCraswell/buildkit.git",
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
- "check:types": "pnpm build && tsc --noEmit",
63
- "lint": "oxlint --max-warnings=0",
64
- "test": "vitest run",
65
- "test:coverage": "vitest run --coverage",
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
+ }