Skip to content

Commit 399ca27

Browse files
Merge pull request #143 from mindfiredigital/dev
Fix npm stats issue
2 parents 195ec70 + dd6b3a8 commit 399ca27

File tree

5 files changed

+173
-61
lines changed

5 files changed

+173
-61
lines changed

src/app/projects/assets/contributors.json

Lines changed: 77 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
[
22
{
33
"id": 116242186,
4-
"contributions": 273,
4+
"contributions": 286,
55
"html_url": "https://github.com/ashutosh-jena-mindfire",
66
"avatar_url": "https://avatars.githubusercontent.com/u/116242186?v=4",
77
"login": "ashutosh-jena-mindfire"
88
},
99
{
1010
"id": 80667930,
11-
"contributions": 188,
11+
"contributions": 224,
1212
"html_url": "https://github.com/lakinmindfire",
1313
"avatar_url": "https://avatars.githubusercontent.com/u/80667930?v=4",
1414
"login": "lakinmindfire"
1515
},
16+
{
17+
"id": 121153274,
18+
"contributions": 185,
19+
"html_url": "https://github.com/madhav-nasit",
20+
"avatar_url": "https://avatars.githubusercontent.com/u/121153274?v=4",
21+
"login": "madhav-nasit"
22+
},
1623
{
1724
"id": 120394376,
1825
"contributions": 126,
@@ -27,6 +34,20 @@
2734
"avatar_url": "https://avatars.githubusercontent.com/u/7521181?v=4",
2835
"login": "ssswagatss"
2936
},
37+
{
38+
"id": 66638045,
39+
"contributions": 108,
40+
"html_url": "https://github.com/Siddharth-1698",
41+
"avatar_url": "https://avatars.githubusercontent.com/u/66638045?v=4",
42+
"login": "Siddharth-1698"
43+
},
44+
{
45+
"id": 155735643,
46+
"contributions": 87,
47+
"html_url": "https://github.com/deepakyadav-01",
48+
"avatar_url": "https://avatars.githubusercontent.com/u/155735643?v=4",
49+
"login": "deepakyadav-01"
50+
},
3051
{
3152
"id": 63102290,
3253
"contributions": 57,
@@ -35,26 +56,47 @@
3556
"login": "VershalaTandon"
3657
},
3758
{
38-
"id": 31609471,
39-
"contributions": 29,
40-
"html_url": "https://github.com/soumyadeep589",
41-
"avatar_url": "https://avatars.githubusercontent.com/u/31609471?v=4",
42-
"login": "soumyadeep589"
59+
"id": 104986454,
60+
"contributions": 34,
61+
"html_url": "https://github.com/pratul-mindfire",
62+
"avatar_url": "https://avatars.githubusercontent.com/u/104986454?v=4",
63+
"login": "pratul-mindfire"
4364
},
4465
{
4566
"id": 64151314,
46-
"contributions": 26,
67+
"contributions": 33,
4768
"html_url": "https://github.com/BasudevBharatBhushan",
4869
"avatar_url": "https://avatars.githubusercontent.com/u/64151314?v=4",
4970
"login": "BasudevBharatBhushan"
5071
},
72+
{
73+
"id": 108745749,
74+
"contributions": 31,
75+
"html_url": "https://github.com/Shubh2694",
76+
"avatar_url": "https://avatars.githubusercontent.com/u/108745749?v=4",
77+
"login": "Shubh2694"
78+
},
79+
{
80+
"id": 31609471,
81+
"contributions": 29,
82+
"html_url": "https://github.com/soumyadeep589",
83+
"avatar_url": "https://avatars.githubusercontent.com/u/31609471?v=4",
84+
"login": "soumyadeep589"
85+
},
5186
{
5287
"id": 103591425,
5388
"contributions": 25,
5489
"html_url": "https://github.com/ArnabKMindfire",
5590
"avatar_url": "https://avatars.githubusercontent.com/u/103591425?v=4",
5691
"login": "ArnabKMindfire"
5792
},
93+
{
94+
"id": 85334692,
95+
"contributions": 25,
96+
"html_url": "https://github.com/hemant-sudhanshu",
97+
"avatar_url": "https://avatars.githubusercontent.com/u/85334692?v=4",
98+
"login": "hemant-sudhanshu"
99+
},
58100
{
59101
"id": 148045555,
60102
"contributions": 18,
@@ -70,11 +112,11 @@
70112
"login": "lakinmohapatra"
71113
},
72114
{
73-
"id": 85334692,
115+
"id": 160819069,
74116
"contributions": 16,
75-
"html_url": "https://github.com/hemant-sudhanshu",
76-
"avatar_url": "https://avatars.githubusercontent.com/u/85334692?v=4",
77-
"login": "hemant-sudhanshu"
117+
"html_url": "https://github.com/konark-mindfire",
118+
"avatar_url": "https://avatars.githubusercontent.com/u/160819069?v=4",
119+
"login": "konark-mindfire"
78120
},
79121
{
80122
"id": 118360815,
@@ -90,6 +132,20 @@
90132
"avatar_url": "https://avatars.githubusercontent.com/u/5602062?v=4",
91133
"login": "debabratapatra"
92134
},
135+
{
136+
"id": 155735575,
137+
"contributions": 15,
138+
"html_url": "https://github.com/anandmindfire",
139+
"avatar_url": "https://avatars.githubusercontent.com/u/155735575?v=4",
140+
"login": "anandmindfire"
141+
},
142+
{
143+
"id": 87860388,
144+
"contributions": 15,
145+
"html_url": "https://github.com/iabhishekkumarms",
146+
"avatar_url": "https://avatars.githubusercontent.com/u/87860388?v=4",
147+
"login": "iabhishekkumarms"
148+
},
93149
{
94150
"id": 29296038,
95151
"contributions": 13,
@@ -104,16 +160,9 @@
104160
"avatar_url": "https://avatars.githubusercontent.com/u/134675427?v=4",
105161
"login": "VershalaT"
106162
},
107-
{
108-
"id": 160819069,
109-
"contributions": 11,
110-
"html_url": "https://github.com/konark-mindfire",
111-
"avatar_url": "https://avatars.githubusercontent.com/u/160819069?v=4",
112-
"login": "konark-mindfire"
113-
},
114163
{
115164
"id": 138189810,
116-
"contributions": 10,
165+
"contributions": 11,
117166
"html_url": "https://github.com/Satyam-Mindfire",
118167
"avatar_url": "https://avatars.githubusercontent.com/u/138189810?v=4",
119168
"login": "Satyam-Mindfire"
@@ -139,13 +188,6 @@
139188
"avatar_url": "https://avatars.githubusercontent.com/u/137804674?v=4",
140189
"login": "Bhupesh-mfsi"
141190
},
142-
{
143-
"id": 87860388,
144-
"contributions": 6,
145-
"html_url": "https://github.com/iabhishekkumarms",
146-
"avatar_url": "https://avatars.githubusercontent.com/u/87860388?v=4",
147-
"login": "iabhishekkumarms"
148-
},
149191
{
150192
"id": 10649999,
151193
"contributions": 6,
@@ -180,5 +222,12 @@
180222
"html_url": "https://github.com/divyarbehera",
181223
"avatar_url": "https://avatars.githubusercontent.com/u/20682504?v=4",
182224
"login": "divyarbehera"
225+
},
226+
{
227+
"id": 5079169,
228+
"contributions": 1,
229+
"html_url": "https://github.com/mfsi-waseema",
230+
"avatar_url": "https://avatars.githubusercontent.com/u/5079169?v=4",
231+
"login": "mfsi-waseema"
183232
}
184-
]
233+
]

