stack-analyze 1.3.5 → 1.3.6

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/cli.js CHANGED
@@ -1,213 +1,213 @@
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,
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 {Promise<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);
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
+ }
@@ -1,41 +1,41 @@
1
- // modules
2
- import axios from "axios";
3
- import { format } from "timeago.js";
4
- import colors from "colors";
5
-
6
- // save bitly
7
- import { stackSave } from "../utils.js";
8
-
9
- /**
10
- *
11
- * @description call the bitly info data
12
- * @async
13
- * @param { string } link - link for search info
14
- * @param { string } token - bitly api token is required
15
- * @returns { Promise<void> } - return results serach
16
- *
17
- */
18
- export default async function bitlyInfo(link, token) {
19
- try {
20
- const { data } = await axios.post(
21
- "https://api-ssl.bitly.com/v4/expand",
22
- { bitlink_id: link },
23
- {
24
- headers: {
25
- Authorization: `Bearer ${token}`,
26
- "Content-Type": "application/json"
27
- }
28
- }
29
- );
30
-
31
- console.table({
32
- created_link: format(data.created_at),
33
- bitly_link: data.link,
34
- link: data.long_url
35
- });
36
-
37
- stackSave("bitly.json", JSON.stringify(data, null, 2));
38
- } catch (err) {
39
- console.error(colors.red(err.message));
40
- }
41
- }
1
+ // modules
2
+ import axios from "axios";
3
+ import { format } from "timeago.js";
4
+ import colors from "colors";
5
+
6
+ // save bitly
7
+ import { stackSave } from "../utils.js";
8
+
9
+ /**
10
+ *
11
+ * @description call the bitly info data
12
+ * @async
13
+ * @param { string } link - link for search info
14
+ * @param { string } token - bitly api token is required
15
+ * @returns { Promise<void> } - return results serach
16
+ *
17
+ */
18
+ export default async function bitlyInfo(link, token) {
19
+ try {
20
+ const { data } = await axios.post(
21
+ "https://api-ssl.bitly.com/v4/expand",
22
+ { bitlink_id: link },
23
+ {
24
+ headers: {
25
+ Authorization: `Bearer ${token}`,
26
+ "Content-Type": "application/json"
27
+ }
28
+ }
29
+ );
30
+
31
+ console.table({
32
+ created_link: format(data.created_at),
33
+ bitly_link: data.link,
34
+ link: data.long_url
35
+ });
36
+
37
+ stackSave("bitly.json", JSON.stringify(data, null, 2));
38
+ } catch (err) {
39
+ console.error(colors.red(err.message));
40
+ }
41
+ }