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 CHANGED
@@ -2,6 +2,52 @@
2
2
 
3
3
  stack-analyze all version and notable changes, fixed, remove and new additions in code.
4
4
 
5
+ ## version 1.1.6
6
+ ### Added
7
+ - module stack-analyze mode
8
+ ### fixed
9
+ - rewrite code
10
+ - renove nonolive recommends
11
+ ### changed
12
+ - menu renove
13
+ - renove jsdocs in some function or variables
14
+ - remove nonolive recommends soon in versions desktop 7 and pwa 1.5.0
15
+
16
+ ## version 1.1.5
17
+ ### Added
18
+ - add new tool: movie info
19
+ - add new test
20
+ - renove menu
21
+ ### fixed
22
+ - rewrite in some functions and about
23
+ - remove some dependencies not using project
24
+ ### changed
25
+ - change multibar to 2 single bars
26
+ - change switch in all tools for hash functions tables
27
+ - renove nonolive recommends
28
+
29
+ ## version 1.1.4
30
+ ### Added
31
+ - add new tool: bitly info
32
+ - add new test
33
+ ### fixed
34
+ - rewrite some functions
35
+ - update npm modules via manual
36
+ ### changed
37
+ - no changed
38
+
39
+ ## version 1.1.3
40
+ ### Added
41
+ - add new module: coingecko-api
42
+ - add new tool: crypto market
43
+ - add new recomends
44
+ - add new test
45
+ ### fixed
46
+ - rewrite some functions
47
+ - update npm modules via manual
48
+ ### changed
49
+ - add new const variables for map array functions
50
+
5
51
  ## version 1.1.2
6
52
  ### Added
7
53
  - add new nonolive streamers Recomend
package/about/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // version module
2
- const { version, license } = require("../package.json");
2
+ const { license, version } = require("../package.json");
3
3
 
4
4
  /**
5
- * @type { { mainDeveloper: string, version: string, license: string } }
5
+ * @type {{ mainDeveloper: string, version: string, license: string }}
6
6
  */
