@lvnt/release-radar 1.9.6 → 1.9.7
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.
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
function isPreRelease(version) {
|
|
2
|
+
// Check for pre-release property flag
|
|
3
|
+
const preReleaseFlag = version.properties?.find(p => p.key === 'Microsoft.VisualStudio.Code.PreRelease');
|
|
4
|
+
if (preReleaseFlag?.value === 'true') {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
// Also detect pre-release by version format (e.g., "2026.1.2026012801" has date-like suffix)
|
|
8
|
+
// Stable versions typically have 2-4 parts like "1.2.3" or "2026.0.0"
|
|
9
|
+
const parts = version.version.split('.');
|
|
10
|
+
if (parts.length >= 3) {
|
|
11
|
+
const lastPart = parts[parts.length - 1];
|
|
12
|
+
// If last part is unusually long (>4 digits), likely a pre-release build number
|
|
13
|
+
if (lastPart.length > 4 && /^\d+$/.test(lastPart)) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
1
19
|
export async function fetchVSCodeMarketplace(extensionId) {
|
|
2
20
|
const url = 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery';
|
|
3
21
|
const response = await fetch(url, {
|
|
@@ -10,7 +28,7 @@ export async function fetchVSCodeMarketplace(extensionId) {
|
|
|
10
28
|
filters: [{
|
|
11
29
|
criteria: [{ filterType: 7, value: extensionId }]
|
|
12
30
|
}],
|
|
13
|
-
flags:
|
|
31
|
+
flags: 0x1 | 0x10 // IncludeVersions + IncludeVersionProperties
|
|
14
32
|
})
|
|
15
33
|
});
|
|
16
34
|
if (!response.ok) {
|
|
@@ -21,5 +39,11 @@ export async function fetchVSCodeMarketplace(extensionId) {
|
|
|
21
39
|
if (!extension) {
|
|
22
40
|
throw new Error(`Extension not found: ${extensionId}`);
|
|
23
41
|
}
|
|
24
|
-
|
|
42
|
+
// Find first stable (non-pre-release) version
|
|
43
|
+
const stableVersion = extension.versions.find(v => !isPreRelease(v));
|
|
44
|
+
if (!stableVersion) {
|
|
45
|
+
// Fall back to first version if no stable found
|
|
46
|
+
return extension.versions[0].version;
|
|
47
|
+
}
|
|
48
|
+
return stableVersion.version;
|
|
25
49
|
}
|
|
@@ -36,4 +36,41 @@ describe('fetchVSCodeMarketplace', () => {
|
|
|
36
36
|
await expect(fetchVSCodeMarketplace('nonexistent.extension'))
|
|
37
37
|
.rejects.toThrow('Extension not found: nonexistent.extension');
|
|
38
38
|
});
|
|
39
|
+
it('skips pre-release versions with flag', async () => {
|
|
40
|
+
global.fetch = vi.fn().mockResolvedValue({
|
|
41
|
+
ok: true,
|
|
42
|
+
json: () => Promise.resolve({
|
|
43
|
+
results: [{
|
|
44
|
+
extensions: [{
|
|
45
|
+
versions: [
|
|
46
|
+
{
|
|
47
|
+
version: '2026.1.2026012801',
|
|
48
|
+
properties: [{ key: 'Microsoft.VisualStudio.Code.PreRelease', value: 'true' }]
|
|
49
|
+
},
|
|
50
|
+
{ version: '2026.0.0', properties: [] }
|
|
51
|
+
]
|
|
52
|
+
}]
|
|
53
|
+
}]
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
const version = await fetchVSCodeMarketplace('ms-python.python');
|
|
57
|
+
expect(version).toBe('2026.0.0');
|
|
58
|
+
});
|
|
59
|
+
it('skips pre-release versions with long build numbers', async () => {
|
|
60
|
+
global.fetch = vi.fn().mockResolvedValue({
|
|
61
|
+
ok: true,
|
|
62
|
+
json: () => Promise.resolve({
|
|
63
|
+
results: [{
|
|
64
|
+
extensions: [{
|
|
65
|
+
versions: [
|
|
66
|
+
{ version: '1.17.10291017' }, // Long build number = pre-release
|
|
67
|
+
{ version: '1.16.0' }
|
|
68
|
+
]
|
|
69
|
+
}]
|
|
70
|
+
}]
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
const version = await fetchVSCodeMarketplace('ms-python.vscode-python-envs');
|
|
74
|
+
expect(version).toBe('1.16.0');
|
|
75
|
+
});
|
|
39
76
|
});
|