stack-analyze 1.2.3 → 1.2.5

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,217 +2,245 @@
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
5
+ ## generation 3 (ver. 1.2.0 -)
6
+
7
+ ### version 1.2.5
8
+ #### Added
9
+ - pokemon info tool.
10
+ #### Changed
11
+ - update script test.
12
+ - remove the cjs and mjs files.
13
+ - renove changelog based in generations similar to neo-jquery.
14
+ #### fixed
15
+ - add examples in twitch info users.
16
+ - fixed the bug create hardware info file.
17
+
18
+ ### version 1.2.4
19
+ #### Changed
20
+ - remove jest module by node:test,
21
+ - web scraping & github info using native fetch api & not axios,
22
+ #### fixed
23
+ - fixed errors in:
24
+ - single stack.
25
+ - multiple.
26
+ - hardware information.
27
+ - single & multiple stack using sub await mode
28
+
29
+ ### version 1.2.3
30
+ #### Added
7
31
  - bundlephobia info tool
8
- ### Changed
32
+ #### Changed
9
33
  - change write json to csv in hardware information
10
34
 
11
- ## version 1.2.2
12
- ### Added
35
+ ### version 1.2.2
36
+ #### Added
13
37
  - add save file function for the tools
14
- ### Changed
38
+ #### Changed
15
39
  - change the hash table to unique function in hardware information
16
- ### Fixed
40
+ #### Fixed
17
41
  - fixed to unique user to multiple users with split params
18
42
 
19
- ## version 1.2.1
20
- ### Fixed
43
+ ### version 1.2.1
44
+ #### Fixed
21
45
  - rewrite form arrow functions to named function with export default.
22
46
  - rewrite some test functions.
23
47
  - add regexp form bitly info tool
24
- ### Changed
48
+ #### Changed
25
49
  - renove menu now using categories.
26
50
  - add api params.
27
51
  - comeback multibar from pagespeed tool
28
52
 
29
- ## version 1.2.0
30
- ### Added
53
+ ### version 1.2.0
54
+ #### Added
31
55
  - new tool password generator
32
- ### Fixed
56
+ #### Fixed
33
57
  - update anime search tool
34
58
  - the files modules now using callbacks and remove no using vars
35
- ### Changed
59
+ #### Changed
36
60
  - the web scraping tool decided to use the question returns to the main menu instead of going to the main menu
37
61
 
38
- ## version 1.1.9
39
- ### Added
62
+ ## generation 2 (ver. 1.1.0 - 1.1.9)
63
+
64
+ ### version 1.1.9
65
+ #### Added
40
66
  - new module cheerio
41
67
  - new tool webscraping
42
68
  - new test
43
- ### Fixed
69
+ #### Fixed
44
70
  - rewirte axios import
45
- ### Changed
71
+ #### Changed
46
72
  - hardware information change from functions to hash table
47
73
  - about now is hash table
48
74
  - now using the function printTable avoid overwritting.
49
75
  - remove jsdocs the modules files
50
- ### remove
76
+ #### remove
51
77
  - remove models console-table-printer
52
78
  - remove hash tables
53
79
 
54
- ## version 1.1.8
55
- ### Fixed
80
+ ### version 1.1.8
81
+ #### Fixed
56
82
  - restructure all tools as a hash table with promises except the tool hardware information and about section
57
83
  - update all modules
58
- ### Changed
84
+ #### Changed
59
85
  - remove the module coingecko-api
60
86
  - remove process.env variables to writting manual token for security
61
87
 
62
88
  ## version 1.1.7
63
- ### Added
89
+ #### Added
64
90
  - twitch info tool
65
91
  - remove one js module for module to cjs and esm
66
- ### Fixed
92
+ #### Fixed
67
93
  - change write token to process.env varaibles own (not avalible values in github and gitlab)
68
94
  - migrate cjs to esm
69
95
  - rewrite module
70
- ### Changed
96
+ #### Changed
71
97
  - except some hardware tools and github using models from console-table-printer
72
98
  - now using esm now about is js file not folder about with index.js
73
99
  - rewrite all tests functions
74
100
 
75
- ## version 1.1.6
76
- ### Added
101
+ ### version 1.1.6
102
+ #### Added
77
103
  - module stack-analyze mode
78
- ### Fixed
104
+ #### Fixed
79
105
  - rewrite code
80
- ### Changed
106
+ #### Changed
81
107
  - menu renove
82
108
  - renove jsdocs in some function or variables
83
109
  - remove nonolive recommends soon in versions desktop 7 and pwa 1.5.0
