stack-analyze 1.2.2 → 1.2.3

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/CHANGELOG.md CHANGED
@@ -2,20 +2,26 @@
2
2
 
3
3
  stack-analyze all version and notable changes, fixed, remove and new additions in code.
4
4
 
5
+ ## version 1.2.3
6
+ ### Added
7
+ - bundlephobia info tool
8
+ ### Changed
9
+ - change write json to csv in hardware information
10
+
5
11
  ## version 1.2.2
6
12
  ### Added
7
13
  - add save file function for the tools
8
- ### change
14
+ ### Changed
9
15
  - change the hash table to unique function in hardware information
10
- ### fixed
16
+ ### Fixed
11
17
  - fixed to unique user to multiple users with split params
12
18
 
13
19
  ## version 1.2.1
14
- ### fixed
20
+ ### Fixed
15
21
  - rewrite form arrow functions to named function with export default.
16
22
  - rewrite some test functions.
17
23
  - add regexp form bitly info tool
18
- ### change
24
+ ### Changed
19
25
  - renove menu now using categories.
20
26
  - add api params.
21
27
  - comeback multibar from pagespeed tool
@@ -23,10 +29,10 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
23
29
  ## version 1.2.0
24
30
  ### Added
25
31
  - new tool password generator
26
- ### fixed
32
+ ### Fixed
27
33
  - update anime search tool
28
34
  - the files modules now using callbacks and remove no using vars
29
- ### change
35
+ ### Changed
30
36
  - the web scraping tool decided to use the question returns to the main menu instead of going to the main menu
31
37
 
32
38
  ## version 1.1.9
@@ -34,9 +40,9 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
34
40
  - new module cheerio
35
41
  - new tool webscraping
36
42
  - new test
37
- ### fixed
43
+ ### Fixed
38
44
  - rewirte axios import
39
- ### change
45
+ ### Changed
40
46
  - hardware information change from functions to hash table
41
47
  - about now is hash table
42
48
  - now using the function printTable avoid overwritting.
@@ -46,10 +52,10 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
46
52
  - remove hash tables
47
53
 
48
54
  ## version 1.1.8
49
- ### fixed
55
+ ### Fixed
50
56
  - restructure all tools as a hash table with promises except the tool hardware information and about section
51
57
  - update all modules
52
- ### change
58
+ ### Changed
53
59
  - remove the module coingecko-api
54
60
  - remove process.env variables to writting manual token for security
55
61
 
@@ -57,11 +63,11 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
57
63
  ### Added
58
64
  - twitch info tool
59
65
  - remove one js module for module to cjs and esm
60
- ### fixed
66
+ ### Fixed
61
67
  - change write token to process.env varaibles own (not avalible values in github and gitlab)
62
68
  - migrate cjs to esm
63
69
  - rewrite module
64
- ### change
70
+ ### Changed
65
71
  - except some hardware tools and github using models from console-table-printer
66
72
  - now using esm now about is js file not folder about with index.js
67
73
  - rewrite all tests functions
@@ -69,9 +75,9 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
69
75
  ## version 1.1.6
70
76
  ### Added
71
77
  - module stack-analyze mode
72
- ### fixed
78
+ ### Fixed
73
79
  - rewrite code
74
- ### changed
80
+ ### Changed
75
81
  - menu renove
76
82
  - renove jsdocs in some function or variables
77
83
  - remove nonolive recommends soon in versions desktop 7 and pwa 1.5.0
@@ -81,10 +87,10 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
81
87
  - add new tool: movie info
82
88
  - add new test
83
89
  - renove menu
84
- ### fixed
90
+ ### Fixed
85
91
  - rewrite in some functions and about
86
92
  - remove some dependencies not using project
87
- ### changed
93
+ ### Changed
88
94
  - change multibar to 2 single bars
89
95
  - change switch in all tools for hash functions tables
90
96
  - renove nonolive recommends
@@ -93,7 +99,7 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
93
99
  ### Added
94
100
  - add new tool: bitly info
95
101
  - add new test
96
- ### fixed
102
+ ### Fixed
97
103
  - rewrite some functions
98
104
  - update npm modules via manual
99
105
 
@@ -103,31 +109,31 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
103
109
  - add new tool: crypto market
104
110
  - add new recomends
105
111
  - add new test
106
- ### fixed
112
+ ### Fixed
107
113
  - rewrite some functions
108
114
  - update npm modules via manual
109
- ### changed
115
+ ### Changed
110
116
  - add new const variables for map array functions
111
117
 
