Repository: anuraghazra/github-readme-stats
Pull request #2549 (2023-02-25 13:09:17)

fix theme preview
Fixes the theme-preview GitHub action.

vercel[bot]: [vc]: #+eSFdGnj9Lyo/Y146XD5SwUXhSVXLu8nN/c4CTDrXP0=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJnaXRodWItcmVhZG1lLXN0YXRzIiwicm9vdERpcmVjdG9yeSI6bnVsbCwiaW5zcGVjdG9yVXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL2dpdGh1Yi1yZWFkbWUtc3RhdHMtdGVhbS9naXRodWItcmVhZG1lLXN0YXRzL0RZcVdCbUJ6NFRzQlVIVHZDYndhNm9iak5MaGUiLCJuZXh0Q29tbWl0U3RhdHVzIjoiUEVORElORyJ9XX0=
**The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)

| Name | Status | Preview | Updated |
| :--- | :----- | :------ | :------ |
| **github-readme-stats** | 🔄 Building ([Inspect](https://vercel.com/github-readme-stats-team/github-readme-stats/DYqWBmBz4TsBUHTvCbwa6objNLhe)) |  | Feb 25, 2023 at 1:09PM (UTC) |


codecov[bot]: # [Codecov](https://codecov.io/gh/anuraghazra/github-readme-stats/pull/2549?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) Report
Base: **97.29**% // Head: **97.29**% // No change to project coverage :thumbsup:
> Coverage data is based on head [(`4beb3b9`)](https://codecov.io/gh/anuraghazra/github-readme-stats/pull/2549?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) compared to base [(`a3c6f87`)](https://codecov.io/gh/anuraghazra/github-readme-stats/commit/a3c6f874af5c7140c67d3db4e15f85fb92171fd8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra).
> Patch has no changes to coverable lines.

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##           master    #2549   +/-   ##
=======================================
  Coverage   97.29%   97.29%           
=======================================
  Files          24       24           
  Lines        4216     4216           
  Branches      384      384           
=======================================
  Hits         4102     4102           
  Misses        112      112           
  Partials        2        2           
```



Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra)

</details>

[:umbrella: View full report at Codecov](https://codecov.io/gh/anuraghazra/github-readme-stats/pull/2549?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra).

rickstaa: @Zo-Bro-23, a small fix for the theme preview action. We can merge it to try it out.


Patch:
diff --git a/.gitignore b/.gitignore
index 2cdfa3d..2501750 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,5 @@ vercel_token
 # IDE
 .vscode
 *.code-workspace
+
+.vercel
diff --git a/express.js b/express.js
new file mode 100644
index 0000000..0a13962
--- /dev/null
+++ b/express.js
@@ -0,0 +1,15 @@
+import statsCard from './api/index.js'
+import repoCard from './api/pin.js'
+import langCard from './api/top-langs.js'
+import wakatimeCard from './api/wakatime.js'
+import express from 'express'
+import dotenv from 'dotenv'
+
+dotenv.config()
+const app = express()
+app.listen(process.env.port || 9000)
+
+app.get('/', statsCard)
+app.get('/pin', repoCard)
+app.get('/top-langs', langCard)
+app.get('/wakatime', wakatimeCard)
diff --git a/readme.md b/readme.md
index 83f573e..7a60228 100644
--- a/readme.md
+++ b/readme.md
@@ -92,7 +92,9 @@ Visit <https://indiafightscorona.giveindia.org> and make a small donation to hel
     -   [Repo Card Exclusive Options](#repo-card-exclusive-options)
     -   [Language Card Exclusive Options](#language-card-exclusive-options)
     -   [Wakatime Card Exclusive Option](#wakatime-card-exclusive-options)
--   [Deploy Yourself](#deploy-on-your-own-vercel-instance)
+-   [Deploy Yourself](#deploy-on-your-own)
+    -   [On Vercel](#on-vercel)
+    -   [On other platforms](#on-other-platforms)
     -   [Keep your fork up to date](#keep-your-fork-up-to-date)
 
 # GitHub Stats Card
@@ -509,7 +511,9 @@ By default, GitHub does not lay out the cards side by side. To do that, you can
 </a>
 ```
 
-## Deploy on your own Vercel instance
+## Deploy on your own
+
+### On Vercel
 
 #### :film_projector: [Check Out Step By Step Video Tutorial By @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107)
 
@@ -546,6 +550,23 @@ Since the GitHub API only allows 5k requests per hour, my `https://github-readme
 
 </details>
 
+### On other platforms
+
+> **Warning**
+> This way of using GRS is not officially supported and was added to cater to some particular use cases where Vercel could not be used (e.g. #2341). The support for this method, therefore, is limited.
+
+<details>
+<summary><b>:hammer_and_wrench: Step-by-step guide for deploying on other platforms</b></summary>
+
+1. Fork or clone this repo as per your needs
+2. Add `express` to the dependencies section of `package.json`
+https://github.com/anuraghazra/github-readme-stats/blob/ba7c2f8b55eac8452e479c8bd38b044d204d0424/package.json#L54-L61
+3. Run `npm i` if needed (initial setup)
+4. Run `node express.js` to start the server, or set the entry point to `express.js` in `package.json` if you're deploying on a managed service
+https://github.com/anuraghazra/github-readme-stats/blob/ba7c2f8b55eac8452e479c8bd38b044d204d0424/package.json#L11
+5. You're done 🎉
+</details>
+
 ### Keep your fork up to date
 
 You can keep your fork, and thus your private Vercel instance up to date with the upstream using GitHubs' [Sync Fork button](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork). You can also use the [pull](https://github.com/wei/pull) package created by [@wei](https://github.com/wei) to automate this process.
diff --git a/scripts/preview-theme.js b/scripts/preview-theme.js
index 38faf87..aae892c 100644
--- a/scripts/preview-theme.js
+++ b/scripts/preview-theme.js
@@ -298,12 +298,13 @@ const themeNameAlreadyExists = (name) => {
   return themes[name] !== undefined;
 };
 
+const DRY_RUN = process.env.DRY_RUN === "true" || false;
+
 /**
  * Main function.
  */
 export const run = async (prNumber) => {
   try {
-    const dryRun = process.env.DRY_RUN === "true" || false;
     debug("Retrieve action information from context...");
     debug(`Context: ${inspect(github.context)}`);
     let commentBody = `
@@ -513,7 +514,7 @@ export const run = async (prNumber) => {
     // Create or update theme-preview comment.
     debug("Create or update theme-preview comment...");
     let comment_url;
-    if (!dryRun) {
+    if (!DRY_RUN) {
       comment_url = await upsertComment(octokit, {
         comment_id: comment?.id,
         issue_number: pullRequestId,
@@ -535,7 +536,7 @@ export const run = async (prNumber) => {
     const reviewReason = themesValid
       ? undefined
       : INVALID_REVIEW_COMMENT(comment_url);
-    if (!dryRun) {
+    if (!DRY_RUN) {
       await addReview(
         octokit,
         pullRequestId,
@@ -558,7 +559,7 @@ export const run = async (prNumber) => {
     }
   } catch (error) {
     debug("Set review state to `REQUEST_CHANGES` and add `invalid` label...");
-    if (!dryRun) {
+    if (!DRY_RUN) {
       await addReview(
         octokit,
         pullRequestId,
diff --git a/src/cards/top-languages-card.js b/src/cards/top-languages-card.js
index be1328c..ce8e12a 100644
--- a/src/cards/top-languages-card.js
+++ b/src/cards/top-languages-card.js
@@ -13,7 +13,7 @@ import {
 import { langCardLocales } from "../translations.js";
 
 const DEFAULT_CARD_WIDTH = 300;
-const MIN_CARD_WIDTH = 230;
+const MIN_CARD_WIDTH = 280;
 const DEFAULT_LANGS_COUNT = 5;
 const DEFAULT_LANG_COLOR = "#858585";
 const CARD_PADDING = 25;
@@ -317,7 +317,6 @@ const renderTopLanguages = (topLangs, options = {}) => {
 
   let finalLayout = "";
   if (layout === "compact" || hide_progress == true) {
-    width = width + 50; // padding
     height =
       calculateCompactLayoutHeight(langs.length) + (hide_progress ? -25 : 0);
 


Test patch:
diff --git a/tests/e2e/e2e.test.js b/tests/e2e/e2e.test.js
index 402e210..f34859d 100644
--- a/tests/e2e/e2e.test.js
+++ b/tests/e2e/e2e.test.js
@@ -15,14 +15,14 @@ const REPO = "curly-fiesta";
 const USER = "catelinemnemosyne";
 const STATS_DATA = {
   name: "Cateline Mnemosyne",
-  totalPRs: 1,
-  totalCommits: 7,
+  totalPRs: 2,
+  totalCommits: 8,
   totalIssues: 1,
   totalStars: 1,
   contributedTo: 1,
   rank: {
     level: "A+",
-    score: 50.893750297869225,
+    score: 50.88831151384285,
   },
 };
 
diff --git a/tests/renderTopLanguages.test.js b/tests/renderTopLanguages.test.js
index 8ae4bbd..de9e21f 100644
--- a/tests/renderTopLanguages.test.js
+++ b/tests/renderTopLanguages.test.js
@@ -216,7 +216,7 @@ describe("Test renderTopLanguages", () => {
     );
     expect(queryAllByTestId(document.body, "lang-progress")[0]).toHaveAttribute(
       "width",
-      "120",
+      "100",
     );
 
     expect(queryAllByTestId(document.body, "lang-name")[1]).toHaveTextContent(
@@ -224,7 +224,7 @@ describe("Test renderTopLanguages", () => {
     );
     expect(queryAllByTestId(document.body, "lang-progress")[1]).toHaveAttribute(
       "width",
-      "120",
+      "100",
     );
 
     expect(queryAllByTestId(document.body, "lang-name")[2]).toHaveTextContent(
@@ -232,7 +232,7 @@ describe("Test renderTopLanguages", () => {
     );
     expect(queryAllByTestId(document.body, "lang-progress")[2]).toHaveAttribute(
       "width",
-      "60",
+      "50",
     );
   });