stack-analyze 1.2.2 → 1.2.4

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,37 @@
2
2
 
3
3
  stack-analyze all version and notable changes, fixed, remove and new additions in code.
4
4
 
5
+ ## version 1.2.4
6
+ ### Changed
7
+ - remove jest module by node:test
8
+ - web scraping & github info using native fetch api & not axios
9
+ ### fixed
10
+ - fixed errors in:
11
+ - single stack
12
+ - multiple
13
+ - hardware information
14
+ - single & multiple stack using sub await mode
15
+
16
+ ## version 1.2.3
17
+ ### Added
18
+ - bundlephobia info tool
19
+ ### Changed
20
+ - change write json to csv in hardware information
21
+
5
22
  ## version 1.2.2
6
23
  ### Added
7
24
  - add save file function for the tools
8
- ### change
25
+ ### Changed
9
26
  - change the hash table to unique function in hardware information
10
- ### fixed
27
+ ### Fixed
11
28
  - fixed to unique user to multiple users with split params
12
29
 
13
30
  ## version 1.2.1
14
- ### fixed
31
+ ### Fixed
15
32
  - rewrite form arrow functions to named function with export default.
16
33
  - rewrite some test functions.
17
34
  - add regexp form bitly info tool
18
- ### change
35
+ ### Changed
19
36
  - renove menu now using categories.
20
37
  - add api params.
21
38
  - comeback multibar from pagespeed tool
@@ -23,10 +40,10 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
23
40
  ## version 1.2.0
24
41
  ### Added
25
42
  - new tool password generator
26
- ### fixed
43
+ ### Fixed
27
44
  - update anime search tool
28
45
  - the files modules now using callbacks and remove no using vars
29
- ### change
46
+ ### Changed
30
47
  - the web scraping tool decided to use the question returns to the main menu instead of going to the main menu
31
48
 
32
49
  ## version 1.1.9
@@ -34,9 +51,9 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
34
51
  - new module cheerio
35
52
  - new tool webscraping
36
53
  - new test
37
- ### fixed
54
+ ### Fixed
38
55
  - rewirte axios import
39
- ### change
56
+ ### Changed
40
57
  - hardware information change from functions to hash table
41
58
  - about now is hash table
42
59
  - now using the function printTable avoid overwritting.
@@ -46,10 +63,10 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
46
63
  - remove hash tables
47
64
 
48
65
  ## version 1.1.8
49
- ### fixed
66
+ ### Fixed
50
67
  - restructure all tools as a hash table with promises except the tool hardware information and about section
51
68
  - update all modules
52
- ### change
69
+ ### Changed
53
70
  - remove the module coingecko-api
54
71
  - remove process.env variables to writting manual token for security
55
72
 
@@ -57,11 +74,11 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
57
74
  ### Added
58
75
  - twitch info tool
59
76
  - remove one js module for module to cjs and esm
60
- ### fixed
77
+ ### Fixed
61
78
  - change write token to process.env varaibles own (not avalible values in github and gitlab)
62
79
  - migrate cjs to esm
63
80
  - rewrite module
64
- ### change
81
+ ### Changed
65
82
  - except some hardware tools and github using models from console-table-printer
66
83
  - now using esm now about is js file not folder about with index.js
67
84
  - rewrite all tests functions
@@ -69,9 +86,9 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
69
86
  ## version 1.1.6
70
87
  ### Added
71
88
  - module stack-analyze mode
72
- ### fixed
89
+ ### Fixed
73
90
  - rewrite code
74
- ### changed
91
+ ### Changed
75
92
  - menu renove
76
93
  - renove jsdocs in some function or variables
77
94
  - remove nonolive recommends soon in versions desktop 7 and pwa 1.5.0
@@ -81,10 +98,10 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
81
98
  - add new tool: movie info
82
99
  - add new test
83
100
  - renove menu
84
- ### fixed
101
+ ### Fixed
85
102
  - rewrite in some functions and about
86
103
  - remove some dependencies not using project
87
- ### changed
104
+ ### Changed
88
105
  - change multibar to 2 single bars
89
106
  - change switch in all tools for hash functions tables
90
107
  - renove nonolive recommends
@@ -93,7 +110,7 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
93
110
  ### Added
94
111
  - add new tool: bitly info
95
112
  - add new test