112
118
  ## version 1.1.2
113
119
  ### Added
114
120
  - add new nonolive streamers Recomend
115
- ### fixed
121
+ ### Fixed
116
122
  - rewrite multiple techstack
117
123
  - rewrite test files
118
- ### changed
124
+ ### Changed
119
125
  - changed the for loop to foreach loop
120
126
 
121
127
  ## version 1.1.1
122
128
  ### Added
123
129
  - using console.table only in objects variables
124
- - using the console-table-printer in arrays in some functions and the about sectiond
130
+ - using the console-table-printer in arrays in some functions and the about section
125
131
  - add the new module: console-table-printer
126
132
  - add the new nonolive streamers and youtube dev recommedation
127
- ### fixed
133
+ ### Fixed
128
134
  - rewrite some funcions
129
135
  - fragment about section
130
- ### changed
136
+ ### Changed
131
137
  - using console.table only in objects variables
132
138
  - using the console-table-printer in arrays in some functions and the about section
133
139
 
@@ -138,7 +144,7 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
138
144
  - jsdoc + the template minami the dev modules
139
145
  - add the hardware information
140
146
  - add new recomendations for about section
141
- ### fixed
147
+ ### Fixed
142
148
  - rewrite the code the functions singlestack and multiple
143
149
  - add the name app to question function
144
150
  ### Changed
@@ -160,7 +166,7 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
160
166
  - add the new modules:
161
167
  - colors
162
168
  - cli-progress
163
- ### fixed
169
+ ### Fixed
164
170
  change json print to table print version
165
171
  ### Changed
166
172
  - change console.dir about to console.table
