git-watchtower 2.1.2 → 2.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/bin/git-watchtower.js +20 -9
- package/package.json +2 -3
package/bin/git-watchtower.js
CHANGED
|
@@ -708,27 +708,38 @@ function startServerProcess() {
|
|
|
708
708
|
};
|
|
709
709
|
|
|
710
710
|
try {
|
|
711
|
-
|
|
711
|
+
const proc = spawn(cmd, args, spawnOptions);
|
|
712
|
+
serverProcess = proc;
|
|
712
713
|
store.setState({ serverRunning: true });
|
|
713
714
|
|
|
714
|
-
|
|
715
|
+
// Capture `proc` in each listener so a late event from an old process
|
|
716
|
+
// (e.g. proc1's SIGTERM-induced 'close' arriving after restart already
|
|
717
|
+
// spawned proc2) cannot clobber proc2's globals. Without this guard,
|
|
718
|
+
// proc1's close handler resolves the module-level `serverProcess` at
|
|
719
|
+
// execution time — which is now proc2 — and nulls it out, leaving the
|
|
720
|
+
// TUI thinking no server is running while proc2 is alive on its port.
|
|
721
|
+
proc.stdout.on('data', (data) => {
|
|
722
|
+
if (serverProcess !== proc) return;
|
|
715
723
|
const lines = data.toString().split('\n').filter(Boolean);
|
|
716
724
|
lines.forEach(line => addServerLog(line));
|
|
717
725
|
});
|
|
718
726
|
|
|
719
|
-
|
|
727
|
+
proc.stderr.on('data', (data) => {
|
|
728
|
+
if (serverProcess !== proc) return;
|
|
720
729
|
const lines = data.toString().split('\n').filter(Boolean);
|
|
721
730
|
lines.forEach(line => addServerLog(line, true));
|
|
722
731
|
});
|
|
723
732
|
|
|
724
|
-
|
|
733
|
+
proc.on('error', (err) => {
|
|
734
|
+
if (serverProcess !== proc) return;
|
|
725
735
|
store.setState({ serverRunning: false, serverCrashed: true });
|
|
726
736
|
addServerLog(`Error: ${err.message}`, true);
|
|
727
737
|
addLog(`Server error: ${err.message}`, 'error');
|
|
728
738
|
render();
|
|
729
739
|
});
|
|
730
740
|
|
|
731
|
-
|
|
741
|
+
proc.on('close', (code) => {
|
|
742
|
+
if (serverProcess !== proc) return;
|
|
732
743
|
store.setState({ serverRunning: false });
|
|
733
744
|
if (code !== 0 && code !== null) {
|
|
734
745
|
store.setState({ serverCrashed: true });
|
|
@@ -742,7 +753,7 @@ function startServerProcess() {
|
|
|
742
753
|
render();
|
|
743
754
|
});
|
|
744
755
|
|
|
745
|
-
addLog(`Server started (pid: ${
|
|
756
|
+
addLog(`Server started (pid: ${proc.pid})`, 'success');
|
|
746
757
|
} catch (err) {
|
|
747
758
|
store.setState({ serverCrashed: true });
|
|
748
759
|
addServerLog(`Failed to start: ${err.message}`, true);
|
|
@@ -1080,7 +1091,7 @@ async function refreshAllSparklines() {
|
|
|
1080
1091
|
try {
|
|
1081
1092
|
// Get commit counts for last 7 days (try remote, fall back to local)
|
|
1082
1093
|
const sparkResult = await execGitOptional(
|
|
1083
|
-
['log',
|
|
1094
|
+
['log', `${REMOTE_NAME}/${branch.name}`, '--since=7 days ago', '--format=%ad', '--date=format:%Y-%m-%d'],
|
|
1084
1095
|
{ cwd: PROJECT_ROOT }
|
|
1085
1096
|
) || await execGitOptional(
|
|
1086
1097
|
['log', branch.name, '--since=7 days ago', '--format=%ad', '--date=format:%Y-%m-%d'],
|
|
@@ -1119,7 +1130,7 @@ async function getPreviewData(branchName) {
|
|
|
1119
1130
|
try {
|
|
1120
1131
|
// Get last 5 commits (try remote, fall back to local)
|
|
1121
1132
|
const logResult = await execGitOptional(
|
|
1122
|
-
['log',
|
|
1133
|
+
['log', `${REMOTE_NAME}/${branchName}`, '-5', '--oneline'],
|
|
1123
1134
|
{ cwd: PROJECT_ROOT }
|
|
1124
1135
|
) || await execGitOptional(
|
|
1125
1136
|
['log', branchName, '-5', '--oneline'],
|
|
@@ -1135,7 +1146,7 @@ async function getPreviewData(branchName) {
|
|
|
1135
1146
|
// Get files changed (comparing to current branch)
|
|
1136
1147
|
let filesChanged = [];
|
|
1137
1148
|
const diffResult = await execGitOptional(
|
|
1138
|
-
['diff', '--stat', '--name-only', `HEAD
|
|
1149
|
+
['diff', '--stat', '--name-only', `HEAD...${REMOTE_NAME}/${branchName}`],
|
|
1139
1150
|
{ cwd: PROJECT_ROOT }
|
|
1140
1151
|
) || await execGitOptional(
|
|
1141
1152
|
['diff', '--stat', '--name-only', `HEAD...${branchName}`],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-watchtower",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "Terminal-based Git branch monitor with activity sparklines and optional dev server with live reload",
|
|
5
5
|
"main": "bin/git-watchtower.js",
|
|
6
6
|
"bin": {
|
|
@@ -67,8 +67,7 @@
|
|
|
67
67
|
"main"
|
|
68
68
|
],
|
|
69
69
|
"plugins": [
|
|
70
|
-
"
|
|
71
|
-
"@semantic-release/release-notes-generator",
|
|
70
|
+
"./scripts/release-filter-cli.js",
|
|
72
71
|
[
|
|
73
72
|
"@semantic-release/changelog",
|
|
74
73
|
{
|