84
110
 
85
- ## version 1.1.5
86
- ### Added
111
+ ### version 1.1.5
112
+ #### Added
87
113
  - add new tool: movie info
88
114
  - add new test
89
115
  - renove menu
90
- ### Fixed
116
+ #### Fixed
91
117
  - rewrite in some functions and about
92
118
  - remove some dependencies not using project
93
- ### Changed
119
+ #### Changed
94
120
  - change multibar to 2 single bars
95
121
  - change switch in all tools for hash functions tables
96
122
  - renove nonolive recommends
97
123
 
98
- ## version 1.1.4
99
- ### Added
124
+ ### version 1.1.4
125
+ #### Added
100
126
  - add new tool: bitly info
101
127
  - add new test
102
- ### Fixed
128
+ #### Fixed
103
129
  - rewrite some functions
104
130
  - update npm modules via manual
105
131
 
106
- ## version 1.1.3
107
- ### Added
132
+ ### version 1.1.3
133
+ #### Added
108
134
  - add new module: coingecko-api
109
135
  - add new tool: crypto market
110
136
  - add new recomends
111
137
  - add new test
112
- ### Fixed
138
+ #### Fixed
113
139
  - rewrite some functions
114
140
  - update npm modules via manual
115
- ### Changed
141
+ #### Changed
116
142
  - add new const variables for map array functions
117
143
 
118
- ## version 1.1.2
119
- ### Added
144
+ ### version 1.1.2
145
+ #### Added
120
146
  - add new nonolive streamers Recomend
121
- ### Fixed
147
+ #### Fixed
122
148
  - rewrite multiple techstack
123
149
  - rewrite test files
124
- ### Changed
150
+ #### Changed
125
151
  - changed the for loop to foreach loop
126
152
 
127
- ## version 1.1.1
128
- ### Added
153
+ ### version 1.1.1
154
+ #### Added
129
155
  - using console.table only in objects variables
130
156
  - using the console-table-printer in arrays in some functions and the about section
131
157
  - add the new module: console-table-printer
132
158
  - add the new nonolive streamers and youtube dev recommedation
133
- ### Fixed
159
+ #### Fixed
134
160
  - rewrite some funcions
135
161
  - fragment about section
136
- ### Changed
162
+ #### Changed
137
163
  - using console.table only in objects variables
138
164
  - using the console-table-printer in arrays in some functions and the about section
139
165
 
140
- ## version 1.1.0
141
- ### Added
166
+ ### version 1.1.0
167
+ #### Added
142
168
  - add the new modules:
143
169
  - systeminformation the main module
144
170
  - jsdoc + the template minami the dev modules
145
171
  - add the hardware information
146
172
  - add new recomendations for about section
147
- ### Fixed
173
+ #### Fixed
148
174
  - rewrite the code the functions singlestack and multiple
149
175
  - add the name app to question function
150
- ### Changed
176
+ #### Changed
151
177
  - changed the node style color to using colors
152
178
 
153
- ## version 1.0.9
154
- ### Added
179
+ ## generation 1 (ver. 1.0.1 - 1.0.9)
180
+
181
+ ### version 1.0.9
182
+ #### Added
155
183
  - add the new modules:
156
184
  - timeago.js for the github user
157
185
  - add the options github info and anime search the main options
158
186
  - add new recomendations for the about section
159
- ### Fixed
187
+ #### Fixed
160
188
  - return the peformance now for pagespeed
161
- ### Changed
189
+ #### Changed
162
190
  - add new testing
163
191
 
164
- ## version 1.0.8
165
- ### Added
192
+ ### version 1.0.8
193
+ #### Added
166
194
  - add the new modules:
167
195
  - colors
168
196
  - cli-progress
169
- ### Fixed
197
+ #### Fixed
170
198
  change json print to table print version
171
- ### Changed
199
+ #### Changed
172
200
  - change console.dir about to console.table
173
201
  - change from text to bar for pagespeed results
174
202
  - add the badge tech stack project
175
- ### patch version 1.0.85
203
+ #### patch version 1.0.85
176
204
  notes:
177
205
  - fixed the cli run
178
206
  - remove performance.now for the defined time in pagespeed
179
207
  - add recomendations sections
180
208
 
181
- ## version 1.0.7
182
- ### Added
209
+ ### version 1.0.7
210
+ #### Added
183
211
  - add the new modules:
184
212
  - figlet the main module
185
213
  - jest dev module and testing functions
186
214
  - add the options page speed and about the main options
