@gachlab/devup 0.8.1 → 0.9.1
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 +35 -0
- package/README.md +1 -0
- package/dist/config/cli.d.ts +2 -1
- package/dist/config/cli.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +177 -11
- package/dist/index.js.map +1 -1
- package/dist/process/port-conflicts.d.ts +33 -0
- package/dist/process/port-conflicts.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ServiceConfig } from '../config/types.js';
|
|
2
|
+
export interface PortHolder {
|
|
3
|
+
pid: number;
|
|
4
|
+
command: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PortConflict {
|
|
7
|
+
service: string;
|
|
8
|
+
port: number;
|
|
9
|
+
holder: PortHolder | null;
|
|
10
|
+
}
|
|
11
|
+
/** Run `lsof` to find what's listening on a port. Returns the first matching
|
|
12
|
+
* PID + command, or null if nothing's there (or lsof isn't available). */
|
|
13
|
+
export declare function findPortHolder(port: number): Promise<PortHolder | null>;
|
|
14
|
+
/** Scan every API-typed service for port conflicts. (Webs are usually managed
|
|
15
|
+
* by their own dev server which sometimes handles port collisions itself, so
|
|
16
|
+
* we leave them alone — matching the spawner's pre-flight scope.) */
|
|
17
|
+
export declare function scanPortConflicts(services: ServiceConfig[]): Promise<PortConflict[]>;
|
|
18
|
+
/** SIGTERM with grace, falling back to SIGKILL after `graceMs`. */
|
|
19
|
+
export declare function killHolder(pid: number, graceMs?: number): Promise<boolean>;
|
|
20
|
+
export interface ResolveOpts {
|
|
21
|
+
autoKill: boolean;
|
|
22
|
+
out: (line: string) => void;
|
|
23
|
+
/** Returns true if user confirms, false otherwise. Skipped when autoKill or
|
|
24
|
+
* when stdin is not a TTY. */
|
|
25
|
+
prompt?: () => Promise<boolean>;
|
|
26
|
+
/** If stdin is not a TTY and autoKill is false, resolution fails by default.
|
|
27
|
+
* Tests pass `isInteractive: true` with a mocked prompt to bypass. */
|
|
28
|
+
isInteractive?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** Returns true if all conflicts were resolved (no holders left), false if the
|
|
31
|
+
* user declined or some kills failed. */
|
|
32
|
+
export declare function resolvePortConflicts(conflicts: PortConflict[], opts: ResolveOpts): Promise<boolean>;
|
|
33
|
+
//# sourceMappingURL=port-conflicts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"port-conflicts.d.ts","sourceRoot":"","sources":["../../src/process/port-conflicts.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;CAC3B;AAID;2EAC2E;AAC3E,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAa7E;AAuBD;;sEAEsE;AACtE,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAU1F;AAED,mEAAmE;AACnE,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAW9E;AAMD,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B;mCAC+B;IAC/B,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC;2EACuE;IACvE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;0CAC0C;AAC1C,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,YAAY,EAAE,EACzB,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,OAAO,CAAC,CAgClB"}
|