96
- ### fixed
113
+ ### Fixed
97
114
  - rewrite some functions
98
115
  - update npm modules via manual
99
116
 
@@ -103,31 +120,31 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
103
120
  - add new tool: crypto market
104
121
  - add new recomends
105
122
  - add new test
106
- ### fixed
123
+ ### Fixed
107
124
  - rewrite some functions
108
125
  - update npm modules via manual
109
- ### changed
126
+ ### Changed
110
127
  - add new const variables for map array functions
111
128
 
112
129
  ## version 1.1.2
113
130
  ### Added
114
131
  - add new nonolive streamers Recomend
115
- ### fixed
132
+ ### Fixed
116
133
  - rewrite multiple techstack
117
134
  - rewrite test files
118
- ### changed
135
+ ### Changed
119
136
  - changed the for loop to foreach loop
120
137
 
121
138
  ## version 1.1.1
122
139
  ### Added
123
140
  - using console.table only in objects variables
124
- - using the console-table-printer in arrays in some functions and the about sectiond
141
+ - using the console-table-printer in arrays in some functions and the about section
125
142
  - add the new module: console-table-printer
126
143
  - add the new nonolive streamers and youtube dev recommedation
127
- ### fixed
144
+ ### Fixed
128
145
  - rewrite some funcions
129
146
  - fragment about section
130
- ### changed
147
+ ### Changed
131
148
  - using console.table only in objects variables
132
149
  - using the console-table-printer in arrays in some functions and the about section
133
150
 
@@ -138,7 +155,7 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
138
155
  - jsdoc + the template minami the dev modules
139
156
  - add the hardware information
140
157
  - add new recomendations for about section
141
- ### fixed
158
+ ### Fixed
142
159
  - rewrite the code the functions singlestack and multiple
143
160
  - add the name app to question function
144
161
  ### Changed
@@ -160,7 +177,7 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
160
177
  - add the new modules:
161
178
  - colors
162
179
  - cli-progress
163
- ### fixed
180
+ ### Fixed
164
181
  change json print to table print version
165
182
  ### Changed
166
183
  - 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 get info of npm package
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
 
@@ -16,7 +16,7 @@ import { stackSave } from "../utils.js";
16
16
  */