src/app/projects/assets/projects.json

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,33 @@
110110
"shortDescription": "Simplifies mobile development with pre-built features like login, signup, and settings. Developers integrate efficiently, leveraging diverse themes.",
111111
"githubUrl": "https://github.com/mindfiredigital/MobileQuickLaunchKit-Android",
112112
"documentationUrl": "https://github.com/mindfiredigital/MobileQuickLaunchKit-Android"
113+
},
114+
{
115+
"id": 15,
116+
"title": "neo-pusher",
117+
"short_description": "Automates CSV to Neo4j data transfer with schema generation, preprocessing, and insertion. Streamlines database integration, ensuring data consistency and efficiency.",
118+
"github_repository_link": "https://github.com/mindfiredigital/neo-pusher",
119+
"documentation_link": "https://pypi.org/project/neo-pusher/",
120+
"project_type": "current",
121+
"date_created": "2024-08-28T11:26:33.000Z",
122+
"date_updated": null,
123+
"status": "published",
124+
"shortDescription": "Automates CSV to Neo4j data transfer with schema generation, preprocessing, and insertion. Streamlines database integration, ensuring data consistency and efficiency.",
125+
"githubUrl": "https://github.com/mindfiredigital/neo-pusher",
126+
"documentationUrl": "https://pypi.org/project/neo-pusher/"
127+
},
128+
{
129+
"id": 16,
130+
"title": "react-text-igniter",
131+
"short_description": "A powerful and intuitive HTML Editor built with React.js.",
132+
"github_repository_link": "https://github.com/mindfiredigital/react-text-igniter",
133+
"documentation_link": "https://github.com/mindfiredigital/react-text-igniter",
134+
"project_type": "current",
135+
"date_created": "2024-09-03T11:15:08.000Z",
136+
"date_updated": null,
137+
"status": "published",
138+
"shortDescription": "A powerful and intuitive HTML Editor built with React.js.",
139+
"githubUrl": "https://github.com/mindfiredigital/react-text-igniter",
140+
"documentationUrl": "https://github.com/mindfiredigital/react-text-igniter"
113141
}
114-
]
142+
]

