stack-analyze 1.3.6 → 1.3.7

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
@@ -4,6 +4,15 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
4
4
 
5
5
  ## generation 4 (ver. 1.3.0 - )
6
6
 
7
+ ### version 1.3.7
8
+
9
+ #### Added
10
+ - quotes new tool
11
+
12
+ #### Changed
13
+ - some files using new types jsdocs via import
14
+ - cpuinfo using separetd of cache
15
+
7
16
  ### version 1.3.6 (5th aniversary)
8
17
 
9
18
  #### Added
package/about.js CHANGED
@@ -4,36 +4,13 @@ import { printTable } from "console-table-printer";
4
4
  // package.json
5
5
  const { default: { license, version}} = await import("./package.json", {with: {type: "json" }});
6
6
 
7
+ /** @type {number} */
7
8
  const timeout = 1e3;
8
9
 
9
- /**
10
- * types for about tools
11
- *
12
- * @typedef {Object} Info
13
- * @property {string} Info.mainDeveloper
14
- * @property {string} Info.version
15
- * @property {string} Info.license
16
- *
17
- * @typedef {Object} DeveloperList
18
- * @property {string} DeveloperList.name
19
- * @property {string} DeveloperList.roles
20
- *
21
- * @typedef {Object} Youtube
22
- * @property {string} Youtube.youtubeChannel
23
- * @property {string} Youtube.recomendation
24
- *
25
- * @typedef {Object} Twitch
26
- * @property {string} Twitch.user
27
- * @property {string} [Twitch.details]
28
- *
29
- * @typedef {Object} Project
30
- * @property {string} Project.name
31
- * @property {string} Project.desc
32
- */
33
-
10
+ /** @type {import("./types.js").Select}*/
34
11
  const aboutTool = {
35
12
  mainInfo(refreshCallback) {
36
- /** @type {Info} */
13
+ /** @type {import("./types.js").Info} */
37
14
  const aboutApp = {
38
15
  mainDeveloper: "omega5300",
39
16
  license,
@@ -48,7 +25,7 @@ const aboutTool = {
48
25
  async lineup(refreshCallback) {
49
26
  const { listFormat } = await import("./utils.js");
50
27
 
51
- /** @type {DeveloperList[]} */
28
+ /** @type {import("./types.js").DeveloperList[]} */
52
29
  const developers = [
53
30
  {
54
31
  name: "omega5300",
@@ -61,7 +38,7 @@ const aboutTool = {
61
38
  setTimeout(refreshCallback, timeout);
62
39
  },
63
40
  youtubeRecomendation(refreshCallback) {
64
- /** @type {Youtube[]} */
41
+ /** @type {import("./types.js").Youtube[]} */
65
42
  const youtubeDev = [
66
43
  { youtubeChannel: "fazt", recomendation: "recommend" },
67
44
  { youtubeChannel: "doriandesings", recomendation: "recommend" },
@@ -76,7 +53,7 @@ const aboutTool = {
76
53
  setTimeout(refreshCallback, timeout);
77
54
  },
78
55
  twitchRecomendation(refreshCallback) {
79
- /** @type {Twitch[]} */
56
+ /** @type {import("./types.js").Twitch[]} */
80
57
  const twitchUsers = [
81
58
  {
82
59
  user: "DannyAgii",
@@ -96,7 +73,7 @@ const aboutTool = {
96
73
  setTimeout(refreshCallback, timeout);
97
74
  },
98
75
  projectsRecomendation(refreshCallback) {
99
- /** @type {Project[]} */
76
+ /** @type {import("./types.js").Project[]} */
100
77
  const projects = [
101
78
  {
102
79
  name: "black metal promotion",
package/cli.js CHANGED
@@ -14,14 +14,10 @@ import wallpaperSelect from "./hash/wallpaperSelect.js";
14
14
  import aboutTool from "./about.js";
15
15
 
16
16
  import {
17
- menuOpts,
18
- menuQueryOpts,
19
- menuWebOpts,
20
- menuAboutOpts,
21
- menuInfoOpts,
22
- menuWallpaperOpts,
23
- menuUtilityOpts
17
+ menuOpts, menuQueryOpts, menuWebOpts, menuAboutOpts,
18
+ menuInfoOpts, menuWallpaperOpts, menuUtilityOpts, menuQuoteOpts
24
19
  } from "./utils.js";
20
+ import quoteSelect from "./hash/quotesSelect.js";
25
21
 
26
22
  const [gauge, totalTime, pageSize] = [new Gauge(), 1e4, 9];
27
23
 
@@ -31,13 +27,9 @@ const exitCli = () => {
31
27
  console.info("thanks for use stack-analyze".green);
32
28
  };
33
29
 
34
- /**
35
- * @async
36
- * @returns {Promise<void>}
37
- */
38
- async function webOpts() {
30
+ /** @type {import('./types.js').Menu} */async function webOpts() {
39
31
  console.info(colors.yellow(figlet.textSync("web options")));
40
-
32
+
41
33
  const web = await stackMenu({
42
34
  pageSize,
43
35
  message: "enter a web tool option",
@@ -49,13 +41,10 @@ async function webOpts() {
49
41
  : mainMenu();
50
42
  }
51
43
 
52
- /**
53
- * @async
54
- * @returns {Promise<void>}
55
- */
44
+ /** @type {import('./types.js').Menu} */
56
45
  async function infoOpts() {
57
46
  console.info(colors.yellow(figlet.textSync("info options")));
58
-
47
+
59
48
  const info = await stackMenu({
60
49
  pageSize,
61
50
  message: "enter a info tool option",
@@ -67,13 +56,10 @@ async function infoOpts() {
67
56
  : infoTools[info](returnMain);
68
57
  }
69
58
 
70
- /**
71
- * @async
72
- * @returns {Promise<void>}
73
- */
59
+ /** @type {import('./types.js').Menu} */
74
60
  async function queryOpts() {
75
61
  console.info(colors.yellow(figlet.textSync("query options")));
76
-
62
+
77
63
  const query = await stackMenu({
78
64
  pageSize,
79
65
  message: "enter a query tool option",
@@ -85,31 +71,40 @@ async function queryOpts() {
85
71
  : queryTools[query](returnMain);
86
72
  }
87
73
 
88
- /**
89
- * @async
90
- * @returns {Promise<void>}
91
- */
74
+ /** @type {import('./types.js').Menu} */
92
75
  async function wallpapersOpts() {
93
76
  console.info(colors.yellow(figlet.textSync("wallpapers")));
94
-
77
+
95
78
  const wallpaper = await stackMenu({
96
79
  pageSize,
97
80
  message: "enter a wallpaper selector",
98
81
  choices: menuWallpaperOpts
99
82
  });
100
-
83
+
101
84
  wallpaper === "return main menu"
102
85
  ? mainMenu()
103
86
  : wallpaperSelect[wallpaper](returnMain, wallpapersOpts);
104
87
  }
105
88
 
106
- /**
107
- * @async
108
- * @returns {Promise<void>}
109
- */
89
+ /** @type {import('./types.js').Menu} */
90
+ async function quotesOpts() {
91
+ console.info(colors.yellow(figlet.textSync("")));
92
+
93
+ const quotes = await stackMenu({
94
+ pageSize,
95
+ choices: menuQuoteOpts,
96
+ message: "enter a quote option"
97
+ });
98
+
99
+ quotes === "return main menu"
100
+ ? mainMenu()
101
+ : quoteSelect[quotes](returnMain);
102
+ }
103
+
104
+ /** @type {import('./types.js').Menu} */
110
105
  async function utilityOpts() {
111
106
  console.info(colors.yellow(figlet.textSync("utility options")));
112
-
107
+
113
108
  const utility = await stackMenu({
114
109
  pageSize,
115
110
  message: "enter a utility tool option",
@@ -121,13 +116,10 @@ async function utilityOpts() {
121
116
  : utilityTools[utility](returnMain);
122
117
  }
123
118
 
124
- /**
125
- * @async
126
- * @returns {Promise<void>}
127
- */
119
+ /** @type {import('./types.js').Menu} */
128
120
  async function aboutOpts() {
129
121
  console.info(colors.yellow(figlet.textSync("About Menu")));
130
-
122
+
131
123
  const about = await stackMenu({
132
124
  pageSize,
133
125
  message: "select about option info",
@@ -139,17 +131,15 @@ async function aboutOpts() {
139
131
  : mainMenu();
140
132
  }
141
133
 
142
- /**
143
- * @async
144
- * @returns {Promise<void>}
145
- */
134
+ /** @type {import('./types.js').Menu} */
146
135
  async function mainMenu() {
147
136
  console.clear();
148
137
  console.info(colors.yellow(figlet.textSync("stack-analyze")));
149
138
 
150
139
  const option = await stackMenu({
151
- message: "what option do you want to analyze stack",
152
- choices: menuOpts
140
+ message: "what option do you want to analyze stack",
141
+ choices: menuOpts,
142
+ pageSize: 10
153
143
  });
154
144
 
155
145
  const menuList = {
@@ -173,6 +163,10 @@ async function mainMenu() {
173
163
  console.clear();
174
164
  wallpapersOpts();
175
165
  },
166
+ quotes() {
167
+ console.clear();
168
+ quotesOpts();
169
+ },
176
170
  about() {
177
171
  console.clear();
178
172
  aboutOpts();
@@ -182,10 +176,7 @@ async function mainMenu() {
182
176
  option !== "exit" ? menuList[option]() : exitCli();
183
177
  }
184
178
 
185
- /**
186
- * @async
187
- * @returns {Promise<void>}
188
- */
179
+ /** @type {import('./types.js').Menu} */
189
180
  async function returnMain() {
190
181
  try {
191
182
  const returnMain = await confirm({
@@ -9,7 +9,7 @@ import { stackSave } from "../utils.js";
9
9
 
10
10
  /**
11
11
  *
12
- * @description call the anime serach info
12
+ * @description call the anime serach info.
13
13
  * @async
14
14
  * @param { string } q - get query results
15
15
  * @returns { Promise<void> } - return results serach
@@ -37,15 +37,15 @@ export default async function hardware() {
37
37
  hardwareinfo.write(csvData(biosInfo, "\n\n"));
38
38
 
39
39
  // cpu info
40
- const cpuInfo = await cpu();
41
-
42
- cpuInfo.cache = Object.entries(cpuInfo.cache)
43
- .map(([key, value]) => `${key}: ${value}`)
44
- .join(" ");
40
+ const { cache: cpuCache, ...cpuInfo } = await cpu();
45
41
 
46
42
  hardwareinfo.write(csvHeader(cpuInfo));
47
43
  hardwareinfo.write(csvData(cpuInfo, "\n\n"));
48
44
 
45
+ hardwareinfo.write("cpu cache\n");
46
+ hardwareinfo.write(csvHeader(cpuCache));
47
+ hardwareinfo.write(csvData(cpuCache, "\n\n"));
48
+
49
49
  // os info
50
50
  const os = await osInfo();
51
51
 
@@ -0,0 +1,33 @@
1
+ import axios from "axios";
2
+ import colors from "colors";
3
+
4
+ /**
5
+ * @description get random quote from anime characters.
6
+ * @async
7
+ * @param {string} anime
8
+ * @returns {Promise<void>}
9
+ */
10
+ async function getAnimeQuote(anime) {
11
+ try {
12
+ /** @type {import('axios').AxiosResponse<import('../types.js').AnimeQuoute>} */
13
+ const { data } = await axios.get("https://api.animechan.io/v1/quotes/random", {
14
+ params: { anime }
15
+ });
16
+
17
+ const {
18
+ content,
19
+ anime: { altName: animeAltName, name: animeName },
20
+ character: { name: characterName }
21
+ } = data.data;
22
+
23
+ console.info({
24
+ content, animeAltName, animeName, characterName
25
+ });
26
+ } catch (err) {
27
+ console.error(colors.red(/** @type {import('axios').AxiosError} */(err).message));
28
+ }
29
+ }
30
+
31
+ export {
32
+ getAnimeQuote
33
+ };
package/hash/infoTools.js CHANGED
@@ -10,6 +10,7 @@ import bundlephobia from "../functions/bundlephobia.js";
10
10
  // bitly regexp
11
11
  const bitlyRegexp = /bit\.ly\//g;
12
12
 
13
+ /** @type {import("../types.js").Select}*/
13
14
  const infoTools = {
14
15
  async github_info(refreshCallback) {
15
16
  console.clear();
@@ -32,7 +33,6 @@ const infoTools = {
32
33
  }),
33
34
  token: await password({
34
35
  message: "enter a bitly token",
35
- required: true,
36
36
  mask: true
37
37
  })
38
38
  };
@@ -9,7 +9,7 @@ import twitchInfo from "../functions/twitch.js";
9
9
  import deezer from "../functions/deezer.js";
10
10
  import potterSearch from "../functions/potterSearch.js";
11
11
 
12
- /** query tools */
12
+ /** @type {import("../types.js").Select}*/
13
13
  const queryTools = {
14
14
  async anime_Search(refreshCallback) {
15
15
  console.clear();
@@ -32,7 +32,6 @@ const queryTools = {
32
32
  }),
33
33
  token: await password({
34
34
  message: "enter a token key",
35
- required: true,
36
35
  mask: true
37
36
  })
38
37
  };
@@ -76,12 +75,10 @@ const queryTools = {
76
75
  }),
77
76
  twitchClient: await password({
78
77
  message: "enter a twitch client ID:",
79
- required: true,
80
78
  mask: true
81
79
  }),
82
80
  twitchToken: await password({
83
81
  message: "enter a twitch token:",
84
- required: true,
85
82
  mask: true
86
83
  })
87
84
  };
@@ -0,0 +1,16 @@
1
+ import { input } from "@inquirer/prompts";
2
+ import { getAnimeQuote } from "../functions/quotes.js";
3
+
4
+ /** @type {import("../types.js").Select}*/
5
+ const quoteSelect = {
6
+ animeQuote: async (refreshCallback) => {
7
+ const quote = await input({
8
+ message: "enter a anime for get random quote: \u0022if press enter key get random\u0022:".yellow,
9
+ });
10
+
11
+ getAnimeQuote(quote);
12
+ setTimeout(refreshCallback, 5000);
13
+ },
14
+ };
15
+
16
+ export default quoteSelect;
@@ -7,6 +7,7 @@ import genPassword from "../functions/password.js";
7
7
  import hardware from "../functions/hardware.js";
8
8
  import pokerGame from "../functions/poker.js";
9
9
 
10
+ /** @type {import("../types.js").Select}*/
10
11
  const utilityTools = {
11
12
  password(refreshCallback) {
12
13
  console.clear();
@@ -16,7 +17,7 @@ const utilityTools = {
16
17
  async hardware(refreshCallback) {
17
18
  console.clear();
18
19
  hardware();
19
- setTimeout(refreshCallback, 3e3);
20
+ setTimeout(refreshCallback, 12e3);
20
21
  },
21
22
  async poker_game(refreshCallback) {
22
23
  const pokeOpt = await stackMenu({
@@ -6,8 +6,9 @@ import { wallpaperDownload } from "../functions/download.js";
6
6
  const message = "select a wallpaper for download:";
7
7
  const backMenu = "back to menu";
8
8
 
9
+ /** @type {import("../types.js").Select}*/
9
10
  const wallpaperSelect = {
10
- async solMoon(refreshCallback, alternativeCallback) {
11
+ solMoon: async (refreshCallback, alternativeCallback) => {
11
12
  const solMoonWallpapers = [...Array(20).keys()]
12
13
  .map(i => `sol-moon${i + 1}.jpeg`);
13
14
 
@@ -23,7 +24,7 @@ const wallpaperSelect = {
23
24
  setTimeout(refreshCallback, 5000);
24
25
  }
25
26
  },
26
- async dimensions(refreshCallback, alternativeCallback) {
27
+ dimensions: async (refreshCallback, alternativeCallback) => {
27
28
  const dimensionsWallpapers = [...Array(12).keys()]
28
29
  .map(i => `dimensions-${i + 1}.jpeg`);
29
30
 
@@ -39,7 +40,7 @@ const wallpaperSelect = {
39
40
  setTimeout(refreshCallback, 5000);
40
41
  }
41
42
  },
42
- async seyyahi2(refreshCallback, alternativeCallback) {
43
+ seyyahi2: async (refreshCallback, alternativeCallback) => {
43
44
  const seyyahiWallpapers = [...Array(14).keys()]
44
45
  .map(i => `seyyahi2-wallpaper${i + 1}.jpg`);
45
46
 
@@ -54,7 +55,7 @@ const wallpaperSelect = {
54
55
  setTimeout(refreshCallback, 5000);
55
56
  }
56
57
  },
57
- async ancientMistery(refreshCallback, alternativeCallback) {
58
+ ancientMistery: async (refreshCallback, alternativeCallback) => {
58
59
  const ancientMisteryWallpapers = [...Array(6).keys()]
59
60
  .map(i => `ancient-mistery${i + 1}.jpeg`);
60
61
 
@@ -69,7 +70,7 @@ const wallpaperSelect = {
69
70
  setTimeout(refreshCallback, 5000);
70
71
  }
71
72
  },
72
- async tsukyNoEmily(refreshCallback, alternativeCallback) {
73
+ tsukyNoEmily: async (refreshCallback, alternativeCallback) => {
73
74
  const tsukyNoEmilyWallpapers = [...Array(6).keys()]
74
75
  .map(i => `tsuky-no-emily${i + 1}.jpeg`);
75
76
 
package/hash/webTools.js CHANGED
@@ -17,6 +17,7 @@ import { scrapingOpts } from "../utils.js";
17
17
  // regex
18
18
  const webRegex = /https?:\/\//g;
19
19
 
20
+ /** @type {import("../types.js").Select}*/
20
21
  const webTools = {
21
22
  async single(refreshCallback) {
22
23
  console.clear();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stack-analyze",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
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": "cli.js",
@@ -8,25 +8,25 @@
8
8
  "stack-analyze": "cli.js"
9
9
  },
10
10
  "dependencies": {
11
- "@inquirer/prompts": "^7.3.2",
12
- "axios": "^1.7.7",
11
+ "@inquirer/prompts": "^7.6.0",
12
+ "axios": "^1.10.0",
13
13
  "boxen": "^8.0.1",
14
- "cheerio": "^1.0.0",
14
+ "cheerio": "^1.1.0",
15
15
  "cli-progress": "^3.12.0",
16
16
  "colors": "^1.4.0",
17
- "console-table-printer": "^2.12.1",
18
- "figlet": "^1.8.0",
17
+ "console-table-printer": "^2.14.6",
18
+ "figlet": "^1.8.1",
19
19
  "gauge": "^5.0.2",
20
- "inquirer": "^12.0.1",
21
- "systeminformation": "^5.23.5",
20
+ "inquirer": "^12.7.0",
21
+ "systeminformation": "^5.27.7",
22
22
  "timeago.js": "^4.0.2",
23
- "w3c-css-validator": "^1.3.2",
23
+ "w3c-css-validator": "^1.4.0",
24
24
  "wapalyzer": "^6.10.65"
25
25
  },
26
26
  "devDependencies": {
27
- "@eslint/js": "^9.14.0",
28
- "eslint": "^9.14.0",
29
- "globals": "^15.12.0",
27
+ "@eslint/js": "^9.30.1",
28
+ "eslint": "^9.30.1",
29
+ "globals": "^16.3.0",
30
30
  "jsdoc": "^4.0.4"
31
31
  },
32
32
  "scripts": {
package/types.js ADDED
@@ -0,0 +1,51 @@
1
+ /**
2
+ * general functions
3
+ * @typedef {() => Promise<void>} Menu
4
+ *
5
+ * types for about tools
6
+ *
7
+ * @typedef {Object} Info
8
+ * @property {string} Info.mainDeveloper
9
+ * @property {string} Info.version
10
+ * @property {string} Info.license
11
+ *
12
+ * @typedef {Object} DeveloperList
13
+ * @property {string} DeveloperList.name
14
+ * @property {string} DeveloperList.roles
15
+ *
16
+ * @typedef {Object} Youtube
17
+ * @property {string} Youtube.youtubeChannel
18
+ * @property {string} Youtube.recomendation
19
+ *
20
+ * @typedef {Object} Twitch
21
+ * @property {string} Twitch.user
22
+ * @property {string} [Twitch.details]
23
+ *
24
+ * @typedef {Object} Project
25
+ * @property {string} Project.name
26
+ * @property {string} Project.desc
27
+ *
28
+ * anime quote types
29
+ * @typedef {Object} Anime
30
+ * @property {number} id
31
+ * @property {string} name
32
+ * @property {string} altName
33
+ *
34
+ * @typedef {Object} Data
35
+ * @property {string} content
36
+ * @property {Anime} anime
37
+ * @property {Omit<Anime, 'altName'>} character
38
+ *
39
+ * @typedef {Object} AnimeQuoute
40
+ * @property {string} status
41
+ * @property {Data} data
42
+ *
43
+ * select types
44
+ * @typedef {({
45
+ * [x: string]: (
46
+ * refreshCallback: () => Promise<void>,
47
+ * alternativeCallback?: () => Promise<void>
48
+ * ) => Promise<void> | void
49
+ * })} Select
50
+ *
51
+ */
package/utils.js CHANGED
@@ -12,7 +12,7 @@ const currency = new Intl.NumberFormat("en-us", {
12
12
  const returnMainOpts = "return main menu";
13
13
 
14
14
  const menuOpts = [
15
- "web", "info", "query", "utility", "wallpapers",
15
+ "web", "info", "query", "utility", "wallpapers", "quotes",
16
16
  "about", "exit"
17
17
  ];
18
18
 
@@ -39,6 +39,8 @@ const menuWallpaperOpts = [
39
39
  "tsukyNoEmily", returnMainOpts
40
40
  ];
41
41
 
42
+ const menuQuoteOpts = ["animeQuote", returnMainOpts];
43
+
42
44
  const menuHardwareOpts = [
43
45
  "cpuInfo", "ramMemInfo", "osDetail", "diskInfo",
44
46
  "controllerInfo", "displayInfo", "biosInfo", returnMainOpts
@@ -86,19 +88,9 @@ const stackSave = async (filename, data) => {
86
88
  const exitCli = "thanks for use stack-analyze";
87
89
 
88
90
  export {
89
- listFormat,
90
- currency,
91
- menuOpts,
92
- menuWebOpts,
93
- menuInfoOpts,
94
- menuQueryOpts,
95
- menuUtilityOpts,
96
- menuHardwareOpts,
97
- menuWallpaperOpts,
98
- menuAboutOpts,
99
- scrapingOpts,
100
- stackSave,
101
- pokerGameOpts,
102
- exitCli
91
+ listFormat, currency, menuOpts, menuWebOpts,
92
+ menuInfoOpts, menuQueryOpts, menuUtilityOpts, menuHardwareOpts,
93
+ menuWallpaperOpts, menuAboutOpts, scrapingOpts, menuQuoteOpts,
94
+ stackSave, pokerGameOpts, exitCli
103
95
  };
104
96