stack-analyze 1.3.5 → 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.
Files changed (43) hide show
  1. package/CHANGELOG.md +335 -311
  2. package/LICENSE +21 -21
  3. package/about.js +98 -121
  4. package/api/pokerApi.js +5 -5
  5. package/api/wallpapersURL.js +7 -5
  6. package/api/webApis.js +21 -21
  7. package/cli.js +204 -213
  8. package/eslint.config.js +44 -44
  9. package/functions/animeInfo.js +45 -45
  10. package/functions/bitly.js +41 -41
  11. package/functions/bundlephobia.js +36 -36
  12. package/functions/cryptoList.js +48 -48
  13. package/functions/cssValidator.js +25 -25
  14. package/functions/deezer.js +37 -37
  15. package/functions/download.js +25 -24
  16. package/functions/gitUser.js +37 -37
  17. package/functions/hardware.js +109 -109
  18. package/functions/moviesInfo.js +55 -55
  19. package/functions/multipleStack.js +53 -53
  20. package/functions/pageSpeed.js +82 -82
  21. package/functions/password.js +24 -24
  22. package/functions/pokemon.js +106 -106
  23. package/functions/poker.js +40 -42
  24. package/functions/potterSearch.js +32 -32
  25. package/functions/quotes.js +33 -0
  26. package/functions/scraping.js +132 -132
  27. package/functions/singleStack.js +48 -48
  28. package/functions/twitch.js +72 -72
  29. package/hash/infoTools.js +61 -61
  30. package/hash/queryTools.js +113 -116
  31. package/hash/quotesSelect.js +16 -0
  32. package/hash/utilityTools.js +33 -32
  33. package/hash/wallpaperSelect.js +90 -59
  34. package/hash/webTools.js +93 -92
  35. package/logo-module.webp +0 -0
  36. package/menu.js +13 -13
  37. package/package.json +67 -67
  38. package/prompts/webPrompts.js +31 -31
  39. package/readme.md +44 -44
  40. package/types.js +51 -0
  41. package/utils.js +96 -101
  42. package/validations/infoValidations.js +37 -37
  43. package/validations/webValidations.js +33 -33
