diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml
index a25b6fc..837aba7 100644
--- a/.github/workflows/testing.yml
+++ b/.github/workflows/testing.yml
@@ -7,19 +7,19 @@ on:
pull_request:
branches:
- master
+ workflow_dispatch:
jobs:
install-dependencies:
runs-on: ubuntu-latest
strategy:
matrix:
- deno-version: [1.36.1]
+ deno-version: [1.43.6]
steps:
- name: Git Checkout Deno Module
- uses: actions/checkout@v2
- - name: Use Deno Version ${{ matrix.deno-version }}
- uses: denolib/setup-deno@v2
+ uses: actions/checkout@v4
+ - uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno-version }}
- name: Deno format check
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5e01cba..e6bbb1c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -45,8 +45,8 @@ Read the [.editorconfig](./.editorconfig)
## Pull Requests
-Pull requests are are always welcome! In general, they should a single concern
-in the least number of changed lines as possible. For changes that address core
+Pull requests are always welcome! In general, they should a single concern in
+the least number of changed lines as possible. For changes that address core
functionality, it is best to open an issue to discuss your proposal first. I
look forward to seeing what you come up with!
diff --git a/README.md b/README.md
index 8ccf4e9..f5dae51 100644
--- a/README.md
+++ b/README.md
@@ -1,36 +1,35 @@
-
-
+
+
GitHub Profile Trophy
🏆 Add dynamically generated GitHub Stat Trophies on your readme
-
-
+
+
+
You can use this service for free. I'm looking for sponsors to help us keep up with this service❤️
-
+
# Quick Start
@@ -42,7 +41,7 @@ readme, change the `?username=` value to your GitHub's username.
```
-
+
## Use theme
diff --git a/api/index.ts b/api/index.ts
index fd4a33c..dfe8e19 100644
--- a/api/index.ts
+++ b/api/index.ts
@@ -117,7 +117,7 @@ async function app(req: Request): Promise {
const userResponseInfo = await client.requestUserInfo(username);
if (userResponseInfo instanceof ServiceError) {
return new Response(
- ErrorPage({ error: userResponseInfo, username }).render(),
+ ErrorPage({ error: userResponseInfo }).render(),
{
status: userResponseInfo.code,
headers: new Headers({ "Content-Type": "text" }),
diff --git a/src/Services/GithubApiService.ts b/src/Services/GithubApiService.ts
index 6960de6..d226e3c 100644
--- a/src/Services/GithubApiService.ts
+++ b/src/Services/GithubApiService.ts
@@ -14,8 +14,7 @@ import {
} from "../Schemas/index.ts";
import { Retry } from "../Helpers/Retry.ts";
import { CONSTANTS } from "../utils.ts";
-import { EServiceKindError } from "../Types/EServiceKindError.ts";
-import { ServiceError } from "../Types/ServiceError.ts";
+import { EServiceKindError, ServiceError } from "../Types/index.ts";
import { Logger } from "../Helpers/Logger.ts";
import { requestGithubData } from "./request.ts";
@@ -85,7 +84,7 @@ export class GithubApiService extends GithubRepository {
(activity as PromiseFulfilledResult).value,
(issue as PromiseFulfilledResult).value,
(pullRequest as PromiseFulfilledResult).value,
- repository as GitHubUserRepository,
+ repository,
);
}
@@ -98,15 +97,13 @@ export class GithubApiService extends GithubRepository {
TOKENS.length,
CONSTANTS.DEFAULT_GITHUB_RETRY_DELAY,
);
- const response = await retry.fetch>(async ({ attempt }) => {
+ return await retry.fetch>(async ({ attempt }) => {
return await requestGithubData(
query,
variables,
TOKENS[attempt],
);
});
-
- return response;
} catch (error) {
if (error.cause instanceof ServiceError) {
Logger.error(error.cause.message);
diff --git a/src/Services/__tests__/githubApiService.test.ts b/src/Services/__tests__/githubApiService.test.ts
index 99c5935..93af3f1 100644
--- a/src/Services/__tests__/githubApiService.test.ts
+++ b/src/Services/__tests__/githubApiService.test.ts
@@ -3,17 +3,17 @@ import { assertEquals, returnsNext, soxa, stub } from "../../../deps.ts";
import { GitHubUserRepository } from "../../user_info.ts";
const rateLimitMock = await import("../__mocks__/rateLimitMock.json", {
- assert: { type: "json" },
+ with: { type: "json" },
});
const successGithubResponseMock = await import(
"../__mocks__/successGithubResponse.json",
- { assert: { type: "json" } }
+ { with: { type: "json" } }
);
const notFoundGithubResponseMock = await import(
"../__mocks__/notFoundUserMock.json",
- { assert: { type: "json" } }
+ { with: { type: "json" } }
);
import { ServiceError } from "../../Types/index.ts";
diff --git a/src/StaticRenderRegeneration/index.ts b/src/StaticRenderRegeneration/index.ts
index bc84621..853f595 100644
--- a/src/StaticRenderRegeneration/index.ts
+++ b/src/StaticRenderRegeneration/index.ts
@@ -29,7 +29,7 @@ export async function staticRenderRegeneration(
const response = await render(request);
if (response.status >= 200 && response.status < 300) {
- cacheManager.save(response);
+ void cacheManager.save(response);
}
return response;
diff --git a/src/card.ts b/src/card.ts
index 70e39f4..5087a5e 100644
--- a/src/card.ts
+++ b/src/card.ts
@@ -66,7 +66,7 @@ export class Card {
return row;
}
private getHeight(row: number) {
- // Calculate the height of card from turns
+ // Calculate the height of the card from turns
return this.panelSize * row + this.marginHeight * (row - 1);
}
diff --git a/src/error_page.ts b/src/error_page.ts
index 0da194f..7b1acb9 100644
--- a/src/error_page.ts
+++ b/src/error_page.ts
@@ -3,12 +3,11 @@ abstract class BaseError {
readonly message!: string;
constructor(readonly content?: string) {}
render() {
- const page = this.renderPage();
- return page;
+ return this.renderPage();
}
private renderPage() {
- const htmlPage = `
+ return `
@@ -46,7 +45,7 @@ abstract class BaseError {
border-radius: 5px;
padding: 20px;
margin-bottom: 20px;
- box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
+ box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
}
form {
display: flex;
@@ -108,12 +107,10 @@ abstract class BaseError {
${this.content ?? ""}
${
this.content &&
- 'Go back'
+ 'Go back'
}
`;
-
- return htmlPage;
}
}
diff --git a/src/pages/Error.ts b/src/pages/Error.ts
index 3e93d3d..9170345 100644
--- a/src/pages/Error.ts
+++ b/src/pages/Error.ts
@@ -3,10 +3,9 @@ import { Error400, Error404, Error419 } from "../error_page.ts";
interface ErrorPageProps {
error: ServiceError;
- username: string;
}
-export function ErrorPage({ error, username }: ErrorPageProps) {
+export function ErrorPage({ error }: ErrorPageProps) {
let cause: Error400 | Error404 | Error419 = new Error400();
if (error.cause === EServiceKindError.RATE_LIMIT) {
@@ -15,7 +14,7 @@ export function ErrorPage({ error, username }: ErrorPageProps) {
if (error.cause === EServiceKindError.NOT_FOUND) {
cause = new Error404(
- "Can not find a user with username: " + username,
+ "Sorry, the user you are looking for was not found.",
);
}
diff --git a/src/trophy.ts b/src/trophy.ts
index 14602c6..f81cdc7 100644
--- a/src/trophy.ts
+++ b/src/trophy.ts
@@ -26,7 +26,7 @@ export class Trophy {
this.setRank();
}
setRank() {
- const sortedRankConditions = this.rankConditions.sort((a, b) =>
+ const sortedRankConditions = this.rankConditions.toSorted((a, b) =>
RANK_ORDER.indexOf(a.rank) - RANK_ORDER.indexOf(b.rank)
);
// Set the rank that hit the first condition
@@ -314,7 +314,6 @@ export class AccountDurationTrophy extends Trophy {
super(score, rankConditions);
this.title = "Experience";
this.filterTitles = ["Experience", "Duration", "Since"];
- // this.hidden = true;
}
}
diff --git a/src/trophy_list.ts b/src/trophy_list.ts
index 1f190d9..7c0b083 100644
--- a/src/trophy_list.ts
+++ b/src/trophy_list.ts
@@ -77,7 +77,7 @@ export class TrophyList {
);
}
sortByRank() {
- this.trophies = this.trophies.sort((a: Trophy, b: Trophy) =>
+ this.trophies = this.trophies.toSorted((a: Trophy, b: Trophy) =>
RANK_ORDER.indexOf(a.rank) - RANK_ORDER.indexOf(b.rank)
);
}
diff --git a/src/utils.ts b/src/utils.ts
index a244d11..ca5b07c 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -1,9 +1,4 @@
export class CustomURLSearchParams extends URLSearchParams {
- constructor(
- init?: string[][] | Record | string | URLSearchParams,
- ) {
- super(init);
- }
getStringValue(key: string, defaultValue: string): string {
if (super.has(key)) {
const param = super.get(key);