@lvnt/release-radar 1.7.4 → 1.7.6

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/cli/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvnt/release-radar-cli",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Interactive CLI for downloading tools through Nexus proxy",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,4 +1,4 @@
1
- import { execSync, spawn } from 'child_process';
1
+ import { execSync } from 'child_process';
2
2
  import { readFileSync } from 'fs';
3
3
  import { fileURLToPath } from 'url';
4
4
  import { dirname, join } from 'path';
@@ -45,14 +45,7 @@ export async function checkAndUpdate(): Promise<boolean> {
45
45
  stdio: ['pipe', 'pipe', 'pipe'],
46
46
  });
47
47
  if (result) console.log(result);
48
- console.log('Update complete. Restarting...\n');
49
-
50
- // Restart self with a fresh terminal
51
- const child = spawn(process.argv[0], process.argv.slice(1), {
52
- detached: true,
53
- stdio: 'inherit',
54
- });
55
- child.unref();
48
+ console.log('Update complete. Please run the command again.\n');
56
49
  process.exit(0);
57
50
  } catch (error) {
58
51
  console.error('Update failed, continuing with current version');
package/dist/updater.js CHANGED
@@ -55,6 +55,11 @@ export function executeUpdate() {
55
55
  });
56
56
  });
57
57
  }
58
+ // Lock to prevent concurrent updates
59
+ let updateInProgress = false;
60
+ let lastUpdateVersion = null;
61
+ let lastUpdateTime = 0;
62
+ const UPDATE_COOLDOWN_MS = 60000; // 1 minute cooldown between updates
58
63
  export function startUpdater(config) {
59
64
  const server = createServer(async (req, res) => {
60
65
  // Only accept POST /webhook
@@ -92,11 +97,29 @@ export function startUpdater(config) {
92
97
  res.end('OK (ignored)');
93
98
  return;
94
99
  }
100
+ // Check if update is already in progress or recently completed for this version
101
+ const now = Date.now();
102
+ if (updateInProgress) {
103
+ console.log(`Ignoring release event for v${version} - update already in progress`);
104
+ res.writeHead(200);
105
+ res.end('OK (update in progress)');
106
+ return;
107
+ }
108
+ if (lastUpdateVersion === version && (now - lastUpdateTime) < UPDATE_COOLDOWN_MS) {
109
+ console.log(`Ignoring release event for v${version} - recently updated`);
110
+ res.writeHead(200);
111
+ res.end('OK (recently updated)');
112
+ return;
113
+ }
95
114
  // Respond immediately, update async
96
115
  res.writeHead(200);
97
116
  res.end('OK');
117
+ updateInProgress = true;
98
118
  console.log(`Received release event for v${version}, updating...`);
99
119
  const result = await executeUpdate();
120
+ updateInProgress = false;
121
+ lastUpdateVersion = version;
122
+ lastUpdateTime = Date.now();
100
123
  if (result.success) {
101
124
  await config.telegramBot.sendMessage(config.chatId, `🔄 Updated release-radar to v${version}`);
102
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvnt/release-radar",
3
- "version": "1.7.4",
3
+ "version": "1.7.6",
4
4
  "description": "Monitor tool versions and notify via Telegram when updates are detected",
5
5
  "main": "dist/index.js",
6
6
  "bin": {