diff --git a/.github/workflows/generate-theme-doc.yml b/.github/workflows/generate-theme-doc.yml index 9028044..75fcb89 100644 --- a/.github/workflows/generate-theme-doc.yml +++ b/.github/workflows/generate-theme-doc.yml @@ -16,7 +16,7 @@ jobs: - name: setup node uses: actions/setup-node@v1 with: - node-version: "12.x" + node-version: "16.x" - name: npm install, generate readme run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0911168..f5eec35 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v1 with: - node-version: "12.x" + node-version: "16.x" - name: Install & Test run: | diff --git a/api/index.js b/api/index.js index 2315ddd..64231a5 100644 --- a/api/index.js +++ b/api/index.js @@ -1,17 +1,19 @@ -require("dotenv").config(); -const { +import { renderError, parseBoolean, parseArray, clampValue, CONSTANTS, -} = require("../src/common/utils"); -const fetchStats = require("../src/fetchers/stats-fetcher"); -const renderStatsCard = require("../src/cards/stats-card"); -const blacklist = require("../src/common/blacklist"); -const { isLocaleAvailable } = require("../src/translations"); +} from "../src/common/utils"; +import fetchStats from "../src/fetchers/stats-fetcher"; +import renderStatsCard from "../src/cards/stats-card"; +import blacklist from "../src/common/blacklist"; +import { isLocaleAvailable } from "../src/translations"; +import * as dotenv from "dotenv"; -module.exports = async (req, res) => { +dotenv.config(); + +export default async (req, res) => { const { username, hide, diff --git a/api/pin.js b/api/pin.js index f2761cb..1902388 100644 --- a/api/pin.js +++ b/api/pin.js @@ -1,16 +1,15 @@ -require("dotenv").config(); -const { +import { renderError, parseBoolean, clampValue, CONSTANTS, -} = require("../src/common/utils"); -const fetchRepo = require("../src/fetchers/repo-fetcher"); -const renderRepoCard = require("../src/cards/repo-card"); -const blacklist = require("../src/common/blacklist"); -const { isLocaleAvailable } = require("../src/translations"); +} from "../src/common/utils"; +import fetchRepo from "../src/fetchers/repo-fetcher"; +import renderRepoCard from "../src/cards/repo-card"; +import blacklist from "../src/common/blacklist"; +import { isLocaleAvailable } from "../src/translations"; -module.exports = async (req, res) => { +export default async (req, res) => { const { username, repo, diff --git a/api/top-langs.js b/api/top-langs.js index 8080207..d83d9d6 100644 --- a/api/top-langs.js +++ b/api/top-langs.js @@ -1,17 +1,19 @@ -require("dotenv").config(); -const { +import { renderError, clampValue, parseBoolean, parseArray, CONSTANTS, -} = require("../src/common/utils"); -const fetchTopLanguages = require("../src/fetchers/top-languages-fetcher"); -const renderTopLanguages = require("../src/cards/top-languages-card"); -const blacklist = require("../src/common/blacklist"); -const { isLocaleAvailable } = require("../src/translations"); +} from "../src/common/utils"; +import fetchTopLanguages from "../src/fetchers/top-languages-fetcher"; +import { renderTopLanguages } from "../src/cards/top-languages-card"; +import blacklist from "../src/common/blacklist"; +import { isLocaleAvailable } from "../src/translations"; +import * as dotenv from "dotenv"; -module.exports = async (req, res) => { +dotenv.config(); + +export default async (req, res) => { const { username, hide, diff --git a/api/wakatime.js b/api/wakatime.js index 18b5218..8e27e2f 100644 --- a/api/wakatime.js +++ b/api/wakatime.js @@ -1,16 +1,18 @@ -require("dotenv").config(); -const { +import { renderError, parseBoolean, clampValue, parseArray, CONSTANTS, -} = require("../src/common/utils"); -const { isLocaleAvailable } = require("../src/translations"); -const { fetchWakatimeStats } = require("../src/fetchers/wakatime-fetcher"); -const wakatimeCard = require("../src/cards/wakatime-card"); +} from "../src/common/utils"; +import { isLocaleAvailable } from "../src/translations"; +import fetchWakatimeStats from "../src/fetchers/wakatime-fetcher"; +import wakatimeCard from "../src/cards/wakatime-card"; +import * as dotenv from "dotenv"; -module.exports = async (req, res) => { +dotenv.config(); + +export default async (req, res) => { const { username, title_color, diff --git a/jest.config.js b/jest.config.js index 0d51c47..7fbe69b 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,3 +1,5 @@ -module.exports = { +export default { clearMocks: true, + transform: {}, + testEnvironment: "jsdom", }; diff --git a/package.json b/package.json index be9e435..4cfcd07 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,11 @@ "version": "1.0.0", "description": "Dynamically generate stats for your github readmes", "main": "index.js", + "type": "module", "scripts": { - "test": "jest --coverage", - "test:watch": "jest --watch", + "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage", + "test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch", + "test:update:snapshot": "node --experimental-vm-modules node_modules/jest/bin/jest.js -u", "theme-readme-gen": "node scripts/generate-theme-doc", "preview-theme": "node scripts/preview-theme", "generate-langs-json": "node scripts/generate-langs-json", @@ -20,14 +22,15 @@ "devDependencies": { "@actions/core": "^1.2.4", "@actions/github": "^4.0.0", - "@testing-library/dom": "^7.20.0", - "@testing-library/jest-dom": "^5.11.0", + "@testing-library/dom": "^8.17.1", + "@testing-library/jest-dom": "^5.16.5", + "jest-environment-jsdom": "^29.0.3", + "jest": "^29.0.3", "@uppercod/css-to-object": "^1.1.1", "axios-mock-adapter": "^1.18.1", "color-contrast-checker": "^2.1.0", "hjson": "^3.2.2", "husky": "^4.2.5", - "jest": "^26.1.0", "js-yaml": "^4.1.0", "lodash.snakecase": "^4.1.1", "parse-diff": "^0.7.0", @@ -38,6 +41,7 @@ "dotenv": "^8.2.0", "emoji-name-map": "^1.2.8", "github-username-regex": "^1.0.0", + "upgrade": "^1.1.0", "word-wrap": "^1.2.3" }, "husky": { diff --git a/scripts/generate-langs-json.js b/scripts/generate-langs-json.js index bd210a3..803d60b 100644 --- a/scripts/generate-langs-json.js +++ b/scripts/generate-langs-json.js @@ -1,6 +1,6 @@ -const fs = require("fs"); -const jsYaml = require("js-yaml"); -const axios = require("axios"); +import axios from "axios"; +import fs from "fs"; +import jsYaml from "js-yaml"; const LANGS_FILEPATH = "./src/common/languageColors.json"; diff --git a/scripts/generate-theme-doc.js b/scripts/generate-theme-doc.js index fcb3c5e..e8b83ad 100644 --- a/scripts/generate-theme-doc.js +++ b/scripts/generate-theme-doc.js @@ -1,5 +1,5 @@ -const theme = require("../themes/index"); -const fs = require("fs"); +import fs from "fs"; +import { themes } from "../themes/index"; const TARGET_FILE = "./themes/README.md"; const REPO_CARD_LINKS_FLAG = ""; @@ -54,7 +54,7 @@ const createStatMdLink = (theme) => { }; const generateLinks = (fn) => { - return Object.keys(theme) + return Object.keys(themes) .map((name) => fn(name)) .join(""); }; @@ -65,7 +65,7 @@ const createTableItem = ({ link, label, isRepoCard }) => { }; const generateTable = ({ isRepoCard }) => { const rows = []; - const themes = Object.keys(theme).filter( + const themes = Object.keys(themes).filter( (name) => name !== (!isRepoCard ? "default_repocard" : "default"), ); diff --git a/scripts/preview-theme.js b/scripts/preview-theme.js index e4422ec..33ee96b 100644 --- a/scripts/preview-theme.js +++ b/scripts/preview-theme.js @@ -1,11 +1,12 @@ -const core = require("@actions/core"); -const github = require("@actions/github"); -const parse = require("parse-diff"); -const Hjson = require("hjson"); -const snakeCase = require("lodash.snakecase"); -const ColorContrastChecker = require("color-contrast-checker"); +import core from "@actions/core"; +import github from "@actions/github"; +import ColorContrastChecker from "color-contrast-checker"; +import * as dotenv from "dotenv"; +import Hjson from "hjson"; +import snakeCase from "lodash.snakecase"; +import parse from "parse-diff"; -require("dotenv").config(); +dotenv.config(); const OWNER = "anuraghazra"; const REPO = "github-readme-stats"; @@ -76,10 +77,10 @@ function getGrsLink(colors) { } const themeContribGuidelines = ` - \rHi, thanks for the theme contribution, please read our theme [contribution guidelines](https://github.com/anuraghazra/github-readme-stats/blob/master/CONTRIBUTING.md#themes-contribution). + \rHi, thanks for the theme contribution, please read our theme [contribution guidelines](https://github.com/anuraghazra/github-readme-stats/blob/master/CONTRIBUTING.md#themes-contribution). \rWe are currently only accepting color combinations from any VSCode theme or themes which have good color combination to minimize bloating the themes collection. - \r> Also note that if this theme is exclusively for your personal use, then instead of adding it to our theme collection you can use card [customization options](https://github.com/anuraghazra/github-readme-stats#customization) + \r> Also note that if this theme is exclusively for your personal use, then instead of adding it to our theme collection you can use card [customization options](https://github.com/anuraghazra/github-readme-stats#customization) `; async function run() { @@ -128,7 +129,7 @@ async function run() { issue_number: pullRequestId, body: ` \r**${COMMENT_TITLE}** - + \rCannot create theme preview ${themeContribGuidelines} @@ -167,16 +168,16 @@ async function run() { owner: OWNER, repo: REPO, body: ` - \r**${COMMENT_TITLE}** - + \r**${COMMENT_TITLE}** + \r${warnings.map((warning) => `- :warning: ${warning}\n`).join("")} \ntitle_color: #${titleColor} | icon_color: #${iconColor} | text_color: #${textColor} | bg_color: #${bgColor} - + \r[Preview Link](${url}) \r[![](${url})](${url}) - + ${themeContribGuidelines} `, }); diff --git a/scripts/push-theme-readme.sh b/scripts/push-theme-readme.sh index 5223dd1..946096b 100755 --- a/scripts/push-theme-readme.sh +++ b/scripts/push-theme-readme.sh @@ -11,4 +11,4 @@ git checkout -b $BRANCH_NAME git add --all git commit --message "docs(theme): Auto update theme readme" || exit 0 git remote add origin-$BRANCH_NAME https://${PERSONAL_TOKEN}@github.com/${GH_REPO}.git -git push --force --quiet --set-upstream origin-$BRANCH_NAME $BRANCH_NAME \ No newline at end of file +git push --force --quiet --set-upstream origin-$BRANCH_NAME $BRANCH_NAME diff --git a/src/calculateRank.js b/src/calculateRank.js index 742b9ab..bbfece1 100644 --- a/src/calculateRank.js +++ b/src/calculateRank.js @@ -57,8 +57,8 @@ function calculateRank({ issues * ISSUES_OFFSET + stargazers * STARS_OFFSET + prs * PRS_OFFSET + - followers * FOLLOWERS_OFFSET + - totalRepos * REPO_OFFSET + followers * FOLLOWERS_OFFSET + + totalRepos * REPO_OFFSET ) / 100; const normalizedScore = normalcdf(score, TOTAL_VALUES, ALL_OFFSETS) * 100; @@ -74,4 +74,5 @@ function calculateRank({ return { level, score: normalizedScore }; } -module.exports = calculateRank; +export { calculateRank }; +export default calculateRank; diff --git a/src/cards/repo-card.js b/src/cards/repo-card.js index 034ee1f..61073be 100644 --- a/src/cards/repo-card.js +++ b/src/cards/repo-card.js @@ -1,17 +1,17 @@ // @ts-check -const { - kFormatter, +import { Card } from "../common/Card"; +import { I18n } from "../common/I18n"; +import { icons } from "../common/icons"; +import { encodeHTML, - getCardColors, flexLayout, - wrapTextMultiline, + getCardColors, + kFormatter, measureText, parseEmojis, -} = require("../common/utils"); -const I18n = require("../common/I18n"); -const Card = require("../common/Card"); -const icons = require("../common/icons"); -const { repoCardLocales } = require("../translations"); + wrapTextMultiline, +} from "../common/utils"; +import { repoCardLocales } from "../translations"; /** * @param {string} label @@ -185,4 +185,5 @@ const renderRepoCard = (repo, options = {}) => { `); }; -module.exports = renderRepoCard; +export { renderRepoCard }; +export default renderRepoCard; diff --git a/src/cards/stats-card.js b/src/cards/stats-card.js index 30056b8..962c1e4 100644 --- a/src/cards/stats-card.js +++ b/src/cards/stats-card.js @@ -1,16 +1,16 @@ // @ts-check -const I18n = require("../common/I18n"); -const Card = require("../common/Card"); -const icons = require("../common/icons"); -const { getStyles } = require("../getStyles"); -const { statCardLocales } = require("../translations"); -const { - kFormatter, - flexLayout, +import { Card } from "../common/Card"; +import { I18n } from "../common/I18n"; +import { icons } from "../common/icons"; +import { clampValue, - measureText, + flexLayout, getCardColors, -} = require("../common/utils"); + kFormatter, + measureText, +} from "../common/utils"; +import { getStyles } from "../getStyles"; +import { statCardLocales } from "../translations"; const createTextNode = ({ icon, @@ -300,4 +300,5 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => { `); }; -module.exports = renderStatsCard; +export { renderStatsCard }; +export default renderStatsCard; diff --git a/src/cards/top-languages-card.js b/src/cards/top-languages-card.js index b2f5c36..d8c1825 100644 --- a/src/cards/top-languages-card.js +++ b/src/cards/top-languages-card.js @@ -1,16 +1,16 @@ // @ts-check -const Card = require("../common/Card"); -const I18n = require("../common/I18n"); -const { langCardLocales } = require("../translations"); -const { createProgressNode } = require("../common/createProgressNode"); -const { +import { Card } from "../common/Card"; +import { createProgressNode } from "../common/createProgressNode"; +import { I18n } from "../common/I18n"; +import { + chunkArray, clampValue, - getCardColors, flexLayout, + getCardColors, lowercaseTrim, measureText, - chunkArray, -} = require("../common/utils"); +} from "../common/utils"; +import { langCardLocales } from "../translations"; const DEFAULT_CARD_WIDTH = 300; const MIN_CARD_WIDTH = 230; @@ -311,5 +311,4 @@ const renderTopLanguages = (topLangs, options = {}) => { `); }; -module.exports = renderTopLanguages; -module.exports.MIN_CARD_WIDTH = MIN_CARD_WIDTH; +export { renderTopLanguages, MIN_CARD_WIDTH }; diff --git a/src/cards/wakatime-card.js b/src/cards/wakatime-card.js index 5ab2f29..2f30b94 100644 --- a/src/cards/wakatime-card.js +++ b/src/cards/wakatime-card.js @@ -1,16 +1,16 @@ // @ts-check -const Card = require("../common/Card"); -const I18n = require("../common/I18n"); -const { getStyles } = require("../getStyles"); -const { wakatimeCardLocales } = require("../translations"); -const languageColors = require("../common/languageColors.json"); -const { createProgressNode } = require("../common/createProgressNode"); -const { +import { Card } from "../common/Card"; +import { createProgressNode } from "../common/createProgressNode"; +import { I18n } from "../common/I18n"; +import languageColors from "../common/languageColors.json"; +import { clampValue, - getCardColors, flexLayout, + getCardColors, lowercaseTrim, -} = require("../common/utils"); +} from "../common/utils"; +import { getStyles } from "../getStyles"; +import { wakatimeCardLocales } from "../translations"; /** * @param {{color: string, text: string}} param0 @@ -314,5 +314,5 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => { `); }; -module.exports = renderWakatimeCard; -exports.createProgressNode = createProgressNode; +export { renderWakatimeCard }; +export default renderWakatimeCard; diff --git a/src/common/Card.js b/src/common/Card.js index 2cc8455..24ec443 100644 --- a/src/common/Card.js +++ b/src/common/Card.js @@ -1,5 +1,5 @@ -const { getAnimations } = require("../getStyles"); -const { flexLayout, encodeHTML } = require("../common/utils"); +import { encodeHTML, flexLayout } from "../common/utils"; +import { getAnimations } from "../getStyles"; class Card { /** @@ -216,4 +216,5 @@ class Card { } } -module.exports = Card; +export { Card }; +export default Card; diff --git a/src/common/I18n.js b/src/common/I18n.js index e28f605..7f607cd 100644 --- a/src/common/I18n.js +++ b/src/common/I18n.js @@ -18,4 +18,5 @@ class I18n { } } -module.exports = I18n; +export { I18n }; +export default I18n; diff --git a/src/common/blacklist.js b/src/common/blacklist.js index 3ef635c..752ef94 100644 --- a/src/common/blacklist.js +++ b/src/common/blacklist.js @@ -1,3 +1,4 @@ const blacklist = ["renovate-bot", "technote-space", "sw-yx"]; -module.exports = blacklist; +export { blacklist }; +export default blacklist; diff --git a/src/common/createProgressNode.js b/src/common/createProgressNode.js index 0f15264..80abc8f 100644 --- a/src/common/createProgressNode.js +++ b/src/common/createProgressNode.js @@ -1,4 +1,4 @@ -const { clampValue } = require("../common/utils"); +import { clampValue } from "../common/utils"; const createProgressNode = ({ x, @@ -16,7 +16,7 @@ const createProgressNode = ({ @@ -25,4 +25,5 @@ const createProgressNode = ({ `; }; -exports.createProgressNode = createProgressNode; +export { createProgressNode }; +export default createProgressNode; diff --git a/src/common/icons.js b/src/common/icons.js index 7b7e507..5282a93 100644 --- a/src/common/icons.js +++ b/src/common/icons.js @@ -8,4 +8,5 @@ const icons = { fork: ``, }; -module.exports = icons; +export { icons }; +export default icons; diff --git a/src/common/languageColors.json b/src/common/languageColors.json index 12c85bd..3c1370f 100644 --- a/src/common/languageColors.json +++ b/src/common/languageColors.json @@ -499,4 +499,4 @@ "wdl": "#42f1f4", "wisp": "#7582D1", "xBase": "#403a40" -} \ No newline at end of file +} diff --git a/src/common/retryer.js b/src/common/retryer.js index b06d3e2..f37aaa4 100644 --- a/src/common/retryer.js +++ b/src/common/retryer.js @@ -1,4 +1,4 @@ -const { logger, CustomError } = require("../common/utils"); +import { CustomError, logger } from "../common/utils"; const retryer = async (fetcher, variables, retries = 0) => { if (retries > 7) { @@ -40,4 +40,5 @@ const retryer = async (fetcher, variables, retries = 0) => { } }; -module.exports = retryer; +export { retryer }; +export default retryer; diff --git a/src/common/utils.js b/src/common/utils.js index 2ad18dd..042b635 100644 --- a/src/common/utils.js +++ b/src/common/utils.js @@ -1,8 +1,8 @@ // @ts-check -const axios = require("axios"); -const wrap = require("word-wrap"); -const themes = require("../../themes"); -const toEmoji = require("emoji-name-map"); +import axios from "axios"; +import toEmoji from "emoji-name-map"; +import wrap from "word-wrap"; +import { themes } from "../../themes"; /** * @param {string} message @@ -370,7 +370,7 @@ function parseEmojis(str) { }); } -module.exports = { +export { renderError, kFormatter, encodeHTML, diff --git a/src/fetchers/repo-fetcher.js b/src/fetchers/repo-fetcher.js index 0bad5f2..c55c3d7 100644 --- a/src/fetchers/repo-fetcher.js +++ b/src/fetchers/repo-fetcher.js @@ -1,6 +1,6 @@ // @ts-check -const retryer = require("../common/retryer"); -const { request, MissingParamError } = require("../common/utils"); +import { retryer } from "../common/retryer"; +import { MissingParamError, request } from "../common/utils"; /** * @param {import('Axios').AxiosRequestHeaders} variables @@ -97,4 +97,5 @@ async function fetchRepo(username, reponame) { } } -module.exports = fetchRepo; +export { fetchRepo }; +export default fetchRepo; diff --git a/src/fetchers/stats-fetcher.js b/src/fetchers/stats-fetcher.js index dc9be5b..cb13255 100644 --- a/src/fetchers/stats-fetcher.js +++ b/src/fetchers/stats-fetcher.js @@ -1,17 +1,17 @@ // @ts-check -const axios = require("axios").default; -const githubUsernameRegex = require("github-username-regex"); - -const retryer = require("../common/retryer"); -const calculateRank = require("../calculateRank"); -const { - request, - logger, +import axios from "axios"; +import * as dotenv from "dotenv"; +import githubUsernameRegex from "github-username-regex"; +import { calculateRank } from "../calculateRank"; +import { retryer } from "../common/retryer"; +import { CustomError, + logger, MissingParamError, -} = require("../common/utils"); + request, +} from "../common/utils"; -require("dotenv").config(); +dotenv.config(); /** * @param {import('axios').AxiosRequestHeaders} variables @@ -187,4 +187,5 @@ async function fetchStats( return stats; } -module.exports = fetchStats; +export { fetchStats }; +export default fetchStats; diff --git a/src/fetchers/top-languages-fetcher.js b/src/fetchers/top-languages-fetcher.js index 7c4c878..555fb06 100644 --- a/src/fetchers/top-languages-fetcher.js +++ b/src/fetchers/top-languages-fetcher.js @@ -1,7 +1,9 @@ // @ts-check -const { request, logger, MissingParamError } = require("../common/utils"); -const retryer = require("../common/retryer"); -require("dotenv").config(); +import * as dotenv from "dotenv"; +import { retryer } from "../common/retryer"; +import { logger, MissingParamError, request } from "../common/utils"; + +dotenv.config(); /** * @param {import('Axios').AxiosRequestHeaders} variables @@ -104,4 +106,5 @@ async function fetchTopLanguages(username, exclude_repo = []) { return topLangs; } -module.exports = fetchTopLanguages; +export { fetchTopLanguages }; +export default fetchTopLanguages; diff --git a/src/fetchers/wakatime-fetcher.js b/src/fetchers/wakatime-fetcher.js index fe06c63..8c40deb 100644 --- a/src/fetchers/wakatime-fetcher.js +++ b/src/fetchers/wakatime-fetcher.js @@ -1,5 +1,5 @@ -const axios = require("axios"); -const { MissingParamError } = require("../common/utils"); +import axios from "axios"; +import { MissingParamError } from "../common/utils"; /** * @param {{username: string, api_domain: string, range: string}} props @@ -26,6 +26,5 @@ const fetchWakatimeStats = async ({ username, api_domain, range }) => { } }; -module.exports = { - fetchWakatimeStats, -}; +export { fetchWakatimeStats }; +export default fetchWakatimeStats; diff --git a/src/getStyles.js b/src/getStyles.js index e76b51f..3c77787 100644 --- a/src/getStyles.js +++ b/src/getStyles.js @@ -81,7 +81,7 @@ const getStyles = ({ animation: fadeInAnimation 0.3s ease-in-out forwards; } .rank-text { - font: 800 24px 'Segoe UI', Ubuntu, Sans-Serif; fill: ${textColor}; + font: 800 24px 'Segoe UI', Ubuntu, Sans-Serif; fill: ${textColor}; animation: scaleInAnimation 0.3s ease-in-out forwards; } @@ -91,7 +91,7 @@ const getStyles = ({ fill: ${iconColor}; display: ${!!show_icons ? "block" : "none"}; } - + .rank-circle-rim { stroke: ${titleColor}; fill: none; @@ -113,4 +113,4 @@ const getStyles = ({ `; }; -module.exports = { getStyles, getAnimations }; +export { getStyles, getAnimations }; diff --git a/src/translations.js b/src/translations.js index 31b2d21..c91dcb5 100644 --- a/src/translations.js +++ b/src/translations.js @@ -1,4 +1,4 @@ -const { encodeHTML } = require("./common/utils"); +import { encodeHTML } from "./common/utils"; const statCardLocales = ({ name, apostrophe }) => { const encodedName = encodeHTML(name); @@ -358,7 +358,7 @@ function isLocaleAvailable(locale) { return availableLocales.includes(locale.toLowerCase()); } -module.exports = { +export { isLocaleAvailable, availableLocales, statCardLocales, diff --git a/tests/__snapshots__/renderWakatimeCard.test.js.snap b/tests/__snapshots__/renderWakatimeCard.test.js.snap index bd62580..69e22e4 100644 --- a/tests/__snapshots__/renderWakatimeCard.test.js.snap +++ b/tests/__snapshots__/renderWakatimeCard.test.js.snap @@ -1,180 +1,20 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Test Render Wakatime Card should render correctly 1`] = ` -" - - - - - - - - - - - - - Wakatime Stats - - - - - - - - - - Other: - 19 mins - - - - - - - - - - - TypeScript: - 1 min - - - - - - - - - - - - - - " -`; +exports[`Test Render Wakatime Card should render correctly 1`] = `[Function]`; exports[`Test Render Wakatime Card should render correctly with compact layout 1`] = ` " - - + +