Skip to content

Commit e739364

Browse files
committed
feat: add devtools updates
1 parent 70aaaab commit e739364

File tree

1 file changed

+30
-0
lines changed
  • apps/svelte.dev/src/routes/devtools/updates.json

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { json } from '@sveltejs/kit';
2+
3+
export const prerender = true;
4+
5+
export async function GET({ fetch }) {
6+
const gh: Array<{ name: string }> = await fetch(
7+
'https://api.github.com/repos/sveltejs/svelte-devtools/tags'
8+
).then((r) => r.json());
9+
10+
// v2.2.0 is the first version that has the Firefox extension
11+
const tags = gh.reverse().slice(gh.findIndex((t) => t.name === 'v2.2.0'));
12+
const base = 'https://github.com/sveltejs/svelte-devtools/releases/download';
13+
return json({
14+
addons: {
15+
16+
updates: tags.map(({ name: tag }) => {
17+
return {
18+
version: tag,
19+
update_link: `${base}/${tag}/svelte-devtools.xpi`,
20+
applications: requirements[tag] && { gecko: requirements[tag] }
21+
};
22+
})
23+
}
24+
}
25+
});
26+
}
27+
28+
const requirements: Record<string, any> = {
29+
'v2.2.2': { strict_min_version: '121.0' }
30+
};

0 commit comments

Comments
 (0)