@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 +1 -1
- package/dist/cli-publisher.js +26 -6
- package/package.json +1 -1
package/cli/package.json
CHANGED
package/dist/cli-publisher.js
CHANGED
|
@@ -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
|
-
//
|
|
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
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
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)
|