stack-analyze 1.1.2 → 1.1.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/CHANGELOG.md +46 -0
- package/about/index.js +27 -83
- package/cli.js +227 -0
- package/functions/animeInfo.js +13 -3
- package/functions/bitly.js +43 -0
- package/functions/cryptoList.js +80 -0
- package/functions/hardware.js +28 -17
- package/functions/moviesInfo.js +84 -0
- package/functions/multipleStack.js +11 -5
- package/functions/pageSpeed.js +56 -86
- package/functions/singleStack.js +10 -4
- package/hash/aboutOpts.js +55 -0
- package/hash/hardwareTools.js +47 -0
- package/hash/infoTools.js +90 -0
- package/hash/mainTools.js +67 -0
- package/index.js +328 -373
- package/models/aboutTables.js +40 -0
- package/package.json +19 -17
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// modules
|
|
2
|
+
const axios = require("axios").default;
|
|
3
|
+
const { red } = require("colors");
|
|
4
|
+
const { Table } = require("console-table-printer");
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @description movie info tool
|
|
8
|
+
* @param { string } api_key - key required for api tool
|
|
9
|
+
* @param { string } query - search any movie
|
|
10
|
+
* @returns { Promise<void> } - return movie lisy
|
|
11
|
+
*/
|
|
12
|
+
const movieDB = async (api_key, query) => {
|
|
13
|
+
try {
|
|
14
|
+
const { data } = await axios.get("https://api.themoviedb.org/3/search/movie", {
|
|
15
|
+
params: {
|
|
16
|
+
api_key,
|
|
17
|
+
query,
|
|
18
|
+
page: 1
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const movieList = new Table({
|
|
23
|
+
columns: [
|
|
24
|
+
{
|
|
25
|
+
name: "title",
|
|
26
|
+
alignment: "left",
|
|
27
|
+
color: "green"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "original_language",
|
|
31
|
+
alignment: "left",
|
|
32
|
+
color: "green"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "popularity",
|
|
36
|
+
alignment: "left",
|
|
37
|
+
color: "yellow"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "vote_average",
|
|
41
|
+
alignment: "left",
|
|
42
|
+
color: "yellow"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "release_date",
|
|
46
|
+
alignment: "left",
|
|
47
|
+
color: "yellow"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const movieData = data.results
|
|
53
|
+
.map(({
|
|
54
|
+
title,
|
|
55
|
+
original_language,
|
|
56
|
+
popularity,
|
|
57
|
+
vote_average,
|
|
58
|
+
release_date
|
|
59
|
+
}) => ({
|
|
60
|
+
title,
|
|
61
|
+
original_language,
|
|
62
|
+
popularity,
|
|
63
|
+
vote_average,
|
|
64
|
+
release_date
|
|
65
|
+
}))
|
|
66
|
+
.sort((x, y) => {
|
|
67
|
+
// date values
|
|
68
|
+
const primaryDate = new Date(x.release_date);
|
|
69
|
+
const secondaryDate = new Date(y.release_date);
|
|
70
|
+
|
|
71
|
+
return primaryDate.getTime() - secondaryDate.getTime();
|
|
72
|
+
})
|
|
73
|
+
.filter(({ release_date }) => release_date !== undefined && release_date !== "");
|
|
74
|
+
|
|
75
|
+
movieList.addRows(movieData);
|
|
76
|
+
|
|
77
|
+
movieList.printTable();
|
|
78
|
+
} catch (err) {
|
|
79
|
+
console.error(red(err.message));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// export
|
|
84
|
+
module.exports = movieDB;
|
|
@@ -51,13 +51,19 @@ const multipleStack = async (urls) => {
|
|
|
51
51
|
console.group();
|
|
52
52
|
// loop web site tech stack
|
|
53
53
|
results.forEach(({url, technologies}) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
const stackResult = technologies.map(({
|
|
55
|
+
name,
|
|
56
|
+
website,
|
|
57
|
+
categories
|
|
58
|
+
}) => ({
|
|
57
59
|
techName: name,
|
|
58
60
|
techWebsite: website,
|
|
59
|
-
techCategories: categories.map(({name}) => name).join(", ")
|
|
60
|
-
}))
|
|
61
|
+
techCategories: categories.map(({ name }) => name).join(", ")
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
console.info(green(textSync(url, "Small")));
|
|
65
|
+
console.group();
|
|
66
|
+
p.addRows(stackResult);
|
|
61
67
|
p.printTable();
|
|
62
68
|
console.groupEnd();
|
|
63
69
|
});
|
package/functions/pageSpeed.js
CHANGED
|
@@ -1,146 +1,116 @@
|
|
|
1
1
|
// modules
|
|
2
2
|
const axios = require("axios").default;
|
|
3
|
-
const {
|
|
4
|
-
red,
|
|
5
|
-
yellow,
|
|
6
|
-
green,
|
|
7
|
-
magenta,
|
|
8
|
-
bgRed
|
|
9
|
-
} = require("colors");
|
|
10
3
|
const cliProgress = require("cli-progress");
|
|
11
|
-
|
|
12
|
-
// result pagespeed bar color
|
|
13
|
-
let bar;
|
|
4
|
+
const { red } = require("colors");
|
|
14
5
|
|
|
15
6
|
/**
|
|
16
7
|
* @description async function mobile website pagespeed
|
|
17
8
|
* @param { string } url - website from pagespeed mobile results
|
|
18
9
|
* @returns { Promise<void> } - return async mobile results
|
|
19
10
|
*/
|
|
20
|
-
const
|
|
21
|
-
const
|
|
11
|
+
const pageSpeed = async (url) => {
|
|
12
|
+
const resMobile = await axios.get("https://www.googleapis.com/pagespeedonline/v5/runPagespeed", {
|
|
22
13
|
params: {
|
|
23
14
|
url,
|
|
24
15
|
key: "AIzaSyBEDaW4FxSZ2s1vz5CdD5Ai6PGZGdAzij0",
|
|
25
16
|
strategy: "mobile"
|
|
26
17
|
}
|
|
27
18
|
});
|
|
28
|
-
|
|
19
|
+
|
|
20
|
+
const resDesktop = await axios.get("https://www.googleapis.com/pagespeedonline/v5/runPagespeed", {
|
|
21
|
+
params: {
|
|
22
|
+
url,
|
|
23
|
+
key: "AIzaSyBEDaW4FxSZ2s1vz5CdD5Ai6PGZGdAzij0",
|
|
24
|
+
strategy: "desktop"
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// extract results
|
|
29
|
+
const mobile = Math.round(resMobile.data.lighthouseResult.categories.performance.score * 100);
|
|
30
|
+
const desktop = Math.round(resDesktop.data.lighthouseResult.categories.performance.score * 100);
|
|
31
|
+
|
|
32
|
+
// result pagespeed bar color
|
|
33
|
+
let b1;
|
|
34
|
+
let b2;
|
|
35
|
+
|
|
29
36
|
try {
|
|
30
|
-
const movil = data.lighthouseResult.categories.performance.score * 100;
|
|
31
37
|
|
|
38
|
+
// valid results
|
|
32
39
|
switch (true) {
|
|
33
|
-
case (
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
case (mobile === 1 || mobile <= 49):
|
|
41
|
+
case (desktop === 1 || desktop <= 49):
|
|
42
|
+
b1 = new cliProgress.SingleBar({
|
|
43
|
+
format: "Mobile Result | {bar} || {value}/{total} || bad".red,
|
|
36
44
|
barCompleteChar: "\u2588",
|
|
37
45
|
barIncompleteChar: "\u2591",
|
|
38
46
|
hideCursor: true
|
|
39
47
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
bar = new cliProgress.SingleBar({
|
|
43
|
-
format: `Mobile Result | ${yellow("{bar}")} || {value}/{total} decent`,
|
|
48
|
+
b2 = new cliProgress.SingleBar({
|
|
49
|
+
format: "Desktop Result | {bar} || {value}/{total} || bad".red,
|
|
44
50
|
barCompleteChar: "\u2588",
|
|
45
51
|
barIncompleteChar: "\u2591",
|
|
46
52
|
hideCursor: true
|
|
47
53
|
});
|
|
48
54
|
break;
|
|
49
|
-
case (
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
case (mobile === 50 || mobile <= 89):
|
|
56
|
+
case (desktop === 50 || desktop <= 89):
|
|
57
|
+
b1 = new cliProgress.SingleBar({
|
|
58
|
+
format: "Mobile Result | {bar} || {value}/{total} || decent".yellow,
|
|
52
59
|
barCompleteChar: "\u2588",
|
|
53
60
|
barIncompleteChar: "\u2591",
|
|
54
61
|
hideCursor: true
|
|
55
62
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
bar = new cliProgress.SingleBar({
|
|
59
|
-
format: `Mobile Result | ${magenta("{bar}")} || {value}/{total} excelent`,
|
|
63
|
+
b2 = new cliProgress.SingleBar({
|
|
64
|
+
format: "Desktop Result | {bar} || {value}/{total} || decent".yellow,
|
|
60
65
|
barCompleteChar: "\u2588",
|
|
61
66
|
barIncompleteChar: "\u2591",
|
|
62
67
|
hideCursor: true
|
|
63
68
|
});
|
|
64
69
|
break;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
// update values
|
|
70
|
-
bar.update(Math.round(movil));
|
|
71
|
-
|
|
72
|
-
bar.stop();
|
|
73
|
-
} catch (err) {
|
|
74
|
-
console.error(err.message.red);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
80
|
-
* @description async function desktop website pagespeed
|
|
81
|
-
* @param { string } url - website from pagespeed desktop
|
|
82
|
-
* @return { Promise<void> } - return async desktop results
|
|
83
|
-
*
|
|
84
|
-
*/
|
|
85
|
-
const desktop = async (url) => {
|
|
86
|
-
const { data } = await axios.get("https://www.googleapis.com/pagespeedonline/v5/runPagespeed", {
|
|
87
|
-
params: {
|
|
88
|
-
url,
|
|
89
|
-
key: "AIzaSyBEDaW4FxSZ2s1vz5CdD5Ai6PGZGdAzij0",
|
|
90
|
-
strategy: "desktop"
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
try {
|
|
95
|
-
const desktop = data.lighthouseResult.categories.performance.score * 100;
|
|
96
|
-
|
|
97
|
-
switch (true) {
|
|
98
|
-
case (desktop === 0 || desktop <=49):
|
|
99
|
-
bar = new cliProgress.SingleBar({
|
|
100
|
-
format: `Desktop Result | ${red("{bar}")} || {value}/{total} || bad`,
|
|
70
|
+
case (mobile >= 90 || mobile === 100):
|
|
71
|
+
case (desktop >= 90 || desktop === 100):
|
|
72
|
+
b1 = new cliProgress.SingleBar({
|
|
73
|
+
format: "Mobile Result | {bar} || {value}/{total} || excelent".green,
|
|
101
74
|
barCompleteChar: "\u2588",
|
|
102
75
|
barIncompleteChar: "\u2591",
|
|
103
76
|
hideCursor: true
|
|
104
77
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
bar = new cliProgress.SingleBar({
|
|
108
|
-
format: `Desktop Result | ${yellow("{bar}")} || {value}/{total} decent`,
|
|
78
|
+
b2 = new cliProgress.SingleBar({
|
|
79
|
+
format: "Desktop Result | {bar} || {value}/{total} || excelent".green,
|
|
109
80
|
barCompleteChar: "\u2588",
|
|
110
81
|
barIncompleteChar: "\u2591",
|
|
111
82
|
hideCursor: true
|
|
112
83
|
});
|
|
113
84
|
break;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
format:
|
|
85
|
+
default:
|
|
86
|
+
b1 = new cliProgress.SingleBar({
|
|
87
|
+
format: "Mobile Result | {bar} || {value}/{total} || undifined",
|
|
117
88
|
barCompleteChar: "\u2588",
|
|
118
89
|
barIncompleteChar: "\u2591",
|
|
119
90
|
hideCursor: true
|
|
120
91
|
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
bar = new cliProgress.SingleBar({
|
|
124
|
-
format: `Desktop Result | ${magenta("{bar}")} || {value}/{total} undifined`,
|
|
92
|
+
b2 = new cliProgress.SingleBar({
|
|
93
|
+
format: "Desktop Result | {bar} || {value}/{total} || undifined",
|
|
125
94
|
barCompleteChar: "\u2588",
|
|
126
95
|
barIncompleteChar: "\u2591",
|
|
127
96
|
hideCursor: true
|
|
128
97
|
});
|
|
129
98
|
break;
|
|
130
99
|
}
|
|
131
|
-
|
|
132
|
-
|
|
100
|
+
|
|
101
|
+
// initials bars
|
|
102
|
+
b1.start(100, 0);
|
|
103
|
+
b2.start(100, 0);
|
|
104
|
+
|
|
105
|
+
b1.update(mobile);
|
|
106
|
+
b2.update(desktop);
|
|
133
107
|
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
bar.stop();
|
|
108
|
+
// stop all bars
|
|
109
|
+
b1.stop();
|
|
110
|
+
b2.stop();
|
|
138
111
|
} catch (err) {
|
|
139
|
-
console.error(
|
|
112
|
+
console.error(red(err.message));
|
|
140
113
|
}
|
|
141
114
|
};
|
|
142
115
|
|
|
143
|
-
module.exports =
|
|
144
|
-
mobile,
|
|
145
|
-
desktop
|
|
146
|
-
};
|
|
116
|
+
module.exports = pageSpeed;
|
package/functions/singleStack.js
CHANGED
|
@@ -40,13 +40,19 @@ async function singleStack(url) {
|
|
|
40
40
|
|
|
41
41
|
const { technologies } = await wappalyzer.open(url).analyze();
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const stackResult = technologies.map(({
|
|
44
|
+
name,
|
|
45
|
+
website,
|
|
46
|
+
categories
|
|
47
|
+
}) => ({
|
|
46
48
|
techName: name,
|
|
47
49
|
techWebsite: website,
|
|
48
50
|
techCategories: categories.map(({ name }) => name).join(", ")
|
|
49
|
-
}))
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
console.info(green(textSync(url)));
|
|
54
|
+
|
|
55
|
+
p.addRows(stackResult);
|
|
50
56
|
|
|
51
57
|
p.printTable();
|
|
52
58
|
} catch (err) {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// print table
|
|
2
|
+
const { printTable } = require("console-table-printer");
|
|
3
|
+
|
|
4
|
+
// tables models
|
|
5
|
+
const {
|
|
6
|
+
youtubeDevTable,
|
|
7
|
+
nonoliveTable,
|
|
8
|
+
ideasTable
|
|
9
|
+
} = require("../models/aboutTables");
|
|
10
|
+
|
|
11
|
+
// about sections
|
|
12
|
+
const {
|
|
13
|
+
aboutApp,
|
|
14
|
+
developers,
|
|
15
|
+
youtubeDev,
|
|
16
|
+
nonolive,
|
|
17
|
+
twitch,
|
|
18
|
+
projects,
|
|
19
|
+
ideas
|
|
20
|
+
} = require("../about");
|
|
21
|
+
|
|
22
|
+
/** @type {{ main_info(): void, lineup(): void, youtube_recomendation(): void, nonolive_recomendation(): void, twitch_recomendation(): void, projects_recomendation(): void, tools_ideas(): void }} */
|
|
23
|
+
const aboutTool = {
|
|
24
|
+
main_info() {
|
|
25
|
+
console.clear();
|
|
26
|
+
console.table(aboutApp);
|
|
27
|
+
},
|
|
28
|
+
lineup() {
|
|
29
|
+
console.clear();
|
|
30
|
+
printTable(developers.map((dev, i) => ({ index: i + 1, dev })));
|
|
31
|
+
},
|
|
32
|
+
youtube_recomendation() {
|
|
33
|
+
console.clear();
|
|
34
|
+
youtubeDevTable.addRows(youtubeDev);
|
|
35
|
+
youtubeDevTable.printTable();
|
|
36
|
+
},
|
|
37
|
+
twitch_recomendation() {
|
|
38
|
+
console.clear();
|
|
39
|
+
const streamers = twitch.map((streamer, i) => ({ index: i + 1, streamer }));
|
|
40
|
+
printTable(streamers);
|
|
41
|
+
},
|
|
42
|
+
projects_recomendation() {
|
|
43
|
+
console.clear();
|
|
44
|
+
const proyectsReccomend = projects.map((project, i) => ({ index: i + 1, project }));
|
|
45
|
+
printTable(proyectsReccomend);
|
|
46
|
+
},
|
|
47
|
+
tools_ideas() {
|
|
48
|
+
console.clear();
|
|
49
|
+
ideasTable.addRows(ideas);
|
|
50
|
+
ideasTable.printTable();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// export hash
|
|
55
|
+
module.exports = aboutTool;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// hardware modules
|
|
2
|
+
const {
|
|
3
|
+
cpuInfo,
|
|
4
|
+
ramMemInfo,
|
|
5
|
+
osDetail,
|
|
6
|
+
diskInfo,
|
|
7
|
+
controllerInfo,
|
|
8
|
+
displayInfo,
|
|
9
|
+
biosInfo
|
|
10
|
+
} = require("../functions/hardware");
|
|
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
|
+
module.exports = hardwareTools;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// modules
|
|
2
|
+
const inquirer = require("inquirer");
|
|
3
|
+
|
|
4
|
+
// github info
|
|
5
|
+
const githubInfo = require("../functions/gitUser");
|
|
6
|
+
|
|
7
|
+
// anime search
|
|
8
|
+
const animeSearch = require("../functions/animeInfo");
|
|
9
|
+
|
|
10
|
+
// crypto market
|
|
11
|
+
const cryptoMarket = require("../functions/cryptoList");
|
|
12
|
+
|
|
13
|
+
// bitly
|
|
14
|
+
const bitlyInfo = require("../functions/bitly");
|
|
15
|
+
|
|
16
|
+
// movies
|
|
17
|
+
const movieDB = require("../functions/moviesInfo");
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @type {{ github_info(): Promise<void>, anime_search(): Promise<void>, crypto_market(): void, bitly_info(): Promise<void>, movie_info(): Promise<void> }}
|
|
22
|
+
*/
|
|
23
|
+
const infoTools = {
|
|
24
|
+
async github_info() {
|
|
25
|
+
const { user } = await inquirer.prompt({
|
|
26
|
+
name: "user",
|
|
27
|
+
message: "enter a github user"
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (user !== "") {
|
|
31
|
+
console.clear();
|
|
32
|
+
githubInfo(user);
|
|
33
|
+
} else {
|
|
34
|
+
console.error("please the github username is required".red);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
async anime_search() {
|
|
38
|
+
const { anime } = await inquirer.prompt({
|
|
39
|
+
name: "anime",
|
|
40
|
+
message: "enter a anime, movie or ova search"
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (anime !== "") {
|
|
44
|
+
console.clear();
|
|
45
|
+
animeSearch(anime);
|
|
46
|
+
} else {
|
|
47
|
+
console.error("please the anime is required".red);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
crypto_market() {
|
|
51
|
+
console.clear();
|
|
52
|
+
cryptoMarket();
|
|
53
|
+
},
|
|
54
|
+
async bitly_info() {
|
|
55
|
+
console.clear();
|
|
56
|
+
const { link, token } = await inquirer.prompt([
|
|
57
|
+
{
|
|
58
|
+
name: "link",
|
|
59
|
+
message: "enter a bitly link without http|https",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "token",
|
|
63
|
+
message: "enter a bitly token",
|
|
64
|
+
type: "password",
|
|
65
|
+
mask: "?"
|
|
66
|
+
}
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
bitlyInfo(link, token);
|
|
70
|
+
},
|
|
71
|
+
async movie_info() {
|
|
72
|
+
const { api_key, query } = await inquirer.prompt([
|
|
73
|
+
{
|
|
74
|
+
name: "api_key",
|
|
75
|
+
message: "insert api key",
|
|
76
|
+
type: "password",
|
|
77
|
+
mask: "?"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "query",
|
|
81
|
+
message: "please search a movie search",
|
|
82
|
+
}
|
|
83
|
+
]);
|
|
84
|
+
|
|
85
|
+
movieDB(api_key, query);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// exports
|
|
90
|
+
module.exports = infoTools;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// modules
|
|
2
|
+
const inquirer = require("inquirer");
|
|
3
|
+
const { textSync } = require("figlet");
|
|
4
|
+
const { green } = require("colors");
|
|
5
|
+
|
|
6
|
+
// analyze web
|
|
7
|
+
const singleStack = require("../functions/singleStack");
|
|
8
|
+
const multipleStack = require("../functions/multipleStack");
|
|
9
|
+
|
|
10
|
+
// pagespeed web
|
|
11
|
+
const pageSpeed = require("../functions/pageSpeed");
|
|
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(green(textSync(speedWeb)));
|
|
56
|
+
|
|
57
|
+
// start pagespeed results mobile
|
|
58
|
+
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
|
+
module.exports = mainTools;
|