@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 CHANGED
@@ -9,7 +9,7 @@ Get basic stats about public **npm** packages maintained by you, in your termina
9
9
  **Install Globally:**
10
10
 
11
11
  ```shell
12
- Publication to NPM registry is pending
12
+ $ npm i -g @fusionfroze/statsy
13
13
  ```
14
14
 
15
15
  **For Local Development:**
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
- throw new Error(
28
- `Can't fetch download stats: ${downloadDataResponse.status}`,
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));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fusionfroze/statsy",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Get stats about the npm packages maintained by you in your terminal",
5
5
  "license": "MIT",
6
6
  "author": "FusionFroze",