port-reclaim 0.4.0 → 0.4.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/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  A zero-configuration, cross-platform CLI for safely reclaiming ports held by stale local development processes.
4
4
 
5
+ ![A recorded session: listing a busy port, releasing it, declining to kill a database and a Docker process, then reclaiming ports by process name](https://raw.githubusercontent.com/princegoel0/port-reclaim/main/assets/demo.gif)
6
+
5
7
  ## Why `port-reclaim`?
6
8
 
7
9
  Tools like [`kill-port`](https://www.npmjs.com/package/kill-port) free a port by killing whatever holds it. `port-reclaim` is built for everyday development, where the process holding port 3000 is usually *yours*:
@@ -71,7 +73,7 @@ The same safety rules apply: refusals still block Docker and operating-system PI
71
73
 
72
74
  ### Colour
73
75
 
74
- Successes are green, refusals and errors red, prompts yellow, and process details dim. Colour switches itself off when output is redirected, and can be forced off with `--no-color` or the `NO_COLOR` environment variable.
76
+ Successes are green, refusals and errors red, prompts yellow, and process details dim. Colour switches itself off when output is redirected, can be forced off with `--no-color` or the `NO_COLOR` environment variable, and forced on with `FORCE_COLOR=1` for CI logs and recorded demos.
75
77
 
76
78
  ## Configuration
77
79
 
package/dist/src/style.js CHANGED
@@ -18,6 +18,8 @@ export function colourEnabled() {
18
18
  return true;
19
19
  if (process.env.NO_COLOR)
20
20
  return false;
21
+ if (process.env.FORCE_COLOR && process.env.FORCE_COLOR !== "0")
22
+ return true;
21
23
  return Boolean(process.stdout.isTTY);
22
24
  }
23
25
  // Wraps a whole segment rather than interpolating inside one, so message text stays greppable.
@@ -28,3 +28,28 @@ test("auto mode defers to NO_COLOR and never mode always strips", () => {
28
28
  setColourMode("auto");
29
29
  }
30
30
  });
31
+ test("FORCE_COLOR keeps colour on when output is redirected, unless NO_COLOR wins", () => {
32
+ const originalForce = process.env.FORCE_COLOR;
33
+ const originalNo = process.env.NO_COLOR;
34
+ setColourMode("auto");
35
+ try {
36
+ delete process.env.NO_COLOR;
37
+ process.env.FORCE_COLOR = "1";
38
+ assert.equal(colourEnabled(), true);
39
+ process.env.FORCE_COLOR = "0";
40
+ assert.equal(colourEnabled(), Boolean(process.stdout.isTTY));
41
+ process.env.FORCE_COLOR = "1";
42
+ process.env.NO_COLOR = "1";
43
+ assert.equal(colourEnabled(), false);
44
+ }
45
+ finally {
46
+ if (originalForce === undefined)
47
+ delete process.env.FORCE_COLOR;
48
+ else
49
+ process.env.FORCE_COLOR = originalForce;
50
+ if (originalNo === undefined)
51
+ delete process.env.NO_COLOR;
52
+ else
53
+ process.env.NO_COLOR = originalNo;
54
+ }
55
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "port-reclaim",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Free up a port already in use: find and kill the process holding it (EADDRINUSE). Cross-platform, zero-config, Docker-safe.",
5
5
  "author": "princegoel0",
6
6
  "license": "MIT",