stack-analyze 1.1.8 → 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 +24 -2
- package/about.js +97 -45
- package/cli.js +127 -18
- package/demo.js +20 -0
- package/functions/animeInfo.js +3 -6
- package/functions/bitly.js +1 -1
- package/functions/cryptoList.js +9 -8
- package/functions/gitUser.js +1 -1
- package/functions/hardware.js +195 -243
- package/functions/moviesInfo.js +3 -7
- package/functions/multipleStack.js +13 -8
- package/functions/pageSpeed.js +1 -1
- package/functions/scraping.js +153 -0
- package/functions/singleStack.js +14 -9
- package/functions/twitch.js +3 -4
- package/index.cjs +141 -114
- package/index.mjs +141 -119
- package/package.json +9 -8
- package/readme.md +11 -3
- package/utils.js +15 -0
- package/.vscode/settings.json +0 -4
- package/hash/aboutOpts.js +0 -53
- package/hash/hardwareTools.js +0 -47
- package/models/aboutTables.js +0 -40
- package/models/animeTable.js +0 -33
- package/models/cryptoTables.js +0 -32
- package/models/hardwareTables.js +0 -87
- package/models/movieTables.js +0 -33
- package/models/stackTables.js +0 -23
- package/models/twitchTables.js +0 -28
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
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
|
+
|
|
5
29
|
## version 1.1.7
|
|
6
30
|
### Added
|
|
7
31
|
- twitch info tool
|
|
@@ -45,8 +69,6 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
|
|
|
45
69
|
### fixed
|
|
46
70
|
- rewrite some functions
|
|
47
71
|
- update npm modules via manual
|
|
48
|
-
### changed
|
|
49
|
-
- no changed
|
|
50
72
|
|
|
51
73
|
## version 1.1.3
|
|
52
74
|
### Added
|
package/about.js
CHANGED
|
@@ -1,58 +1,110 @@
|
|
|
1
|
+
// print table
|
|
2
|
+
import { printTable } from "console-table-printer";
|
|
3
|
+
|
|
4
|
+
import { listFormat } from "./utils.js";
|
|
5
|
+
|
|
1
6
|
// package.json
|
|
2
7
|
import { createRequire } from "module";
|
|
3
8
|
const require = createRequire(import.meta.url);
|
|
4
9
|
const { license, version } = require("./package.json");
|
|
5
10
|
|
|
6
11
|
/**
|
|
7
|
-
*
|
|
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
|
|
8
36
|
*/
|
|
9
|
-
const aboutApp = {
|
|
10
|
-
mainDeveloper: "omega5300",
|
|
11
|
-
license,
|
|
12
|
-
version
|
|
13
|
-
};
|
|
14
37
|
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
38
|
+
/** @type {aboutTable} */
|
|
39
|
+
const aboutTool = {
|
|
40
|
+
mainInfo() {
|
|
41
|
+
/** @type {info} */
|
|
42
|
+
const aboutApp = {
|
|
43
|
+
mainDeveloper: "omega5300",
|
|
44
|
+
license,
|
|
45
|
+
version
|
|
46
|
+
};
|
|
20
47
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
+
];
|
|
25
59
|
|
|
26
|
-
|
|
27
|
-
|
|
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
|
+
];
|
|
28
73
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*/
|
|
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
|
+
];
|
|
34
88
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
youtubeDev,
|
|
55
|
-
twitch,
|
|
56
|
-
projects,
|
|
57
|
-
ideas
|
|
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
|
+
}
|
|
58
108
|
};
|
|
109
|
+
|
|
110
|
+
export default aboutTool;
|
package/cli.js
CHANGED
|
@@ -7,8 +7,8 @@ import figlet from "figlet";
|
|
|
7
7
|
import colors from "colors";
|
|
8
8
|
|
|
9
9
|
// hash tables
|
|
10
|
-
import hardwareTools from "./
|
|
11
|
-
import aboutTool from "./
|
|
10
|
+
import hardwareTools from "./functions/hardware.js";
|
|
11
|
+
import aboutTool from "./about.js";
|
|
12
12
|
|
|
13
13
|
import singleStack from "./functions/singleStack.js";
|
|
14
14
|
import multipleStack from "./functions/multipleStack.js";
|
|
@@ -19,6 +19,112 @@ import cryptoMarket from "./functions/cryptoList.js";
|
|
|
19
19
|
import bitlyInfo from "./functions/bitly.js";
|
|
20
20
|
import movieDB from "./functions/moviesInfo.js";
|
|
21
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
|
+
}
|
|
22
128
|
|
|
23
129
|
/**
|
|
24
130
|
* @description about menu
|
|
@@ -31,12 +137,11 @@ async function aboutOpts() {
|
|
|
31
137
|
name: "about",
|
|
32
138
|
message: "select about option info",
|
|
33
139
|
choices: [
|
|
34
|
-
"
|
|
140
|
+
"mainInfo",
|
|
35
141
|
"lineup",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"tools_ideas",
|
|
142
|
+
"youtubeRecomendation",
|
|
143
|
+
"twitchRecomendation",
|
|
144
|
+
"projectsRecomendation",
|
|
40
145
|
"return to main menu"
|
|
41
146
|
]
|
|
42
147
|
});
|
|
@@ -78,9 +183,9 @@ async function returnQuestion() {
|
|
|
78
183
|
}
|
|
79
184
|
|
|
80
185
|
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
*/
|
|
186
|
+
* @description This is a hash table with the options of the tools menu.
|
|
187
|
+
* @type {Object.<string, function(): void>}
|
|
188
|
+
*/
|
|
84
189
|
const toolsOpts = {
|
|
85
190
|
single() {
|
|
86
191
|
console.clear();
|
|
@@ -206,7 +311,7 @@ const toolsOpts = {
|
|
|
206
311
|
}
|
|
207
312
|
]).then(({ api_key, query }) => {
|
|
208
313
|
console.clear();
|
|
209
|
-
movieDB(
|
|
314
|
+
movieDB(query, api_key);
|
|
210
315
|
setTimeout(returnQuestion, 3000);
|
|
211
316
|
});
|
|
212
317
|
},
|
|
@@ -252,13 +357,13 @@ async function hardwareOpts() {
|
|
|
252
357
|
pageSize: 9,
|
|
253
358
|
message: "select a hardware-information option:",
|
|
254
359
|
choices: [
|
|
255
|
-
"
|
|
256
|
-
"
|
|
257
|
-
"
|
|
258
|
-
"
|
|
259
|
-
"
|
|
260
|
-
"
|
|
261
|
-
"
|
|
360
|
+
"cpuInfo",
|
|
361
|
+
"ramMemInfo",
|
|
362
|
+
"osDetail",
|
|
363
|
+
"diskInfo",
|
|
364
|
+
"controllerInfo",
|
|
365
|
+
"displayInfo",
|
|
366
|
+
"biosInfo",
|
|
262
367
|
"exit to main menu"
|
|
263
368
|
]
|
|
264
369
|
});
|
|
@@ -296,6 +401,7 @@ async function question() {
|
|
|
296
401
|
"movie_info",
|
|
297
402
|
"twitch_info",
|
|
298
403
|
"hardware tools",
|
|
404
|
+
"scraping",
|
|
299
405
|
"about",
|
|
300
406
|
"exit"
|
|
301
407
|
]
|
|
@@ -308,6 +414,9 @@ async function question() {
|
|
|
308
414
|
case "about":
|
|
309
415
|
aboutOpts();
|
|
310
416
|
break;
|
|
417
|
+
case "scraping":
|
|
418
|
+
scrapingLink();
|
|
419
|
+
break;
|
|
311
420
|
case "exit":
|
|
312
421
|
console.clear();
|
|
313
422
|
console.info("thanks for use stack-analyze".green);
|
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
|
+
})
|
package/functions/animeInfo.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// modules
|
|
2
|
-
import axios from "axios";
|
|
2
|
+
import { default as axios } from "axios";
|
|
3
3
|
import { format } from "timeago.js";
|
|
4
4
|
import colors from "colors";
|
|
5
|
-
import
|
|
5
|
+
import { printTable } from "console-table-printer";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -38,10 +38,7 @@ const animeSearch = async (query) => {
|
|
|
38
38
|
}));
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
animeList.printTable();
|
|
44
|
-
|
|
41
|
+
printTable(animeData);
|
|
45
42
|
} catch (err) { console.error(colors.red(err.message)); }
|
|
46
43
|
};
|
|
47
44
|
|
package/functions/bitly.js
CHANGED
package/functions/cryptoList.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// modules
|
|
2
|
-
import axios from "axios";
|
|
2
|
+
import {default as axios} from "axios";
|
|
3
3
|
import { format } from "timeago.js";
|
|
4
4
|
import colors from "colors";
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import { printTable } from "console-table-printer";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// currency format
|
|
9
|
+
import { currency } from "../utils.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
9
12
|
*
|
|
10
13
|
* @descripiton call the crypto market list
|
|
11
14
|
* @returns { Promise<void> } - return results search
|
|
@@ -15,7 +18,7 @@ const cryptoMarket = async () => {
|
|
|
15
18
|
try {
|
|
16
19
|
// start crypto
|
|
17
20
|
const { data } = await axios.get(
|
|
18
|
-
"https://api.coingecko.com/api/v3/coins/markets",{
|
|
21
|
+
"https://api.coingecko.com/api/v3/coins/markets", {
|
|
19
22
|
params: {
|
|
20
23
|
vs_currency: "usd",
|
|
21
24
|
per_page: 10
|
|
@@ -33,17 +36,15 @@ const cryptoMarket = async () => {
|
|
|
33
36
|
}) => ({
|
|
34
37
|
symbol,
|
|
35
38
|
name,
|
|
36
|
-
price: current_price,
|
|
39
|
+
price: currency.format(current_price),
|
|
37
40
|
priceChanged: price_change_percentage_24h > 0
|
|
38
41
|
? colors.green(price_change_percentage_24h)
|
|
39
42
|
: colors.red(price_change_percentage_24h),
|
|
40
43
|
lastUpdated: format(last_updated)
|
|
41
44
|
}));
|
|
42
45
|
|
|
43
|
-
coinTable.addRows(coinList);
|
|
44
|
-
|
|
45
46
|
// print table
|
|
46
|
-
|
|
47
|
+
printTable(coinList);
|
|
47
48
|
} catch (err) {
|
|
48
49
|
// print err message
|
|
49
50
|
console.error(colors.red(err.message));
|
package/functions/gitUser.js
CHANGED