stack-analyze 1.1.5 → 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,17 @@
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
+
5
16
  ## version 1.1.5
6
17
  ### Added
7
18
  - add new tool: movie info
package/about/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // version module
2
- const { license } = require("../package.json");
2
+ const { license, version } = require("../package.json");
3
3
 
4
4
  /**
5
5
  * @type {{ mainDeveloper: string, version: string, license: string }}
@@ -7,14 +7,16 @@ const { license } = require("../package.json");
7
7
  const aboutApp = {
8
8
  mainDeveloper: "omega5300",
9
9
  license,
10
- version: process.env.npm_package_version
10
+ version
11
11
  };
12
12
 
13
13
  /**
14
- * @typedef {Object[]} ideas
14
+ * @typedef {Object} ideas
15
15
  * @property {string} ideas.author
16
16
  * @property {string} ideas.tool
17
17
  */
18
+
19
+ /** @type {ideas[]} */
18
20
  const ideas = [
19
21
  { author: "verguiskarime", tool: "bitly info" }
20
22
  ];
@@ -23,10 +25,12 @@ const ideas = [
23
25
  const developers = [ "omega5300" ];
24
26
 
25
27
  /**
26
- * @typedef {Object[]} youtubeDev
28
+ * @typedef {Object} youtubeDev
27
29
  * @property {string} youtubeDev.youtubeChannel
28
30
  * @property {string} youtubeDev.recomendation
29
31
  */
32
+
33
+ /** @type {youtubeDev[]} */
30
34
  const youtubeDev = [
31
35
  { youtubeChannel: "fazt", recomendation: "recommend" },
32
36
  { youtubeChannel: "doriandesings", recomendation: "recommend" },
@@ -36,26 +40,8 @@ const youtubeDev = [
36
40
  { youtubeChannel: "soy dalto", recomendation: "neutral recommend" },
37
41
  ];
38
42
 
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
43
  /** @type { string[] } */
58
- const twitch = [ "lunanny", "dannyaegyo" ];
44
+ const twitch = [ "dannyaegyo" ];
59
45
 
60
46
  /** @type { string[] } */
61
47
  const projects = [ "Doofy's Projects" ];
@@ -64,7 +50,6 @@ module.exports = {
64
50
  aboutApp,
65
51
  developers,
66
52
  youtubeDev,
67
- nonolive,
68
53
  twitch,
69
54
  projects,
70
55
  ideas
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
+
package/hash/aboutOpts.js CHANGED
@@ -34,11 +34,6 @@ const aboutTool = {
34
34
  youtubeDevTable.addRows(youtubeDev);
35
35
  youtubeDevTable.printTable();
36
36
  },
37
- nonolive_recomendation() {
38
- console.clear();
39
- nonoliveTable.addRows(nonolive);
40
- nonoliveTable.printTable();
41
- },
42
37
  twitch_recomendation() {
43
38
  console.clear();
44
39
  const streamers = twitch.map((streamer, i) => ({ index: i + 1, streamer }));
@@ -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;
package/hash/mainTools.js CHANGED
@@ -10,23 +10,8 @@ const multipleStack = require("../functions/multipleStack");
10
10
  // pagespeed web
11
11
  const pageSpeed = require("../functions/pageSpeed");
12
12
 
13
- // github info
14
- const githubInfo = require("../functions/gitUser");
15
-
16
- // anime search
17
- const animeSearch = require("../functions/animeInfo");
18
-
19
- // crypto market
20
- const cryptoMarket = require("../functions/cryptoList");
21
-
22
- // bitly
23
- const bitlyInfo = require("../functions/bitly");
24
-
25
- // movies
26
- const movieDB = require("../functions/moviesInfo");
27
-
28
13
  /**
29
- * @type {{ single(): Promise<void>, multiple(): Promise<void>, pagespeed(): Promise<void>, github_info(): Promise<void>, anime_search(): Promise<void>, cryto_market(): void, bitly_info(): Promise<void>, movie_info(): Promise<void> }}
14
+ * @type {{ single(): Promise<void>, multiple(): Promise<void>, pagespeed(): Promise<void> }}
30
15
  */
31
16
  const mainTools = {
32
17
  async single() {
@@ -75,69 +60,6 @@ const mainTools = {
75
60
  } else {
76
61
  console.error("please insert a URL with parameter https;// or http://".red);
77
62
  }
78
- },
79
- async github_info() {
80
- const { user } = await inquirer.prompt({
81
- name: "user",
82
- message: "enter a github user"
83
- });
84
-
85
- if (user !== "") {
86
- console.clear();
87
- githubInfo(user);
88
- } else {
89
- console.error("please the github username is required".red);
90
- }
91
- },
92
- async anime_search() {
93
- const { anime } = await inquirer.prompt({
94
- name: "anime",
95
- message: "enter a anime, movie or ova search"
96
- });
97
-
98
- if (anime !== "") {
99
- console.clear();
100
- animeSearch(anime);
101
- } else {
102
- console.error("please the anime is required".red);
103
- }
104
- },
105
- cryto_market() {
106
- console.clear();
107
- cryptoMarket();
108
- },
109
- async bitly_info() {
110
- console.clear();
111
- const { link, token } = await inquirer.prompt([
112
- {
113
- name: "link",
114
- message: "enter a bitly link without http|https",
115
- },
116
- {
117
- name: "token",
118
- message: "enter a bitly token",
119
- type: "password",
120
- mask: "?"
121
- }
122
- ]);
123
-
124
- bitlyInfo(link, token);
125
- },
126
- async movie_info() {
127
- const { api_key, query } = await inquirer.prompt([
128
- {
129
- name: "api_key",
130
- message: "insert api key",
131
- type: "password",
132
- mask: "?"
133
- },
134
- {
135
- name: "query",
136
- message: "please search a movie search",
137
- }
138
- ]);
139
-
140
- movieDB(api_key, query);
141
63
  }
142
64
  };
143
65
 
package/index.js CHANGED
@@ -1,170 +1,359 @@
1
- #!/usr/bin/env node
2
-
3
1
  // 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
-
14
- /**
15
- * @description about menu
16
- * @return { Promise<void> } about option sections answer
17
- */
18
- async function aboutOpts() {
19
- const { about } = await inquirer.prompt({
20
- type: "list",
21
- pageSize: 9,
22
- name: "about",
23
- message: "select about option info",
24
- choices: [
25
- "main_info",
26
- "lineup",
27
- "youtube_recomendation",
28
- "nonolive_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
- }
2
+ const axios = require("axios").default;
3
+ const CoinGecko = require("coingecko-api");
4
+ const {
5
+ cpu,
6
+ mem,
7
+ osInfo,
8
+ diskLayout,
9
+ graphics,
10
+ bios
11
+ } = require("systeminformation");
12
+ const Wappalyzer = require("wappalyzer");
43
13
 
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 returnQuestion() {
14
+ // init coingecko api
15
+ const CoinGeckoClient = new CoinGecko();
16
+
17
+ // functions
18
+
19
+ const animeSearch = async (query) => {
20
+ /* error manager */
21
+ try {
22
+ // call api
23
+ const { data } = await axios.get("https://api.jikan.moe/v3/search/anime", {
24
+ params: {
25
+ q: query,
26
+ limit: 10
27
+ }
28
+ });
29
+
30
+ return data.results;
31
+
32
+ } catch (err) { return err; }
33
+ };
34
+
35
+ const bitlyInfo = async (link, token) => {
51
36
  try {
52
- const anw = await inquirer.prompt([
37
+ const { data } = await axios.post(
38
+ "https://api-ssl.bitly.com/v4/expand",
39
+ {
40
+ bitlink_id: link
41
+ },
53
42
  {
54
- type: "confirm",
55
- name: "return",
56
- message: "do you want go to the tools menu?",
43
+ headers: {
44
+ Authorization: `Bearer ${token}`,
45
+ "Content-Type": "application/json"
46
+ }
57
47
  }
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
- }
48
+ );
49
+
50
+ return data;
51
+ } catch (err) { return err; }
52
+ };
70
53
 
71
- /**
72
- * @description call hardware information options
73
- * @returns { Promise<void> } hardware options tool
54
+ /*
55
+ *
56
+ * @descripiton call the crypto market list
57
+ * @returns { Promise<void> } - return results search
58
+ *
74
59
  */
75
- async function hardwareOpts() {
76
- const { hardware } = await inquirer.prompt({
77
- type: "list",
78
- name: "hardware",
79
- pageSize: 9,
80
- message: "select a hardware-information option:",
81
- choices: [
82
- "cpu",
83
- "ram_memory",
84
- "os",
85
- "disk",
86
- "controller",
87
- "display",
88
- "bios",
89
- "exit to main menu"
90
- ]
91
- });
92
-
93
- if(hardware !== "exit to main menu") {
94
- hardwareTools[hardware]();
95
- setTimeout(hardwareOpts, 1000);
96
- } else {
97
- question();
98
- }
60
+ const cryptoMarket = async () => {
61
+ try {
62
+ // start crypto
63
+ const coinData = await CoinGeckoClient.coins.markets({
64
+ per_page: 10
65
+ });
66
+
67
+ // map coinData
68
+ return coinData.data;
69
+ } catch (err) { return err; }
70
+ };
71
+
72
+ async function githubInfo(user) {
73
+ try {
74
+ const { data } = await axios.get(`https://api.github.com/users/${user}`);
75
+
76
+ return data;
77
+ } catch (err) { return err; }
99
78
  }
100
79
 
101
- /**
102
- *
103
- * @description call the function question raw list options
104
- * @returns { Promise<void> } return main tools options
105
- *
106
- */
107
- async function mainOptions() {
108
- const { main } = await inquirer.prompt({
109
- type: "list",
110
- pageSize: 9,
111
- name: "main",
112
- message: "",
113
- choices: [
114
- "single",
115
- "multiple",
116
- "pagespeed",
117
- "github_info",
118
- "anime_search",
119
- "cryto_market",
120
- "bitly_info",
121
- "movie_info",
122
- "return main menu"
123
- ]
124
- });
125
-
126
- if (main !== "return main menu") {
127
- mainTools[main]();
128
- const timeEnd = performance.now();
129
- setTimeout(returnQuestion, timeEnd);
130
- } else {
131
- question();
132
- }
80
+ async function cpuInfo() {
81
+ try {
82
+ const {
83
+ manufacturer,
84
+ brand,
85
+ speed,
86
+ cores,
87
+ physicalCores,
88
+ processors,
89
+ vendor,
90
+ family,
91
+ model
92
+ } = await cpu();
93
+
94
+ // show results
95
+ return {
96
+ manufacturer,
97
+ brand,
98
+ speed,
99
+ cores,
100
+ physicalCores,
101
+ processors,
102
+ vendor,
103
+ family,
104
+ model
105
+ };
106
+ } catch (err) { return err; }
133
107
  }
134
108
 
135
- /**
136
- *
137
- * @description call the function question raw list options
138
- * @returns { Promise<void> } return exit question
139
- *
140
- */
141
- async function question() {
142
- console.clear();
143
- console.info(yellow(textSync("stack-analyze")));
144
- const { analyze } = await inquirer.prompt({
145
- type: "list",
146
- name: "analyze",
147
- message: "what option do you want to analyze stack",
148
- choices: ["main tools", "hardware tools", "about", "exit"]
149
- });
150
-
151
- switch (analyze) {
152
- case "main tools":
153
- mainOptions();
154
- break;
155
- case "hardware tools":
156
- hardwareOpts();
157
- break;
158
- case "about":
159
- aboutOpts();
160
- break;
161
- default:
162
- console.clear();
163
- console.info("thanks for use stack-analyze".green);
164
- break;
165
- }
109
+ async function ramMemInfo() {
110
+ try {
111
+ const {
112
+ total,
113
+ free,
114
+ used,
115
+ active,
116
+ available
117
+ } = await mem();
118
+
119
+ // show results
120
+ return {
121
+ total_mem: `${(total / 1073741824).toFixed(2)} GB`,
122
+ free_mem: `${(free / 1073741824).toFixed(2)} GB`,
123
+ used_mem: `${(used / 1073741824).toFixed(2)} GB`,
124
+ active_mem: `${(active / 1073741824).toFixed(2)} GB`,
125
+ available_mem: `${(available / 1073741824).toFixed(2)} GB`
126
+ };
127
+ } catch (err) { return err; }
128
+ }
129
+
130
+ async function osDetail() {
131
+ try {
132
+ const {
133
+ hostname,
134
+ platform,
135
+ distro,
136
+ release,
137
+ kernel,
138
+ arch,
139
+ serial,
140
+ uefi
141
+ } = await osInfo();
142
+
143
+ // show results
144
+ return {
145
+ hostname,
146
+ platform,
147
+ distro,
148
+ release,
149
+ kernel,
150
+ arch,
151
+ serial,
152
+ uefi
153
+ };
154
+ } catch (err) { return err; }
155
+ }
156
+
157
+ async function diskInfo() {
158
+ try {
159
+ const disks = await diskLayout();
160
+
161
+ const disksList = disks.map(({
162
+ type,
163
+ name,
164
+ vendor,
165
+ size,
166
+ interfaceType
167
+ }) => ({
168
+ type,
169
+ name,
170
+ vendor,
171
+ diskSize: `${(size / 1073741824).toFixed(2)} GB`,
172
+ interfaceType
173
+ }));
174
+
175
+ return disksList;
176
+
177
+ } catch (err) { return err; }
178
+ }
179
+
180
+ async function controllerInfo() {
181
+ try {
182
+ const { controllers } = await graphics();
183
+
184
+ const controllersList = controllers.map(({
185
+ model,
186
+ vendor,
187
+ vram
188
+ }) => ({
189
+ model,
190
+ vendor,
191
+ vramSize: vram < 1024
192
+ ? `${vram} MB`
193
+ : `${(vram / 1024).toFixed(2)} GB`
194
+ }));
195
+
196
+ return controllersList;
197
+ } catch (err) { return err; }
198
+ }
199
+
200
+ async function displayInfo() {
201
+ try {
202
+ const { displays } = await graphics();
203
+
204
+ const displayList = displays.map(({
205
+ model,
206
+ main,
207
+ connection,
208
+ resolutionX,
209
+ resolutionY
210
+ }) => ({
211
+ model,
212
+ main,
213
+ connection,
214
+ resolutionX,
215
+ resolutionY
216
+ }));
217
+
218
+ return displayList;
219
+ } catch (err) { return err; }
220
+ }
221
+
222
+ async function biosInfo() {
223
+ try {
224
+ const {
225
+ releaseDate,
226
+ vendor,
227
+ revision,
228
+ version
229
+ } = await bios();
230
+
231
+ return { releaseDate, vendor, revision, version };
232
+ } catch (err) { return err; }
233
+ }
234
+
235
+ const movieDB = async (api_key, query) => {
236
+ try {
237
+ const { data } = await axios.get("https://api.themoviedb.org/3/search/movie", {
238
+ params: {
239
+ api_key,
240
+ query,
241
+ page: 1
242
+ }
243
+ });
244
+
245
+ const movieData = data.results
246
+ .map(({
247
+ title,
248
+ original_language,
249
+ popularity,
250
+ vote_average,
251
+ release_date
252
+ }) => ({
253
+ title,
254
+ original_language,
255
+ popularity,
256
+ vote_average,
257
+ release_date
258
+ }))
259
+ .sort((x, y) => {
260
+ // date values
261
+ const primaryDate = new Date(x.release_date);
262
+ const secondaryDate = new Date(y.release_date);
263
+
264
+ return primaryDate.getTime() - secondaryDate.getTime();
265
+ })
266
+ .filter(({ release_date }) => release_date !== undefined && release_date !== "");
267
+
268
+ return movieData;
269
+ } catch (err) { return err; }
270
+ };
271
+
272
+ async function multipleStack(urls) {
273
+ let result;
274
+ const wappalyzer = new Wappalyzer();
275
+ try {
276
+ await wappalyzer.init();
277
+ result = await Promise.all(
278
+ urls.map(async (url) => {
279
+ const { technologies } = await wappalyzer.open(url).analyze();
280
+ return {
281
+ url,
282
+ technologies
283
+ };
284
+ })
285
+ );
286
+ } catch (err) { result = err; }
287
+ await wappalyzer.destroy();
288
+ return result;
289
+ }
290
+
291
+ const pageSpeed = async (url) => {
292
+ try {
293
+ const resMobile = await axios.get("https://www.googleapis.com/pagespeedonline/v5/runPagespeed", {
294
+ params: {
295
+ url,
296
+ key: "AIzaSyBEDaW4FxSZ2s1vz5CdD5Ai6PGZGdAzij0",
297
+ strategy: "mobile"
298
+ }
299
+ });
300
+
301
+ const resDesktop = await axios.get("https://www.googleapis.com/pagespeedonline/v5/runPagespeed", {
302
+ params: {
303
+ url,
304
+ key: "AIzaSyBEDaW4FxSZ2s1vz5CdD5Ai6PGZGdAzij0",
305
+ strategy: "desktop"
306
+ }
307
+ });
308
+
309
+ // extract results
310
+ const mobile = Math.round(resMobile.data.lighthouseResult.categories.performance.score * 100);
311
+ const desktop = Math.round(resDesktop.data.lighthouseResult.categories.performance.score * 100);
312
+
313
+ return {mobile, desktop};
314
+ } catch (err) { return err; }
315
+ };
316
+
317
+ async function singleStack(url) {
318
+ const wappalyzer = await new Wappalyzer;
319
+
320
+ let result;
321
+ try {
322
+ await wappalyzer.init();
323
+
324
+ const { technologies } = await wappalyzer.open(url).analyze();
325
+
326
+ result = technologies.map(({
327
+ name,
328
+ website,
329
+ categories
330
+ }) => ({
331
+ techName: name,
332
+ techWebsite: website,
333
+ techCategories: categories.map(({ name }) => name).join(", ")
334
+ }));
335
+ } catch (err) { result = err; }
336
+
337
+ await wappalyzer.destroy();
338
+ return result;
166
339
  }
167
340
 
168
- // call the message title and question list
169
- question();
170
341
 
342
+ // exports
343
+ exports = {
344
+ animeSearch,
345
+ bitlyInfo,
346
+ cryptoMarket,
347
+ githubInfo,
348
+ controllerInfo,
349
+ osDetail,
350
+ diskInfo,
351
+ displayInfo,
352
+ biosInfo,
353
+ cpuInfo,
354
+ ramMemInfo,
355
+ movieDB,
356
+ multipleStack,
357
+ pageSpeed,
358
+ singleStack
359
+ };
@@ -17,22 +17,6 @@ const youtubeDevTable = new Table({
17
17
  ]
18
18
  });
19
19
 
20
- // nonolive model
21
- const nonoliveTable = new Table({
22
- columns: [
23
- {
24
- name: "nonoID",
25
- alignment: "left",
26
- color: "red"
27
- },
28
- {
29
- name: "name",
30
- alignment: "left",
31
- color: "yellow"
32
- }
33
- ]
34
- });
35
-
36
20
  // ideas model
37
21
  const ideasTable = new Table({
38
22
  columns: [
@@ -52,6 +36,5 @@ const ideasTable = new Table({
52
36
  // exports tables
53
37
  module.exports = {
54
38
  youtubeDevTable,
55
- nonoliveTable,
56
39
  ideasTable
57
40
  };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "stack-analyze",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "cli tech stack analyze and pagespeed with node.js using the wappalyzer module. with google pagespeed api, hardware and crypto market",
5
5
  "main": "index.js",
6
6
  "bin": {
7
- "stack-analyze": "index.js"
7
+ "stack-analyze": "cli.js"
8
8
  },
9
9
  "dependencies": {
10
10
  "axios": "^0.21.4",
@@ -26,7 +26,7 @@
26
26
  "minami": "^1.2.3"
27
27
  },
28
28
  "scripts": {
29
- "start": "node index.js",
29
+ "start": "node cli.js",
30
30
  "test": "jest",
31
31
  "lint:test": "eslint . --ext .js",
32
32
  "lint:fix": "eslint . --ext .js --fix",