187
215
  - add return in a option select except about and exit
188
- ### Fixed
216
+ #### Fixed
189
217
  - the website in blank or website without http:// or https:// return the main options
190
218
  - eslint custom rules without style guide
191
- ### Changed
219
+ #### Changed
192
220
  - changed the inquirer list to inquirer rawlist
193
221
  - rewirte jsdoc in all project except test files
194
222
  - the tech stack using other console methods console.log only in exit cli
195
223
 
196
224
  ## version 1.0.6
197
- ### Added
225
+ #### Added
198
226
  - add the new options: multiple (analyze many sites) and exit (exit cli).
199
227
  - the code was testing with eslint to avoid errors to execute
200
228
  - rewrite the module docs.
201
- ### Changed
229
+ #### Changed
202
230
  - the list options with inquirer
203
231
  - welcome message modified
204
232
 
205
- ## version 1.0.5
206
- ### Changed
233
+ ### version 1.0.5
234
+ #### Changed
207
235
  - modify the code and module structure
208
- ### remove
236
+ #### remove
209
237
  - remove the commander module
210
238
 
211
- ## version 1.0.4
239
+ #### version 1.0.4
212
240
  - fisrt official version in npm with the modules:
213
241
  - wappalyzer
214
242
  - inquirer
215
243
  - commander
216
244
 
217
- ## version 1.0.1 to 1.0.3
245
+ #### version 1.0.1 to 1.0.3
218
246
  test version modules without wappalyzer module (only testing)
package/about.js CHANGED
@@ -46,6 +46,7 @@ const aboutTool = {
46
46
 
47
47
  console.clear();
48
48
  console.table(aboutApp);
49
+
49
50
  setTimeout(refreshCallback, timeout);
50
51
  },
