@lvnt/release-radar 1.7.2 → 1.7.3

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.2",
3
+ "version": "0.2.4",
4
4
  "description": "Interactive CLI for downloading tools through Nexus proxy",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -2,6 +2,24 @@
2
2
  import { execSync } from 'child_process';
3
3
  import { readFileSync, writeFileSync, existsSync } from 'fs';
4
4
  import { generateVersionsJson } from './versions-generator.js';
5
+ function getLatestNpmVersion(packageName) {
6
+ try {
7
+ const result = execSync(`npm view ${packageName} version`, {
8
+ encoding: 'utf-8',
9
+ stdio: ['pipe', 'pipe', 'pipe'],
10
+ timeout: 15000,
11
+ });
12
+ return result.trim();
13
+ }
14
+ catch {
15
+ return null;
16
+ }
17
+ }
18
+ function bumpPatchVersion(version) {
19
+ const parts = version.split('.').map(Number);
20
+ parts[2]++;
21
+ return parts.join('.');
22
+ }
5
23
  export class CliPublisher {
6
24
  downloadsConfig;
7
25
  cliPath;
@@ -22,14 +40,16 @@ export class CliPublisher {
22
40
  // Write to CLI package
23
41
  const cliVersionsPath = `${this.cliPath}/versions.json`;
24
42
  writeFileSync(cliVersionsPath, JSON.stringify(versionsJson, null, 2));
25
- // Read current CLI version
43
+ // Get latest version from npm (fallback to local if npm unreachable)
26
44
  const pkgPath = `${this.cliPath}/package.json`;
27
45
  const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
28
- const currentVersion = pkg.version;
29
- // Bump patch version
30
- const versionParts = currentVersion.split('.').map(Number);
31
- versionParts[2]++;
32
- const newVersion = versionParts.join('.');
46
+ const packageName = pkg.name;
47
+ console.log('[CliPublisher] Checking latest version on npm...');
48
+ const latestNpmVersion = getLatestNpmVersion(packageName);
49
+ const baseVersion = latestNpmVersion || pkg.version;
50
+ console.log(`[CliPublisher] Base version: ${baseVersion} (from ${latestNpmVersion ? 'npm' : 'local'})`);
51
+ // Bump patch version from the latest
52
+ const newVersion = bumpPatchVersion(baseVersion);
33
53
  pkg.version = newVersion;
34
54
  writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
35
55
  // Install dependencies (including devDependencies for TypeScript)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvnt/release-radar",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "Monitor tool versions and notify via Telegram when updates are detected",
5
5
  "main": "dist/index.js",
6
6
  "bin": {