@fusionfroze/statsy 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/fetchStats.js +9 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/fetchStats.js
CHANGED
|
@@ -18,14 +18,20 @@ export default async function fetchStats(packageName, config) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const rowPromises = packageData.map(async (p) => {
|
|
21
|
+
if (!p) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
try {
|
|
22
26
|
const downloadDataResponse = await fetch(
|
|
23
27
|
`https://api.npmjs.org/downloads/point/last-week/${p.package.name}`,
|
|
24
28
|
);
|
|
25
29
|
|
|
26
30
|
if (!downloadDataResponse.ok) {
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
console.error(
|
|
32
|
+
chalk.red(
|
|
33
|
+
`${downloadDataResponse.status}: Can't fetch download stats for ${p.package.name}`,
|
|
34
|
+
),
|
|
29
35
|
);
|
|
30
36
|
}
|
|
31
37
|
|
|
@@ -73,7 +79,7 @@ export default async function fetchStats(packageName, config) {
|
|
|
73
79
|
version: packageVersion,
|
|
74
80
|
stars: repositoryData.starsCount,
|
|
75
81
|
issues: repositoryData.issuesCount,
|
|
76
|
-
downloads: downloadData.downloads,
|
|
82
|
+
downloads: downloadData.downloads ? downloadData.downloads : "N/A",
|
|
77
83
|
};
|
|
78
84
|
} catch (error) {
|
|
79
85
|
console.error(chalk.red(error.message));
|