-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
127 changed files
with
24,161 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: "v3.0.0-alpha.4" # Use the sha or tag you want to point at | ||
hooks: | ||
- id: prettier | ||
files: ".*.(json|js|css)" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
src/serviceWorker.js | ||
package-lock.json | ||
src/assets/lottie | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"trailingComma": "none", | ||
"bracketSpacing": false, | ||
"arrowParens": "avoid", | ||
"singleQuote": false, | ||
"printWidth": 80, | ||
"useTabs": false, | ||
"tabWidth": 2, | ||
"semi": true | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This file is the main docker file configurations | ||
|
||
# Official Node JS runtime as a parent image | ||
FROM node:20.0-alpine | ||
|
||
# Set the working directory to ./app | ||
WORKDIR /app | ||
|
||
# Install app dependencies | ||
# A wildcard is used to ensure both package.json AND package-lock.json are copied | ||
# where available (npm@5+) | ||
COPY package.json ./ | ||
|
||
RUN apk add --no-cache git | ||
|
||
# Install any needed packages | ||
RUN npm install | ||
|
||
# Audit fix npm packages | ||
RUN npm audit fix | ||
|
||
# Bundle app source | ||
COPY . /app | ||
|
||
# Make port 3000 available to the world outside this container | ||
EXPOSE 3000 | ||
|
||
# Run app.js when the container launches | ||
CMD ["npm", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// README | ||
// This is only a .env example | ||
// Do not change this file, adding your GITHUB TOKEN here! | ||
// Use cp or mv (like this: cp env.example .env), then edit .env with your GITHUB TOKEN. | ||
// IMPORTANT: Don't forget to add to update your .gitignore with .env (to avoid making your key public!) | ||
|
||
REACT_APP_GITHUB_TOKEN = "YOUR GITHUB TOKEN HERE" | ||
GITHUB_USERNAME = "YOUR GITHUB USERNAME HERE" | ||
// Set to true to fetch profile data from GitHub (remember to remove all components relying on GitHub data if set to false) | ||
USE_GITHUB_DATA = "true" | ||
// Set to your username in order to fetch blog data from Medium (otherwise, hardcoded values from Blogs.js are used) | ||
MEDIUM_USERNAME = "YOU MEDIUM USERNAME HERE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
fs = require("fs"); | ||
const https = require("https"); | ||
process = require("process"); | ||
require("dotenv").config(); | ||
|
||
const GITHUB_TOKEN = process.env.REACT_APP_GITHUB_TOKEN; | ||
const GITHUB_USERNAME = process.env.GITHUB_USERNAME; | ||
const USE_GITHUB_DATA = process.env.USE_GITHUB_DATA; | ||
const MEDIUM_USERNAME = process.env.MEDIUM_USERNAME; | ||
|
||
const ERR = { | ||
noUserName: | ||
"Github Username was found to be undefined. Please set all relevant environment variables.", | ||
requestFailed: | ||
"The request to GitHub didn't succeed. Check if GitHub token in your .env file is correct.", | ||
requestFailedMedium: | ||
"The request to Medium didn't succeed. Check if Medium username in your .env file is correct." | ||
}; | ||
if (USE_GITHUB_DATA === "true") { | ||
if (GITHUB_USERNAME === undefined) { | ||
throw new Error(ERR.noUserName); | ||
} | ||
|
||
console.log(`Fetching profile data for ${GITHUB_USERNAME}`); | ||
var data = JSON.stringify({ | ||
query: ` | ||
{ | ||
user(login:"${GITHUB_USERNAME}") { | ||
name | ||
bio | ||
avatarUrl | ||
location | ||
pinnedItems(first: 6, types: [REPOSITORY]) { | ||
totalCount | ||
edges { | ||
node { | ||
... on Repository { | ||
name | ||
description | ||
forkCount | ||
stargazers { | ||
totalCount | ||
} | ||
url | ||
id | ||
diskUsage | ||
primaryLanguage { | ||
name | ||
color | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
` | ||
}); | ||
const default_options = { | ||
hostname: "api.github.com", | ||
path: "/graphql", | ||
port: 443, | ||
method: "POST", | ||
headers: { | ||
Authorization: `Bearer ${GITHUB_TOKEN}`, | ||
"User-Agent": "Node" | ||
} | ||
}; | ||
|
||
const req = https.request(default_options, res => { | ||
let data = ""; | ||
|
||
console.log(`statusCode: ${res.statusCode}`); | ||
if (res.statusCode !== 200) { | ||
throw new Error(ERR.requestFailed); | ||
} | ||
|
||
res.on("data", d => { | ||
data += d; | ||
}); | ||
res.on("end", () => { | ||
fs.writeFile("./public/profile.json", data, function (err) { | ||
if (err) return console.log(err); | ||
console.log("saved file to public/profile.json"); | ||
}); | ||
}); | ||
}); | ||
|
||
req.on("error", error => { | ||
throw error; | ||
}); | ||
|
||
req.write(data); | ||
req.end(); | ||
} | ||
|
||
if (MEDIUM_USERNAME !== undefined) { | ||
console.log(`Fetching Medium blogs data for ${MEDIUM_USERNAME}`); | ||
const options = { | ||
hostname: "api.rss2json.com", | ||
path: `/v1/api.json?rss_url=https://medium.com/feed/@${MEDIUM_USERNAME}`, | ||
port: 443, | ||
method: "GET" | ||
}; | ||
|
||
const req = https.request(options, res => { | ||
let mediumData = ""; | ||
|
||
console.log(`statusCode: ${res.statusCode}`); | ||
if (res.statusCode !== 200) { | ||
throw new Error(ERR.requestMediumFailed); | ||
} | ||
|
||
res.on("data", d => { | ||
mediumData += d; | ||
}); | ||
res.on("end", () => { | ||
fs.writeFile("./public/blogs.json", mediumData, function (err) { | ||
if (err) return console.log(err); | ||
console.log("saved file to public/blogs.json"); | ||
}); | ||
}); | ||
}); | ||
|
||
req.on("error", error => { | ||
throw error; | ||
}); | ||
|
||
req.end(); | ||
} |
Oops, something went wrong.