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 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
- * @type {{ mainDeveloper: string, version: string, license: string }}
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
- * @typedef {Object} ideas
17
- * @property {string} ideas.author
18
- * @property {string} ideas.tool
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
- /** @type {ideas[]} */
22
- const ideas = [
23
- { author: "verguiskarime", tool: "bitly info" }
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
- /** @type { string[] } */
27
- const developers = [ "omega5300" ];
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
- * @typedef {Object} youtubeDev
31
- * @property {string} youtubeDev.youtubeChannel
32
- * @property {string} youtubeDev.recomendation
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
- /** @type {youtubeDev[]} */
36
- const youtubeDev = [
37
- { youtubeChannel: "fazt", recomendation: "recommend" },
38
- { youtubeChannel: "doriandesings", recomendation: "recommend" },
39
- { youtubeChannel: "bluuweb", recomendation: "recommend" },
40
- { youtubeChannel: "leonidas esteban", recomendation: "neutral recommend" },
41
- { youtubeChannel: "fernando herrera", recomendation: "recommend" },
42
- { youtubeChannel: "soy dalto", recomendation: "neutral recommend" },
43
- ];
44
-
45
- /** @type { string[] } */
46
- const twitch = [ "dannyaegyo", "Lunanny" ];
47
-
48
- /** @type { string[] } */
49
- const projects = [ "Doofy's Projects" ];
50
-
51
- export {
52
- aboutApp,
53
- developers,
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 "./hash/hardwareTools.js";
11
- import aboutTool from "./hash/aboutOpts.js";
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
- "main_info",
140
+ "mainInfo",
35
141
  "lineup",
36
- "youtube_recomendation",
37
- "twitch_recomendation",
38
- "projects_recomendation",
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
- @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
- */
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(api_key, query);
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
- "cpu",
256
- "ram_memory",
257
- "os",
258
- "disk",
259
- "controller",
260
- "display",
261
- "bios",
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
+ })
@@ -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 animeList from "../models/animeTable.js";
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
- animeList.addRows(animeData);
42
-
43
- animeList.printTable();
44
-
41
+ printTable(animeData);
45
42
  } catch (err) { console.error(colors.red(err.message)); }
46
43
  };
47
44
 
@@ -1,5 +1,5 @@
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
 
@@ -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 coinTable from "../models/cryptoTables.js";
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
- coinTable.printTable();
47
+ printTable(coinList);
47
48
  } catch (err) {
48
49
  // print err message
49
50
  console.error(colors.red(err.message));
@@ -1,5 +1,5 @@
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