stack-analyze 1.3.7 → 1.3.9
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 +12 -0
- package/about.js +40 -27
- package/cli.js +38 -35
- package/functions/deezer.js +2 -3
- package/functions/hardware.js +1 -10
- package/functions/moviesInfo.js +4 -8
- package/functions/pokemon.js +7 -15
- package/functions/poker.js +1 -1
- package/functions/quotes.js +5 -19
- package/functions/tcgp.js +69 -0
- package/hash/infoTools.js +51 -20
- package/hash/queryTools.js +15 -2
- package/hash/quotesSelect.js +20 -11
- package/hash/utilityTools.js +22 -10
- package/hash/wallpaperSelect.js +15 -2
- package/hash/webTools.js +15 -3
- package/menu.js +5 -2
- package/package.json +14 -13
- package/utils.js +38 -49
- package/validations/infoValidations.js +1 -6
- package/validations/webValidations.js +1 -5
- package/types.js +0 -51
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ 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.9
|
|
8
|
+
|
|
9
|
+
#### Added
|
|
10
|
+
- added new tool (tcg pocket card info):
|
|
11
|
+
- @tcgdex/sdk *new module*
|
|
12
|
+
|
|
13
|
+
### version 1.3.8
|
|
14
|
+
|
|
15
|
+
#### Changed
|
|
16
|
+
- replace all arrays option instead using keys object for fast adaptible.
|
|
17
|
+
- change anime quotes to taylor swift quotes (neo-jquery easter egg)
|
|
18
|
+
|
|
7
19
|
### version 1.3.7
|
|
8
20
|
|
|
9
21
|
#### Added
|
package/about.js
CHANGED
|
@@ -1,31 +1,54 @@
|
|
|
1
1
|
// print table
|
|
2
2
|
import { printTable } from "console-table-printer";
|
|
3
|
+
import { returnMainOpts, listFormat } from "./utils.js";
|
|
3
4
|
|
|
4
5
|
// package.json
|
|
5
|
-
const { default: { license, version}} = await import("./package.json", {with: {type: "json" }});
|
|
6
|
+
const { default: { license, version } } = await import("./package.json", { with: { type: "json" } });
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Object} DeveloperList
|
|
10
|
+
* @property {string} DeveloperList.name
|
|
11
|
+
* @property {string} DeveloperList.roles
|
|
12
|
+
*
|
|
13
|
+
* @typedef {Object} Youtube
|
|
14
|
+
* @property {string} Youtube.youtubeChannel
|
|
15
|
+
* @property {string} Youtube.recomendation
|
|
16
|
+
*
|
|
17
|
+
* @typedef {Object} Twitch
|
|
18
|
+
* @property {string} Twitch.user
|
|
19
|
+
* @property {string} [Twitch.details]
|
|
20
|
+
*
|
|
21
|
+
* @typedef {Object} Project
|
|
22
|
+
* @property {string} Project.name
|
|
23
|
+
* @property {string} Project.desc
|
|
24
|
+
*
|
|
25
|
+
* @typedef {({
|
|
26
|
+
* [x: string]: (
|
|
27
|
+
* refreshCallback: () => Promise<void>,
|
|
28
|
+
* ) => void
|
|
29
|
+
* })} Select
|
|
30
|
+
*/
|
|
31
|
+
|
|
6
32
|
|
|
7
33
|
/** @type {number} */
|
|
8
34
|
const timeout = 1e3;
|
|
9
35
|
|
|
10
|
-
/** @type {
|
|
36
|
+
/** @type {Select}*/
|
|
11
37
|
const aboutTool = {
|
|
12
38
|
mainInfo(refreshCallback) {
|
|
13
|
-
/** @type {
|
|
39
|
+
/** @type {Object<string, string>} */
|
|
14
40
|
const aboutApp = {
|
|
15
41
|
mainDeveloper: "omega5300",
|
|
16
|
-
license,
|
|
17
|
-
version
|
|
42
|
+
license, version
|
|
18
43
|
};
|
|
19
44
|
|
|
20
45
|
console.clear();
|
|
21
46
|
console.table(aboutApp);
|
|
22
|
-
|
|
47
|
+
|
|
23
48
|
setTimeout(refreshCallback, timeout);
|
|
24
49
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/** @type {import("./types.js").DeveloperList[]} */
|
|
50
|
+
lineup(refreshCallback) {
|
|
51
|
+
/** @type {DeveloperList[]} */
|
|
29
52
|
const developers = [
|
|
30
53
|
{
|
|
31
54
|
name: "omega5300",
|
|
@@ -38,7 +61,7 @@ const aboutTool = {
|
|
|
38
61
|
setTimeout(refreshCallback, timeout);
|
|
39
62
|
},
|
|
40
63
|
youtubeRecomendation(refreshCallback) {
|
|
41
|
-
/** @type {
|
|
64
|
+
/** @type {Youtube[]} */
|
|
42
65
|
const youtubeDev = [
|
|
43
66
|
{ youtubeChannel: "fazt", recomendation: "recommend" },
|
|
44
67
|
{ youtubeChannel: "doriandesings", recomendation: "recommend" },
|
|
@@ -52,20 +75,12 @@ const aboutTool = {
|
|
|
52
75
|
printTable(youtubeDev);
|
|
53
76
|
setTimeout(refreshCallback, timeout);
|
|
54
77
|
},
|
|
55
|
-
twitchRecomendation(refreshCallback) {
|
|
56
|
-
/** @type {
|
|
78
|
+
twitchRecomendation(refreshCallback) {
|
|
79
|
+
/** @type {Twitch[]} */
|
|
57
80
|
const twitchUsers = [
|
|
58
81
|
{
|
|
59
82
|
user: "DannyAgii",
|
|
60
83
|
},
|
|
61
|
-
{
|
|
62
|
-
user: "Lunanny",
|
|
63
|
-
details: "art director with ADHD."
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
user: "Japon_HR",
|
|
67
|
-
details: "cosplayer, gamer, dance & halo machinima creator"
|
|
68
|
-
}
|
|
69
84
|
];
|
|
70
85
|
|
|
71
86
|
console.clear();
|
|
@@ -73,7 +88,7 @@ const aboutTool = {
|
|
|
73
88
|
setTimeout(refreshCallback, timeout);
|
|
74
89
|
},
|
|
75
90
|
projectsRecomendation(refreshCallback) {
|
|
76
|
-
/** @type {
|
|
91
|
+
/** @type {Project[]} */
|
|
77
92
|
const projects = [
|
|
78
93
|
{
|
|
79
94
|
name: "black metal promotion",
|
|
@@ -83,10 +98,6 @@ const aboutTool = {
|
|
|
83
98
|
name: "black metal catalog",
|
|
84
99
|
desc: "promos albums and community"
|
|
85
100
|
},
|
|
86
|
-
{
|
|
87
|
-
name: "slithering black records",
|
|
88
|
-
desc: "record label & community"
|
|
89
|
-
}
|
|
90
101
|
];
|
|
91
102
|
|
|
92
103
|
console.clear();
|
|
@@ -95,4 +106,6 @@ const aboutTool = {
|
|
|
95
106
|
}
|
|
96
107
|
};
|
|
97
108
|
|
|
98
|
-
|
|
109
|
+
const menuAboutOpts = [...Object.keys(aboutTool), returnMainOpts];
|
|
110
|
+
|
|
111
|
+
export { aboutTool, menuAboutOpts };
|
package/cli.js
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import ora from "ora";
|
|
3
3
|
import colors from "colors";
|
|
4
4
|
import { confirm } from "@inquirer/prompts";
|
|
5
5
|
import figlet from "figlet";
|
|
6
6
|
|
|
7
7
|
import { stackMenu } from "./menu.js";
|
|
8
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";
|
|
9
|
+
import {menuWebOpts, webTools} from "./hash/webTools.js";
|
|
10
|
+
import {menuQueryOpts, queryTools} from "./hash/queryTools.js";
|
|
11
|
+
import {infoTools, menuInfoOpts} from "./hash/infoTools.js";
|
|
12
|
+
import {menuUtilityOpts, utilityTools} from "./hash/utilityTools.js";
|
|
13
|
+
import {menuWallpaperOpts, wallpaperSelect} from "./hash/wallpaperSelect.js";
|
|
14
|
+
import {aboutTool, menuAboutOpts} from "./about.js";
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
menuInfoOpts, menuWallpaperOpts, menuUtilityOpts, menuQuoteOpts
|
|
19
|
-
} from "./utils.js";
|
|
20
|
-
import quoteSelect from "./hash/quotesSelect.js";
|
|
16
|
+
import { exitMsg } from "./utils.js";
|
|
17
|
+
import { quoteSelect, menuQuoteOpts } from "./hash/quotesSelect.js";
|
|
21
18
|
|
|
22
|
-
const [
|
|
19
|
+
const [spinner, totalTime, pageSize] = [
|
|
20
|
+
ora({spinner: "dots11", color: "white" }),
|
|
21
|
+
1e4, 9
|
|
22
|
+
];
|
|
23
23
|
|
|
24
24
|
/** @returns {void} */
|
|
25
25
|
const exitCli = () => {
|
|
26
26
|
console.clear();
|
|
27
|
-
console.info(
|
|
27
|
+
console.info(exitMsg);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
/** @
|
|
30
|
+
/** @returns {Promise<void>} */
|
|
31
|
+
async function webOpts() {
|
|
31
32
|
console.info(colors.yellow(figlet.textSync("web options")));
|
|
32
33
|
|
|
33
34
|
const web = await stackMenu({
|
|
@@ -41,7 +42,7 @@ const exitCli = () => {
|
|
|
41
42
|
: mainMenu();
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
/** @
|
|
45
|
+
/** @returns {Promise<void>} */
|
|
45
46
|
async function infoOpts() {
|
|
46
47
|
console.info(colors.yellow(figlet.textSync("info options")));
|
|
47
48
|
|
|
@@ -56,7 +57,7 @@ async function infoOpts() {
|
|
|
56
57
|
: infoTools[info](returnMain);
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
/** @
|
|
60
|
+
/** @returns {Promise<void>} */
|
|
60
61
|
async function queryOpts() {
|
|
61
62
|
console.info(colors.yellow(figlet.textSync("query options")));
|
|
62
63
|
|
|
@@ -71,7 +72,7 @@ async function queryOpts() {
|
|
|
71
72
|
: queryTools[query](returnMain);
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
/** @
|
|
75
|
+
/** @returns {Promise<void>} */
|
|
75
76
|
async function wallpapersOpts() {
|
|
76
77
|
console.info(colors.yellow(figlet.textSync("wallpapers")));
|
|
77
78
|
|
|
@@ -86,9 +87,9 @@ async function wallpapersOpts() {
|
|
|
86
87
|
: wallpaperSelect[wallpaper](returnMain, wallpapersOpts);
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
/** @
|
|
90
|
+
/** @returns {Promise<void>} */
|
|
90
91
|
async function quotesOpts() {
|
|
91
|
-
console.info(colors.yellow(figlet.textSync("")));
|
|
92
|
+
console.info(colors.yellow(figlet.textSync("quotes")));
|
|
92
93
|
|
|
93
94
|
const quotes = await stackMenu({
|
|
94
95
|
pageSize,
|
|
@@ -101,7 +102,7 @@ async function quotesOpts() {
|
|
|
101
102
|
: quoteSelect[quotes](returnMain);
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
/** @
|
|
105
|
+
/** @returns {Promise<void>} */
|
|
105
106
|
async function utilityOpts() {
|
|
106
107
|
console.info(colors.yellow(figlet.textSync("utility options")));
|
|
107
108
|
|
|
@@ -116,7 +117,7 @@ async function utilityOpts() {
|
|
|
116
117
|
: utilityTools[utility](returnMain);
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
/** @
|
|
120
|
+
/** @returns {Promise<void>} */
|
|
120
121
|
async function aboutOpts() {
|
|
121
122
|
console.info(colors.yellow(figlet.textSync("About Menu")));
|
|
122
123
|
|
|
@@ -131,17 +132,11 @@ async function aboutOpts() {
|
|
|
131
132
|
: mainMenu();
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
/** @
|
|
135
|
+
/** @returns {Promise<void>} */
|
|
135
136
|
async function mainMenu() {
|
|
136
137
|
console.clear();
|
|
137
138
|
console.info(colors.yellow(figlet.textSync("stack-analyze")));
|
|
138
139
|
|
|
139
|
-
const option = await stackMenu({
|
|
140
|
-
message: "what option do you want to analyze stack",
|
|
141
|
-
choices: menuOpts,
|
|
142
|
-
pageSize: 10
|
|
143
|
-
});
|
|
144
|
-
|
|
145
140
|
const menuList = {
|
|
146
141
|
web() {
|
|
147
142
|
console.clear();
|
|
@@ -173,15 +168,21 @@ async function mainMenu() {
|
|
|
173
168
|
}
|
|
174
169
|
};
|
|
175
170
|
|
|
171
|
+
const option = await stackMenu({
|
|
172
|
+
message: "what option do you want to analyze stack",
|
|
173
|
+
choices: [...Object.keys(menuList), "exit"],
|
|
174
|
+
pageSize: 10
|
|
175
|
+
});
|
|
176
|
+
|
|
176
177
|
option !== "exit" ? menuList[option]() : exitCli();
|
|
177
178
|
}
|
|
178
179
|
|
|
179
|
-
/** @
|
|
180
|
+
/** @returns {Promise<void>} */
|
|
180
181
|
async function returnMain() {
|
|
181
182
|
try {
|
|
182
183
|
const returnMain = await confirm({
|
|
183
184
|
message: "do you want go to the main menu?",
|
|
184
|
-
});
|
|
185
|
+
}).catch();
|
|
185
186
|
|
|
186
187
|
returnMain ? mainMenu() : exitCli();
|
|
187
188
|
} catch (err) {
|
|
@@ -190,15 +191,17 @@ async function returnMain() {
|
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
for (let i = 50; i < totalTime; i += 50) {
|
|
193
|
-
const percentage = i / totalTime;
|
|
194
|
+
const percentage = i / totalTime * 100;
|
|
194
195
|
|
|
195
196
|
setTimeout(() => {
|
|
196
|
-
gauge.pulse();
|
|
197
|
-
gauge.show(`Loading app... ${percentage * 100}%`.random, percentage);
|
|
197
|
+
/* gauge.pulse();
|
|
198
|
+
gauge.show(`Loading app... ${percentage * 100}%`.random, percentage); */
|
|
199
|
+
spinner.text = `Loading app... ${Math.ceil(percentage)}%`.random;
|
|
200
|
+
spinner.start();
|
|
198
201
|
}, i);
|
|
199
202
|
}
|
|
200
203
|
|
|
201
204
|
setTimeout(() => {
|
|
202
|
-
|
|
205
|
+
spinner.stop();
|
|
203
206
|
mainMenu();
|
|
204
207
|
}, totalTime);
|
package/functions/deezer.js
CHANGED
|
@@ -7,7 +7,7 @@ import { stackSave } from "../utils.js";
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @async
|
|
10
|
-
* @
|
|
10
|
+
* @param {string} q
|
|
11
11
|
* @returns {Promise<void>}
|
|
12
12
|
*/
|
|
13
13
|
export default async function deezer(q) {
|
|
@@ -20,9 +20,8 @@ export default async function deezer(q) {
|
|
|
20
20
|
id, title, record_type,
|
|
21
21
|
explicit_lyrics, artist, nb_tracks
|
|
22
22
|
}) => ({
|
|
23
|
-
id,
|
|
23
|
+
id, title,
|
|
24
24
|
artist: artist.name,
|
|
25
|
-
title,
|
|
26
25
|
type: record_type,
|
|
27
26
|
num_tracks: nb_tracks,
|
|
28
27
|
lyrics_content: explicit_lyrics ? "explicit" : "clean"
|
package/functions/hardware.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
// modules
|
|
2
2
|
import { createWriteStream } from "node:fs";
|
|
3
|
-
import {
|
|
4
|
-
cpu,
|
|
5
|
-
mem,
|
|
6
|
-
osInfo,
|
|
7
|
-
diskLayout,
|
|
8
|
-
graphics,
|
|
9
|
-
bios
|
|
10
|
-
} from "systeminformation";
|
|
3
|
+
import { cpu, mem, osInfo, diskLayout, graphics, bios } from "systeminformation";
|
|
11
4
|
import colors from "colors";
|
|
12
5
|
|
|
13
6
|
const csvHeader = (obj) => `${Object.keys(obj).join(";")}\n`;
|
|
14
7
|
const csvData = (obj, spaces) => `${Object.values(obj).join(";")}${spaces}`;
|
|
15
8
|
|
|
16
9
|
/**
|
|
17
|
-
*
|
|
18
10
|
* @param {number} size
|
|
19
11
|
* @param {number} [base = 1073741824]
|
|
20
12
|
* @returns {string}
|
|
@@ -22,7 +14,6 @@ const csvData = (obj, spaces) => `${Object.values(obj).join(";")}${spaces}`;
|
|
|
22
14
|
const gigabyteConvert = (size, base = 1073741824) => (size / base).toFixed(2);
|
|
23
15
|
|
|
24
16
|
/**
|
|
25
|
-
*
|
|
26
17
|
* @async
|
|
27
18
|
* @returns {Promise<void>}
|
|
28
19
|
*/
|
package/functions/moviesInfo.js
CHANGED
|
@@ -25,16 +25,12 @@ export default async function movieDB(query, token) {
|
|
|
25
25
|
|
|
26
26
|
const movieData = data.results
|
|
27
27
|
.map(({
|
|
28
|
-
title,
|
|
29
|
-
|
|
30
|
-
popularity,
|
|
31
|
-
vote_average,
|
|
28
|
+
title, original_language,
|
|
29
|
+
popularity, vote_average,
|
|
32
30
|
release_date
|
|
33
31
|
}) => ({
|
|
34
|
-
title,
|
|
35
|
-
|
|
36
|
-
popularity,
|
|
37
|
-
vote_average,
|
|
32
|
+
title, original_language,
|
|
33
|
+
popularity, vote_average,
|
|
38
34
|
release_date
|
|
39
35
|
}))
|
|
40
36
|
.sort((x, y) => {
|
package/functions/pokemon.js
CHANGED
|
@@ -6,6 +6,7 @@ import CliProgress from "cli-progress";
|
|
|
6
6
|
// utils
|
|
7
7
|
import { listFormat, stackSave } from "../utils.js";
|
|
8
8
|
|
|
9
|
+
/** @type {Object<string, number>} */
|
|
9
10
|
const pokeStats = {
|
|
10
11
|
hp: 255,
|
|
11
12
|
attack: 194,
|
|
@@ -17,7 +18,7 @@ const pokeStats = {
|
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
|
-
* @param {string}
|
|
21
|
+
* @param {string} stat
|
|
21
22
|
* @returns {string}
|
|
22
23
|
*/
|
|
23
24
|
const barColor = stat => {
|
|
@@ -27,7 +28,7 @@ const barColor = stat => {
|
|
|
27
28
|
case "attack":
|
|
28
29
|
return "{bar}".yellow;
|
|
29
30
|
case "defense":
|
|
30
|
-
return "{bar}".
|
|
31
|
+
return "{bar}".white;
|
|
31
32
|
case "special-attack":
|
|
32
33
|
return "{bar}".blue;
|
|
33
34
|
case "special-defense":
|
|
@@ -61,22 +62,13 @@ export default async function pokemonInfo(pokemon) {
|
|
|
61
62
|
).json();
|
|
62
63
|
|
|
63
64
|
const {
|
|
64
|
-
id,
|
|
65
|
-
|
|
66
|
-
height,
|
|
67
|
-
base_experience,
|
|
68
|
-
weight,
|
|
69
|
-
stats,
|
|
70
|
-
types
|
|
65
|
+
id, name, height, base_experience, weight,
|
|
66
|
+
stats, types
|
|
71
67
|
} = data;
|
|
72
68
|
|
|
73
69
|
const info = {
|
|
74
|
-
id,
|
|
75
|
-
name,
|
|
76
|
-
height,
|
|
77
|
-
base_experience,
|
|
78
|
-
weight,
|
|
79
|
-
types: listFormat.format(types.map(({ type }) => type.name)),
|
|
70
|
+
id, name, height, base_experience,
|
|
71
|
+
weight, types: listFormat.format(types.map(({ type }) => type.name)),
|
|
80
72
|
};
|
|
81
73
|
|
|
82
74
|
const PokeInfo = boxen(info.types, {title: `${id} - ${name}`});
|
package/functions/poker.js
CHANGED
|
@@ -6,7 +6,7 @@ import { stackSave } from "../utils.js";
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @typedef {"go-fish"|"gin-rummy"|"blackjack"|"slapjack"|"basics-of-poker"|"texas-holdem-poker"} Options
|
|
9
|
-
* @
|
|
9
|
+
* @param {Options} game
|
|
10
10
|
* @returns {Promise<void>}
|
|
11
11
|
*/
|
|
12
12
|
export default async function pokerGame(game) {
|
package/functions/quotes.js
CHANGED
|
@@ -2,32 +2,18 @@ import axios from "axios";
|
|
|
2
2
|
import colors from "colors";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @description get random quote from anime characters.
|
|
6
5
|
* @async
|
|
7
|
-
* @param {string} anime
|
|
8
6
|
* @returns {Promise<void>}
|
|
9
7
|
*/
|
|
10
|
-
async function
|
|
8
|
+
async function getSwiftQuotes() {
|
|
11
9
|
try {
|
|
12
|
-
|
|
13
|
-
const { data } = await axios.get("https://api.animechan.io/v1/quotes/random", {
|
|
14
|
-
params: { anime }
|
|
15
|
-
});
|
|
10
|
+
const { data } = await axios.get("https://taylorswiftapi.onrender.com/get");
|
|
16
11
|
|
|
17
|
-
|
|
18
|
-
content,
|
|
19
|
-
anime: { altName: animeAltName, name: animeName },
|
|
20
|
-
character: { name: characterName }
|
|
21
|
-
} = data.data;
|
|
12
|
+
console.info(`"${data.quote}" \n album: ${data.album} song: ${data.song}`);
|
|
22
13
|
|
|
23
|
-
console.info({
|
|
24
|
-
content, animeAltName, animeName, characterName
|
|
25
|
-
});
|
|
26
14
|
} catch (err) {
|
|
27
|
-
console.error(colors.red(
|
|
15
|
+
console.error(colors.red(err.message));
|
|
28
16
|
}
|
|
29
17
|
}
|
|
30
18
|
|
|
31
|
-
export {
|
|
32
|
-
getAnimeQuote
|
|
33
|
-
};
|
|
19
|
+
export { getSwiftQuotes };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import TCGdex from "@tcgdex/sdk";
|
|
2
|
+
import boxen from "boxen";
|
|
3
|
+
import colors from "colors";
|
|
4
|
+
import { stackSave } from "../utils.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {string} info
|
|
8
|
+
* @returns {string}
|
|
9
|
+
*/
|
|
10
|
+
const boxInfo = (info) => boxen(info, {
|
|
11
|
+
title: "🎴 CARD INFORMATION",
|
|
12
|
+
titleAlignment: "center",
|
|
13
|
+
padding: 1
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @async
|
|
18
|
+
* @param {string} set
|
|
19
|
+
* @param {number} id
|
|
20
|
+
* @returns {Promise<void>}
|
|
21
|
+
*/
|
|
22
|
+
export default async function getTcgpCard(set, id) {
|
|
23
|
+
const tcgdex = new TCGdex("en");
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const card = await tcgdex.fetchCard(id, set);
|
|
27
|
+
|
|
28
|
+
const cardInfo = `
|
|
29
|
+
Name: ${card.name}
|
|
30
|
+
ID: ${card.id}
|
|
31
|
+
Type: ${card.category}
|
|
32
|
+
|
|
33
|
+
${card.hp && `HP: ${card.hp}` || ""}
|
|
34
|
+
${card.types?.length && `Types: ${card.types.join(", ")}` || ""}
|
|
35
|
+
Rarity: ${card.rarity}
|
|
36
|
+
${card.stage && `Stage: ${card.stage}` || ""}
|
|
37
|
+
${card.evolveFrom && `Evolves from: ${card.evolveFrom}\n` || ""}
|
|
38
|
+
|
|
39
|
+
${card.abilities?.length && `⚡ Abilities:
|
|
40
|
+
${card.abilities.map((ability, i) => `
|
|
41
|
+
${i + 1}. ${ability.name || "Unnamed Ability"}
|
|
42
|
+
${ability.effect && " Effect: "+ability.effect}
|
|
43
|
+
`.trim()).join("")}
|
|
44
|
+
\n`.trim()
|
|
45
|
+
|| ""}
|
|
46
|
+
|
|
47
|
+
${card.attacks?.length && `⚔️ Moveset/Attacks:
|
|
48
|
+
${card.attacks.map((attack, i) => `
|
|
49
|
+
${i + 1}. ${attack.name}
|
|
50
|
+
Energy Cost: ${attack.cost?.length ? attack.cost.join(", ") : "free" }
|
|
51
|
+
Damage: ${attack.damage ? attack.damage : "special"}
|
|
52
|
+
Effect: ${attack.effect ? attack.effect: "no effect"}
|
|
53
|
+
\n`).join("")}
|
|
54
|
+
` || ""}
|
|
55
|
+
|
|
56
|
+
${card.effect && `✨ Card Effect: ${card.effect} ` || ""}
|
|
57
|
+
|
|
58
|
+
${card.weaknesses?.length && `🔻 Weaknesses:
|
|
59
|
+
${card.weaknesses.map(({type, value}) => `${type}: ${value}`).join("")}\n` || ""}
|
|
60
|
+
|
|
61
|
+
${card.retreat !== undefined && `🏃 Retreat Cost: ${card.retreat}\n` || ""} \n`
|
|
62
|
+
.replace(/(^[ \t]*\n)/gm, "");
|
|
63
|
+
|
|
64
|
+
console.info(boxInfo(cardInfo));
|
|
65
|
+
stackSave(`${card.name}.txt`, cardInfo);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
console.error(colors.red(err.message));
|
|
68
|
+
}
|
|
69
|
+
}
|
package/hash/infoTools.js
CHANGED
|
@@ -1,42 +1,53 @@
|
|
|
1
1
|
// inquirer
|
|
2
|
-
import { input, password } from "@inquirer/prompts";
|
|
2
|
+
import { input, password, number, select } from "@inquirer/prompts";
|
|
3
3
|
|
|
4
4
|
// functions
|
|
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
|
+
import { returnMainOpts, TCGP_EXPANSIONS } from "../utils.js";
|
|
10
|
+
import getTcgpCard from "../functions/tcgp.js";
|
|
9
11
|
|
|
10
12
|
// bitly regexp
|
|
11
13
|
const bitlyRegexp = /bit\.ly\//g;
|
|
12
14
|
|
|
13
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* select types
|
|
17
|
+
* @typedef {({
|
|
18
|
+
* [x: string]: (
|
|
19
|
+
* refreshCallback: () => Promise<void>,
|
|
20
|
+
* ) => Promise<void> | void
|
|
21
|
+
* })} Select
|
|
22
|
+
* /
|
|
23
|
+
|
|
24
|
+
/** @type {Select}*/
|
|
14
25
|
const infoTools = {
|
|
15
26
|
async github_info(refreshCallback) {
|
|
16
27
|
console.clear();
|
|
17
|
-
|
|
28
|
+
|
|
18
29
|
const gitUser = await input({
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
message: "enter a github user for search",
|
|
31
|
+
required: true
|
|
21
32
|
});
|
|
22
|
-
|
|
33
|
+
|
|
23
34
|
githubInfo(gitUser);
|
|
24
35
|
setTimeout(refreshCallback, 2e3);
|
|
25
36
|
},
|
|
26
37
|
async bitly_info(refreshCallback) {
|
|
27
38
|
console.clear();
|
|
28
|
-
|
|
39
|
+
|
|
29
40
|
const { bitlyLink, token } = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
bitlyLink: await input({
|
|
42
|
+
message: "enter a short link:",
|
|
43
|
+
validate: input => bitlyRegexp.test(input) || "only bitly link".yellow
|
|
44
|
+
}),
|
|
45
|
+
token: await password({
|
|
46
|
+
message: "enter a bitly token",
|
|
47
|
+
mask: true
|
|
48
|
+
})
|
|
38
49
|
};
|
|
39
|
-
|
|
50
|
+
|
|
40
51
|
bitlyInfo(bitlyLink, token);
|
|
41
52
|
setTimeout(refreshCallback, 2e3);
|
|
42
53
|
},
|
|
@@ -47,15 +58,35 @@ const infoTools = {
|
|
|
47
58
|
},
|
|
48
59
|
async bundlephobia_info(refreshCallback) {
|
|
49
60
|
console.clear();
|
|
50
|
-
|
|
61
|
+
|
|
51
62
|
const pkgName = await input({
|
|
52
|
-
|
|
63
|
+
message: "enter a npm package name for search info size"
|
|
53
64
|
});
|
|
54
|
-
|
|
65
|
+
|
|
55
66
|
console.info(pkgName);
|
|
56
67
|
bundlephobia(pkgName);
|
|
57
68
|
setTimeout(refreshCallback, 5e3);
|
|
58
69
|
},
|
|
70
|
+
async tcgpCard(refreshCallback) {
|
|
71
|
+
console.clear();
|
|
72
|
+
|
|
73
|
+
const setName = await select({
|
|
74
|
+
message: "Select a expansion set TCGP:",
|
|
75
|
+
choices: Object.keys(TCGP_EXPANSIONS),
|
|
76
|
+
loop: true,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const cardID = await number({
|
|
80
|
+
message: `Enter a card id between 1 to ${TCGP_EXPANSIONS[setName]}:`,
|
|
81
|
+
min: 1, max: TCGP_EXPANSIONS[setName]
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
getTcgpCard(setName, cardID);
|
|
85
|
+
|
|
86
|
+
setTimeout(refreshCallback, 5e3);
|
|
87
|
+
}
|
|
59
88
|
};
|
|
60
89
|
|
|
61
|
-
|
|
90
|
+
const menuInfoOpts = [...Object.keys(infoTools), returnMainOpts];
|
|
91
|
+
|
|
92
|
+
export { infoTools, menuInfoOpts };
|
package/hash/queryTools.js
CHANGED
|
@@ -8,8 +8,19 @@ import pokemonInfo from "../functions/pokemon.js";
|
|
|
8
8
|
import twitchInfo from "../functions/twitch.js";
|
|
9
9
|
import deezer from "../functions/deezer.js";
|
|
10
10
|
import potterSearch from "../functions/potterSearch.js";
|
|
11
|
+
import { returnMainOpts } from "../utils.js";
|
|
11
12
|
|
|
12
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* select types
|
|
15
|
+
* @typedef {({
|
|
16
|
+
* [x: string]: (
|
|
17
|
+
* refreshCallback: () => Promise<void>,
|
|
18
|
+
* alternativeCallback?: () => Promise<void>
|
|
19
|
+
* ) => Promise<void> | void
|
|
20
|
+
* })} Select
|
|
21
|
+
* /
|
|
22
|
+
|
|
23
|
+
/** @type {Select}*/
|
|
13
24
|
const queryTools = {
|
|
14
25
|
async anime_Search(refreshCallback) {
|
|
15
26
|
console.clear();
|
|
@@ -110,4 +121,6 @@ const queryTools = {
|
|
|
110
121
|
}
|
|
111
122
|
};
|
|
112
123
|
|
|
113
|
-
|
|
124
|
+
const menuQueryOpts = [...Object.keys(queryTools), returnMainOpts];
|
|
125
|
+
|
|
126
|
+
export {queryTools, menuQueryOpts};
|
package/hash/quotesSelect.js
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
import { input } from "@inquirer/prompts";
|
|
2
|
-
import {
|
|
1
|
+
// import { input } from "@inquirer/prompts";
|
|
2
|
+
import { getSwiftQuotes } from "../functions/quotes.js";
|
|
3
|
+
import { returnMainOpts } from "../utils.js";
|
|
4
|
+
/**
|
|
5
|
+
* select types
|
|
6
|
+
* @typedef {({
|
|
7
|
+
* [x: string]: (
|
|
8
|
+
* refreshCallback: () => Promise<void>,
|
|
9
|
+
* alternativeCallback?: () => Promise<void>
|
|
10
|
+
* ) => Promise<void> | void
|
|
11
|
+
* })} Select
|
|
12
|
+
* /
|
|
3
13
|
|
|
4
|
-
/** @type {
|
|
14
|
+
/** @type {Select}*/
|
|
5
15
|
const quoteSelect = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
getAnimeQuote(quote);
|
|
16
|
+
|
|
17
|
+
swiftQuotes: (refreshCallback) => {
|
|
18
|
+
getSwiftQuotes();
|
|
12
19
|
setTimeout(refreshCallback, 5000);
|
|
13
|
-
}
|
|
20
|
+
}
|
|
14
21
|
};
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
const menuQuoteOpts = [...Object.keys(quoteSelect), returnMainOpts];
|
|
24
|
+
|
|
25
|
+
export {quoteSelect, menuQuoteOpts };
|
package/hash/utilityTools.js
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
// menu
|
|
2
2
|
import { stackMenu } from "../menu.js";
|
|
3
|
-
import { pokerGameOpts } from "../utils.js";
|
|
3
|
+
import { pokerGameOpts, returnMainOpts } from "../utils.js";
|
|
4
4
|
|
|
5
5
|
// functions
|
|
6
6
|
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
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* select types
|
|
12
|
+
* @typedef {({
|
|
13
|
+
* [x: string]: (
|
|
14
|
+
* refreshCallback: () => Promise<void>,
|
|
15
|
+
* alternativeCallback?: () => Promise<void>
|
|
16
|
+
* ) => Promise<void> | void
|
|
17
|
+
* })} Select
|
|
18
|
+
* /
|
|
19
|
+
|
|
20
|
+
/** @type {Select}*/
|
|
11
21
|
const utilityTools = {
|
|
12
22
|
password(refreshCallback) {
|
|
13
23
|
console.clear();
|
|
@@ -20,14 +30,16 @@ const utilityTools = {
|
|
|
20
30
|
setTimeout(refreshCallback, 12e3);
|
|
21
31
|
},
|
|
22
32
|
async poker_game(refreshCallback) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
const pokeOpt = await stackMenu({
|
|
34
|
+
message: "select a poker game for view instructions:",
|
|
35
|
+
choices: pokerGameOpts
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
pokerGame(pokeOpt);
|
|
39
|
+
setTimeout(refreshCallback, 5e3);
|
|
30
40
|
}
|
|
31
41
|
};
|
|
32
42
|
|
|
33
|
-
|
|
43
|
+
const menuUtilityOpts = [...Object.keys(utilityTools), returnMainOpts];
|
|
44
|
+
|
|
45
|
+
export { utilityTools, menuUtilityOpts };
|
package/hash/wallpaperSelect.js
CHANGED
|
@@ -2,11 +2,22 @@
|
|
|
2
2
|
import { select } from "@inquirer/prompts";
|
|
3
3
|
|
|
4
4
|
import { wallpaperDownload } from "../functions/download.js";
|
|
5
|
+
import { returnMainOpts } from "../utils.js";
|
|
5
6
|
|
|
6
7
|
const message = "select a wallpaper for download:";
|
|
7
8
|
const backMenu = "back to menu";
|
|
8
9
|
|
|
9
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* select types
|
|
12
|
+
* @typedef {({
|
|
13
|
+
* [x: string]: (
|
|
14
|
+
* refreshCallback: () => Promise<void>,
|
|
15
|
+
* alternativeCallback?: () => Promise<void>
|
|
16
|
+
* ) => Promise<void> | void
|
|
17
|
+
* })} Select
|
|
18
|
+
* /
|
|
19
|
+
|
|
20
|
+
/** @type {Select}*/
|
|
10
21
|
const wallpaperSelect = {
|
|
11
22
|
solMoon: async (refreshCallback, alternativeCallback) => {
|
|
12
23
|
const solMoonWallpapers = [...Array(20).keys()]
|
|
@@ -87,4 +98,6 @@ const wallpaperSelect = {
|
|
|
87
98
|
},
|
|
88
99
|
};
|
|
89
100
|
|
|
90
|
-
|
|
101
|
+
const menuWallpaperOpts = [...Object.keys(wallpaperSelect), returnMainOpts];
|
|
102
|
+
|
|
103
|
+
export {wallpaperSelect, menuWallpaperOpts};
|
package/hash/webTools.js
CHANGED
|
@@ -12,12 +12,22 @@ import scrape from "../functions/scraping.js";
|
|
|
12
12
|
import cssValidate from "../functions/cssValidator.js";
|
|
13
13
|
|
|
14
14
|
import { stackMenu } from "../menu.js";
|
|
15
|
-
import { scrapingOpts } from "../utils.js";
|
|
15
|
+
import { returnMainOpts, scrapingOpts } from "../utils.js";
|
|
16
16
|
|
|
17
17
|
// regex
|
|
18
18
|
const webRegex = /https?:\/\//g;
|
|
19
19
|
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* select types
|
|
22
|
+
* @typedef {({
|
|
23
|
+
* [x: string]: (
|
|
24
|
+
* refreshCallback: () => Promise<void>,
|
|
25
|
+
* alternativeCallback?: () => Promise<void>
|
|
26
|
+
* ) => Promise<void> | void
|
|
27
|
+
* })} Select
|
|
28
|
+
* /
|
|
29
|
+
|
|
30
|
+
/** @type {Select}*/
|
|
21
31
|
const webTools = {
|
|
22
32
|
async single(refreshCallback) {
|
|
23
33
|
console.clear();
|
|
@@ -90,4 +100,6 @@ const webTools = {
|
|
|
90
100
|
}
|
|
91
101
|
};
|
|
92
102
|
|
|
93
|
-
|
|
103
|
+
const menuWebOpts = [...Object.keys(webTools), returnMainOpts];
|
|
104
|
+
|
|
105
|
+
export {webTools, menuWebOpts};
|
package/menu.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { select } from "@inquirer/prompts";
|
|
2
|
+
import { forceExit } from "./utils.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @typedef {Object} Menu
|
|
5
6
|
* @property {string} message
|
|
6
7
|
* @property {string[]} choices
|
|
7
8
|
* @property {number} [pageSize]
|
|
8
|
-
*
|
|
9
|
+
*
|
|
10
|
+
* @param {Menu} menu
|
|
11
|
+
* @async
|
|
9
12
|
* @returns {Promise<any>}
|
|
10
13
|
*/
|
|
11
14
|
export const stackMenu = async ({message, choices, pageSize}) => await select({
|
|
12
15
|
message, choices, pageSize
|
|
13
|
-
});
|
|
16
|
+
}).catch(forceExit);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stack-analyze",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.9",
|
|
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,26 +8,27 @@
|
|
|
8
8
|
"stack-analyze": "cli.js"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@inquirer/prompts": "^7.
|
|
12
|
-
"
|
|
11
|
+
"@inquirer/prompts": "^7.9.0",
|
|
12
|
+
"@tcgdex/sdk": "^2.7.1",
|
|
13
|
+
"axios": "^1.13.1",
|
|
13
14
|
"boxen": "^8.0.1",
|
|
14
|
-
"cheerio": "^1.1.
|
|
15
|
+
"cheerio": "^1.1.2",
|
|
15
16
|
"cli-progress": "^3.12.0",
|
|
16
17
|
"colors": "^1.4.0",
|
|
17
|
-
"console-table-printer": "^2.
|
|
18
|
-
"figlet": "^1.
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"systeminformation": "^5.27.
|
|
18
|
+
"console-table-printer": "^2.15.0",
|
|
19
|
+
"figlet": "^1.9.3",
|
|
20
|
+
"inquirer": "^12.10.0",
|
|
21
|
+
"ora": "^9.0.0",
|
|
22
|
+
"systeminformation": "^5.27.11",
|
|
22
23
|
"timeago.js": "^4.0.2",
|
|
23
24
|
"w3c-css-validator": "^1.4.0",
|
|
24
25
|
"wapalyzer": "^6.10.65"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"@eslint/js": "^9.
|
|
28
|
-
"eslint": "^9.
|
|
29
|
-
"globals": "^16.
|
|
30
|
-
"jsdoc": "^4.0.
|
|
28
|
+
"@eslint/js": "^9.39.1",
|
|
29
|
+
"eslint": "^9.39.1",
|
|
30
|
+
"globals": "^16.5.0",
|
|
31
|
+
"jsdoc": "^4.0.5"
|
|
31
32
|
},
|
|
32
33
|
"scripts": {
|
|
33
34
|
"start": "node cli.js",
|
package/utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { writeFile } from "node:fs/promises";
|
|
2
|
+
import colors from "colors";
|
|
2
3
|
|
|
3
4
|
const listFormat = new Intl.ListFormat("en", {
|
|
4
5
|
style: "short",
|
|
@@ -9,48 +10,9 @@ const currency = new Intl.NumberFormat("en-us", {
|
|
|
9
10
|
style: "currency", currency: "USD"
|
|
10
11
|
});
|
|
11
12
|
|
|
13
|
+
/** @type {string} */
|
|
12
14
|
const returnMainOpts = "return main menu";
|
|
13
15
|
|
|
14
|
-
const menuOpts = [
|
|
15
|
-
"web", "info", "query", "utility", "wallpapers", "quotes",
|
|
16
|
-
"about", "exit"
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
const menuWebOpts = [
|
|
20
|
-
"single", "multiple", "pagespeed", "scraping", "css_validate",
|
|
21
|
-
returnMainOpts
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
const menuInfoOpts = [
|
|
25
|
-
"github_info", "crypto_market", "bitly_info", "bundlephobia_info", returnMainOpts
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
const menuQueryOpts = [
|
|
29
|
-
"anime_Search", "movie_info", "pokemon_info",
|
|
30
|
-
"twitch_info", "deezer", "potter_search", returnMainOpts
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
const menuUtilityOpts = [
|
|
34
|
-
"hardware", "password", "poker_game", returnMainOpts
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
const menuWallpaperOpts = [
|
|
38
|
-
"solMoon", "dimensions", "seyyahi2", "ancientMistery",
|
|
39
|
-
"tsukyNoEmily", returnMainOpts
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
const menuQuoteOpts = ["animeQuote", returnMainOpts];
|
|
43
|
-
|
|
44
|
-
const menuHardwareOpts = [
|
|
45
|
-
"cpuInfo", "ramMemInfo", "osDetail", "diskInfo",
|
|
46
|
-
"controllerInfo", "displayInfo", "biosInfo", returnMainOpts
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
const menuAboutOpts = [
|
|
50
|
-
"mainInfo", "lineup", "youtubeRecomendation",
|
|
51
|
-
"twitchRecomendation", "projectsRecomendation", returnMainOpts
|
|
52
|
-
];
|
|
53
|
-
|
|
54
16
|
const scrapingOpts = [
|
|
55
17
|
"title", "images", "metadata", "headings",
|
|
56
18
|
"tableHead", "tableData", "links", "cites"
|
|
@@ -62,7 +24,25 @@ const pokerGameOpts = [
|
|
|
62
24
|
];
|
|
63
25
|
|
|
64
26
|
/**
|
|
65
|
-
*
|
|
27
|
+
* @readonly
|
|
28
|
+
* @type {Object<string,number>}
|
|
29
|
+
*/
|
|
30
|
+
const TCGP_EXPANSIONS = {
|
|
31
|
+
"p-a": 100,
|
|
32
|
+
a1: 286,
|
|
33
|
+
a1a: 86,
|
|
34
|
+
a2: 207,
|
|
35
|
+
a2a: 96,
|
|
36
|
+
a2b: 111,
|
|
37
|
+
a3: 239,
|
|
38
|
+
a3a: 103,
|
|
39
|
+
a3b: 107,
|
|
40
|
+
a4: 241,
|
|
41
|
+
a4a: 105,
|
|
42
|
+
b1: 331,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
66
46
|
* @param {string} filename
|
|
67
47
|
* @param {any} data
|
|
68
48
|
* @returns {Promise<void>}
|
|
@@ -72,8 +52,8 @@ const stackSave = async (filename, data) => {
|
|
|
72
52
|
console.error("stackSave no using falsy values");
|
|
73
53
|
return;
|
|
74
54
|
}
|
|
75
|
-
|
|
76
|
-
if(typeof data === "boolean") {
|
|
55
|
+
|
|
56
|
+
if (typeof data === "boolean") {
|
|
77
57
|
console.info("stackSave no using boolean types");
|
|
78
58
|
return;
|
|
79
59
|
}
|
|
@@ -81,16 +61,25 @@ const stackSave = async (filename, data) => {
|
|
|
81
61
|
try {
|
|
82
62
|
await writeFile(filename, data);
|
|
83
63
|
} catch (err) {
|
|
84
|
-
console.info(err.message);
|
|
64
|
+
console.info(colors.red(err.message));
|
|
85
65
|
}
|
|
86
66
|
};
|
|
87
67
|
|
|
88
|
-
const
|
|
68
|
+
const exitMsg = "thanks for use stack-analyze".green;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {Error} err
|
|
72
|
+
* @returns {void}
|
|
73
|
+
*/
|
|
74
|
+
const forceExit = (err) => {
|
|
75
|
+
if (err.name === "ExitPromptError") {
|
|
76
|
+
console.info("👋 until next time!".green);
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
89
80
|
|
|
90
81
|
export {
|
|
91
|
-
listFormat, currency,
|
|
92
|
-
|
|
93
|
-
menuWallpaperOpts, menuAboutOpts, scrapingOpts, menuQuoteOpts,
|
|
94
|
-
stackSave, pokerGameOpts, exitCli
|
|
82
|
+
listFormat, currency, scrapingOpts, forceExit,
|
|
83
|
+
stackSave, pokerGameOpts, exitMsg, returnMainOpts, TCGP_EXPANSIONS
|
|
95
84
|
};
|
|
96
85
|
|
package/types.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
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
|
-
*/
|