mirror of
https://github.com/zen-browser/www.git
synced 2025-07-07 17:05:32 +02:00
feat(lint): add biome formatter and linter, husky and lint-staged
This commit adds the Biome formatter and linter to replace Prettier, including: - Add biome.json config file - Add pre-commit hook with Husky - Configure GitHub Action to run Biome checks - Apply Biome formatting rules to codebase - Remove Prettier dependencies
This commit is contained in:
parent
b4e5fe2bea
commit
bcb1427a79
50 changed files with 904 additions and 793 deletions
|
@ -3,29 +3,25 @@
|
|||
* Returns a mapping from filename to checksum.
|
||||
*/
|
||||
export async function getChecksums() {
|
||||
const res = await fetch(
|
||||
'https://api.github.com/repos/zen-browser/desktop/releases/latest',
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/vnd.github+json',
|
||||
'X-GitHub-Api-Version': '2022-11-28',
|
||||
'User-Agent': 'zen-browser-checksum-fetcher',
|
||||
},
|
||||
const res = await fetch("https://api.github.com/repos/zen-browser/desktop/releases/latest", {
|
||||
headers: {
|
||||
Accept: "application/vnd.github+json",
|
||||
"X-GitHub-Api-Version": "2022-11-28",
|
||||
"User-Agent": "zen-browser-checksum-fetcher",
|
||||
},
|
||||
)
|
||||
if (!res.ok)
|
||||
throw new Error('Failed to fetch GitHub release: ' + res.statusText)
|
||||
const data = await res.json()
|
||||
const body = data.body as string
|
||||
});
|
||||
if (!res.ok) throw new Error(`Failed to fetch GitHub release: ${res.statusText}`);
|
||||
const data = await res.json();
|
||||
const body = data.body as string;
|
||||
|
||||
// Extract the checksum block
|
||||
const match = body.match(/File Checksums \(SHA-256\)[\s\S]*?```([\s\S]*?)```/)
|
||||
const checksums: Record<string, string> = {}
|
||||
if (match && match[1]) {
|
||||
match[1].split('\n').forEach((line) => {
|
||||
const [hash, filename] = line.trim().split(/\s+/, 2)
|
||||
if (hash && filename) checksums[filename] = hash
|
||||
})
|
||||
const match = body.match(/File Checksums \(SHA-256\)[\s\S]*?```([\s\S]*?)```/);
|
||||
const checksums: Record<string, string> = {};
|
||||
if (match?.[1]) {
|
||||
for (const line of match[1].split("\n")) {
|
||||
const [hash, filename] = line.trim().split(/\s+/, 2);
|
||||
if (hash && filename) checksums[filename] = hash;
|
||||
}
|
||||
}
|
||||
return checksums
|
||||
return checksums;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue