Skip to content

Commit

Permalink
chore: Update formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 committed Feb 15, 2024
1 parent 2de0782 commit 2ff6c39
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/apis/firefox-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import consola from "consola";
export function createFirefoxApiClient() {
return {
getAddon: async (
idOrSlugOrGuid: number | string
idOrSlugOrGuid: number | string,
): Promise<Gql.FirefoxAddon> => {
consola.info("Fetching " + idOrSlugOrGuid);
const url = new URL(
`https://addons.mozilla.org/api/v5/addons/addon/${idOrSlugOrGuid}`
`https://addons.mozilla.org/api/v5/addons/addon/${idOrSlugOrGuid}`,
);
const res = await fetch(url);
if (res.status !== 200)
throw Error(
`${url.href} failed with status: ${res.status} ${res.statusText}`
`${url.href} failed with status: ${res.status} ${res.statusText}`,
);

const json = await res.json();
Expand Down
10 changes: 5 additions & 5 deletions src/crawlers/chrome-crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HTMLAnchorElement, HTMLElement, parseHTML } from "linkedom";

export async function crawlExtension(
id: string,
lang: string
lang: string,
): Promise<Gql.ChromeExtension | undefined> {
consola.info("Crawling " + id);
const url = `https://chromewebstore.google.com/detail/${id}?hl=${lang}`;
Expand All @@ -28,13 +28,13 @@ export async function crawlExtension(
const storeUrl = metaContent(document, "property=og:url");
const iconUrl = metaContent(document, "property=og:image")?.replace(
/=.+?$/,
"=s256"
"=s256",
);
const shortDescription = metaContent(document, "property=og:description");

// Grab the main sections that contain content
const sections = (document as HTMLElement).querySelectorAll(
"main > * > section"
"main > * > section",
);
const header: HTMLElement = sections[0];
const description: HTMLElement = sections[2];
Expand Down Expand Up @@ -69,10 +69,10 @@ export async function crawlExtension(
// </span>
// </span>
const ratingRow = header.querySelector(
"div:first-child > div:nth-child(2) > span:last-child"
"div:first-child > div:nth-child(2) > span:last-child",
);
const rating = extractNumber(
ratingRow.querySelector("span:first-child > span:first-child").textContent
ratingRow.querySelector("span:first-child > span:first-child").textContent,
);
const reviewCount = extractNumber(ratingRow.querySelector("p").textContent);

Expand Down
8 changes: 4 additions & 4 deletions src/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export function createGraphql(ctx: WxtQueueCtx) {
const start = performance.now();
consola.debug(
`${pc.dim(`←-- [${id}]`)} ${pc.green(method)} ${pc.cyan(
pc.bold(operationName)
)}`
pc.bold(operationName),
)}`,
);

const response = await graphql({
Expand All @@ -36,8 +36,8 @@ export function createGraphql(ctx: WxtQueueCtx) {
const end = performance.now();
consola.debug(
`${pc.dim(`--→ [${id}]`)} ${pc.green(method)} ${pc.cyan(
pc.bold(operationName)
)} ${(end - start).toFixed(3)}ms`
pc.bold(operationName),
)} ${(end - start).toFixed(3)}ms`,
);

return response;
Expand Down
4 changes: 2 additions & 2 deletions src/public/playground.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<title>Playground - wxt-queue v{{VERSION}}</title>
Expand Down Expand Up @@ -50,7 +50,7 @@
fetcher,
defaultEditorToolsVisibility: true,
plugins: [explorerPlugin],
})
}),
);
</script>
</body>
Expand Down
6 changes: 3 additions & 3 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { createFirefoxService } from "./services/firefox-service";

const playgroundHtml = playgroundHtmlTemplate.replace(
"{{VERSION}}",
pkg.version
pkg.version,
);

export function createServer(config?: ServerConfig) {
Expand Down Expand Up @@ -62,7 +62,7 @@ export function createServer(config?: ServerConfig) {
});

consola.info(
`${pc.cyan("store-api v" + pkg.version)} ${pc.dim("server started")}`
`${pc.cyan("store-api v" + pkg.version)} ${pc.dim("server started")}`,
);
consola.log(` ${pc.bold(pc.green("➜"))} http://localhost:${port}`);
console.log();
Expand Down Expand Up @@ -98,7 +98,7 @@ function createResponse(
| FormData
| URLSearchParams
| null,
options?: ResponseInit
options?: ResponseInit,
) {
const res = new Response(body, options);
res.headers.set("Access-Control-Allow-Origin", "*");
Expand Down
2 changes: 1 addition & 1 deletion src/services/chrome-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function createChromeService() {
string,
Gql.ChromeExtension | undefined
>(DAY_MS, (ids) =>
Promise.all(ids.map((id) => chrome.crawlExtension(id, "en")))
Promise.all(ids.map((id) => chrome.crawlExtension(id, "en"))),
);

return {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface CacheEntry<T> {

export function createCachedDataLoader<K, V>(
ttl: number,
batchLoadFn: DataLoader.BatchLoadFn<K, V>
batchLoadFn: DataLoader.BatchLoadFn<K, V>,
) {
return new DataLoader(batchLoadFn, {
cacheMap: createInMemoryCache({ ttl }),
Expand Down

0 comments on commit 2ff6c39

Please sign in to comment.