diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..135c80e
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,25 @@
+# API
+API_HOST=0.0.0.0
+API_PORT=3001
+API_DOMAIN=opengraph.opensauced.pizza
+MEMORY_HEAP=200
+MEMORY_RSS=3000
+DISK_PERCENTAGE=0.7
+DISK_SIZE=100
+NODE_ENV=development
+API_CODENAME=opengraph-local
+
+# Github
+GITHUB_PAT_USER=
+GITHUB_PAT_PR=
+GITHUB_PAT_COMMIT=
+
+# Digital Ocean
+DO_SPACES_ACCESS_KEY_ID=
+DO_SPACES_SECRET_ACCESS_KEY=
+DO_SPACES_PROTOCOL=https
+DO_SPACES_ENDPOINT=digitaloceanspaces.com
+DO_SPACES_REGION=sfo3
+DO_SPACES_BUCKET_NAME=opengraph-dev
+DO_SPACES_SUBDOMAIN=
+DO_SPACES_CDN_DISABLED=true
diff --git a/README.md b/README.md
index 8ece0ef..7965ab2 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,21 @@
- [](https://opensauced.pizza)
+[](https://opensauced.pizza)
- # 🍕 Open Sauced OpenGraph Generator 🍕
- > The path to your next Open Source contribution
+# 🍕 Open Sauced OpenGraph Generator 🍕
- [](https://www.digitalocean.com/?refcode=c65a90d0956d&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge)
+> The path to your next Open Source contribution
+
+[](https://www.digitalocean.com/?refcode=c65a90d0956d&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge)
+
+[](https://github.com/open-sauced/opengraph.opensauced.pizza/pulse)
+[](https://github.com/open-sauced/opengraph.opensauced.pizza/pulse)
+[](https://github.com/open-sauced/opengraph.opensauced.pizza/issues)
+[](https://github.com/open-sauced/opengraph.opensauced.pizza/releases)
+[](https://discord.gg/U2peSNf23P)
+[](https://twitter.com/saucedopen)
- [](https://github.com/open-sauced/opengraph.opensauced.pizza/pulse)
- [](https://github.com/open-sauced/opengraph.opensauced.pizza/pulse)
- [](https://github.com/open-sauced/opengraph.opensauced.pizza/issues)
- [](https://github.com/open-sauced/opengraph.opensauced.pizza/releases)
- [](https://discord.gg/U2peSNf23P)
- [](https://twitter.com/saucedopen)
## 🚀 Live release environments
@@ -31,6 +33,7 @@
## 📖 Prerequisites
In order to run the project we need the following software binaries installed on our development machines:
+
- [x] `node>=18.15.0`
- [x] `npm>=9.6.3`
- [ ] `docker>=20.10.23`
@@ -53,14 +56,21 @@ npm run start:dev
There are a few scripts that can be used to generate and test the social cards locally without having to deploy to the CDN. This is the way to go when developing & testing the interface for the social cards.
-#### Generating user profile cards:
+#### Generating user profile cards
```shell
-npm run local-dev:usercards
+npm run test:local:user
```
> Generates user cards for all users in the test array inside `test/local-dev/UserCards.ts` and outputs them in `dist/local-dev/` for testing.
+The same goes for the other card types:
+
+- `npm run test:local:insight` is for generating insight cards.
+- `npm run test:local:highlight` is for generating highlight cards.
+
+The output of these scripts can be found in the `dist/local-dev/` folder as well.
+
### 📝 Environment variables
Some environment variables are required to run the application. You can find them in the `.env.example` file. While most of them are optional, some are required to run the application.
@@ -137,7 +147,7 @@ We have a couple of scripts to check and adjust missing types.
In order to dry run what types would be added to `package.json`:
```shell
-npm run types:auto-check
+npm run types:auto-check
```
In order to add any missing types to `package.json`:
diff --git a/src/social-card/user-card/user-card.service.ts b/src/social-card/user-card/user-card.service.ts
index 4f186d8..6649450 100644
--- a/src/social-card/user-card/user-card.service.ts
+++ b/src/social-card/user-card/user-card.service.ts
@@ -77,9 +77,9 @@ export class UserCardService {
name: user.name,
langs: Array.from(Object.values(langs)).sort((a, b) => b.size - a.size),
langTotal,
- repos: user.topRepositories.nodes?.filter(
- repo => !repo?.isPrivate && repo?.owner.login !== username,
- ) as Repository[],
+ repos: user.topRepositories.nodes
+ ?.filter(repo => !repo?.isPrivate && repo?.owner.login !== username)
+ .filter(Boolean) as Repository[],
avatarUrl: `${String(user.avatarUrl)}&size=150`,
formattedName: user.login,
};
diff --git a/test/local-dev/HighlightCards.ts b/test/local-dev/HighlightCards.ts
index d71c746..d762424 100644
--- a/test/local-dev/HighlightCards.ts
+++ b/test/local-dev/HighlightCards.ts
@@ -6,7 +6,7 @@ import { HighlightCardService } from "../../src/social-card/highlight-card/highl
const testHighlights = [102, 101, 103];
-const folderPath = "dist";
+const folderPath = "dist/local-dev";
async function testHighlightCards() {
const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [AppModule] }).compile();
diff --git a/test/local-dev/InsightCards.ts b/test/local-dev/InsightCards.ts
index b8a24e1..797d3aa 100644
--- a/test/local-dev/InsightCards.ts
+++ b/test/local-dev/InsightCards.ts
@@ -6,7 +6,7 @@ import { InsightCardService } from "../../src/social-card/insight-card/insight-c
const testInsightIds = [350, 351];
-const folderPath = "dist";
+const folderPath = "dist/local-dev";
async function testHighlightCards() {
const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [AppModule] }).compile();
diff --git a/test/local-dev/UserCards.ts b/test/local-dev/UserCards.ts
index e7d22ad..73a33a2 100644
--- a/test/local-dev/UserCards.ts
+++ b/test/local-dev/UserCards.ts
@@ -5,8 +5,7 @@ import { existsSync } from "node:fs";
import { mkdir, writeFile } from "fs/promises";
const testUsernames = ["bdougie", "deadreyo", "defunkt", "0-vortex", "Anush008", "diivi"];
-
-const folderPath = "dist";
+const folderPath = "dist/local-dev";
async function testUserCards() {
const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [AppModule] }).compile();