7
7
  const aboutApp = {
8
8
  mainDeveloper: "omega5300",
@@ -10,103 +10,47 @@ const aboutApp = {
10
10
  version
11
11
  };
12
12
 
13
- /** @type { string[] } */
14
- const developers = [
15
- "omega5300"
13
+ /**
14
+ * @typedef {Object} ideas
15
+ * @property {string} ideas.author
16
+ * @property {string} ideas.tool
17
+ */
18
+
19
+ /** @type {ideas[]} */
20
+ const ideas = [
21
+ { author: "verguiskarime", tool: "bitly info" }
16
22
  ];
17
23
 
24
+ /** @type { string[] } */
25
+ const developers = [ "omega5300" ];
26
+
18
27
  /**
19
- * @typedef {Object[]} youtubeDev
28
+ * @typedef {Object} youtubeDev
20
29
  * @property {string} youtubeDev.youtubeChannel
21
30
  * @property {string} youtubeDev.recomendation
22
31
  */
23
- const youtubeDev = [
24
- {
25
- youtubeChannel: "fazt",
26
- recomendation: "recommend"
27
- },
28
- {
29
- youtubeChannel: "doriandesings",
30
- recomendation: "recommend"
31
- },
32
- {
33
- youtubeChannel: "bluuweb",
34
- recomendation: "recommend"
35
- },
36
- {
37
- youtubeChannel: "leonidas esteban",
38
- recomendation: "neutral recommend"
39
- },
40
- {
41
- youtubeChannel: "fernando herrera",
42
- recomendation: "recommend"
43
- },
44
- {
45
- youtubeChannel: "soy dalto",
46
- recomendation: "neutral recommend"
47
- },
48
- ];
49
32
 
50
- /**
51
- * @typedef {Object[]} nonolive
52
- * @property {string} nonolive.youtubeChannel
53
- * @property {string} nonolive.recomendation
54
- */
55
- const nonolive = [
56
- {
57
- nonoID: 14278329,
58
- name: "⚔️GothspiceChann💰"
59
- },
60
- {
61
- nonoID: 33519748,
62
- name: "Ly Pháp ❤️",
63
- },
64
- {
65
- nonoID: 28525468,
66
- name: "Seyyahi Solist"
67
- },
68
- {
69
- nonoID: 41145492,
70
- name: "ᴹᴰToni😈🦇Stream"
71
- },
72
- {
73
- nonoID: 35874353,
74
- name: "AlpiCornioRex🦙🦄🦖"
75
- },
76
- {
77
- nonoID: 41135433,
78
- name: "ᴹᴰ🐰CELI🦄🦎"
79
- },
80
- {
81
- nonoID: 17342980,
82
- name: "🎬Sailormoon🌙"
83
- },
84
- {
85
- nonoID: 31655138,
86
- name: "🦎🌟Aidee💋🦜"
87
- },
88
- {
89
- nonoID: 9330839,
90
- name: "🦎🌟GUANI🌻🍦"
91
- }
33
+ /** @type {youtubeDev[]} */
34
+ const youtubeDev = [
35
+ { youtubeChannel: "fazt", recomendation: "recommend" },
36
+ { youtubeChannel: "doriandesings", recomendation: "recommend" },
37
+ { youtubeChannel: "bluuweb", recomendation: "recommend" },
38
+ { youtubeChannel: "leonidas esteban", recomendation: "neutral recommend" },
39
+ { youtubeChannel: "fernando herrera", recomendation: "recommend" },
40
+ { youtubeChannel: "soy dalto", recomendation: "neutral recommend" },
92
41
  ];
93
42
 
94
43
  /** @type { string[] } */
95
- const twitch = [
96
- "lunanny",
97
- "dannyaegyo"
98
- ];
44
+ const twitch = [ "dannyaegyo" ];
99
45
 
100
46
  /** @type { string[] } */
101
- const projects = [
102
- "Doofy's Projects"
103
- ];
47
+ const projects = [ "Doofy's Projects" ];
104
48
 
105
49
  module.exports = {
106
50
  aboutApp,
107
51
  developers,
108
52
  youtubeDev,
109
- nonolive,
110
53
  twitch,
111
- projects
54
+ projects,
55
+ ideas
112
56
  };
package/cli.js ADDED
@@ -0,0 +1,227 @@
1
+ #!/usr/bin/env node
2
+
3
+ // modules
4
+ const { performance } = require("perf_hooks");
5
+ const inquirer = require("inquirer");
6
+ const { textSync } = require("figlet");
7
+ const { yellow, red } = require("colors");
8
+
9
+ // hash tables
10
+ const mainTools = require("./hash/mainTools");
11
+ const hardwareTools = require("./hash/hardwareTools");
12
+ const aboutTool = require("./hash/aboutOpts");
13
+ const infoTools = require("./hash/infoTools");
14
+
15
+ /**
16
+ * @description about menu
17
+ * @return { Promise<void> } about option sections answer
18
+ */
19
+ async function aboutOpts() {
20
+ const { about } = await inquirer.prompt({
21
+ type: "list",
22
+ pageSize: 9,
23
+ name: "about",
24
+ message: "select about option info",
25
+ choices: [
26
+ "main_info",
27
+ "lineup",
28
+ "youtube_recomendation",
29
+ "twitch_recomendation",
30
+ "projects_recomendation",
31
+ "tools_ideas",
32
+ "return to main menu"
33
+ ]
34
+ });
35
+
36
+ if (about !== "return to main menu") {
37
+ aboutTool[about]();
38
+ setTimeout(aboutOpts, 1000);
39
+ } else {
40
+ question();
41
+ }
42
+ }
43
+
44
+ /**
45
+ *
46
+ * @description call the async function return list to question list
47
+ * @return { Promise<void> } - return in boolean a result question list
48
+ *
49
+ */
50
+ async function returnWebQuestion() {
51
+ try {
52
+ const anw = await inquirer.prompt([
53
+ {
54
+ type: "confirm",
55
+ name: "return",
56
+ message: "do you want go to the tools menu?",
57
+ }
58
+ ]);
59
+
60
+ if (anw.return) {
61
+ console.clear();
62
+ mainOptions();
63
+ } else {
64
+ question();
65
+ }
66
+ } catch (err) {
67
+ console.error(red(err.message));
68
+ }
69
+ }
70
+
71
+ /**
72
+ *
73
+ * @description call the async function return list to question list
74
+ * @return { Promise<void> } - return in boolean a result question list
75
+ *
76
+ */
77
+ async function returnInfoQuestion() {
78
+ try {
79
+ const anw = await inquirer.prompt([
80
+ {
81
+ type: "confirm",
82
+ name: "return",
83
+ message: "do you want go to the tools menu?",
84
+ }
85
+ ]);
86
+
87
+ if (anw.return) {
88
+ console.clear();
89
+ infoOpts();
90
+ } else {
91
+ question();
92
+ }
93
+ } catch (err) {
94
+ console.error(red(err.message));
95
+ }
96
+ }
97
+
98
+ /**
99
+ * @description call hardware information options
100
+ * @returns { Promise<void> } hardware options tool
101
+ */
102
+ async function hardwareOpts() {
103
+ const { hardware } = await inquirer.prompt({
104
+ type: "list",
105
+ name: "hardware",
106
+ pageSize: 9,
107
+ message: "select a hardware-information option:",
108
+ choices: [
109
+ "cpu",
110
+ "ram_memory",
111
+ "os",
112
+ "disk",
113
+ "controller",
114
+ "display",
115
+ "bios",
116
+ "exit to main menu"
117
+ ]
118
+ });
119
+
120
+ if(hardware !== "exit to main menu") {
121
+ hardwareTools[hardware]();
122
+ setTimeout(hardwareOpts, 1000);
123
+ } else {
124
+ question();
125
+ }
126
+ }
127
+
128
+ /**
129
+ *
130
+ * @description call the function question web tools options
131
+ * @returns { Promise<void> } return main tools options
132
+ *
133
+ */
134
+ async function mainOptions() {
135
+ const { main } = await inquirer.prompt({
136
+ type: "list",
137
+ pageSize: 9,
138
+ name: "main",
139
+ message: "",
140
+ choices: [
141
+ "single",
142
+ "multiple",
143
+ "pagespeed",
144
+ "return main menu"
145
+ ]
146
+ });
147
+
148
+ if (main !== "return main menu") {
149
+ mainTools[main]();
150
+ const timeEnd = performance.now();
151
+ setTimeout(returnWebQuestion, timeEnd);
152
+ } else {
153
+ question();
154
+ }
155
+ }
156
+
157
+ /**
158
+ *
159
+ * @description call the function question info tools options
160
+ * @returns { Promise<void> } return main tools options
161
+ *
162
+ */
163
+ async function infoOpts() {
164
+ const { info } = await inquirer.prompt({
165
+ type: "list",
166
+ pageSize: 9,
167
+ name: "info",
168
+ message: "enter a info tools option",
169
+ choices: [
170
+ "github_info",
171
+ "anime_search",
172
+ "crypto_market",
173
+ "bitly_info",
174
+ "movie_info",
175
+ "return main menu"
176
+ ]
177
+ });
178
+
179
+ if (info !== "return main menu") {
180
+ infoTools[info]();
181
+ const timeEnd = performance.now();
182
+ setTimeout(returnInfoQuestion, timeEnd);
183
+ } else {
184
+ question();
185
+ }
186
+ }
187
+
188
+
189
+ /**
190
+ *
191
+ * @description call the function question raw list options
192
+ * @returns { Promise<void> } return exit question
193
+ *
194
+ */
195
+ async function question() {
196
+ console.clear();
197
+ console.info(yellow(textSync("stack-analyze")));
198
+ const { analyze } = await inquirer.prompt({
199
+ type: "list",
200
+ name: "analyze",
201
+ message: "what option do you want to analyze stack",
202
+ choices: ["web tools", "info tools", "hardware tools", "about", "exit"]
203
+ });
204
+
205
+ switch (analyze) {
206
+ case "web tools":
207
+ mainOptions();
208
+ break;
209
+ case "info tools":
210
+ infoOpts();
211
+ break;
212
+ case "hardware tools":
213
+ hardwareOpts();
214
+ break;
215
+ case "about":
216
+ aboutOpts();
217
+ break;
218
+ default:
219
+ console.clear();
220
+ console.info("thanks for use stack-analyze".green);
221
+ break;
222
+ }
223
+ }
224
+
225
+ // call the message title and question list
226
+ question();
227
+
@@ -52,13 +52,23 @@ const animeSearch = async (query) => {
52
52
  ]
53
53
  });
54
54
 
55
- animeList.addRows(data.results.map(({ title, episodes, start_date, end_date, type }) => ({
55
+ const animeData = data.results.map(({
56
+ title,
57
+ episodes,
58
+ start_date,
59
+ end_date,
60
+ type }) => ({
56
61
  title,
57
62
  type,
58
63
  episodes,
59
64
  debutDate: format(start_date),
60
- finalDate: end_date === null ? "current date" : format(end_date)
61
- })));
65
+ finalDate: end_date !== null
66
+ ? format(end_date)
67
+ : "current date"
68
+ }));
69
+
70
+
71
+ animeList.addRows(animeData);
62
72
 
63
73
  animeList.printTable();
64
74
 
@@ -0,0 +1,43 @@
1
+ // modules
2
+ const axios = require("axios").default;
3
+ const { format } = require("timeago.js");
4
+ const { red } = require("colors");
5
+
6
+ /**
7
+ *
8
+ * @description call the bitly info data
9
+ * @param { string } link - link for search info
10
+ * @param { string } token - token for using tool
11
+ * @returns { Promise<void> } - return results serach
12
+ *
13
+ */
14
+ const bitlyInfo = async (link, token) => {
15
+ try {
16
+ const { data, status } = await axios.post(
17
+ "https://api-ssl.bitly.com/v4/expand",
18
+ {
19
+ bitlink_id: link
20
+ },
21
+ {
22
+ headers: {
23
+ Authorization: `Bearer ${token}`,
24
+ "Content-Type": "application/json"
25
+ }
26
+ }
27
+ );
28
+
29
+ status === 404
30
+ ? console.info("no found link".green)
31
+ : console.table({
32
+ created_link: format(data.created_at),
33
+ bitly_link: data.link,
34
+ link: data.long_url
35
+ });
36
+ } catch (err) {
37
+ console.error(red(err.message));
38
+ }
39
+ };
40
+
41
+ // export
42
+ module.exports = bitlyInfo;
43
+
@@ -0,0 +1,80 @@
1
+ // modules
2
+ const CoinGecko = require("coingecko-api");
3
+ const { format } = require("timeago.js");
4
+ const { red, green } = require("colors");
5
+ const { Table } = require("console-table-printer");
6
+
7
+ // init coingecko api
8
+ const CoinGeckoClient = new CoinGecko();
9
+
10
+ /*
11
+ *
12
+ * @descripiton call the crypto market list
13
+ * @returns { Promise<void> } - return results search
14
+ *
15
+ */
16
+ const cryptoMarket = async () => {
17
+ try {
18
+ // start crypto
19
+ const coinData = await CoinGeckoClient.coins.markets({
20
+ per_page: 10
21
+ });
22
+
23
+ // map coinData
24
+ const coinList = coinData.data.map(({
25
+ symbol,
26
+ name,
27
+ current_price,
28
+ price_change_percentage_24h,
29
+ last_updated
30
+ }) => ({
31
+ symbol,
32
+ name,
33
+ price: current_price,
34
+ priceChanged: price_change_percentage_24h > 0
35
+ ? green(price_change_percentage_24h)
36
+ : red(price_change_percentage_24h),
37
+ lastUpdated: format(last_updated)
38
+ }));
39
+
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
+ coinTable.addRows(coinList);
71
+
72
+ // print table
73
+ coinTable.printTable();
74
+ } catch (err) {
75
+ // print err message
76
+ console.error(red(err.message));
77
+ }
78
+ };
79
+
80
+ module.exports = cryptoMarket;
@@ -121,15 +121,22 @@ async function osDetail() {
121
121
  async function diskInfo() {
122
122
  try {
123
123
  const disks = await diskLayout();
124
+
125
+ const disksList = disks.map(({
126
+ type,
127
+ name,
128
+ vendor,
129
+ size,
130
+ interfaceType
131
+ }) => ({
132
+ type,
133
+ name,
134
+ vendor,
135
+ diskSize: `${(size / 1073741824).toFixed(2)} GB`,
136
+ interfaceType
137
+ }));
124
138
 
125
- printTable(
126
- disks.map(({ type, name, vendor, size, interfaceType }) => ({
127
- type,
128
- name,
129
- vendor,
130
- disk_size: `${(size / 1073741824).toFixed(2)} GB`,
131
- interfaceType
132
- })));
139
+ printTable(disksList);
133
140
 
134
141
  } catch (err) {
135
142
  console.error(red(err.message));
@@ -146,16 +153,20 @@ async function controllerInfo() {
146
153
  try {
147
154
  const { controllers } = await graphics();
148
155
 
149
- // show results
150
- printTable(controllers.map(({
156
+ const controllersList = controllers.map(({
151
157
  model,
152
158
  vendor,
153
159
  vram
154
160
  }) => ({
155
161
  model,
156
162
  vendor,
157
- vram_size: vram < 1024 ? `${vram} MB` : `${(vram / 1024).toFixed(2)} GB`
158
- })));
163
+ vramSize: vram < 1024
164
+ ? `${vram} MB`
165
+ : `${(vram / 1024).toFixed(2)} GB`
166
+ }));
167
+
168
+ // show results
169
+ printTable(controllersList);
159
170
  } catch (err) {
160
171
  console.error(red(err.message));
161
172
  }
@@ -171,22 +182,22 @@ async function displayInfo() {
171
182
  try {
172
183
  const { displays } = await graphics();
173
184
 
174
- // show results
175
- printTable(displays.map(({
185
+ const displayList = displays.map(({
176
186
  model,
177
187
  main,
178
188
  connection,
179
- // in px
180
189
  resolutionX,
181
190
  resolutionY
182
191
  }) => ({
183
192
  model,
184
193
  main,
185
194
  connection,
186
- // in px
187
195
  resolutionX,
188
196
  resolutionY
189
- })));
197
+ }));
198
+
199
+ // show results
200
+ printTable(displayList);
190
201
  } catch (err) {
191
202
  console.error(red(err.message));
192
203
  }