src/app/projects/assets/stats.json

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
11
[
22
{
3-
"name": "fmdapi-node-weaver",
3+
"name": "react-canvas-editor",
44
"type": "npm",
55
"day": 0,
6-
"week": 3,
7-
"year": 70,
8-
"total": 70
6+
"week": 32,
7+
"year": 1514,
8+
"total": 1514
99
},
1010
{
11-
"name": "react-canvas-editor",
11+
"name": "canvas-editor",
1212
"type": "npm",
1313
"day": 1,
14-
"week": 22,
15-
"year": 947,
16-
"total": 947
14+
"week": 19,
15+
"year": 1426,
16+
"total": 1426
1717
},
1818
{
19-
"name": "canvas-editor",
19+
"name": "react-text-igniter",
20+
"type": "npm",
21+
"day": 72,
22+
"week": 230,
23+
"year": 230,
24+
"total": 230
25+
},
26+
{
27+
"name": "fmdapi-node-weaver",
2028
"type": "npm",
2129
"day": 0,
22-
"week": 7,
23-
"year": 1063,
24-
"total": 1063
30+
"week": 1,
31+
"year": 94,
32+
"total": 94
2533
},
2634
{
2735
"name": "neo-pusher",
2836
"type": "pypi",
29-
"last_day": 46,
30-
"last_week": 935,
31-
"last_month": 1011,
32-
"total": 1011
37+
"last_day": 14,
38+
"last_week": 376,
39+
"last_month": 1341,
40+
"total": 1341
3341
}
34-
]
42+
]

src/app/projects/assets/upcomingProjects.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@
8383
"githubUrl": "https://github.com/mindfiredigital/QuickLaunchReactNativeKit",
8484
"documentationUrl": "https://github.com/mindfiredigital/QuickLaunchReactNativeKit"
8585
}
86-
]
86+
]

updateProject.mjs

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { fileURLToPath } from "url";
66

77
const __filename = fileURLToPath(import.meta.url);
88
const __dirname = path.dirname(__filename);
9-
109
// Function to fetch data from an API endpoint
1110
async function fetchData(url, options) {
1211
const response = await fetch(url, options);
@@ -24,11 +23,29 @@ async function fetchCollaborators(url, githubToken) {
2423
Accept: "application/vnd.github.v3+json",
2524
},
2625
};
27-
return await fetchData(url, options);
26+
try {
27+
const data = await fetchData(url, options);
28+
// New: Check if the response is an array (valid collaborators data)
29+
if (Array.isArray(data)) {
30+
return data;
31+
} else {
32+
console.log(`No collaborators found or invalid response for URL: ${url}`);
33+
return [];
34+
}
35+
} catch (error) {
36+
console.error(`Error fetching collaborators from ${url}:`, error.message);
37+
return [];
38+
}
2839
}
2940

3041
// Function to get collaborators of a repository
3142
async function getCollaborators(repoData, githubToken) {
43+
// Check if contributors_url exists
44+
if (!repoData.contributors_url) {
45+
console.log(`No contributors URL found for repository: ${repoData.name}`);
46+
return [];
47+
}
48+
3249
if (repoData.fork && repoData.parent?.contributors_url) {
3350
// If the repository is a fork and has a parent, fetch collaborators from both
3451
const [c1, c2] = await Promise.all([
@@ -138,19 +155,28 @@ async function updateProjects() {
138155
const repoNames = repositories.map((repo) => repo.name);
139156
const contributorsObject = {};
140157
for (const repoName of repoNames) {
141-
const repoData = await fetchData(
142-
`https://api.github.com/repos/mindfiredigital/${repoName}`,
143-
{
144-
headers: {
145-
Authorization: `token ${githubToken}`,
146-
Accept: "application/vnd.github.v3+json",
147-
},
158+
try {
159+
const repoData = await fetchData(
160+
`https://api.github.com/repos/mindfiredigital/${repoName}`,
161+
{
162+
headers: {
163+
Authorization: `token ${githubToken}`,
164+
Accept: "application/vnd.github.v3+json",
165+
},
166+
}
167+
);
168+
const contributors = await getCollaborators(repoData, githubToken);
169+
if (contributors.length > 0) {
170+
contributorsObject[repoName] = contributors;
171+
} else {
172+
console.log(`No contributors found for repository: ${repoName}`);
148173
}
149-
);
150-
contributorsObject[repoName] = await getCollaborators(
151-
repoData,
152-
githubToken
153-
);
174+
} catch (error) {
175+
console.error(
176+
`Error processing repository ${repoName}:`,
177+
error.message
178+
);
179+
}
154180
}
155181

156182
// Aggregate contributor from contributors
@@ -192,6 +218,7 @@ async function updateProjects() {
192218
"fmdapi-node-weaver",
193219
"react-canvas-editor",
194220
"canvas-editor",
221+
"react-text-igniter",
195222
];
196223
const pypiPackages = ["neo-pusher"];
197224
getAllStats(npmPackages, pypiPackages)

0 commit comments

Comments
 (0)