51
52
  lineup(refreshCallback) {
@@ -85,6 +86,10 @@ const aboutTool = {
85
86
  {
86
87
  user: "Lunanny",
87
88
  details: "art director with ADHD."
89
+ },
90
+ {
91
+ user: "Japon_HR",
92
+ details: "cosplayer, gamer, dance & halo machinima creator"
88
93
  }
89
94
  ];
90
95
 
@@ -10,7 +10,7 @@ import { stackSave } from "../utils.js";
10
10
  const kilobyteConvert = (size) => (size < 1024 ? `${size} B` : `${size / 1024} KB`);
11
11
 
12
12
  /**
13
- * @description
13
+ * @description get info of npm package
14
14
  * @param {string} pkg
15
15
  * @async
16
16
  * @returns { Promise<void> } - return result bundlephobia info
@@ -1,5 +1,4 @@
1
1
  // modules
2
- import axios from "axios";
3
2
  import { format } from "timeago.js";
4
3
  import colors from "colors";
5
4
 
@@ -16,7 +15,7 @@ import { stackSave } from "../utils.js";
16
15
  */
17
16
  export default async function githubInfo(user) {
18
17
  try {
19
- const { data } = await axios.get(`https://api.github.com/users/${user}`);
18
+ const data = await (await fetch(`https://api.github.com/users/${user}`)).json();
20
19
 
21
20
  const info = {
22
21
  username: data.login,
@@ -10,10 +10,6 @@ import {
10
10
  } from "systeminformation";
11
11
  import colors from "colors";
12
12
 
13
- import { stackSave } from "../utils.js";
14
-
15
- const hardwareinfo = createWriteStream("hardware.csv");
16
-
17
13
  const csvHeader = (obj) => `${Object.keys(obj).join(";")}\n`;
18
14
  const csvData = (obj, spaces) => `${Object.values(obj).join(";")}${spaces}`;
19
15
 
@@ -32,33 +28,17 @@ const gigabyteConvert = (size, base = 1073741824) => (size / base).toFixed(2);
32
28
  */
33
29
  export default async function hardware() {
34
30
  try {
31
+ const hardwareinfo = createWriteStream("hardware.csv");
32
+
35
33
  // bios info
36
34
  const biosInfo = await bios();
37
35
 
38
- for (const key in biosInfo) {
39
- if (!biosInfo[key]) {
40
- delete biosInfo[key];
41
- }
42
- }
43
-
44
36
  hardwareinfo.write(csvHeader(biosInfo));
45
37
  hardwareinfo.write(csvData(biosInfo, "\n\n"));
46
38
 
47
39
  // cpu info
48
40
  const cpuInfo = await cpu();
49
41
 
50
- for (const key in cpuInfo) {
51
- if (!cpuInfo[key]) {
52
- delete cpuInfo[key];
53
- }
54
- }
55
-
56
- for (const key in cpuInfo.cache) {
57
- if (!cpuInfo.cache[key]) {
58
- delete cpuInfo.cache[key];
59
- }
60
- }
61
-
62
42
  cpuInfo.cache = Object.entries(cpuInfo.cache)
63
43
  .map(([key, value]) => `${key}: ${value}`)
64
44
  .join(" ");
@@ -69,12 +49,6 @@ export default async function hardware() {
69
49
  // os info
70
50
  const os = await osInfo();
71
51
 
72
- for (const key in os) {
73
- if (!os[key]) {
74
- delete os[key];
75
- }
76
- }
77
-
78
52
  hardwareinfo.write(csvHeader(os));
79
53
  hardwareinfo.write(csvData(os, "\n\n"));
80
54
 
@@ -87,26 +61,21 @@ export default async function hardware() {
87
61
  }
88
62
 
89
63
  hardwareinfo.write(csvHeader(ram));
90
- hardwareinfo.write(csvData(ram));
64
+ hardwareinfo.write(csvData(ram, "\n\n"));
91
65
 
92
66
  // disks
93
67
  const disks = await diskLayout();
94
68
 
95
69
  disks.forEach(disk => {
96
70
  for (const key in disk) {
97
- if (!disk[key]) {
98
- delete disk[key];
99
- }
100
-
101
71
  if (typeof disk[key] === "number") {
102
- disk[key] = `${gigabyteConvert(ram[key])} GB`;
72
+ disk[key] = `${gigabyteConvert(disk[key])} GB`;
103
73
  }
104
74
  }
105
75
 
106
76
  hardwareinfo.write(csvHeader(disk));
107
- hardwareinfo.write(csvData(disk, "\n"));
77
+ hardwareinfo.write(csvData(disk, "\n\n"));
108
78
  });
109
- hardwareinfo.write("\n");
110
79
 
111
80
  /* displays & controllers */
112
81
  const { displays, controllers } = await graphics();
@@ -114,10 +83,6 @@ export default async function hardware() {
114
83
  // controllers
115
84
  controllers.forEach(controller => {
116
85
  for (const key in controller) {
117
- if (!controller[key]) {
118
- delete controller[key];
119
- }
120
-
121
86
  if (typeof controller[key] === "number") {
122
87
  controller[key] = controller[key] < 1024
123
88
  ? `${controller[key]} MB`
@@ -132,12 +97,6 @@ export default async function hardware() {
132
97
  hardwareinfo.write("\n");
133
98
 
134
99
  displays.forEach(display => {
135
- for (const key in display) {
136
- if (!display[key]) {
137
- delete display[key];
138
- }
139
- }
140
-
141
100
  hardwareinfo.write(csvHeader(display));
142
101
  hardwareinfo.write(csvData(display, "\n"));
143
102
  });
@@ -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,
@@ -20,5 +20,5 @@ export default function genPassword() {
20
20
 
21
21
  // print new passwors
22
22
  console.info("new password:", password);
23
- stackSave("password.txt", `new password: ${password}`)
23
+ stackSave("password.txt", `new password: ${password}`);
24
24
  }
@@ -0,0 +1,49 @@
1
+ // colors
2
+ import colors from "colors";
3
+
4
+ // utils
5
+ import { listFormat, stackSave } from "../utils.js";
6
+
7
+ /**
8
+ * @async
9
+ * @param {number | string} pokemon
10
+ * @returns {Promise<void>}
11
+ */
12
+ export default async function pokemonInfo(pokemon) {
13
+ console.clear();
14
+
15
+ try {
16
+ const data = await (
17
+ await fetch(`https://pokeapi.co/api/v2/pokemon/${pokemon}`)
18
+ ).json();
19
+
20
+ const {
21
+ id,
22
+ name,
23
+ height,
24
+ base_experience,
25
+ weight,
26
+ stats,
27
+ types
28
+ } = data;
29
+
30
+ const info = {
31
+ id,
32
+ name,
33
+ height,
34
+ base_experience,
35
+ weight,
36
+ types: listFormat.format(types.map(({ type }) => type.name))
37
+ };
38
+
39
+ stats.forEach(({ base_stat, stat }) => {
40
+ info[stat.name] = base_stat;
41
+ });
42
+
43
+ console.info(info);
44
+
45
+ stackSave("poke-info.json", JSON.stringify(info, null, 2));
46
+ } catch(err) {
47
+ console.info(colors.red(err.message));
48
+ }
49
+ }
@@ -1,4 +1,3 @@
1
- import 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;
@@ -101,7 +100,7 @@ export default async function scrape(url, options) {
101
100
  })).toArray()
102
101
  .filter(({ url }) => url.indexOf("#") !== 0);
103
102
 
104
- result = linkList
103
+ result = linkList;
105
104
 
106
105
  printTable(linkList);
107
106
  },
@@ -125,8 +124,8 @@ export default async function scrape(url, options) {
125
124
  scraping[options]();
126
125
 
127
126
  typeof result === "string"
128
- ? stackSave('scraping.txt', result)
129
- : stackSave('scraping.json', JSON.stringify(result, null, 2));
127
+ ? stackSave("scraping.txt", result)
128
+ : stackSave("scraping.json", JSON.stringify(result, null, 2));
130
129
  } catch (err) {
131
130
  console.error(colors.red(err.message));
132
131
  }
@@ -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,
package/hash/infoTools.js CHANGED
@@ -47,7 +47,7 @@ const infoTools = {
47
47
  promptParams("pkgName", "enter a npm package name for search info size")
48
48
  ])
49
49
  .then(({ pkgName }) => {
50
- console.info(pkgName)
50
+ console.info(pkgName);
51
51
  bundlephobia(pkgName);
52
52
  setTimeout(refreshCallback, 2e3);
53
53
  });
@@ -4,6 +4,7 @@ import inquirer from "inquirer";
4
4
  // functions
5
5
  import animeSearch from "../functions/animeInfo.js";
6
6
  import movieDB from "../functions/moviesInfo.js";
7
+ import pokemonInfo from "../functions/pokemon.js";
7
8
  import twitchInfo from "../functions/twitch.js";
8
9
 
9
10
  // fields
@@ -14,7 +15,6 @@ import {
14
15
 
15
16
  /** query tools */
16
17
  const queryTools = {
17
-
18
18
  anime_Search(refreshCallback) {
19
19
  console.clear();
20
20
  inquirer.prompt([promptParams("query", "")])
@@ -34,11 +34,53 @@ const queryTools = {
34
34
  setTimeout(refreshCallback, 2e3);
35
35
  });
36
36
  },
37
+ pokemon_info(refreshCallback) {
38
+ console.clear();
39
+ inquirer.prompt([
40
+ {
41
+ type: "list",
42
+ name: "pokeOpt",
43
+ message: "enter a opt for start search",
44
+ choices: ["ID", "Name"],
45
+ },
46
+ {
47
+ type: "number",
48
+ name: "pokeId",
49
+ message: "enter a poekmon ID:",
50
+ validate: value => value > 0 || "this field not allowed empty values, NaN or number less or equal to 0",
51
+ filter(value) {
52
+ if(!value) return "";
53
+
54
+ const int = parseInt(value);
55
+
56
+ if(isNaN(int)) return "";
57
+
58
+ return int <= 0 ? "" : int;
59
+ },
60
+ when: ({pokeOpt}) => pokeOpt === "ID",
61
+ },
62
+ {
63
+ type: "input",
64
+ name: "pokeName",
65
+ message: "enter a poekmon name:",
66
+ validate(input) {
67
+ const excludeNumbers = /[^0-9]/;
68
+
69
+ return excludeNumbers.test(input) || "the pokemon name is required";
70
+ },
71
+ when: ({pokeOpt}) => pokeOpt === "Name",
72
+ },
73
+ ])
74
+ .then(anw => {
75
+ pokemonInfo(anw?.pokeName || anw?.pokeId);
76
+ setTimeout(refreshCallback, 2e3);
77
+ });
78
+ },
37
79
  twitch_info(refreshCallback) {
38
80
  console.clear();
39
81
  inquirer.prompt([
40
- promptParams("twitchSeparator", "enter a separator for split"),
41
- promptParams("twitchUsers", "enter a twitch user"),
82
+ promptParams("twitchSeparator", "enter a separator for split example ',':"),
83
+ promptParams("twitchUsers", "enter a twitch users example 'a,b,c'"),
42
84
  promptKey("twitchClient", "enter a twitch client ID"),
43
85
  promptKey("twitchToken", "enter a twitch token"),
44
86
  ])
@@ -2,8 +2,6 @@
2
2
  import genPassword from "../functions/password.js";
3
3
  import hardware from "../functions/hardware.js";
4
4
 
5
- // opts
6
- import { menuHardwareOpts } from "../utils.js";
7
5
 
8
6
  const utilityTools = {
9
7
  password(refreshCallback) {