stack-analyze 1.1.5 → 1.1.8
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/.vscode/settings.json +4 -0
- package/CHANGELOG.md +23 -0
- package/{about/index.js → about.js} +13 -26
- package/cli.js +322 -0
- package/functions/animeInfo.js +9 -39
- package/functions/bitly.js +5 -7
- package/functions/cryptoList.js +17 -44
- package/functions/gitUser.js +6 -9
- package/functions/hardware.js +32 -24
- package/functions/moviesInfo.js +9 -38
- package/functions/multipleStack.js +9 -29
- package/functions/pageSpeed.js +13 -13
- package/functions/singleStack.js +9 -32
- package/functions/twitch.js +45 -0
- package/hash/aboutOpts.js +9 -16
- package/hash/hardwareTools.js +3 -3
- package/index.cjs +474 -0
- package/index.mjs +474 -0
- package/models/aboutTables.js +2 -19
- 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 +24 -18
- package/readme.md +2 -2
- package/hash/mainTools.js +0 -145
- package/index.js +0 -170
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
stack-analyze all version and notable changes, fixed, remove and new additions in code.
|
|
4
4
|
|
|
5
|
+
## version 1.1.7
|
|
6
|
+
### Added
|
|
7
|
+
- twitch info tool
|
|
8
|
+
- remove one js module for module to cjs and esm
|
|
9
|
+
### fixed
|
|
10
|
+
- change write token to process.env varaibles own (not avalible values in github and gitlab)
|
|
11
|
+
- migrate cjs to esm
|
|
12
|
+
- rewrite module
|
|
13
|
+
### change
|
|
14
|
+
- except some hardware tools and github using models from console-table-printer
|
|
15
|
+
- now using esm now about is js file not folder about with index.js
|
|
16
|
+
- rewrite all tests functions
|
|
17
|
+
|
|
18
|
+
## version 1.1.6
|
|
19
|
+
### Added
|
|
20
|
+
- module stack-analyze mode
|
|
21
|
+
### fixed
|
|
22
|
+
- rewrite code
|
|
23
|
+
### changed
|
|
24
|
+
- menu renove
|
|
25
|
+
- renove jsdocs in some function or variables
|
|
26
|
+
- remove nonolive recommends soon in versions desktop 7 and pwa 1.5.0
|
|
27
|
+
|
|
5
28
|
## version 1.1.5
|
|
6
29
|
### Added
|
|
7
30
|
- add new tool: movie info
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
1
|
+
// package.json
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
const { license, version } = require("./package.json");
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* @type {{ mainDeveloper: string, version: string, license: string }}
|
|
@@ -7,14 +9,16 @@ const { license } = require("../package.json");
|
|
|
7
9
|
const aboutApp = {
|
|
8
10
|
mainDeveloper: "omega5300",
|
|
9
11
|
license,
|
|
10
|
-
version
|
|
12
|
+
version
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
|
-
* @typedef {Object
|
|
16
|
+
* @typedef {Object} ideas
|
|
15
17
|
* @property {string} ideas.author
|
|
16
18
|
* @property {string} ideas.tool
|
|
17
19
|
*/
|
|
20
|
+
|
|
21
|
+
/** @type {ideas[]} */
|
|
18
22
|
const ideas = [
|
|
19
23
|
{ author: "verguiskarime", tool: "bitly info" }
|
|
20
24
|
];
|
|
@@ -23,10 +27,12 @@ const ideas = [
|
|
|
23
27
|
const developers = [ "omega5300" ];
|
|
24
28
|
|
|
25
29
|
/**
|
|
26
|
-
* @typedef {Object
|
|
30
|
+
* @typedef {Object} youtubeDev
|
|
27
31
|
* @property {string} youtubeDev.youtubeChannel
|
|
28
32
|
* @property {string} youtubeDev.recomendation
|
|
29
33
|
*/
|
|
34
|
+
|
|
35
|
+
/** @type {youtubeDev[]} */
|
|
30
36
|
const youtubeDev = [
|
|
31
37
|
{ youtubeChannel: "fazt", recomendation: "recommend" },
|
|
32
38
|
{ youtubeChannel: "doriandesings", recomendation: "recommend" },
|
|
@@ -36,35 +42,16 @@ const youtubeDev = [
|
|
|
36
42
|
{ youtubeChannel: "soy dalto", recomendation: "neutral recommend" },
|
|
37
43
|
];
|
|
38
44
|
|
|
39
|
-
/**
|
|
40
|
-
* @typedef {Object[]} nonolive
|
|
41
|
-
* @property {string} nonolive.youtubeChannel
|
|
42
|
-
* @property {string} nonolive.recomendation
|
|
43
|
-
*/
|
|
44
|
-
const nonolive = [
|
|
45
|
-
{ nonoID: 14278329, name: "⚔️GothspiceChann💰" },
|
|
46
|
-
{ nonoID: 28525468, name: "Seyyahi Solist" },
|
|
47
|
-
{ nonoID: 41145492, name: "ᴹᴰToniDAle" },
|
|
48
|
-
{ nonoID: 41135433, name: "ᴹᴰ🐰CELI69🦄🦎" },
|
|
49
|
-
{ nonoID: 17342980, name: "🎬Sailormoon🌙" },
|
|
50
|
-
{ nonoID: 31655138, name: "🦎🌟Aidee💋🦜" },
|
|
51
|
-
{ nonoID: 18539967, name: "💋🧉Narki🐺Lili" },
|
|
52
|
-
{ nonoID: 28480328, name: "🌼PAPATYA❣SS🌼" },
|
|
53
|
-
{ nonoID: 31925565, name: "💲💋Lili🧉🌟" },
|
|
54
|
-
{ nonoID: 9330839, name: "🦎🌟GUANI🌻🍦" }
|
|
55
|
-
];
|
|
56
|
-
|
|
57
45
|
/** @type { string[] } */
|
|
58
|
-
const twitch = [ "
|
|
46
|
+
const twitch = [ "dannyaegyo", "Lunanny" ];
|
|
59
47
|
|
|
60
48
|
/** @type { string[] } */
|
|
61
49
|
const projects = [ "Doofy's Projects" ];
|
|
62
50
|
|
|
63
|
-
|
|
51
|
+
export {
|
|
64
52
|
aboutApp,
|
|
65
53
|
developers,
|
|
66
54
|
youtubeDev,
|
|
67
|
-
nonolive,
|
|
68
55
|
twitch,
|
|
69
56
|
projects,
|
|
70
57
|
ideas
|
package/cli.js
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// modules
|
|
4
|
+
import { performance } from "perf_hooks";
|
|
5
|
+
import inquirer from "inquirer";
|
|
6
|
+
import figlet from "figlet";
|
|
7
|
+
import colors from "colors";
|
|
8
|
+
|
|
9
|
+
// hash tables
|
|
10
|
+
import hardwareTools from "./hash/hardwareTools.js";
|
|
11
|
+
import aboutTool from "./hash/aboutOpts.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
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @description about menu
|
|
25
|
+
* @return { Promise<void> } about option sections answer
|
|
26
|
+
*/
|
|
27
|
+
async function aboutOpts() {
|
|
28
|
+
const { about } = await inquirer.prompt({
|
|
29
|
+
type: "list",
|
|
30
|
+
pageSize: 9,
|
|
31
|
+
name: "about",
|
|
32
|
+
message: "select about option info",
|
|
33
|
+
choices: [
|
|
34
|
+
"main_info",
|
|
35
|
+
"lineup",
|
|
36
|
+
"youtube_recomendation",
|
|
37
|
+
"twitch_recomendation",
|
|
38
|
+
"projects_recomendation",
|
|
39
|
+
"tools_ideas",
|
|
40
|
+
"return to main menu"
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
if (about !== "return to main menu") {
|
|
45
|
+
aboutTool[about]();
|
|
46
|
+
setTimeout(aboutOpts, 1000);
|
|
47
|
+
} else {
|
|
48
|
+
question();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* @description call the async function return list to question list
|
|
55
|
+
* @return { Promise<void> } - return in boolean a result question list
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
async function returnQuestion() {
|
|
59
|
+
try {
|
|
60
|
+
const anw = await inquirer.prompt([
|
|
61
|
+
{
|
|
62
|
+
type: "confirm",
|
|
63
|
+
name: "return",
|
|
64
|
+
message: "do you want go to the tools menu?",
|
|
65
|
+
}
|
|
66
|
+
]);
|
|
67
|
+
|
|
68
|
+
if (anw.return) {
|
|
69
|
+
console.clear();
|
|
70
|
+
question();
|
|
71
|
+
} else {
|
|
72
|
+
console.clear();
|
|
73
|
+
console.info("thanks for use stack-analyze".green);
|
|
74
|
+
}
|
|
75
|
+
} catch (err) {
|
|
76
|
+
console.error(colors.red(err.message));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
@description This is a hash table with the options of the tools menu.
|
|
82
|
+
@type {{ single(): void, multiple(): void, pagespeed(): void, github_info(): void, anime_search(): void, crypto_market(): void, bitly_info(): void, movie_info(): void, twitch_info(): void }}
|
|
83
|
+
*/
|
|
84
|
+
const toolsOpts = {
|
|
85
|
+
single() {
|
|
86
|
+
console.clear();
|
|
87
|
+
inquirer.prompt({
|
|
88
|
+
name: "url",
|
|
89
|
+
message: "enter url for analyze the tech stack:"
|
|
90
|
+
}).then(({ url }) => {
|
|
91
|
+
if (url.indexOf("http") === 0) {
|
|
92
|
+
singleStack(url);
|
|
93
|
+
const timeEnd = performance.now();
|
|
94
|
+
setTimeout(returnQuestion, timeEnd);
|
|
95
|
+
} else {
|
|
96
|
+
console.error("please insert a URL with parameter http:// or https://".red);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
multiple() {
|
|
101
|
+
console.clear();
|
|
102
|
+
inquirer.prompt({
|
|
103
|
+
name: "urls",
|
|
104
|
+
message: "enter URLs for analyze the tech stacks with whitespace without quotes example 'http://example.com https://nodejs.org': \n"
|
|
105
|
+
}).then(({ urls }) => {
|
|
106
|
+
|
|
107
|
+
if (
|
|
108
|
+
urls.match(/(http|https)/g) !== null ||
|
|
109
|
+
urls.match(/(http|https)/g) >= 2
|
|
110
|
+
) {
|
|
111
|
+
const websites = urls.split(" ");
|
|
112
|
+
console.clear();
|
|
113
|
+
multipleStack(websites);
|
|
114
|
+
const timeEnd = performance.now();
|
|
115
|
+
setTimeout(returnQuestion, timeEnd);
|
|
116
|
+
} else {
|
|
117
|
+
console.error("please in each URL insert a website the parameter https:// or http://".red);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
pagespeed() {
|
|
122
|
+
console.clear();
|
|
123
|
+
inquirer.prompt({
|
|
124
|
+
name: "speedWeb",
|
|
125
|
+
message: "insert URL for page speed analyze:"
|
|
126
|
+
}).then(({ speedWeb }) => {
|
|
127
|
+
if (speedWeb.indexOf("http") === 0) {
|
|
128
|
+
console.clear();
|
|
129
|
+
|
|
130
|
+
// start pagespeed results mobile
|
|
131
|
+
figlet.textSync(speedWeb, "Small");
|
|
132
|
+
pageSpeed(speedWeb);
|
|
133
|
+
const timeEnd = performance.now();
|
|
134
|
+
setTimeout(returnQuestion, timeEnd);
|
|
135
|
+
} else {
|
|
136
|
+
console.error("please insert a URL with parameter https;// or http://".red);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
github_info() {
|
|
141
|
+
console.clear();
|
|
142
|
+
inquirer.prompt({
|
|
143
|
+
name: "user",
|
|
144
|
+
message: "enter a github user"
|
|
145
|
+
}).then(({ user }) => {
|
|
146
|
+
if (user !== "") {
|
|
147
|
+
console.clear();
|
|
148
|
+
githubInfo(user);
|
|
149
|
+
setTimeout(returnQuestion, 2000);
|
|
150
|
+
} else {
|
|
151
|
+
console.error("please the github username is required".red);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
anime_search() {
|
|
156
|
+
console.clear();
|
|
157
|
+
inquirer.prompt({
|
|
158
|
+
name: "anime",
|
|
159
|
+
message: "enter a anime, movie or ova search"
|
|
160
|
+
}).then(({ anime }) => {
|
|
161
|
+
if (anime !== "") {
|
|
162
|
+
console.clear();
|
|
163
|
+
animeSearch(anime);
|
|
164
|
+
setTimeout(returnQuestion, 2000);
|
|
165
|
+
} else {
|
|
166
|
+
console.error("please the anime is required".red);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
crypto_market() {
|
|
171
|
+
console.clear();
|
|
172
|
+
cryptoMarket();
|
|
173
|
+
setTimeout(returnQuestion, 5000);
|
|
174
|
+
},
|
|
175
|
+
bitly_info() {
|
|
176
|
+
console.clear();
|
|
177
|
+
inquirer.prompt([
|
|
178
|
+
{
|
|
179
|
+
name: "link",
|
|
180
|
+
message: "enter a bitly link without http|https",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: "token",
|
|
184
|
+
message: "enter a bitly token",
|
|
185
|
+
type: "password",
|
|
186
|
+
mask: "?"
|
|
187
|
+
}
|
|
188
|
+
])
|
|
189
|
+
.then(({ link, token }) => {
|
|
190
|
+
bitlyInfo(link, token);
|
|
191
|
+
setTimeout(returnQuestion, 3000);
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
movie_info() {
|
|
195
|
+
console.clear();
|
|
196
|
+
inquirer.prompt([
|
|
197
|
+
{
|
|
198
|
+
name: "api_key",
|
|
199
|
+
message: "insert api key",
|
|
200
|
+
type: "password",
|
|
201
|
+
mask: "?"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "query",
|
|
205
|
+
message: "please search a movie search",
|
|
206
|
+
}
|
|
207
|
+
]).then(({ api_key, query }) => {
|
|
208
|
+
console.clear();
|
|
209
|
+
movieDB(api_key, query);
|
|
210
|
+
setTimeout(returnQuestion, 3000);
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
twitch_info() {
|
|
214
|
+
console.clear();
|
|
215
|
+
inquirer.prompt([
|
|
216
|
+
{
|
|
217
|
+
name: "user",
|
|
218
|
+
message: "get twitch user"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: "twitch_client",
|
|
222
|
+
message: "enter a twitch token client",
|
|
223
|
+
type: "password",
|
|
224
|
+
mask: "*"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: "twitch_token",
|
|
228
|
+
message: "enter a twitch token without the key Bearer",
|
|
229
|
+
type: "password",
|
|
230
|
+
mask: "?"
|
|
231
|
+
}
|
|
232
|
+
]).then(({ user, twitch_client, twitch_token }) => {
|
|
233
|
+
if (user !== "" && twitch_client !== "" && twitch_token !== "") {
|
|
234
|
+
console.clear();
|
|
235
|
+
twitchInfo(user, twitch_client, twitch_token);
|
|
236
|
+
setTimeout(returnQuestion, 3000);
|
|
237
|
+
} else {
|
|
238
|
+
console.error("twitch info fields is required".red);
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* @description call hardware information options
|
|
246
|
+
* @returns { Promise<void> } hardware options tool
|
|
247
|
+
*/
|
|
248
|
+
async function hardwareOpts() {
|
|
249
|
+
const { hardware } = await inquirer.prompt({
|
|
250
|
+
type: "list",
|
|
251
|
+
name: "hardware",
|
|
252
|
+
pageSize: 9,
|
|
253
|
+
message: "select a hardware-information option:",
|
|
254
|
+
choices: [
|
|
255
|
+
"cpu",
|
|
256
|
+
"ram_memory",
|
|
257
|
+
"os",
|
|
258
|
+
"disk",
|
|
259
|
+
"controller",
|
|
260
|
+
"display",
|
|
261
|
+
"bios",
|
|
262
|
+
"exit to main menu"
|
|
263
|
+
]
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
if (hardware !== "exit to main menu") {
|
|
267
|
+
hardwareTools[hardware]();
|
|
268
|
+
setTimeout(hardwareOpts, 1000);
|
|
269
|
+
} else {
|
|
270
|
+
question();
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
*
|
|
276
|
+
* @description call the function question raw list options
|
|
277
|
+
* @returns { Promise<void> } return exit question
|
|
278
|
+
*
|
|
279
|
+
*/
|
|
280
|
+
async function question() {
|
|
281
|
+
console.clear();
|
|
282
|
+
console.info(colors.yellow(figlet.textSync("stack-analyze")));
|
|
283
|
+
const { analyze } = await inquirer.prompt({
|
|
284
|
+
type: "list",
|
|
285
|
+
pageSize: 15,
|
|
286
|
+
name: "analyze",
|
|
287
|
+
message: "what option do you want to analyze stack",
|
|
288
|
+
choices: [
|
|
289
|
+
"single",
|
|
290
|
+
"multiple",
|
|
291
|
+
"pagespeed",
|
|
292
|
+
"github_info",
|
|
293
|
+
"anime_search",
|
|
294
|
+
"crypto_market",
|
|
295
|
+
"bitly_info",
|
|
296
|
+
"movie_info",
|
|
297
|
+
"twitch_info",
|
|
298
|
+
"hardware tools",
|
|
299
|
+
"about",
|
|
300
|
+
"exit"
|
|
301
|
+
]
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
switch (analyze) {
|
|
305
|
+
case "hardware tools":
|
|
306
|
+
hardwareOpts();
|
|
307
|
+
break;
|
|
308
|
+
case "about":
|
|
309
|
+
aboutOpts();
|
|
310
|
+
break;
|
|
311
|
+
case "exit":
|
|
312
|
+
console.clear();
|
|
313
|
+
console.info("thanks for use stack-analyze".green);
|
|
314
|
+
break;
|
|
315
|
+
default:
|
|
316
|
+
toolsOpts[analyze]();
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// call the message title and question list
|
|
322
|
+
question();
|
package/functions/animeInfo.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// modules
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import { format } from "timeago.js";
|
|
4
|
+
import colors from "colors";
|
|
5
|
+
import animeList from "../models/animeTable.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -22,36 +22,6 @@ const animeSearch = async (query) => {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
const animeList = new Table({
|
|
26
|
-
columns: [
|
|
27
|
-
{
|
|
28
|
-
name: "title",
|
|
29
|
-
alignment: "left",
|
|
30
|
-
color: "green"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "type",
|
|
34
|
-
alignment: "left",
|
|
35
|
-
color: "magenta"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: "episodes",
|
|
39
|
-
alignment: "left",
|
|
40
|
-
color: "magenta"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "debutDate",
|
|
44
|
-
alignment: "left",
|
|
45
|
-
color: "magenta"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: "finalDate",
|
|
49
|
-
alignment: "left",
|
|
50
|
-
color: "green"
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
});
|
|
54
|
-
|
|
55
25
|
const animeData = data.results.map(({
|
|
56
26
|
title,
|
|
57
27
|
episodes,
|
|
@@ -62,18 +32,18 @@ const animeSearch = async (query) => {
|
|
|
62
32
|
type,
|
|
63
33
|
episodes,
|
|
64
34
|
debutDate: format(start_date),
|
|
65
|
-
finalDate: end_date !== null
|
|
66
|
-
? format(end_date)
|
|
35
|
+
finalDate: end_date !== null
|
|
36
|
+
? format(end_date)
|
|
67
37
|
: "current date"
|
|
68
38
|
}));
|
|
69
|
-
|
|
39
|
+
|
|
70
40
|
|
|
71
41
|
animeList.addRows(animeData);
|
|
72
42
|
|
|
73
43
|
animeList.printTable();
|
|
74
44
|
|
|
75
|
-
} catch (err) { console.error(red(err.message)); }
|
|
45
|
+
} catch (err) { console.error(colors.red(err.message)); }
|
|
76
46
|
};
|
|
77
47
|
|
|
78
48
|
// exports module
|
|
79
|
-
|
|
49
|
+
export default animeSearch;
|
package/functions/bitly.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// modules
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import { format } from "timeago.js";
|
|
4
|
+
import colors from "colors";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
8
|
* @description call the bitly info data
|
|
9
9
|
* @param { string } link - link for search info
|
|
10
|
-
* @param { string } token - token for using tool
|
|
11
10
|
* @returns { Promise<void> } - return results serach
|
|
12
11
|
*
|
|
13
12
|
*/
|
|
@@ -34,10 +33,9 @@ const bitlyInfo = async (link, token) => {
|
|
|
34
33
|
link: data.long_url
|
|
35
34
|
});
|
|
36
35
|
} catch (err) {
|
|
37
|
-
console.error(red(err.message));
|
|
36
|
+
console.error(colors.red(err.message));
|
|
38
37
|
}
|
|
39
38
|
};
|
|
40
39
|
|
|
41
40
|
// export
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
export default bitlyInfo;
|
package/functions/cryptoList.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
// modules
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const { Table } = require("console-table-printer");
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import { format } from "timeago.js";
|
|
4
|
+
import colors from "colors";
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
const CoinGeckoClient = new CoinGecko();
|
|
6
|
+
import coinTable from "../models/cryptoTables.js";
|
|
9
7
|
|
|
10
8
|
/*
|
|
11
9
|
*
|
|
@@ -16,12 +14,17 @@ const CoinGeckoClient = new CoinGecko();
|
|
|
16
14
|
const cryptoMarket = async () => {
|
|
17
15
|
try {
|
|
18
16
|
// start crypto
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const { data } = await axios.get(
|
|
18
|
+
"https://api.coingecko.com/api/v3/coins/markets",{
|
|
19
|
+
params: {
|
|
20
|
+
vs_currency: "usd",
|
|
21
|
+
per_page: 10
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
);
|
|
22
25
|
|
|
23
26
|
// map coinData
|
|
24
|
-
const coinList =
|
|
27
|
+
const coinList = data.map(({
|
|
25
28
|
symbol,
|
|
26
29
|
name,
|
|
27
30
|
current_price,
|
|
@@ -32,49 +35,19 @@ const cryptoMarket = async () => {
|
|
|
32
35
|
name,
|
|
33
36
|
price: current_price,
|
|
34
37
|
priceChanged: price_change_percentage_24h > 0
|
|
35
|
-
? green(price_change_percentage_24h)
|
|
36
|
-
: red(price_change_percentage_24h),
|
|
38
|
+
? colors.green(price_change_percentage_24h)
|
|
39
|
+
: colors.red(price_change_percentage_24h),
|
|
37
40
|
lastUpdated: format(last_updated)
|
|
38
41
|
}));
|
|
39
42
|
|
|
40
|
-
// init table
|
|
41
|
-
const coinTable = new Table({
|
|
42
|
-
columns: [
|
|
43
|
-
{
|
|
44
|
-
name: "symbol",
|
|
45
|
-
alignment: "left",
|
|
46
|
-
color: "green"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: "name",
|
|
50
|
-
alignment: "left",
|
|
51
|
-
color: "white_bold"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: "price",
|
|
55
|
-
alignment: "left",
|
|
56
|
-
color: "yellow"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: "priceChanged",
|
|
60
|
-
alignment: "left"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: "lastUpdated",
|
|
64
|
-
alignment: "left",
|
|
65
|
-
color: "magenta"
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
});
|
|
69
|
-
|
|
70
43
|
coinTable.addRows(coinList);
|
|
71
44
|
|
|
72
45
|
// print table
|
|
73
46
|
coinTable.printTable();
|
|
74
47
|
} catch (err) {
|
|
75
48
|
// print err message
|
|
76
|
-
console.error(red(err.message));
|
|
49
|
+
console.error(colors.red(err.message));
|
|
77
50
|
}
|
|
78
51
|
};
|
|
79
52
|
|
|
80
|
-
|
|
53
|
+
export default cryptoMarket;
|
package/functions/gitUser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// modules
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import { format } from "timeago.js";
|
|
4
|
+
import colors from "colors";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
@@ -10,7 +10,7 @@ const { red, yellow } = require("colors");
|
|
|
10
10
|
* @returns { Promise<void> } - return results info
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
|
-
async function githubInfo(user) {
|
|
13
|
+
export default async function githubInfo(user) {
|
|
14
14
|
try {
|
|
15
15
|
const res = await axios.get(`https://api.github.com/users/${user}`);
|
|
16
16
|
|
|
@@ -30,12 +30,9 @@ async function githubInfo(user) {
|
|
|
30
30
|
|
|
31
31
|
console.table(info);
|
|
32
32
|
} else {
|
|
33
|
-
console.info(yellow(res.status.toString()));
|
|
33
|
+
console.info(colors.yellow(res.status.toString()));
|
|
34
34
|
}
|
|
35
35
|
} catch(err) {
|
|
36
|
-
console.error(red(err.message));
|
|
36
|
+
console.error(colors.red(err.message));
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
module.exports = githubInfo;
|
|
41
|
-
|