package/cli.js CHANGED
@@ -1,213 +1,204 @@
1
- #!/usr/bin/env node
2
- import Gauge from "gauge";
3
- import colors from "colors";
4
- import { confirm } from "@inquirer/prompts";
5
- import figlet from "figlet";
6
-
7
- import { stackMenu } from "./menu.js";
8
-
9
- import webTools from "./hash/webTools.js";
10
- import queryTools from "./hash/queryTools.js";
11
- import infoTools from "./hash/infoTools.js";
12
- import utilityTools from "./hash/utilityTools.js";
13
- import wallpaperSelect from "./hash/wallpaperSelect.js";
14
- import aboutTool from "./about.js";
15
-
16
- import {
17
- menuOpts,
18
- menuQueryOpts,
19
- menuWebOpts,
20
- menuAboutOpts,
21
- menuInfoOpts,
22
- menuWallpaperOpts,
23
- menuUtilityOpts
24
- } from "./utils.js";
25
-
26
- const [gauge, totalTime, pageSize] = [new Gauge(), 1e4, 9];
27
-
28
- /** @returns {void} */
29
- const exitCli = () => {
30
- console.clear();
31
- console.info("thanks for use stack-analyze".green);
32
- };
33
-
34
- /**
35
- * @async
36
- * @returns {Promise<void>}
37
- */
38
- async function webOpts() {
39
- console.info(colors.yellow(figlet.textSync("web options")));
40
-
41
- const web = await stackMenu({
42
- pageSize,
43
- message: "enter a web tool option",
44
- choices: menuWebOpts
45
- });
46
-
47
- web !== "return main menu"
48
- ? webTools[web](returnMain)
49
- : mainMenu();
50
- }
51
-
52
- /**
53
- * @async
54
- * @returns {Promise<void>}
55
- */
56
- async function infoOpts() {
57
- console.info(colors.yellow(figlet.textSync("info options")));
58
-
59
- const info = await stackMenu({
60
- pageSize,
61
- message: "enter a info tool option",
62
- choices: menuInfoOpts
63
- });
64
-
65
- info === "return main menu"
66
- ? mainMenu()
67
- : infoTools[info](returnMain);
68
- }
69
-
70
- /**
71
- * @async
72
- * @returns {Promise<void>}
73
- */
74
- async function queryOpts() {
75
- console.info(colors.yellow(figlet.textSync("query options")));
76
-
77
- const query = await stackMenu({
78
- pageSize,
79
- message: "enter a query tool option",
80
- choices: menuQueryOpts
81
- });
82
-
83
- query === "return main menu"
84
- ? mainMenu()
85
- : queryTools[query](returnMain);
86
- }
87
-
88
- /**
89
- * @async
90
- * @returns {void}
91
- */
92
- async function wallpapersOpts() {
93
- console.info(colors.yellow(figlet.textSync("wallpapers")));
94
-
95
- const wallpaper = await stackMenu({
96
- pageSize,
97
- message: "enter a wallpaper selector",
98
- choices: menuWallpaperOpts
99
- });
100
-
101
- wallpaper === "return main menu"
102
- ? mainMenu()
103
- : wallpaperSelect[wallpaper](returnMain, wallpapersOpts);
104
- }
105
-
106
- /**
107
- * @async
108
- * @returns {Promise<void>}
109
- */
110
- async function utilityOpts() {
111
- console.info(colors.yellow(figlet.textSync("utility options")));
112
-
113
- const utility = await stackMenu({
114
- pageSize,
115
- message: "enter a utility tool option",
116
- choices: menuUtilityOpts
117
- });
118
-
119
- utility === "return main menu"
120
- ? mainMenu()
121
- : utilityTools[utility](returnMain);
122
- }
123
-
124
- /**
125
- * @async
126
- * @returns {Promise<void>}
127
- */
128
- async function aboutOpts() {
129
- console.info(colors.yellow(figlet.textSync("About Menu")));
130
-
131
- const about = await stackMenu({
132
- pageSize,
133
- message: "select about option info",
134
- choices: menuAboutOpts
135
- });
136
-
137
- about !== "return main menu"
138
- ? aboutTool[about](aboutOpts)
139
- : mainMenu();
140
- }
141
-
142
- /**
143
- * @async
144
- * @returns {Promise<void>}
145
- */
146
- async function mainMenu() {
147
- console.clear();
148
- console.info(colors.yellow(figlet.textSync("stack-analyze")));
149
-
150
- const option = await stackMenu({
151
- message: "what option do you want to analyze stack",
152
- choices: menuOpts
153
- });
154
-
155
- const menuList = {
156
- web() {
157
- console.clear();
158
- webOpts();
159
- },
160
- info() {
161
- console.clear();
162
- infoOpts();
163
- },
164
- query() {
165
- console.clear();
166
- queryOpts();
167
- },
168
- utility() {
169
- console.clear();
170
- utilityOpts();
171
- },
172
- wallpapers() {
173
- console.clear();
174
- wallpapersOpts();
175
- },
176
- about() {
177
- console.clear();
178
- aboutOpts();
179
- }
180
- };
181
-
182
- option !== "exit" ? menuList[option]() : exitCli();
183
- }
184
-
185
- /**
186
- * @async
187
- * @returns {Promise<void>}
188
- */
189
- async function returnMain() {
190
- try {
191
- const returnMain = await confirm({
192
- message: "do you want go to the main menu?",
193
- });
194
-
195
- returnMain ? mainMenu() : exitCli();
196
- } catch (err) {
197
- console.error(colors.bgRed(err.message));
198
- }
199
- }
200
-
201
- for (let i = 50; i < totalTime; i += 50) {
202
- const percentage = i / totalTime;
203
-
204
- setTimeout(() => {
205
- gauge.pulse();
206
- gauge.show(`Loading app... ${percentage * 100}%`.random, percentage);
207
- }, i);
208
- }
209
-
210
- setTimeout(() => {
211
- gauge.hide();
212
- mainMenu();
213
- }, totalTime);
1
+ #!/usr/bin/env node
2
+ import Gauge from "gauge";
3
+ import colors from "colors";
4
+ import { confirm } from "@inquirer/prompts";
5
+ import figlet from "figlet";
6
+
7
+ import { stackMenu } from "./menu.js";
8
+
9
+ import webTools from "./hash/webTools.js";
10
+ import queryTools from "./hash/queryTools.js";
11
+ import infoTools from "./hash/infoTools.js";
12
+ import utilityTools from "./hash/utilityTools.js";
13
+ import wallpaperSelect from "./hash/wallpaperSelect.js";
14
+ import aboutTool from "./about.js";
15
+
16
+ import {
17
+ menuOpts, menuQueryOpts, menuWebOpts, menuAboutOpts,
18
+ menuInfoOpts, menuWallpaperOpts, menuUtilityOpts, menuQuoteOpts
19
+ } from "./utils.js";
20
+ import quoteSelect from "./hash/quotesSelect.js";
21
+
22
+ const [gauge, totalTime, pageSize] = [new Gauge(), 1e4, 9];
23
+
24
+ /** @returns {void} */
25
+ const exitCli = () => {
26
+ console.clear();
27
+ console.info("thanks for use stack-analyze".green);
28
+ };
29
+
30
+ /** @type {import('./types.js').Menu} */async function webOpts() {
31
+ console.info(colors.yellow(figlet.textSync("web options")));
32
+
33
+ const web = await stackMenu({
34
+ pageSize,
35
+ message: "enter a web tool option",
36
+ choices: menuWebOpts
37
+ });
38
+
39
+ web !== "return main menu"
40
+ ? webTools[web](returnMain)
41
+ : mainMenu();
42
+ }
43
+
44
+ /** @type {import('./types.js').Menu} */
45
+ async function infoOpts() {
46
+ console.info(colors.yellow(figlet.textSync("info options")));
47
+
48
+ const info = await stackMenu({
49
+ pageSize,
50
+ message: "enter a info tool option",
51
+ choices: menuInfoOpts
52
+ });
53
+
54
+ info === "return main menu"
55
+ ? mainMenu()
56
+ : infoTools[info](returnMain);
57
+ }
58
+
59
+ /** @type {import('./types.js').Menu} */
60
+ async function queryOpts() {
61
+ console.info(colors.yellow(figlet.textSync("query options")));
62
+
63
+ const query = await stackMenu({
64
+ pageSize,
65
+ message: "enter a query tool option",
66
+ choices: menuQueryOpts
67
+ });
68
+
69
+ query === "return main menu"
70
+ ? mainMenu()
71
+ : queryTools[query](returnMain);
72
+ }
73
+
74
+ /** @type {import('./types.js').Menu} */
75
+ async function wallpapersOpts() {
76
+ console.info(colors.yellow(figlet.textSync("wallpapers")));
77
+
78
+ const wallpaper = await stackMenu({
79
+ pageSize,
80
+ message: "enter a wallpaper selector",
81
+ choices: menuWallpaperOpts
82
+ });
83
+
84
+ wallpaper === "return main menu"
85
+ ? mainMenu()
86
+ : wallpaperSelect[wallpaper](returnMain, wallpapersOpts);
87
+ }
88
+
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} */
105
+ async function utilityOpts() {
106
+ console.info(colors.yellow(figlet.textSync("utility options")));
107
+
108
+ const utility = await stackMenu({
109
+ pageSize,
110
+ message: "enter a utility tool option",
111
+ choices: menuUtilityOpts
112
+ });
113
+
114
+ utility === "return main menu"
115
+ ? mainMenu()
116
+ : utilityTools[utility](returnMain);
117
+ }
118
+
119
+ /** @type {import('./types.js').Menu} */
120
+ async function aboutOpts() {
121
+ console.info(colors.yellow(figlet.textSync("About Menu")));
122
+
123
+ const about = await stackMenu({
124
+ pageSize,
125
+ message: "select about option info",
126
+ choices: menuAboutOpts
127
+ });
128
+
129
+ about !== "return main menu"
130
+ ? aboutTool[about](aboutOpts)
131
+ : mainMenu();
132
+ }
133
+
134
+ /** @type {import('./types.js').Menu} */
135
+ async function mainMenu() {
136
+ console.clear();
137
+ console.info(colors.yellow(figlet.textSync("stack-analyze")));
138
+
139
+ const option = await stackMenu({
140
+ message: "what option do you want to analyze stack",
141
+ choices: menuOpts,
142
+ pageSize: 10
143
+ });
144
+
145
+ const menuList = {
146
+ web() {
147
+ console.clear();
148
+ webOpts();
149
+ },
150
+ info() {
151
+ console.clear();
152
+ infoOpts();
153
+ },
154
+ query() {
155
+ console.clear();
156
+ queryOpts();
157
+ },
158
+ utility() {
159
+ console.clear();
160
+ utilityOpts();
161
+ },
162
+ wallpapers() {
163
+ console.clear();
164
+ wallpapersOpts();
165
+ },
166
+ quotes() {
167
+ console.clear();
168
+ quotesOpts();
169
+ },
170
+ about() {
171
+ console.clear();
172
+ aboutOpts();
173
+ }
174
+ };
175
+
176
+ option !== "exit" ? menuList[option]() : exitCli();
177
+ }
178
+
179
+ /** @type {import('./types.js').Menu} */
180
+ async function returnMain() {
181
+ try {
182
+ const returnMain = await confirm({
183
+ message: "do you want go to the main menu?",
184
+ });
185
+
186
+ returnMain ? mainMenu() : exitCli();
187
+ } catch (err) {
188
+ console.error(colors.bgRed(err.message));
189
+ }
190
+ }
191
+
192
+ for (let i = 50; i < totalTime; i += 50) {
193
+ const percentage = i / totalTime;
194
+
195
+ setTimeout(() => {
196
+ gauge.pulse();
197
+ gauge.show(`Loading app... ${percentage * 100}%`.random, percentage);
198
+ }, i);
199
+ }
200
+
201
+ setTimeout(() => {
202
+ gauge.hide();
203
+ mainMenu();
204
+ }, totalTime);
package/eslint.config.js CHANGED
@@ -1,44 +1,44 @@
1
- import path from "node:path";
2
- import { fileURLToPath } from "node:url";
3
- import globals from "globals";
4
- import js from "@eslint/js";
5
- import { FlatCompat } from "@eslint/eslintrc";
6
-
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = path.dirname(__filename);
9
- const compat = new FlatCompat({
10
- baseDirectory: __dirname,
11
- recommendedConfig: js.configs.recommended,
12
- allConfig: js.configs.all
13
- });
14
-
15
- export default [{
16
- ignores: ["node_modules", "test", "docs", "eslint.config.js"],
17
- }, ...compat.extends("eslint:recommended"), {
18
- languageOptions: {
19
- globals: {
20
- ...globals.commonjs,
21
- ...globals.node,
22
- },
23
- ecmaVersion: "latest",
24
- sourceType: "module",
25
- },
26
-
27
- rules: {
28
- "no-var": "error",
29
- eqeqeq: "warn",
30
- "default-case": "error",
31
- "eol-last": "error",
32
- "spaced-comment": "error",
33
- "comma-spacing": "error",
34
- quotes: "error",
35
- "block-spacing": "error",
36
- "prefer-const": "error",
37
-
38
- indent: ["error", 2, {
39
- SwitchCase: 1,
40
- }],
41
-
42
- semi: "error",
43
- },
44
- }];
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import globals from "globals";
4
+ import js from "@eslint/js";
5
+ import { FlatCompat } from "@eslint/eslintrc";
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+ const compat = new FlatCompat({
10
+ baseDirectory: __dirname,
11
+ recommendedConfig: js.configs.recommended,
12
+ allConfig: js.configs.all
13
+ });
14
+
15
+ export default [{
16
+ ignores: ["node_modules", "test", "docs", "eslint.config.js"],
17
+ }, ...compat.extends("eslint:recommended"), {
18
+ languageOptions: {
19
+ globals: {
20
+ ...globals.commonjs,
21
+ ...globals.node,
22
+ },
23
+ ecmaVersion: "latest",
24
+ sourceType: "module",
25
+ },
26
+
27
+ rules: {
28
+ "no-var": "error",
29
+ eqeqeq: "warn",
30
+ "default-case": "error",
31
+ "eol-last": "error",
32
+ "spaced-comment": "error",
33
+ "comma-spacing": "error",
34
+ quotes: "error",
35
+ "block-spacing": "error",
36
+ "prefer-const": "error",
37
+
38
+ indent: ["error", 2, {
39
+ SwitchCase: 1,
40
+ }],
41
+
42
+ semi: "error",
43
+ },
44
+ }];
@@ -1,45 +1,45 @@
1
- // modules
2
- import axios from "axios";
3
- import { format } from "timeago.js";
4
- import colors from "colors";
5
- import { printTable } from "console-table-printer";
6
-
7
- // save anime
8
- import { stackSave } from "../utils.js";
9
-
10
- /**
11
- *
12
- * @description call the anime serach info
13
- * @async
14
- * @param { string } q - get query results
15
- * @returns { Promise<void> } - return results serach
16
- *
17
- */
18
- export default async function animeSearch(q) {
19
- try {
20
- // call api
21
- const { data } = await axios.get("https://api.jikan.moe/v4/anime", {
22
- params: { q }
23
- });
24
-
25
- const animeData = data.data.map(({
26
- title,
27
- episodes,
28
- aired,
29
- status,
30
- type }) => ({
31
- title,
32
- type,
33
- totalEpisodes: episodes || "current",
34
- debutDate: format(aired.from),
35
- finalDate: aired?.to
36
- ? format(aired.to)
37
- : status
38
- }));
39
-
40
-
41
- printTable(animeData.slice(0, 10));
42
-
43
- stackSave(`${q}-results.json`, JSON.stringify(animeData, null, 2));
44
- } catch (err) { console.error(colors.red(err.message)); }
45
- }
1
+ // modules
2
+ import axios from "axios";
3
+ import { format } from "timeago.js";
4
+ import colors from "colors";
5
+ import { printTable } from "console-table-printer";
6
+
7
+ // save anime
8
+ import { stackSave } from "../utils.js";
9
+
10
+ /**
11
+ *
12
+ * @description call the anime serach info.
13
+ * @async
14
+ * @param { string } q - get query results
15
+ * @returns { Promise<void> } - return results serach
16
+ *
17
+ */
18
+ export default async function animeSearch(q) {
19
+ try {
20
+ // call api
21
+ const { data } = await axios.get("https://api.jikan.moe/v4/anime", {
22
+ params: { q }
23
+ });
24
+
25
+ const animeData = data.data.map(({
26
+ title,
27
+ episodes,
28
+ aired,
29
+ status,
30
+ type }) => ({
31
+ title,
32
+ type,
33
+ totalEpisodes: episodes || "current",
34
+ debutDate: format(aired.from),
35
+ finalDate: aired?.to
36
+ ? format(aired.to)
37
+ : status
38
+ }));
39
+
40
+
41
+ printTable(animeData.slice(0, 10));
42
+
43
+ stackSave(`${q}-results.json`, JSON.stringify(animeData, null, 2));
44
+ } catch (err) { console.error(colors.red(err.message)); }
45
+ }