stack-analyze 1.1.6 → 1.1.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 +37 -3
- package/about.js +110 -0
- package/cli.js +318 -114
- package/demo.js +20 -0
- package/functions/animeInfo.js +9 -42
- package/functions/bitly.js +5 -7
- package/functions/cryptoList.js +23 -49
- package/functions/gitUser.js +6 -9
- package/functions/hardware.js +191 -231
- package/functions/moviesInfo.js +8 -41
- package/functions/multipleStack.js +19 -34
- package/functions/pageSpeed.js +13 -13
- package/functions/scraping.js +153 -0
- package/functions/singleStack.js +19 -37
- package/functions/twitch.js +44 -0
- package/{index.js → index.cjs} +202 -60
- package/index.mjs +496 -0
- package/package.json +24 -17
- package/readme.md +13 -5
- package/utils.js +15 -0
- package/about/index.js +0 -56
- package/hash/aboutOpts.js +0 -55
- package/hash/hardwareTools.js +0 -47
- package/hash/infoTools.js +0 -90
- package/hash/mainTools.js +0 -67
- package/models/aboutTables.js +0 -40
package/CHANGELOG.md
CHANGED
|
@@ -2,12 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
stack-analyze all version and notable changes, fixed, remove and new additions in code.
|
|
4
4
|
|
|
5
|
+
## version 1.1.9
|
|
6
|
+
### Added
|
|
7
|
+
- new module cheerio
|
|
8
|
+
- new tool webscraping
|
|
9
|
+
- new test
|
|
10
|
+
### fixed
|
|
11
|
+
- rewirte axios import
|
|
12
|
+
### change
|
|
13
|
+
- hardware information change from functions to hash table
|
|
14
|
+
- about now is hash table
|
|
15
|
+
- now using the function printTable avoid overwritting.
|
|
16
|
+
- remove jsdocs the modules files
|
|
17
|
+
### remove
|
|
18
|
+
- remove models console-table-printer
|
|
19
|
+
- remove hash tables
|
|
20
|
+
|
|
21
|
+
## version 1.1.8
|
|
22
|
+
### fixed
|
|
23
|
+
- restructure all tools as a hash table with promises except the tool hardware information and about section
|
|
24
|
+
- update all modules
|
|
25
|
+
### change
|
|
26
|
+
- remove the module coingecko-api
|
|
27
|
+
- remove process.env variables to writting manual token for security
|
|
28
|
+
|
|
29
|
+
## version 1.1.7
|
|
30
|
+
### Added
|
|
31
|
+
- twitch info tool
|
|
32
|
+
- remove one js module for module to cjs and esm
|
|
33
|
+
### fixed
|
|
34
|
+
- change write token to process.env varaibles own (not avalible values in github and gitlab)
|
|
35
|
+
- migrate cjs to esm
|
|
36
|
+
- rewrite module
|
|
37
|
+
### change
|
|
38
|
+
- except some hardware tools and github using models from console-table-printer
|
|
39
|
+
- now using esm now about is js file not folder about with index.js
|
|
40
|
+
- rewrite all tests functions
|
|
41
|
+
|
|
5
42
|
## version 1.1.6
|
|
6
43
|
### Added
|
|
7
44
|
- module stack-analyze mode
|
|
8
45
|
### fixed
|
|
9
46
|
- rewrite code
|
|
10
|
-
- renove nonolive recommends
|
|
11
47
|
### changed
|
|
12
48
|
- menu renove
|
|
13
49
|
- renove jsdocs in some function or variables
|
|
@@ -33,8 +69,6 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
|
|
|
33
69
|
### fixed
|
|
34
70
|
- rewrite some functions
|
|
35
71
|
- update npm modules via manual
|
|
36
|
-
### changed
|
|
37
|
-
- no changed
|
|
38
72
|
|
|
39
73
|
## version 1.1.3
|
|
40
74
|
### Added
|
package/about.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// print table
|
|
2
|
+
import { printTable } from "console-table-printer";
|
|
3
|
+
|
|
4
|
+
import { listFormat } from "./utils.js";
|
|
5
|
+
|
|
6
|
+
// package.json
|
|
7
|
+
import { createRequire } from "module";
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
const { license, version } = require("./package.json");
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* types for about tools
|
|
13
|
+
*
|
|
14
|
+
* @typedef {Object.<string, function(): void>} aboutTable
|
|
15
|
+
*
|
|
16
|
+
* @typedef {Object} info
|
|
17
|
+
* @property {string} info.mainDeveloper
|
|
18
|
+
* @property {string} info.version
|
|
19
|
+
* @property {string} info.license
|
|
20
|
+
*
|
|
21
|
+
* @typedef {Object} developerList
|
|
22
|
+
* @property {string} developerList.name
|
|
23
|
+
* @property {string} developerList.roles
|
|
24
|
+
*
|
|
25
|
+
* @typedef {Object} youtube
|
|
26
|
+
* @property {string} youtubeChannel
|
|
27
|
+
* @property {string} recomendation
|
|
28
|
+
*
|
|
29
|
+
* @typedef {Object} twitch
|
|
30
|
+
* @property {string} twitch.user
|
|
31
|
+
* @property {string} [twitch.details]
|
|
32
|
+
*
|
|
33
|
+
* @typedef {Object} project
|
|
34
|
+
* @property {string} project.name
|
|
35
|
+
* @property {string} project.desc
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/** @type {aboutTable} */
|
|
39
|
+
const aboutTool = {
|
|
40
|
+
mainInfo() {
|
|
41
|
+
/** @type {info} */
|
|
42
|
+
const aboutApp = {
|
|
43
|
+
mainDeveloper: "omega5300",
|
|
44
|
+
license,
|
|
45
|
+
version
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
console.clear();
|
|
49
|
+
console.table(aboutApp);
|
|
50
|
+
},
|
|
51
|
+
lineup() {
|
|
52
|
+
/** @type {developerList[]} */
|
|
53
|
+
const developers = [
|
|
54
|
+
{
|
|
55
|
+
name: "omega5300",
|
|
56
|
+
roles: listFormat.format(["main developer", "lead project", "founder"])
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
console.clear();
|
|
61
|
+
printTable(developers);
|
|
62
|
+
},
|
|
63
|
+
youtubeRecomendation() {
|
|
64
|
+
/** @type {youtube[]} */
|
|
65
|
+
const youtubeDev = [
|
|
66
|
+
{ youtubeChannel: "fazt", recomendation: "recommend" },
|
|
67
|
+
{ youtubeChannel: "doriandesings", recomendation: "recommend" },
|
|
68
|
+
{ youtubeChannel: "bluuweb", recomendation: "recommend" },
|
|
69
|
+
{ youtubeChannel: "leonidas esteban", recomendation: "neutral recommend" },
|
|
70
|
+
{ youtubeChannel: "fernando herrera", recomendation: "recommend" },
|
|
71
|
+
{ youtubeChannel: "soy dalto", recomendation: "neutral recommend" },
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
console.clear();
|
|
75
|
+
printTable(youtubeDev);
|
|
76
|
+
},
|
|
77
|
+
twitchRecomendation() {
|
|
78
|
+
/** @type {twitch[]} */
|
|
79
|
+
const twitchUsers = [
|
|
80
|
+
{
|
|
81
|
+
user: "dannyaegyo",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
user: "Lunanny",
|
|
85
|
+
details: "audiovisual student even though if has ADHD has a great variety regardless of whether or not he has ADHD."
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
console.clear();
|
|
90
|
+
printTable(twitchUsers);
|
|
91
|
+
},
|
|
92
|
+
projectsRecomendation() {
|
|
93
|
+
/** @type {project[]} */
|
|
94
|
+
const projects = [
|
|
95
|
+
{
|
|
96
|
+
name: "Doofy's Projects",
|
|
97
|
+
desc: "tools and systems customs"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "black metal promotion",
|
|
101
|
+
desc: "upload new albums and sometimes tracks from upcoming albums with the permission of bands and/or labels"
|
|
102
|
+
}
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
console.clear();
|
|
106
|
+
printTable(projects);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export default aboutTool;
|
package/cli.js
CHANGED
|
@@ -1,16 +1,130 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// modules
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { performance } from "perf_hooks";
|
|
5
|
+
import inquirer from "inquirer";
|
|
6
|
+
import figlet from "figlet";
|
|
7
|
+
import colors from "colors";
|
|
8
8
|
|
|
9
9
|
// hash tables
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
import hardwareTools from "./functions/hardware.js";
|
|
11
|
+
import aboutTool from "./about.js";
|
|
12
|
+
|
|
13
|
+
import singleStack from "./functions/singleStack.js";
|
|
14
|
+
import multipleStack from "./functions/multipleStack.js";
|
|
15
|
+
import pageSpeed from "./functions/pageSpeed.js";
|
|
16
|
+
import githubInfo from "./functions/gitUser.js";
|
|
17
|
+
import animeSearch from "./functions/animeInfo.js";
|
|
18
|
+
import cryptoMarket from "./functions/cryptoList.js";
|
|
19
|
+
import bitlyInfo from "./functions/bitly.js";
|
|
20
|
+
import movieDB from "./functions/moviesInfo.js";
|
|
21
|
+
import twitchInfo from "./functions/twitch.js";
|
|
22
|
+
import scrape from "./functions/scraping.js";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @description web scraping menu
|
|
26
|
+
* @return { Promise<void>} web scraping options
|
|
27
|
+
*/
|
|
28
|
+
async function scrapingOpts (url) {
|
|
29
|
+
console.info("web:", url);
|
|
30
|
+
|
|
31
|
+
const { option } = await inquirer.prompt({
|
|
32
|
+
type: "list",
|
|
33
|
+
name: "option",
|
|
34
|
+
message: "select a options for scraping",
|
|
35
|
+
pageSize: 15,
|
|
36
|
+
choices: [
|
|
37
|
+
"pageTitle",
|
|
38
|
+
"pageImages",
|
|
39
|
+
"pageMetadata",
|
|
40
|
+
"pageHeadings",
|
|
41
|
+
"pageTableHead",
|
|
42
|
+
"pageTableData",
|
|
43
|
+
"pageLinks",
|
|
44
|
+
"pageCites",
|
|
45
|
+
"exit to main menu"
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const {
|
|
50
|
+
cites,
|
|
51
|
+
headings,
|
|
52
|
+
images,
|
|
53
|
+
links,
|
|
54
|
+
title,
|
|
55
|
+
metadata,
|
|
56
|
+
table_data,
|
|
57
|
+
table_heading
|
|
58
|
+
} = scrape(url);
|
|
59
|
+
|
|
60
|
+
/** @type {Object.<string, function(): void>} */
|
|
61
|
+
const scrapeOpt = {
|
|
62
|
+
pageTitle() {
|
|
63
|
+
title();
|
|
64
|
+
const timeScrape = performance.now();
|
|
65
|
+
setTimeout(question, timeScrape);
|
|
66
|
+
},
|
|
67
|
+
pageImages() {
|
|
68
|
+
images();
|
|
69
|
+
const timeScrape = performance.now();
|
|
70
|
+
setTimeout(question, timeScrape);
|
|
71
|
+
},
|
|
72
|
+
pageMetadata() {
|
|
73
|
+
metadata();
|
|
74
|
+
const timeScrape = performance.now();
|
|
75
|
+
setTimeout(question, timeScrape);
|
|
76
|
+
},
|
|
77
|
+
pageHeadings() {
|
|
78
|
+
headings();
|
|
79
|
+
const timeScrape = performance.now();
|
|
80
|
+
setTimeout(question, timeScrape);
|
|
81
|
+
},
|
|
82
|
+
pageTableHead() {
|
|
83
|
+
table_heading();
|
|
84
|
+
const timeScrape = performance.now();
|
|
85
|
+
setTimeout(question, timeScrape);
|
|
86
|
+
},
|
|
87
|
+
pageTableData() {
|
|
88
|
+
table_data();
|
|
89
|
+
const timeScrape = performance.now();
|
|
90
|
+
setTimeout(question, timeScrape);
|
|
91
|
+
},
|
|
92
|
+
pageLinks() {
|
|
93
|
+
links();
|
|
94
|
+
const timeScrape = performance.now();
|
|
95
|
+
setTimeout(question, timeScrape);
|
|
96
|
+
},
|
|
97
|
+
pageCites() {
|
|
98
|
+
cites();
|
|
99
|
+
const timeScrape = performance.now();
|
|
100
|
+
setTimeout(question, timeScrape);
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
option === "exit to main menu"
|
|
105
|
+
? question()
|
|
106
|
+
: scrapeOpt[option]();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @description web scraping menu
|
|
111
|
+
* @return { Promise<void>} web scraping options
|
|
112
|
+
*/
|
|
113
|
+
async function scrapingLink() {
|
|
114
|
+
console.clear();
|
|
115
|
+
const { link } = await inquirer.prompt({
|
|
116
|
+
type: "input",
|
|
117
|
+
name: "link",
|
|
118
|
+
message: "enter a web scraping options?"
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
if(link.indexOf("http") === -1) {
|
|
122
|
+
console.error("https:// or http:// is required".red);
|
|
123
|
+
setTimeout(question, 5000);
|
|
124
|
+
} else {
|
|
125
|
+
scrapingOpts(link);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
14
128
|
|
|
15
129
|
/**
|
|
16
130
|
* @description about menu
|
|
@@ -23,12 +137,11 @@ async function aboutOpts() {
|
|
|
23
137
|
name: "about",
|
|
24
138
|
message: "select about option info",
|
|
25
139
|
choices: [
|
|
26
|
-
"
|
|
140
|
+
"mainInfo",
|
|
27
141
|
"lineup",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"tools_ideas",
|
|
142
|
+
"youtubeRecomendation",
|
|
143
|
+
"twitchRecomendation",
|
|
144
|
+
"projectsRecomendation",
|
|
32
145
|
"return to main menu"
|
|
33
146
|
]
|
|
34
147
|
});
|
|
@@ -38,7 +151,7 @@ async function aboutOpts() {
|
|
|
38
151
|
setTimeout(aboutOpts, 1000);
|
|
39
152
|
} else {
|
|
40
153
|
question();
|
|
41
|
-
}
|
|
154
|
+
}
|
|
42
155
|
}
|
|
43
156
|
|
|
44
157
|
/**
|
|
@@ -47,7 +160,7 @@ async function aboutOpts() {
|
|
|
47
160
|
* @return { Promise<void> } - return in boolean a result question list
|
|
48
161
|
*
|
|
49
162
|
*/
|
|
50
|
-
async function
|
|
163
|
+
async function returnQuestion() {
|
|
51
164
|
try {
|
|
52
165
|
const anw = await inquirer.prompt([
|
|
53
166
|
{
|
|
@@ -59,41 +172,179 @@ async function returnWebQuestion() {
|
|
|
59
172
|
|
|
60
173
|
if (anw.return) {
|
|
61
174
|
console.clear();
|
|
62
|
-
mainOptions();
|
|
63
|
-
} else {
|
|
64
175
|
question();
|
|
176
|
+
} else {
|
|
177
|
+
console.clear();
|
|
178
|
+
console.info("thanks for use stack-analyze".green);
|
|
65
179
|
}
|
|
66
180
|
} catch (err) {
|
|
67
|
-
console.error(red(err.message));
|
|
181
|
+
console.error(colors.red(err.message));
|
|
68
182
|
}
|
|
69
183
|
}
|
|
70
184
|
|
|
71
185
|
/**
|
|
72
|
-
*
|
|
73
|
-
* @
|
|
74
|
-
* @return { Promise<void> } - return in boolean a result question list
|
|
75
|
-
*
|
|
186
|
+
* @description This is a hash table with the options of the tools menu.
|
|
187
|
+
* @type {Object.<string, function(): void>}
|
|
76
188
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
189
|
+
const toolsOpts = {
|
|
190
|
+
single() {
|
|
191
|
+
console.clear();
|
|
192
|
+
inquirer.prompt({
|
|
193
|
+
name: "url",
|
|
194
|
+
message: "enter url for analyze the tech stack:"
|
|
195
|
+
}).then(({ url }) => {
|
|
196
|
+
if (url.indexOf("http") === 0) {
|
|
197
|
+
singleStack(url);
|
|
198
|
+
const timeEnd = performance.now();
|
|
199
|
+
setTimeout(returnQuestion, timeEnd);
|
|
200
|
+
} else {
|
|
201
|
+
console.error("please insert a URL with parameter http:// or https://".red);
|
|
84
202
|
}
|
|
85
|
-
|
|
203
|
+
});
|
|
204
|
+
},
|
|
205
|
+
multiple() {
|
|
206
|
+
console.clear();
|
|
207
|
+
inquirer.prompt({
|
|
208
|
+
name: "urls",
|
|
209
|
+
message: "enter URLs for analyze the tech stacks with whitespace without quotes example 'http://example.com https://nodejs.org': \n"
|
|
210
|
+
}).then(({ urls }) => {
|
|
86
211
|
|
|
87
|
-
|
|
212
|
+
if (
|
|
213
|
+
urls.match(/(http|https)/g) !== null ||
|
|
214
|
+
urls.match(/(http|https)/g) >= 2
|
|
215
|
+
) {
|
|
216
|
+
const websites = urls.split(" ");
|
|
217
|
+
console.clear();
|
|
218
|
+
multipleStack(websites);
|
|
219
|
+
const timeEnd = performance.now();
|
|
220
|
+
setTimeout(returnQuestion, timeEnd);
|
|
221
|
+
} else {
|
|
222
|
+
console.error("please in each URL insert a website the parameter https:// or http://".red);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
},
|
|
226
|
+
pagespeed() {
|
|
227
|
+
console.clear();
|
|
228
|
+
inquirer.prompt({
|
|
229
|
+
name: "speedWeb",
|
|
230
|
+
message: "insert URL for page speed analyze:"
|
|
231
|
+
}).then(({ speedWeb }) => {
|
|
232
|
+
if (speedWeb.indexOf("http") === 0) {
|
|
233
|
+
console.clear();
|
|
234
|
+
|
|
235
|
+
// start pagespeed results mobile
|
|
236
|
+
figlet.textSync(speedWeb, "Small");
|
|
237
|
+
pageSpeed(speedWeb);
|
|
238
|
+
const timeEnd = performance.now();
|
|
239
|
+
setTimeout(returnQuestion, timeEnd);
|
|
240
|
+
} else {
|
|
241
|
+
console.error("please insert a URL with parameter https;// or http://".red);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
github_info() {
|
|
246
|
+
console.clear();
|
|
247
|
+
inquirer.prompt({
|
|
248
|
+
name: "user",
|
|
249
|
+
message: "enter a github user"
|
|
250
|
+
}).then(({ user }) => {
|
|
251
|
+
if (user !== "") {
|
|
252
|
+
console.clear();
|
|
253
|
+
githubInfo(user);
|
|
254
|
+
setTimeout(returnQuestion, 2000);
|
|
255
|
+
} else {
|
|
256
|
+
console.error("please the github username is required".red);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
},
|
|
260
|
+
anime_search() {
|
|
261
|
+
console.clear();
|
|
262
|
+
inquirer.prompt({
|
|
263
|
+
name: "anime",
|
|
264
|
+
message: "enter a anime, movie or ova search"
|
|
265
|
+
}).then(({ anime }) => {
|
|
266
|
+
if (anime !== "") {
|
|
267
|
+
console.clear();
|
|
268
|
+
animeSearch(anime);
|
|
269
|
+
setTimeout(returnQuestion, 2000);
|
|
270
|
+
} else {
|
|
271
|
+
console.error("please the anime is required".red);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
},
|
|
275
|
+
crypto_market() {
|
|
276
|
+
console.clear();
|
|
277
|
+
cryptoMarket();
|
|
278
|
+
setTimeout(returnQuestion, 5000);
|
|
279
|
+
},
|
|
280
|
+
bitly_info() {
|
|
281
|
+
console.clear();
|
|
282
|
+
inquirer.prompt([
|
|
283
|
+
{
|
|
284
|
+
name: "link",
|
|
285
|
+
message: "enter a bitly link without http|https",
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: "token",
|
|
289
|
+
message: "enter a bitly token",
|
|
290
|
+
type: "password",
|
|
291
|
+
mask: "?"
|
|
292
|
+
}
|
|
293
|
+
])
|
|
294
|
+
.then(({ link, token }) => {
|
|
295
|
+
bitlyInfo(link, token);
|
|
296
|
+
setTimeout(returnQuestion, 3000);
|
|
297
|
+
});
|
|
298
|
+
},
|
|
299
|
+
movie_info() {
|
|
300
|
+
console.clear();
|
|
301
|
+
inquirer.prompt([
|
|
302
|
+
{
|
|
303
|
+
name: "api_key",
|
|
304
|
+
message: "insert api key",
|
|
305
|
+
type: "password",
|
|
306
|
+
mask: "?"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
name: "query",
|
|
310
|
+
message: "please search a movie search",
|
|
311
|
+
}
|
|
312
|
+
]).then(({ api_key, query }) => {
|
|
88
313
|
console.clear();
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
console.
|
|
314
|
+
movieDB(query, api_key);
|
|
315
|
+
setTimeout(returnQuestion, 3000);
|
|
316
|
+
});
|
|
317
|
+
},
|
|
318
|
+
twitch_info() {
|
|
319
|
+
console.clear();
|
|
320
|
+
inquirer.prompt([
|
|
321
|
+
{
|
|
322
|
+
name: "user",
|
|
323
|
+
message: "get twitch user"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
name: "twitch_client",
|
|
327
|
+
message: "enter a twitch token client",
|
|
328
|
+
type: "password",
|
|
329
|
+
mask: "*"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: "twitch_token",
|
|
333
|
+
message: "enter a twitch token without the key Bearer",
|
|
334
|
+
type: "password",
|
|
335
|
+
mask: "?"
|
|
336
|
+
}
|
|
337
|
+
]).then(({ user, twitch_client, twitch_token }) => {
|
|
338
|
+
if (user !== "" && twitch_client !== "" && twitch_token !== "") {
|
|
339
|
+
console.clear();
|
|
340
|
+
twitchInfo(user, twitch_client, twitch_token);
|
|
341
|
+
setTimeout(returnQuestion, 3000);
|
|
342
|
+
} else {
|
|
343
|
+
console.error("twitch info fields is required".red);
|
|
344
|
+
}
|
|
345
|
+
});
|
|
95
346
|
}
|
|
96
|
-
}
|
|
347
|
+
};
|
|
97
348
|
|
|
98
349
|
/**
|
|
99
350
|
* @description call hardware information options
|
|
@@ -106,18 +357,18 @@ async function hardwareOpts() {
|
|
|
106
357
|
pageSize: 9,
|
|
107
358
|
message: "select a hardware-information option:",
|
|
108
359
|
choices: [
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
360
|
+
"cpuInfo",
|
|
361
|
+
"ramMemInfo",
|
|
362
|
+
"osDetail",
|
|
363
|
+
"diskInfo",
|
|
364
|
+
"controllerInfo",
|
|
365
|
+
"displayInfo",
|
|
366
|
+
"biosInfo",
|
|
116
367
|
"exit to main menu"
|
|
117
368
|
]
|
|
118
369
|
});
|
|
119
370
|
|
|
120
|
-
if(hardware !== "exit to main menu") {
|
|
371
|
+
if (hardware !== "exit to main menu") {
|
|
121
372
|
hardwareTools[hardware]();
|
|
122
373
|
setTimeout(hardwareOpts, 1000);
|
|
123
374
|
} else {
|
|
@@ -127,101 +378,54 @@ async function hardwareOpts() {
|
|
|
127
378
|
|
|
128
379
|
/**
|
|
129
380
|
*
|
|
130
|
-
* @description call the function question
|
|
131
|
-
* @returns { Promise<void> } return
|
|
381
|
+
* @description call the function question raw list options
|
|
382
|
+
* @returns { Promise<void> } return exit question
|
|
132
383
|
*
|
|
133
384
|
*/
|
|
134
|
-
async function
|
|
135
|
-
|
|
385
|
+
async function question() {
|
|
386
|
+
console.clear();
|
|
387
|
+
console.info(colors.yellow(figlet.textSync("stack-analyze")));
|
|
388
|
+
const { analyze } = await inquirer.prompt({
|
|
136
389
|
type: "list",
|
|
137
|
-
pageSize:
|
|
138
|
-
name: "
|
|
139
|
-
message: "",
|
|
390
|
+
pageSize: 15,
|
|
391
|
+
name: "analyze",
|
|
392
|
+
message: "what option do you want to analyze stack",
|
|
140
393
|
choices: [
|
|
141
394
|
"single",
|
|
142
395
|
"multiple",
|
|
143
396
|
"pagespeed",
|
|
144
|
-
"return main menu"
|
|
145
|
-
]
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
if (main !== "return main menu") {
|
|
149
|
-
mainTools[main]();
|
|
150
|
-
const timeEnd = performance.now();
|
|
151
|
-
setTimeout(returnWebQuestion, timeEnd);
|
|
152
|
-
} else {
|
|
153
|
-
question();
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
*
|
|
159
|
-
* @description call the function question info tools options
|
|
160
|
-
* @returns { Promise<void> } return main tools options
|
|
161
|
-
*
|
|
162
|
-
*/
|
|
163
|
-
async function infoOpts() {
|
|
164
|
-
const { info } = await inquirer.prompt({
|
|
165
|
-
type: "list",
|
|
166
|
-
pageSize: 9,
|
|
167
|
-
name: "info",
|
|
168
|
-
message: "enter a info tools option",
|
|
169
|
-
choices: [
|
|
170
397
|
"github_info",
|
|
171
398
|
"anime_search",
|
|
172
399
|
"crypto_market",
|
|
173
400
|
"bitly_info",
|
|
174
401
|
"movie_info",
|
|
175
|
-
"
|
|
402
|
+
"twitch_info",
|
|
403
|
+
"hardware tools",
|
|
404
|
+
"scraping",
|
|
405
|
+
"about",
|
|
406
|
+
"exit"
|
|
176
407
|
]
|
|
177
408
|
});
|
|
178
409
|
|
|
179
|
-
if (info !== "return main menu") {
|
|
180
|
-
infoTools[info]();
|
|
181
|
-
const timeEnd = performance.now();
|
|
182
|
-
setTimeout(returnInfoQuestion, timeEnd);
|
|
183
|
-
} else {
|
|
184
|
-
question();
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
*
|
|
191
|
-
* @description call the function question raw list options
|
|
192
|
-
* @returns { Promise<void> } return exit question
|
|
193
|
-
*
|
|
194
|
-
*/
|
|
195
|
-
async function question() {
|
|
196
|
-
console.clear();
|
|
197
|
-
console.info(yellow(textSync("stack-analyze")));
|
|
198
|
-
const { analyze } = await inquirer.prompt({
|
|
199
|
-
type: "list",
|
|
200
|
-
name: "analyze",
|
|
201
|
-
message: "what option do you want to analyze stack",
|
|
202
|
-
choices: ["web tools", "info tools", "hardware tools", "about", "exit"]
|
|
203
|
-
});
|
|
204
|
-
|
|
205
410
|
switch (analyze) {
|
|
206
|
-
case "web tools":
|
|
207
|
-
mainOptions();
|
|
208
|
-
break;
|
|
209
|
-
case "info tools":
|
|
210
|
-
infoOpts();
|
|
211
|
-
break;
|
|
212
411
|
case "hardware tools":
|
|
213
412
|
hardwareOpts();
|
|
214
413
|
break;
|
|
215
414
|
case "about":
|
|
216
415
|
aboutOpts();
|
|
217
416
|
break;
|
|
218
|
-
|
|
417
|
+
case "scraping":
|
|
418
|
+
scrapingLink();
|
|
419
|
+
break;
|
|
420
|
+
case "exit":
|
|
219
421
|
console.clear();
|
|
220
422
|
console.info("thanks for use stack-analyze".green);
|
|
221
423
|
break;
|
|
424
|
+
default:
|
|
425
|
+
toolsOpts[analyze]();
|
|
426
|
+
break;
|
|
222
427
|
}
|
|
223
428
|
}
|
|
224
429
|
|
|
225
430
|
// call the message title and question list
|
|
226
431
|
question();
|
|
227
|
-
|
package/demo.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
|
|
3
|
+
inquirer
|
|
4
|
+
.prompt([
|
|
5
|
+
{
|
|
6
|
+
type: "input",
|
|
7
|
+
name: "username",
|
|
8
|
+
message: "What's your name?"
|
|
9
|
+
}
|
|
10
|
+
])
|
|
11
|
+
.then((answers) => {
|
|
12
|
+
console.log(`Hello ${answers.username}!`)
|
|
13
|
+
})
|
|
14
|
+
.catch((error) => {
|
|
15
|
+
if (error.isTtyError) {
|
|
16
|
+
console.log("Your console environment is not supported!")
|
|
17
|
+
} else {
|
|
18
|
+
console.log(error)
|
|
19
|
+
}
|
|
20
|
+
})
|