git-tm 1.1.1 → 1.1.2

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
@@ -153,7 +153,7 @@ cd Git-Time-Machine
153
153
  node src/cli.js .
154
154
  ```
155
155
 
156
- Run the tests with `npm test`. See [CONTRIBUTING.md](CONTRIBUTING.md) for how the project is organised, its principles and how to send a pull request.
156
+ Run the tests with `npm test`. Questions and ideas are welcome in [Discussions](https://github.com/nandhu-44/Git-Time-Machine/discussions). See [CONTRIBUTING.md](CONTRIBUTING.md) for how the project is organised, its principles and how to send a pull request.
157
157
 
158
158
  ## Background
159
159
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-tm",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Explore any Git repository in your browser: commit graph, diffs, blame, insights and time travel between any two commits. Zero dependencies.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -32,7 +32,7 @@
32
32
  ],
33
33
  "scripts": {
34
34
  "start": "node src/cli.js",
35
- "test": "node --test test/*.test.js"
35
+ "test": "node --test"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">=18.3"
package/src/cli.js CHANGED
@@ -114,6 +114,15 @@ async function main() {
114
114
  fail(`Could not start server: ${err.message}`);
115
115
  }
116
116
 
117
+ // Handle Ctrl+C and SIGTERM before printing the address, so a signal that
118
+ // arrives right after startup still shuts down cleanly with exit code 0.
119
+ const stop = () => {
120
+ server.close();
121
+ process.exit(0);
122
+ };
123
+ process.on("SIGINT", stop);
124
+ process.on("SIGTERM", stop);
125
+
117
126
  const shownHost = ["127.0.0.1", "::1", "0.0.0.0", "::"].includes(values.host) ? "localhost" : values.host;
118
127
  const url = `http://${shownHost}:${actual}`;
119
128
  const info = await repo.info().catch(() => ({}));
@@ -135,13 +144,6 @@ async function main() {
135
144
  const report = (err) => console.error(`${c.red("error")} ${err?.stack || err}`);
136
145
  process.on("uncaughtException", report);
137
146
  process.on("unhandledRejection", report);
138
-
139
- const stop = () => {
140
- server.close();
141
- process.exit(0);
142
- };
143
- process.on("SIGINT", stop);
144
- process.on("SIGTERM", stop);
145
147
  }
146
148
 
147
149
  main();
@@ -2239,7 +2239,7 @@ mark.del {
2239
2239
  .punch {
2240
2240
  display: block;
2241
2241
  width: 100%;
2242
- min-width: 520px;
2242
+ min-width: 360px;
2243
2243
  }
2244
2244
 
2245
2245
  .punch circle {
@@ -50,7 +50,7 @@ function heatmap(days, endTs) {
50
50
 
51
51
  function punchcard(punch) {
52
52
  const max = Math.max(1, ...punch.flat());
53
- const cw = 22;
53
+ const cw = 16;
54
54
  const rh = 24;
55
55
  const w = 40 + 24 * cw + 12; // room for the last hour label
56
56
  const h = 7 * rh + 20;
@@ -60,7 +60,7 @@ function punchcard(punch) {
60
60
  for (let hr = 0; hr < 24; hr++) {
61
61
  const v = punch[d][hr];
62
62
  if (!v) continue;
63
- const r = 2 + Math.sqrt(v / max) * 8;
63
+ const r = 2 + Math.sqrt(v / max) * 5; // at most 7, so neighbouring hours never overlap
64
64
  svg += `<circle cx="${40 + hr * cw + cw / 2}" cy="${d * rh + rh / 2}" r="${r.toFixed(1)}"><title>${plural(v, "commit")} · ${DAYS[d]} ${hr}:00</title></circle>`;
65
65
  }
66
66
  }