stack-analyze 1.1.4 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/about.js +58 -0
- package/cli.js +228 -0
- package/env/bitly.env.js +1 -0
- package/env/movie.env.js +1 -0
- package/env/twitchID.env.js +1 -0
- package/functions/animeInfo.js +9 -39
- package/functions/bitly.js +8 -9
- package/functions/cryptoList.js +9 -38
- package/functions/gitUser.js +6 -9
- package/functions/hardware.js +32 -24
- package/functions/moviesInfo.js +56 -0
- package/functions/multipleStack.js +9 -29
- package/functions/pageSpeed.js +68 -56
- package/functions/singleStack.js +9 -32
- package/functions/twitch.js +46 -0
- package/hash/aboutOpts.js +53 -0
- package/hash/hardwareTools.js +47 -0
- package/hash/infoTools.js +112 -0
- package/hash/mainTools.js +67 -0
- package/index.cjs +474 -0
- package/index.mjs +474 -0
- package/models/aboutTables.js +40 -0
- package/models/animeTable.js +33 -0
- package/models/cryptoTables.js +32 -0
- package/models/hardwareTables.js +87 -0
- package/models/movieTables.js +33 -0
- package/models/stackTables.js +23 -0
- package/models/twitchTables.js +28 -0
- package/package.json +21 -14
- package/about/index.js +0 -126
- package/index.js +0 -458
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// modules
|
|
2
|
+
import "../env/movie.env.js";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import colors from "colors";
|
|
5
|
+
|
|
6
|
+
// table module
|
|
7
|
+
import movieList from "../models/movieTables.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @description movie info tool
|
|
11
|
+
* @param { string } query - search any movie
|
|
12
|
+
* @returns { Promise<void> } - return movie lisy
|
|
13
|
+
*/
|
|
14
|
+
const movieDB = async (query) => {
|
|
15
|
+
try {
|
|
16
|
+
const { data } = await axios.get("https://api.themoviedb.org/3/search/movie", {
|
|
17
|
+
params: {
|
|
18
|
+
api_key: process.env.MOVIE_CODE,
|
|
19
|
+
query,
|
|
20
|
+
page: 1
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const movieData = data.results
|
|
25
|
+
.map(({
|
|
26
|
+
title,
|
|
27
|
+
original_language,
|
|
28
|
+
popularity,
|
|
29
|
+
vote_average,
|
|
30
|
+
release_date
|
|
31
|
+
}) => ({
|
|
32
|
+
title,
|
|
33
|
+
original_language,
|
|
34
|
+
popularity,
|
|
35
|
+
vote_average,
|
|
36
|
+
release_date
|
|
37
|
+
}))
|
|
38
|
+
.sort((x, y) => {
|
|
39
|
+
// date values
|
|
40
|
+
const primaryDate = new Date(x.release_date);
|
|
41
|
+
const secondaryDate = new Date(y.release_date);
|
|
42
|
+
|
|
43
|
+
return primaryDate.getTime() - secondaryDate.getTime();
|
|
44
|
+
})
|
|
45
|
+
.filter(({ release_date }) => release_date !== undefined && release_date !== "");
|
|
46
|
+
|
|
47
|
+
movieList.addRows(movieData);
|
|
48
|
+
|
|
49
|
+
movieList.printTable();
|
|
50
|
+
} catch (err) {
|
|
51
|
+
console.error(colors.red(err.message));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// export
|
|
56
|
+
export default movieDB;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// modules
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import figlet from "figlet";
|
|
3
|
+
import Wappalyzer from "wappalyzer";
|
|
4
|
+
import colors from "colors";
|
|
5
|
+
import stackTable from "../models/stackTables.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -14,26 +14,6 @@ const { Table } = require("console-table-printer");
|
|
|
14
14
|
const multipleStack = async (urls) => {
|
|
15
15
|
const wappalyzer = await new Wappalyzer();
|
|
16
16
|
|
|
17
|
-
const p = new Table({
|
|
18
|
-
columns: [
|
|
19
|
-
{
|
|
20
|
-
name: "techName",
|
|
21
|
-
alignment: "left",
|
|
22
|
-
color: "cyan"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: "techWebsite",
|
|
26
|
-
alignment: "left",
|
|
27
|
-
color: "green"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: "techCategories",
|
|
31
|
-
alignment: "left",
|
|
32
|
-
color: "cyan"
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
});
|
|
36
|
-
|
|
37
17
|
try {
|
|
38
18
|
await wappalyzer.init();
|
|
39
19
|
|
|
@@ -61,17 +41,17 @@ const multipleStack = async (urls) => {
|
|
|
61
41
|
techCategories: categories.map(({ name }) => name).join(", ")
|
|
62
42
|
}));
|
|
63
43
|
|
|
64
|
-
console.info(green(textSync(url, "Small")));
|
|
44
|
+
console.info(colors.green(figlet.textSync(url, "Small")));
|
|
65
45
|
console.group();
|
|
66
|
-
|
|
67
|
-
|
|
46
|
+
stackTable.addRows(stackResult);
|
|
47
|
+
stackTable.printTable();
|
|
68
48
|
console.groupEnd();
|
|
69
49
|
});
|
|
70
50
|
} catch (err) {
|
|
71
|
-
console.error(red(err.message));
|
|
51
|
+
console.error(colors.red(err.message));
|
|
72
52
|
}
|
|
73
53
|
|
|
74
54
|
await wappalyzer.destroy();
|
|
75
55
|
};
|
|
76
56
|
|
|
77
|
-
|
|
57
|
+
export default multipleStack;
|
package/functions/pageSpeed.js
CHANGED
|
@@ -1,34 +1,7 @@
|
|
|
1
1
|
// modules
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @description get color bar
|
|
8
|
-
* @param { number } valueOne - get value data desktop
|
|
9
|
-
* @param { number } valueTwo - get value data mobile
|
|
10
|
-
* @param { any } bar - using bar
|
|
11
|
-
* @returns { void }
|
|
12
|
-
*/
|
|
13
|
-
const barColor = (valueOne, valueTwo, bar) => {
|
|
14
|
-
switch (true) {
|
|
15
|
-
case (valueOne === 1 || valueOne <= 49):
|
|
16
|
-
case (valueTwo === 1 || valueTwo <= 49):
|
|
17
|
-
colors.red(bar);
|
|
18
|
-
break;
|
|
19
|
-
case (valueOne === 50 || valueOne <= 89):
|
|
20
|
-
case (valueTwo === 50 || valueTwo <= 89):
|
|
21
|
-
colors.yellow(bar);
|
|
22
|
-
break;
|
|
23
|
-
case (valueOne >= 90 || valueOne === 100):
|
|
24
|
-
case (valueTwo >= 90 || valueTwo === 100):
|
|
25
|
-
colors.green(bar);
|
|
26
|
-
break;
|
|
27
|
-
default:
|
|
28
|
-
colors.bgMagenta(bar);
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import { SingleBar } from "cli-progress";
|
|
4
|
+
import colors from "colors";
|
|
32
5
|
|
|
33
6
|
/**
|
|
34
7
|
* @description async function mobile website pagespeed
|
|
@@ -53,52 +26,91 @@ const pageSpeed = async (url) => {
|
|
|
53
26
|
});
|
|
54
27
|
|
|
55
28
|
// extract results
|
|
56
|
-
const
|
|
29
|
+
const mobile = Math.round(resMobile.data.lighthouseResult.categories.performance.score * 100);
|
|
57
30
|
const desktop = Math.round(resDesktop.data.lighthouseResult.categories.performance.score * 100);
|
|
58
31
|
|
|
59
32
|
// result pagespeed bar color
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
clearOnComplete: false,
|
|
63
|
-
hideCursor: true,
|
|
64
|
-
barCompleteChar: "\u2588",
|
|
65
|
-
barIncompleteChar: "\u2591",
|
|
66
|
-
}, cliProgress.Presets.rect);
|
|
67
|
-
|
|
68
|
-
// add bars
|
|
69
|
-
const b1 = multibar.create(100, 0);
|
|
70
|
-
const b2 = multibar.create(100, 0);
|
|
33
|
+
let b1;
|
|
34
|
+
let b2;
|
|
71
35
|
|
|
72
36
|
try {
|
|
73
37
|
|
|
74
38
|
// valid results
|
|
75
39
|
switch (true) {
|
|
76
|
-
case (
|
|
40
|
+
case (mobile === 1 || mobile <= 49):
|
|
77
41
|
case (desktop === 1 || desktop <= 49):
|
|
78
|
-
b1
|
|
79
|
-
|
|
42
|
+
b1 = new SingleBar({
|
|
43
|
+
format: "Mobile Result | {bar} || {value}/{total} || bad".red,
|
|
44
|
+
barCompleteChar: "\u2588",
|
|
45
|
+
barIncompleteChar: "\u2591",
|
|
46
|
+
hideCursor: true
|
|
47
|
+
});
|
|
48
|
+
b2 = new SingleBar({
|
|
49
|
+
format: "Desktop Result | {bar} || {value}/{total} || bad".red,
|
|
50
|
+
barCompleteChar: "\u2588",
|
|
51
|
+
barIncompleteChar: "\u2591",
|
|
52
|
+
hideCursor: true
|
|
53
|
+
});
|
|
80
54
|
break;
|
|
81
|
-
case (
|
|
55
|
+
case (mobile === 50 || mobile <= 89):
|
|
82
56
|
case (desktop === 50 || desktop <= 89):
|
|
83
|
-
b1
|
|
84
|
-
|
|
57
|
+
b1 = new SingleBar({
|
|
58
|
+
format: "Mobile Result | {bar} || {value}/{total} || decent".yellow,
|
|
59
|
+
barCompleteChar: "\u2588",
|
|
60
|
+
barIncompleteChar: "\u2591",
|
|
61
|
+
hideCursor: true
|
|
62
|
+
});
|
|
63
|
+
b2 = new SingleBar({
|
|
64
|
+
format: "Desktop Result | {bar} || {value}/{total} || decent".yellow,
|
|
65
|
+
barCompleteChar: "\u2588",
|
|
66
|
+
barIncompleteChar: "\u2591",
|
|
67
|
+
hideCursor: true
|
|
68
|
+
});
|
|
85
69
|
break;
|
|
86
|
-
case (
|
|
70
|
+
case (mobile >= 90 || mobile === 100):
|
|
87
71
|
case (desktop >= 90 || desktop === 100):
|
|
88
|
-
b1
|
|
89
|
-
|
|
72
|
+
b1 = new SingleBar({
|
|
73
|
+
format: "Mobile Result | {bar} || {value}/{total} || excelent".green,
|
|
74
|
+
barCompleteChar: "\u2588",
|
|
75
|
+
barIncompleteChar: "\u2591",
|
|
76
|
+
hideCursor: true
|
|
77
|
+
});
|
|
78
|
+
b2 = new SingleBar({
|
|
79
|
+
format: "Desktop Result | {bar} || {value}/{total} || excelent".green,
|
|
80
|
+
barCompleteChar: "\u2588",
|
|
81
|
+
barIncompleteChar: "\u2591",
|
|
82
|
+
hideCursor: true
|
|
83
|
+
});
|
|
90
84
|
break;
|
|
91
85
|
default:
|
|
92
|
-
b1
|
|
93
|
-
|
|
86
|
+
b1 = new SingleBar({
|
|
87
|
+
format: "Mobile Result | {bar} || {value}/{total} || undifined",
|
|
88
|
+
barCompleteChar: "\u2588",
|
|
89
|
+
barIncompleteChar: "\u2591",
|
|
90
|
+
hideCursor: true
|
|
91
|
+
});
|
|
92
|
+
b2 = new SingleBar({
|
|
93
|
+
format: "Desktop Result | {bar} || {value}/{total} || undifined",
|
|
94
|
+
barCompleteChar: "\u2588",
|
|
95
|
+
barIncompleteChar: "\u2591",
|
|
96
|
+
hideCursor: true
|
|
97
|
+
});
|
|
94
98
|
break;
|
|
95
99
|
}
|
|
100
|
+
|
|
101
|
+
// initials bars
|
|
102
|
+
b1.start(100, 0);
|
|
103
|
+
b2.start(100, 0);
|
|
104
|
+
|
|
105
|
+
b1.update(mobile);
|
|
106
|
+
b2.update(desktop);
|
|
96
107
|
|
|
97
108
|
// stop all bars
|
|
98
|
-
|
|
109
|
+
b1.stop();
|
|
110
|
+
b2.stop();
|
|
99
111
|
} catch (err) {
|
|
100
|
-
console.error(err.message
|
|
112
|
+
console.error(colors.red(err.message));
|
|
101
113
|
}
|
|
102
114
|
};
|
|
103
115
|
|
|
104
|
-
|
|
116
|
+
export default pageSpeed;
|
package/functions/singleStack.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// module
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import Wappalyzer from "wappalyzer";
|
|
3
|
+
import figlet from "figlet";
|
|
4
|
+
import colors from "colors";
|
|
5
|
+
import stackTable from "../models/stackTables.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -11,30 +11,9 @@ const { Table } = require("console-table-printer");
|
|
|
11
11
|
* @returns { Promise<void> } - return async results single web
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
|
-
async function singleStack(url) {
|
|
14
|
+
export default async function singleStack(url) {
|
|
15
15
|
const wappalyzer = await new Wappalyzer;
|
|
16
16
|
|
|
17
|
-
const p = new Table({
|
|
18
|
-
columns: [
|
|
19
|
-
{
|
|
20
|
-
name: "techName",
|
|
21
|
-
alignment: "left",
|
|
22
|
-
color: "cyan"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: "techWebsite",
|
|
26
|
-
alignment: "left",
|
|
27
|
-
color: "green"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: "techCategories",
|
|
31
|
-
alignment: "left",
|
|
32
|
-
color: "cyan"
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
|
|
38
17
|
try {
|
|
39
18
|
await wappalyzer.init();
|
|
40
19
|
|
|
@@ -50,16 +29,14 @@ async function singleStack(url) {
|
|
|
50
29
|
techCategories: categories.map(({ name }) => name).join(", ")
|
|
51
30
|
}));
|
|
52
31
|
|
|
53
|
-
console.info(green(textSync(url)));
|
|
32
|
+
console.info(colors.green(figlet.textSync(url)));
|
|
54
33
|
|
|
55
|
-
|
|
34
|
+
stackTable.addRows(stackResult);
|
|
56
35
|
|
|
57
|
-
|
|
36
|
+
stackTable.printTable();
|
|
58
37
|
} catch (err) {
|
|
59
|
-
console.error(red(err.message));
|
|
38
|
+
console.error(colors.red(err.message));
|
|
60
39
|
}
|
|
61
40
|
|
|
62
41
|
await wappalyzer.destroy();
|
|
63
42
|
}
|
|
64
|
-
|
|
65
|
-
module.exports = singleStack;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// modules
|
|
2
|
+
import "../env/twitchID.env.js";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import { format } from "timeago.js";
|
|
5
|
+
import colors from "colors";
|
|
6
|
+
|
|
7
|
+
// table
|
|
8
|
+
import twitchTable from "../models/twitchTables.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @description twitch user info
|
|
13
|
+
* @param {string} twitchUser - twitch user for search
|
|
14
|
+
* @param {string} apiToken - twitch api token
|
|
15
|
+
* @returns { Promise<void> } - return twitch results
|
|
16
|
+
*/
|
|
17
|
+
const twitchInfo = async (twitchUser, apiToken) => {
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const { data: twitchData } = await axios.get(`https://api.twitch.tv/helix/users?login=${twitchUser}`, {
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: `Bearer ${apiToken}`,
|
|
23
|
+
"Client-Id": process.env.CLIENT_ID
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const result = twitchData.data.map(({
|
|
28
|
+
display_name,
|
|
29
|
+
broadcaster_type,
|
|
30
|
+
view_count,
|
|
31
|
+
created_at
|
|
32
|
+
}) => ({
|
|
33
|
+
display_name,
|
|
34
|
+
broadcaster_type,
|
|
35
|
+
view_count,
|
|
36
|
+
createdTime: format(created_at)
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
twitchTable.addRows(result);
|
|
40
|
+
twitchTable.printTable();
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.error(colors.red(err));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default twitchInfo;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// print table
|
|
2
|
+
import { printTable } from "console-table-printer";
|
|
3
|
+
|
|
4
|
+
// tables models
|
|
5
|
+
import {
|
|
6
|
+
youtubeDevTable,
|
|
7
|
+
ideasTable
|
|
8
|
+
} from "../models/aboutTables.js";
|
|
9
|
+
|
|
10
|
+
// about sections
|
|
11
|
+
import {
|
|
12
|
+
aboutApp,
|
|
13
|
+
developers,
|
|
14
|
+
twitch,
|
|
15
|
+
projects,
|
|
16
|
+
ideas,
|
|
17
|
+
youtubeDev
|
|
18
|
+
} from "../about.js";
|
|
19
|
+
|
|
20
|
+
/** @type {{ main_info(): void, lineup(): void, youtube_recomendation(): void, twitch_recomendation(): void, projects_recomendation(): void, tools_ideas(): void }} */
|
|
21
|
+
const aboutTool = {
|
|
22
|
+
main_info() {
|
|
23
|
+
console.clear();
|
|
24
|
+
console.table(aboutApp);
|
|
25
|
+
},
|
|
26
|
+
lineup() {
|
|
27
|
+
console.clear();
|
|
28
|
+
printTable(developers.map((dev, i) => ({ index: i + 1, dev })));
|
|
29
|
+
},
|
|
30
|
+
youtube_recomendation() {
|
|
31
|
+
console.clear();
|
|
32
|
+
youtubeDevTable.addRows(youtubeDev);
|
|
33
|
+
youtubeDevTable.printTable();
|
|
34
|
+
},
|
|
35
|
+
twitch_recomendation() {
|
|
36
|
+
console.clear();
|
|
37
|
+
const streamers = twitch.map((streamer, i) => ({ index: i + 1, streamer }));
|
|
38
|
+
printTable(streamers);
|
|
39
|
+
},
|
|
40
|
+
projects_recomendation() {
|
|
41
|
+
console.clear();
|
|
42
|
+
const proyectsReccomend = projects.map((project, i) => ({ index: i + 1, project }));
|
|
43
|
+
printTable(proyectsReccomend);
|
|
44
|
+
},
|
|
45
|
+
tools_ideas() {
|
|
46
|
+
console.clear();
|
|
47
|
+
ideasTable.addRows(ideas);
|
|
48
|
+
ideasTable.printTable();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// export hash
|
|
53
|
+
export default aboutTool;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// hardware modules
|
|
2
|
+
import {
|
|
3
|
+
cpuInfo,
|
|
4
|
+
ramMemInfo,
|
|
5
|
+
osDetail,
|
|
6
|
+
diskInfo,
|
|
7
|
+
controllerInfo,
|
|
8
|
+
displayInfo,
|
|
9
|
+
biosInfo
|
|
10
|
+
} from "../functions/hardware.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {{ cpu(): void, ram_memory(): void, os(): void, disk(): void, controller(): void, display(): void, bios(): void }}
|
|
14
|
+
*/
|
|
15
|
+
const hardwareTools = {
|
|
16
|
+
cpu() {
|
|
17
|
+
console.clear();
|
|
18
|
+
cpuInfo();
|
|
19
|
+
},
|
|
20
|
+
ram_memory() {
|
|
21
|
+
console.clear();
|
|
22
|
+
ramMemInfo();
|
|
23
|
+
},
|
|
24
|
+
os() {
|
|
25
|
+
console.clear();
|
|
26
|
+
osDetail();
|
|
27
|
+
},
|
|
28
|
+
disk() {
|
|
29
|
+
console.clear();
|
|
30
|
+
diskInfo();
|
|
31
|
+
},
|
|
32
|
+
controller() {
|
|
33
|
+
console.clear();
|
|
34
|
+
controllerInfo();
|
|
35
|
+
},
|
|
36
|
+
display() {
|
|
37
|
+
console.clear();
|
|
38
|
+
displayInfo();
|
|
39
|
+
},
|
|
40
|
+
bios() {
|
|
41
|
+
console.clear();
|
|
42
|
+
biosInfo();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// exports
|
|
47
|
+
export default hardwareTools;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// modules
|
|
2
|
+
import inquirer from "inquirer";
|
|
3
|
+
|
|
4
|
+
// github info
|
|
5
|
+
import githubInfo from "../functions/gitUser.js";
|
|
6
|
+
|
|
7
|
+
// anime search
|
|
8
|
+
import animeSearch from "../functions/animeInfo.js";
|
|
9
|
+
|
|
10
|
+
// crypto market
|
|
11
|
+
import cryptoMarket from "../functions/cryptoList.js";
|
|
12
|
+
|
|
13
|
+
// bitly
|
|
14
|
+
import bitlyInfo from "../functions/bitly.js";
|
|
15
|
+
|
|
16
|
+
// movies
|
|
17
|
+
import movieDB from "../functions/moviesInfo.js";
|
|
18
|
+
|
|
19
|
+
// twitch
|
|
20
|
+
import twitchInfo from "../functions/twitch.js";
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @type {{ github_info(): Promise<void>, anime_search(): Promise<void>, crypto_market(): void, bitly_info(): Promise<void>, movie_info(): Promise<void>, twitch_info(): Promise<void>}}
|
|
25
|
+
*/
|
|
26
|
+
const infoTools = {
|
|
27
|
+
async github_info() {
|
|
28
|
+
const { user } = await inquirer.prompt({
|
|
29
|
+
name: "user",
|
|
30
|
+
message: "enter a github user"
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (user !== "") {
|
|
34
|
+
console.clear();
|
|
35
|
+
githubInfo(user);
|
|
36
|
+
} else {
|
|
37
|
+
console.error("please the github username is required".red);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
async anime_search() {
|
|
41
|
+
const { anime } = await inquirer.prompt({
|
|
42
|
+
name: "anime",
|
|
43
|
+
message: "enter a anime, movie or ova search"
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (anime !== "") {
|
|
47
|
+
console.clear();
|
|
48
|
+
animeSearch(anime);
|
|
49
|
+
} else {
|
|
50
|
+
console.error("please the anime is required".red);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
crypto_market() {
|
|
54
|
+
console.clear();
|
|
55
|
+
cryptoMarket();
|
|
56
|
+
},
|
|
57
|
+
async bitly_info() {
|
|
58
|
+
console.clear();
|
|
59
|
+
const { link } = await inquirer.prompt([
|
|
60
|
+
{
|
|
61
|
+
name: "link",
|
|
62
|
+
message: "enter a bitly link without http|https",
|
|
63
|
+
}
|
|
64
|
+
]);
|
|
65
|
+
|
|
66
|
+
if (link !== "") {
|
|
67
|
+
console.clear();
|
|
68
|
+
bitlyInfo(link);
|
|
69
|
+
} else {
|
|
70
|
+
console.error("bitly link is required".red);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
async movie_info() {
|
|
74
|
+
const { query } = await inquirer.prompt([
|
|
75
|
+
{
|
|
76
|
+
name: "query",
|
|
77
|
+
message: "please search a movie search",
|
|
78
|
+
}
|
|
79
|
+
]);
|
|
80
|
+
|
|
81
|
+
if (query !== "") {
|
|
82
|
+
console.clear();
|
|
83
|
+
movieDB(query);
|
|
84
|
+
} else {
|
|
85
|
+
console.error("please the movie is required".red);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
async twitch_info() {
|
|
89
|
+
const { user, twitch_token } = await inquirer.prompt([
|
|
90
|
+
{
|
|
91
|
+
name: "user",
|
|
92
|
+
message: "get twitch user"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "twitch_token",
|
|
96
|
+
message: "enter a twitch token without the key Bearer",
|
|
97
|
+
type: "password",
|
|
98
|
+
mask: "?"
|
|
99
|
+
}
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
if (user !== "" && twitch_token !== "") {
|
|
103
|
+
console.clear();
|
|
104
|
+
twitchInfo(user, twitch_token);
|
|
105
|
+
} else {
|
|
106
|
+
console.error("twitch info fields is required".red);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// exports
|
|
112
|
+
export default infoTools;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// modules
|
|
2
|
+
import inquirer from "inquirer";
|
|
3
|
+
import figlet from "figlet";
|
|
4
|
+
import colors from "colors";
|
|
5
|
+
|
|
6
|
+
// analyze web
|
|
7
|
+
import singleStack from "../functions/singleStack.js";
|
|
8
|
+
import multipleStack from "../functions/multipleStack.js";
|
|
9
|
+
|
|
10
|
+
// pagespeed web
|
|
11
|
+
import pageSpeed from "../functions/pageSpeed.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @type {{ single(): Promise<void>, multiple(): Promise<void>, pagespeed(): Promise<void> }}
|
|
15
|
+
*/
|
|
16
|
+
const mainTools = {
|
|
17
|
+
async single() {
|
|
18
|
+
console.clear();
|
|
19
|
+
const { url } = await inquirer.prompt({
|
|
20
|
+
name: "url",
|
|
21
|
+
message: "enter url for analyze the tech stack:"
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
url.indexOf("http") === 0
|
|
25
|
+
? singleStack(url)
|
|
26
|
+
: console.error("please insert a URL with parameter http:// or https://".red);
|
|
27
|
+
},
|
|
28
|
+
async multiple() {
|
|
29
|
+
console.clear();
|
|
30
|
+
const { urls } = await inquirer.prompt({
|
|
31
|
+
name: "urls",
|
|
32
|
+
message: "enter URLs for analyze the tech stacks with whitespace without quotes example 'http://example.com https://nodejs.org': \n"
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (
|
|
36
|
+
urls.match(/(http|https)/g) !== null ||
|
|
37
|
+
urls.match(/(http|https)/g) >= 2
|
|
38
|
+
) {
|
|
39
|
+
const websites = urls.split(" ");
|
|
40
|
+
console.clear();
|
|
41
|
+
multipleStack(websites);
|
|
42
|
+
} else {
|
|
43
|
+
console.error("please in each URL insert a website the parameter https:// or http://".red);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
async pagespeed() {
|
|
47
|
+
console.clear();
|
|
48
|
+
const { speedWeb } = await inquirer.prompt({
|
|
49
|
+
name: "speedWeb",
|
|
50
|
+
message: "insert URL for page speed analyze:"
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (speedWeb.indexOf("http") === 0) {
|
|
54
|
+
console.clear();
|
|
55
|
+
console.info(colors.green(figlet.textSync(speedWeb)));
|
|
56
|
+
|
|
57
|
+
// start pagespeed results mobile
|
|
58
|
+
figlet.textSync(speedWeb, "Small");
|
|
59
|
+
pageSpeed(speedWeb);
|
|
60
|
+
} else {
|
|
61
|
+
console.error("please insert a URL with parameter https;// or http://".red);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// export
|
|
67
|
+
export default mainTools;
|