refactor: update folder structure

This commit is contained in:
Rick Staa
2023-01-16 12:19:47 +01:00
parent 2c970b29c1
commit 147a5d9e2a
16 changed files with 17 additions and 15 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
themes: themes/index.js
doc-translation: docs/*
card-i18n: src/assets/translations.js
card-i18n: src/translations.js
+1 -1
View File
@@ -8,7 +8,7 @@ import {
renderError,
} from "../src/common/utils.js";
import { fetchStats } from "../src/fetchers/stats-fetcher.js";
import { isLocaleAvailable } from "../src/assets/translations.js";
import { isLocaleAvailable } from "../src/translations.js";
export default async (req, res) => {
const {
+1 -1
View File
@@ -7,7 +7,7 @@ import {
renderError,
} from "../src/common/utils.js";
import { fetchRepo } from "../src/fetchers/repo-fetcher.js";
import { isLocaleAvailable } from "../src/assets/translations.js";
import { isLocaleAvailable } from "../src/translations.js";
export default async (req, res) => {
const {
+1 -1
View File
@@ -8,7 +8,7 @@ import {
renderError,
} from "../src/common/utils.js";
import { fetchTopLanguages } from "../src/fetchers/top-languages-fetcher.js";
import { isLocaleAvailable } from "../src/assets/translations.js";
import { isLocaleAvailable } from "../src/translations.js";
export default async (req, res) => {
const {
+1 -1
View File
@@ -7,7 +7,7 @@ import {
renderError,
} from "../src/common/utils.js";
import { fetchWakatimeStats } from "../src/fetchers/wakatime-fetcher.js";
import { isLocaleAvailable } from "../src/assets/translations.js";
import { isLocaleAvailable } from "../src/translations.js";
export default async (req, res) => {
const {
+1 -1
View File
@@ -11,7 +11,7 @@ import {
parseEmojis,
wrapTextMultiline,
} from "../common/utils.js";
import { repoCardLocales } from "../assets/translations.js";
import { repoCardLocales } from "../translations.js";
/**
* Retrieves the repository description and wraps it to fit the card width.
+1 -1
View File
@@ -10,7 +10,7 @@ import {
measureText,
} from "../common/utils.js";
import { getStyles } from "../common/getStyles.js";
import { statCardLocales } from "../assets/translations.js";
import { statCardLocales } from "../translations.js";
/**
* Create a stats card text item.
+1 -1
View File
@@ -10,7 +10,7 @@ import {
lowercaseTrim,
measureText,
} from "../common/utils.js";
import { langCardLocales } from "../assets/translations.js";
import { langCardLocales } from "../translations.js";
const DEFAULT_CARD_WIDTH = 300;
const MIN_CARD_WIDTH = 230;
+1 -1
View File
@@ -9,7 +9,7 @@ import {
lowercaseTrim,
} from "../common/utils.js";
import { getStyles } from "../common/getStyles.js";
import { wakatimeCardLocales } from "../assets/translations.js";
import { wakatimeCardLocales } from "../translations.js";
/** Import language colors.
*
+3 -1
View File
@@ -45,7 +45,9 @@ const retryer = async (fetcher, variables, retries = 0) => {
// prettier-ignore
// also checking for bad credentials if any tokens gets invalidated
const isBadCredential = err.response.data && err.response.data.message === "Bad credentials";
const isAccountSuspended = err.response.data && err.response.data.message === "Sorry. Your account was suspended.";
const isAccountSuspended =
err.response.data &&
err.response.data.message === "Sorry. Your account was suspended.";
if (isBadCredential || isAccountSuspended) {
logger.log(`PAT_${retries + 1} Failed`);
+1 -1
View File
@@ -1,7 +1,7 @@
// @ts-check
import axios from "axios";
import githubUsernameRegex from "github-username-regex";
import { calculateRank } from "./helpers/calculateRank.js";
import { calculateRank } from "../common/calculateRank.js";
import { retryer } from "../common/retryer.js";
import {
CustomError,
@@ -1,4 +1,4 @@
import { encodeHTML } from "../common/utils.js";
import { encodeHTML } from "./common/utils.js";
/**
* Retrieves stat card labels in the available locales.
+1 -1
View File
@@ -2,7 +2,7 @@ import { jest } from "@jest/globals";
import axios from "axios";
import MockAdapter from "axios-mock-adapter";
import api from "../api/index.js";
import { calculateRank } from "../src/fetchers/helpers/calculateRank.js";
import { calculateRank } from "../src/common/calculateRank.js";
import { renderStatsCard } from "../src/cards/stats-card.js";
import { CONSTANTS, renderError } from "../src/common/utils.js";
+1 -1
View File
@@ -1,5 +1,5 @@
import "@testing-library/jest-dom";
import { calculateRank } from "../src/fetchers/helpers/calculateRank.js";
import { calculateRank } from "../src/common/calculateRank.js";
describe("Test calculateRank", () => {
it("should calculate rank correctly", () => {
+1 -1
View File
@@ -1,7 +1,7 @@
import "@testing-library/jest-dom";
import axios from "axios";
import MockAdapter from "axios-mock-adapter";
import { calculateRank } from "../src/fetchers/helpers/calculateRank.js";
import { calculateRank } from "../src/common/calculateRank.js";
import { fetchStats } from "../src/fetchers/stats-fetcher.js";
const data = {