package/about.js CHANGED
@@ -80,7 +80,7 @@ const aboutTool = {
80
80
  /** @type {twitch[]} */
81
81
  const twitchUsers = [
82
82
  {
83
- user: "dannyaegyo",
83
+ user: "DannyAgii",
84
84
  },
85
85
  {
86
86
  user: "Lunanny",
package/api/webApis.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import Wappalyzer from "wappalyzer";
2
- import { default as axios } from "axios";
2
+ import axios from "axios";
3
3
 
4
4
  const wappalyzer = new Wappalyzer();
5
5
 
@@ -1,5 +1,5 @@
1
1
  // modules
2
- import { default as axios } from "axios";
2
+ import axios from "axios";
3
3
  import { format } from "timeago.js";
4
4
  import colors from "colors";
5
5
  import { printTable } from "console-table-printer";
@@ -1,5 +1,5 @@
1
1
  // modules
2
- import { default as axios } from "axios";
2
+ import axios from "axios";
3
3
  import { format } from "timeago.js";
4
4
  import colors from "colors";
5
5
 
@@ -0,0 +1,36 @@
1
+ import axios from "axios";
2
+ import colors from "colors";
3
+ import { stackSave } from "../utils.js";
4
+
5
+ /**
6
+ * @description kilobyte convert for bundlephobia pkg info
7
+ * @param {number} size - pkg sixe
8
+ * @returns {string} - result converter
9
+ */
10
+ const kilobyteConvert = (size) => (size < 1024 ? `${size} B` : `${size / 1024} KB`);
11
+
12
+ /**
13
+ * @description
14
+ * @param {string} pkg
15
+ * @async
16
+ * @returns { Promise<void> } - return result bundlephobia info
17
+ */
18
+ export default async function bundlephobia (pkg) {
19
+ try {
20
+ const { data } = await axios.get("https://bundlephobia.com/api/size", {
21
+ params: { package: pkg }
22
+ });
23
+
24
+ console.table({
25
+ module_name: data.name,
26
+ module_version: data.version,
27
+ module_repo: data.repository,
28
+ module_size: kilobyteConvert(data.size),
29
+ module_gzip: kilobyteConvert(data.gzip),
30
+ });
31
+
32
+ stackSave(`${pkg}-pkg-info.json`, JSON.stringify(data, null, 2));
33
+ } catch (err) {
34
+ console.error(colors.red(err.message));
35
+ }
36
+ }
@@ -1,5 +1,5 @@
1
1
  // modules
2
- import {default as axios} from "axios";
2
+ import axios from "axios";
3
3
  import { format } from "timeago.js";
4
4
  import colors from "colors";
5
5
 
@@ -1,5 +1,5 @@
1
1
  // modules
2
- import { default as axios } from "axios";
2
+ import axios from "axios";
3
3
  import { format } from "timeago.js";
4
4
  import colors from "colors";
5
5
 
@@ -31,7 +31,7 @@ export default async function githubInfo(user) {
31
31
 
32
32
  console.table(info);
33
33
 
34
- stackSave(`${user}-info.json`, JSON.stringify(info, null, 2))
34
+ stackSave(`${user}-info.json`, JSON.stringify(info, null, 2));
35
35
  } catch(err) {
36
36
  console.error(colors.red(err.message));
37
37
  }
@@ -1,4 +1,5 @@
1
1
  // modules
2
+ import { createWriteStream } from "node:fs";
2
3
  import {
3
4
  cpu,
4
5
  mem,
@@ -11,13 +12,18 @@ import colors from "colors";
11
12
 
12
13
  import { stackSave } from "../utils.js";
13
14
 
15
+ const hardwareinfo = createWriteStream("hardware.csv");
16
+
17
+ const csvHeader = (obj) => `${Object.keys(obj).join(";")}\n`;
18
+ const csvData = (obj, spaces) => `${Object.values(obj).join(";")}${spaces}`;
19
+
14
20
  /**
15
21
  *
16
22
  * @param {number} size
17
23
  * @param {number} [base = 1073741824]
18
24
  * @returns {string}
19
25
  */
20
- const gigabyteConvert = (size, base=1073741824) => (size / base).toFixed(2);
26
+ const gigabyteConvert = (size, base = 1073741824) => (size / base).toFixed(2);
21
27
 
22
28
  /**
23
29
  *
@@ -26,92 +32,116 @@ const gigabyteConvert = (size, base=1073741824) => (size / base).toFixed(2);
26
32
  */
27
33
  export default async function hardware() {
28
34
  try {
29
- // Map object
30
- const hardware = new Map();
35
+ // bios info
36
+ const biosInfo = await bios();
31
37
 
32
- // info
33
- const biosInfo = await bios()
34
- const cpuInfo = await cpu()
35
- const ram = await mem()
36
- const os = await osInfo()
37
- const disks = await diskLayout()
38
- const { displays, controllers } = await graphics();
39
-
40
- // omit falsy values
41
- for(const key in biosInfo) {
42
- if(!biosInfo[key]) {
38
+ for (const key in biosInfo) {
39
+ if (!biosInfo[key]) {
43
40
  delete biosInfo[key];
44
41
  }
45
42
  }
43
+
44
+ hardwareinfo.write(csvHeader(biosInfo));
45
+ hardwareinfo.write(csvData(biosInfo, "\n\n"));
46
46
 
47
- for(const key in cpuInfo) {
48
- if(!cpuInfo[key]) {
47
+ // cpu info
48
+ const cpuInfo = await cpu();
49
+
50
+ for (const key in cpuInfo) {
51
+ if (!cpuInfo[key]) {
49
52
  delete cpuInfo[key];
50
53
  }
51
54
  }
52
-
53
- for(const key in cpuInfo.cache) {
54
- if(!cpuInfo.cache[key]) {
55
+
56
+ for (const key in cpuInfo.cache) {
57
+ if (!cpuInfo.cache[key]) {
55
58
  delete cpuInfo.cache[key];
56
59
  }
57
60
  }
61
+
62
+ cpuInfo.cache = Object.entries(cpuInfo.cache)
63
+ .map(([key, value]) => `${key}: ${value}`)
64
+ .join(" ");
65
+
66
+ hardwareinfo.write(csvHeader(cpuInfo));
67
+ hardwareinfo.write(csvData(cpuInfo, "\n\n"));
58
68
 
59
- for(const key in os) {
60
- if(!os[key]) {
69
+ // os info
70
+ const os = await osInfo();
71
+
72
+ for (const key in os) {
73
+ if (!os[key]) {
61
74
  delete os[key];
62
75
  }
63
76
  }
77
+
78
+ hardwareinfo.write(csvHeader(os));
79
+ hardwareinfo.write(csvData(os, "\n\n"));
80
+
64
81
 
65
- for(const key in ram) {
82
+ // ram memory info
83
+ const ram = await mem();
84
+
85
+ for (const key in ram) {
66
86
  ram[key] = `${gigabyteConvert(ram[key])} GB`;
67
87
  }
68
88
 
89
+ hardwareinfo.write(csvHeader(ram));
90
+ hardwareinfo.write(csvData(ram));
91
+
92
+ // disks
93
+ const disks = await diskLayout();
94
+
69
95
  disks.forEach(disk => {
70
- for(const key in disk) {
71
- if(!disk[key]) {
96
+ for (const key in disk) {
97
+ if (!disk[key]) {
72
98
  delete disk[key];
73
99
  }
74
-
75
- if(typeof disk[key] === "number") {
100
+
101
+ if (typeof disk[key] === "number") {
76
102
  disk[key] = `${gigabyteConvert(ram[key])} GB`;
77
103
  }
78
104
  }
105
+
106
+ hardwareinfo.write(csvHeader(disk));
107
+ hardwareinfo.write(csvData(disk, "\n"));
79
108
  });
109
+ hardwareinfo.write("\n");
110
+
111
+ /* displays & controllers */
112
+ const { displays, controllers } = await graphics();
80
113
 
114
+ // controllers
81
115
  controllers.forEach(controller => {
82
- for(const key in controller) {
83
- if(!controller[key]) {
116
+ for (const key in controller) {
117
+ if (!controller[key]) {
84
118
  delete controller[key];
85
119
  }
86
-
87
- if(typeof controller[key] === "number") {
120
+
121
+ if (typeof controller[key] === "number") {
88
122
  controller[key] = controller[key] < 1024
89
123
  ? `${controller[key]} MB`
90
124
  : `${gigabyteConvert(controller[key])} GB`;
91
125
  }
92
126
  }
127
+
128
+ hardwareinfo.write(csvHeader(controller));
129
+ hardwareinfo.write(csvData(controller, "\n"));
93
130
  });
94
131
 
132
+ hardwareinfo.write("\n");
133
+
95
134
  displays.forEach(display => {
96
- for(const key in display) {
97
- if(!display[key]) {
135
+ for (const key in display) {
136
+ if (!display[key]) {
98
137
  delete display[key];
99
138
  }
100
139
  }
140
+
141
+ hardwareinfo.write(csvHeader(display));
142
+ hardwareinfo.write(csvData(display, "\n"));
101
143
  });
102
144
 
103
- // add values
104
- hardware.set("bios", biosInfo);
105
- hardware.set("cpu", cpuInfo);
106
- hardware.set("ram", ram);
107
- hardware.set("os", os);
108
- hardware.set("disks", disks);
109
- hardware.set("graphics", controllers);
110
- hardware.set("displays", displays);
111
-
112
- // save file
113
- stackSave("hardware.json", JSON.stringify(Object.fromEntries(hardware), null, 2));
114
-
115
145
  // finish
116
146
  console.info("finish the hardware information file");
117
147
  } catch (err) {
@@ -1,5 +1,5 @@
1
1
  // modules
2
- import { default as axios } from "axios";
2
+ import axios from "axios";
3
3
  import colors from "colors";
4
4
  import { printTable } from "console-table-printer";
5
5
 
@@ -1,4 +1,4 @@
1
- import { default as axios } from "axios";
1
+ import axios from "axios";
2
2
  import { load } from "cheerio";
3
3
  import colors from "colors";
4
4
  import { printTable } from "console-table-printer";
@@ -1,5 +1,5 @@
1
1
  // modules
2
- import { default as axios } from "axios";
2
+ import axios from "axios";
3
3
  import { format } from "timeago.js";
4
4
  import { printTable } from "console-table-printer";
5
5
  import colors from "colors";
package/hash/infoTools.js CHANGED
@@ -5,7 +5,7 @@ import inquirer from "inquirer";
5
5
  import bitlyInfo from "../functions/bitly.js";
6
6
  import cryptoMarket from "../functions/cryptoList.js";
7
7
  import githubInfo from "../functions/gitUser.js";
8
-
8
+ import bundlephobia from "../functions/bundlephobia.js";
9
9
 
10
10
  // fields
11
11
  import {
@@ -41,6 +41,17 @@ const infoTools = {
41
41
  cryptoMarket();
42
42
  setTimeout(refreshCallback, 5e3);
43
43
  },
44
+ bundlephobia_info(refreshCallback) {
45
+ console.clear();
46
+ inquirer.prompt([
47
+ promptParams("pkgName", "enter a npm package name for search info size")
48
+ ])
49
+ .then(({ pkgName }) => {
50
+ console.info(pkgName)
51
+ bundlephobia(pkgName);
52
+ setTimeout(refreshCallback, 2e3);
53
+ });
54
+ },
44
55
  };
45
56
 
46
57
  export default infoTools;
package/index.cjs CHANGED
@@ -443,6 +443,26 @@ const password = () => {
443
443
  return password;
444
444
  };
445
445
 
446
+ const bundlephobia = async (pkg) {
447
+ try {
448
+ const { data } = await axios.get("https://bundlephobia.com/api/size", {
449
+ params: { package: pkg }
450
+ });
451
+
452
+ console.table({
453
+ module_name: data.name,
454
+ module_version: data.version,
455
+ module_repo: data.repository,
456
+ module_size: kilobyteConvert(data.size),
457
+ module_gzip: kilobyteConvert(data.gzip),
458
+ });
459
+
460
+ stackSave(`${pkg}-pkg-info.json`, JSON.stringify(data, null, 2));
461
+ } catch (err) {
462
+ console.error(colors.red(err.message));
463
+ }
464
+ };
465
+
446
466
  // exports
447
467
  module.exports = {
448
468
  animeSearch,
@@ -462,5 +482,6 @@ module.exports = {
462
482
  singleStack,
463
483
  twitchInfo,
464
484
  scrape,
465
- password
485
+ password,
486
+ bundlephobia
466
487
  };
package/index.mjs CHANGED
@@ -442,6 +442,26 @@ const password = () => {
442
442
  return password;
443
443
  };
444
444
 
445
+ const bundlephobia = async (pkg) {
446
+ try {
447
+ const { data } = await axios.get("https://bundlephobia.com/api/size", {
448
+ params: { package: pkg }
449
+ });
450
+
451
+ console.table({
452
+ module_name: data.name,
453
+ module_version: data.version,
454
+ module_repo: data.repository,
455
+ module_size: kilobyteConvert(data.size),
456
+ module_gzip: kilobyteConvert(data.gzip),
457
+ });
458
+
459
+ stackSave(`${pkg}-pkg-info.json`, JSON.stringify(data, null, 2));
460
+ } catch (err) {
461
+ console.error(colors.red(err.message));
462
+ }
463
+ };
464
+
445
465
  // exports
446
466
  export {
447
467
  animeSearch,
@@ -461,5 +481,6 @@ export {
461
481
  singleStack,
462
482
  twitchInfo,
463
483
  scrape,
464
- password
484
+ password,
485
+ bundlephobia
465
486
  };
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stack-analyze",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "type": "module",
5
5
  "description": "cli tech stack analyze and pagespeed with node.js using the wappalyzer module. with google pagespeed api, hardware and crypto market",
6
6
  "main": "index.mjs",
@@ -14,23 +14,23 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "axios": "^1.1.3",
17
+ "axios": "^1.3.4",
18
18
  "cheerio": "^1.0.0-rc.12",
19
- "cli-progress": "^3.11.2",
19
+ "cli-progress": "^3.12.0",
20
20
  "colors": "^1.4.0",
21
21
  "console-table-printer": "^2.11.1",
22
22
  "figlet": "^1.5.2",
23
23
  "gauge": "^5.0.0",
24
24
  "inquirer": "^9.1.4",
25
- "systeminformation": "^5.12.11",
25
+ "systeminformation": "^5.17.12",
26
26
  "timeago.js": "^4.0.2",
27
- "wappalyzer": "^6.10.41"
27
+ "wappalyzer": "^6.10.55"
28
28
  },
29
29
  "devDependencies": {
30
- "eslint": "^8.26.0",
31
- "gh-pages": "^4.0.0",
32
- "jest": "^29.2.2",
33
- "jsdoc": "^3.6.11"
30
+ "eslint": "^8.35.0",
31
+ "gh-pages": "^5.0.0",
32
+ "jest": "^29.4.3",
33
+ "jsdoc": "^4.0.2"
34
34
  },
35
35
  "scripts": {
36
36
  "start": "node cli.js",
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # stack analyze
2
2
 
3
- ![logo](logo-module.png)
3
+ ![logo](logo-module.webp)
4
4
 
5
5
  ***
6
6
  [![StackShare](https://img.shields.io/badge/tech-stack-0690fa.svg?style=flat)](https://stackshare.io/intermachine-developers/stack-analyze-cli)
package/utils.js CHANGED
@@ -20,7 +20,7 @@ const menuWebOpts = [
20
20
  ];
21
21
 
22
22
  const menuInfoOpts = [
23
- "github_info", "crypto_market", "bitly_info", returnMainOpts
23
+ "github_info", "crypto_market", "bitly_info", "bundlephobia_info", returnMainOpts
24
24
  ];
25
25
 
26
26
  const menuQueryOpts = [
package/logo-module.png DELETED
Binary file
package/scraping.json DELETED
@@ -1,6 +0,0 @@
1
- [
2
- {
3
- "metaInfo": "viewport",
4
- "metaContent": "width=device-width, initial-scale=1"
5
- }
6
- ]