@lvnt/release-radar 1.9.6 → 1.9.8
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/dist/fetchers/vscode-marketplace.js +26 -2
- package/dist/fetchers/vscode-marketplace.test.js +37 -0
- package/dist/index.js +30 -0
- package/dist/storage.d.ts +2 -0
- package/dist/storage.js +16 -0
- package/package.json +1 -1
|
@@ -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
|
});
|
package/dist/index.js
CHANGED
|
@@ -494,6 +494,36 @@ bot.onText(/\/mirror(?:\s+(.+))?/, async (msg, match) => {
|
|
|
494
494
|
await bot.sendMessage(validatedChatId, `❌ Mirror failed: ${result.error}`);
|
|
495
495
|
}
|
|
496
496
|
});
|
|
497
|
+
bot.onText(/\/resetversion(?:\s+(.+))?/, async (msg, match) => {
|
|
498
|
+
if (msg.chat.id.toString() !== validatedChatId)
|
|
499
|
+
return;
|
|
500
|
+
const toolName = match?.[1]?.trim();
|
|
501
|
+
if (!toolName) {
|
|
502
|
+
await bot.sendMessage(validatedChatId, 'Usage: /resetversion <toolname>\nExample: /resetversion Python\n\nThis clears the stored version so the next /check will re-fetch it.');
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
const deleted = storage.deleteVersion(toolName);
|
|
506
|
+
if (deleted) {
|
|
507
|
+
await bot.sendMessage(validatedChatId, `✅ Reset "${toolName}". Run /check to fetch the current version.`);
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
await bot.sendMessage(validatedChatId, `Tool "${toolName}" not found in storage.`);
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
bot.onText(/\/resetall/, async (msg) => {
|
|
514
|
+
if (msg.chat.id.toString() !== validatedChatId)
|
|
515
|
+
return;
|
|
516
|
+
const versions = storage.getAllVersions();
|
|
517
|
+
const toolNames = Object.keys(versions);
|
|
518
|
+
if (toolNames.length === 0) {
|
|
519
|
+
await bot.sendMessage(validatedChatId, 'No versions stored.');
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
for (const toolName of toolNames) {
|
|
523
|
+
storage.deleteVersion(toolName);
|
|
524
|
+
}
|
|
525
|
+
await bot.sendMessage(validatedChatId, `✅ Reset ${toolNames.length} tools. Run /check to re-fetch all versions.`);
|
|
526
|
+
});
|
|
497
527
|
// Start scheduled checks
|
|
498
528
|
scheduleChecks();
|
|
499
529
|
const mode = configData.scheduleMode || 'interval';
|
package/dist/storage.d.ts
CHANGED
|
@@ -15,4 +15,6 @@ export declare class Storage {
|
|
|
15
15
|
getMirrorUrl(toolName: string): string | null;
|
|
16
16
|
setMirrorUrl(toolName: string, url: string): void;
|
|
17
17
|
getAllMirrorUrls(): Record<string, string>;
|
|
18
|
+
deleteVersion(toolName: string): boolean;
|
|
19
|
+
getAllVersions(): Record<string, string>;
|
|
18
20
|
}
|
package/dist/storage.js
CHANGED
|
@@ -53,4 +53,20 @@ export class Storage {
|
|
|
53
53
|
const state = this.ensureLoaded();
|
|
54
54
|
return state.mirrorUrls ?? {};
|
|
55
55
|
}
|
|
56
|
+
deleteVersion(toolName) {
|
|
57
|
+
const state = this.ensureLoaded();
|
|
58
|
+
if (toolName in state.versions) {
|
|
59
|
+
delete state.versions[toolName];
|
|
60
|
+
if (state.mirrorUrls && toolName in state.mirrorUrls) {
|
|
61
|
+
delete state.mirrorUrls[toolName];
|
|
62
|
+
}
|
|
63
|
+
this.save(state);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
getAllVersions() {
|
|
69
|
+
const state = this.ensureLoaded();
|
|
70
|
+
return state.versions;
|
|
71
|
+
}
|
|
56
72
|
}
|