17
17
  export default async function githubInfo(user) {
18
18
  try {
19
- const { data } = await axios.get(`https://api.github.com/users/${user}`);
19
+ const data = await (await fetch(`https://api.github.com/users/${user}`)).json();
20
20
 
21
21
  const info = {
22
22
  username: data.login,
@@ -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,77 @@ 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();
38
+ hardwareinfo.write(csvHeader(biosInfo));
39
+ hardwareinfo.write(csvData(biosInfo, "\n\n"));
39
40
 
40
- // omit falsy values
41
- for(const key in biosInfo) {
42
- if(!biosInfo[key]) {
43
- delete biosInfo[key];
44
- }
45
- }
46
-
47
- for(const key in cpuInfo) {
48
- if(!cpuInfo[key]) {
49
- delete cpuInfo[key];
50
- }
51
- }
41
+ // cpu info
42
+ const cpuInfo = await cpu();
52
43
 
53
- for(const key in cpuInfo.cache) {
54
- if(!cpuInfo.cache[key]) {
55
- delete cpuInfo.cache[key];
56
- }
57
- }
44
+ cpuInfo.cache = Object.entries(cpuInfo.cache)
45
+ .map(([key, value]) => `${key}: ${value}`)
46
+ .join(" ");
47
+
48
+ hardwareinfo.write(csvHeader(cpuInfo));
49
+ hardwareinfo.write(csvData(cpuInfo, "\n\n"));
58
50
 
59
- for(const key in os) {
60
- if(!os[key]) {
61
- delete os[key];
62
- }
63
- }
51
+ // os info
52
+ const os = await osInfo();
53
+
54
+ hardwareinfo.write(csvHeader(os));
55
+ hardwareinfo.write(csvData(os, "\n\n"));
56
+
64
57
 
65
- for(const key in ram) {
58
+ // ram memory info
59
+ const ram = await mem();
60
+
61
+ for (const key in ram) {
66
62
  ram[key] = `${gigabyteConvert(ram[key])} GB`;
67
63
  }
68
64
 
65
+ hardwareinfo.write(csvHeader(ram));
66
+ hardwareinfo.write(csvData(ram, "\n\n"));
67
+
68
+ // disks
69
+ const disks = await diskLayout();
70
+
69
71
  disks.forEach(disk => {
70
- for(const key in disk) {
71
- if(!disk[key]) {
72
- delete disk[key];
73
- }
74
-
75
- if(typeof disk[key] === "number") {
76
- disk[key] = `${gigabyteConvert(ram[key])} GB`;
72
+ for (const key in disk) {
73
+ if (typeof disk[key] === "number") {
74
+ disk[key] = `${gigabyteConvert(disk[key])} GB`;
77
75
  }
78
76
  }
77
+
78
+ hardwareinfo.write(csvHeader(disk));
79
+ hardwareinfo.write(csvData(disk, "\n\n"));
79
80
  });
81
+
82
+ /* displays & controllers */
83
+ const { displays, controllers } = await graphics();
80
84
 
85
+ // controllers
81
86
  controllers.forEach(controller => {
82
- for(const key in controller) {
83
- if(!controller[key]) {
84
- delete controller[key];
85
- }
86
-
87
- if(typeof controller[key] === "number") {
87
+ for (const key in controller) {
88
+ if (typeof controller[key] === "number") {
88
89
  controller[key] = controller[key] < 1024
89
90
  ? `${controller[key]} MB`
90
91
  : `${gigabyteConvert(controller[key])} GB`;
91
92
  }
92
93
  }
94
+
95
+ hardwareinfo.write(csvHeader(controller));
96
+ hardwareinfo.write(csvData(controller, "\n"));
93
97
  });
94
98
 
99
+ hardwareinfo.write("\n");
100
+
95
101
  displays.forEach(display => {
96
- for(const key in display) {
97
- if(!display[key]) {
98
- delete display[key];
99
- }
100
- }
102
+ hardwareinfo.write(csvHeader(display));
103
+ hardwareinfo.write(csvData(display, "\n"));
101
104
  });
102
105
 
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
106
  // finish
116
107
  console.info("finish the hardware information file");
117
108
  } 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
 
@@ -24,7 +24,7 @@ export default async function multipleStack(urlList) {
24
24
  for await (const url of urlList) {
25
25
  console.info(url.green);
26
26
 
27
- const { technologies } = await wappalyzer.open(url).analyze();
27
+ const { technologies } = await (await wappalyzer.open(url)).analyze();
28
28
 
29
29
  const stackResult = technologies.map(({
30
30
  name,
@@ -1,4 +1,3 @@
1
- import { default as axios } from "axios";
2
1
  import { load } from "cheerio";
3
2
  import colors from "colors";
4
3
  import { printTable } from "console-table-printer";
@@ -16,7 +15,7 @@ import { stackSave } from "../utils.js";
16
15
  */
17
16
  export default async function scrape(url, options) {
18
17
  try {
19
- const { data } = await axios.get(url);
18
+ const data = await (await fetch(url)).text();
20
19
  const $ = load(data);
21
20
 
22
21
  let result;
@@ -19,7 +19,7 @@ export default async function singleStack(url) {
19
19
  try {
20
20
  await wappalyzer.init();
21
21
 
22
- const { technologies } = await wappalyzer.open(url).analyze();
22
+ const { technologies } = await (await wappalyzer.open(url)).analyze();
23
23
 
24
24
  const stackResult = technologies.map(({
25
25
  name,
@@ -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/hardware.csv ADDED
File without changes
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.4",
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,22 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "axios": "^1.1.3",
17
+ "axios": "^1.4.0",
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
- "figlet": "^1.5.2",
23
- "gauge": "^5.0.0",
24
- "inquirer": "^9.1.4",
25
- "systeminformation": "^5.12.11",
22
+ "figlet": "^1.6.0",
23
+ "gauge": "^5.0.1",
24
+ "inquirer": "^9.2.0",
25
+ "systeminformation": "^5.17.12",
26
26
  "timeago.js": "^4.0.2",
27
- "wappalyzer": "^6.10.41"
27
+ "wappalyzer": "^6.10.62"
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.39.0",
31
+ "gh-pages": "^5.0.0",
32
+ "jsdoc": "^4.0.2"
34
33
  },
35
34
  "scripts": {
36
35
  "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
- ]