stack-analyze 1.2.1 → 1.2.3

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.
@@ -0,0 +1,57 @@
1
+ // inquirer
2
+ import inquirer from "inquirer";
3
+
4
+ // functions
5
+ import bitlyInfo from "../functions/bitly.js";
6
+ import cryptoMarket from "../functions/cryptoList.js";
7
+ import githubInfo from "../functions/gitUser.js";
8
+ import bundlephobia from "../functions/bundlephobia.js";
9
+
10
+ // fields
11
+ import {
12
+ bitlyQuery,
13
+ promptParams,
14
+ promptKey
15
+ } from "../validations/infoValidations.js";
16
+
17
+ const infoTools = {
18
+ github_info(refreshCallback) {
19
+ console.clear();
20
+ inquirer.prompt([
21
+ promptParams("gitUser", "enter a github user for search")
22
+ ])
23
+ .then(({ gitUser }) => {
24
+ githubInfo(gitUser);
25
+ setTimeout(refreshCallback, 2e3);
26
+ });
27
+ },
28
+ bitly_info(refreshCallback) {
29
+ console.clear();
30
+ inquirer.prompt([
31
+ bitlyQuery,
32
+ promptKey("token", "enter a bitly token")
33
+ ])
34
+ .then(({ bitlyLink, token }) => {
35
+ bitlyInfo(bitlyLink, token);
36
+ setTimeout(refreshCallback, 2e3);
37
+ });
38
+ },
39
+ crypto_market(refreshCallback) {
40
+ console.clear();
41
+ cryptoMarket();
42
+ setTimeout(refreshCallback, 5e3);
43
+ },
44
+ bundlephobia_info(refreshCallback) {
45
+ console.clear();
46
+ inquirer.prompt([
47
+ promptParams("pkgName", "enter a npm package name for search info size")
48
+ ])
49
+ .then(({ pkgName }) => {
50
+ console.info(pkgName)
51
+ bundlephobia(pkgName);
52
+ setTimeout(refreshCallback, 2e3);
53
+ });
54
+ },
55
+ };
56
+
57
+ export default infoTools;
@@ -2,31 +2,19 @@
2
2
  import inquirer from "inquirer";
3
3
 
4
4
  // functions
5
- import genPassword from "../functions/password.js";
6
- import bitlyInfo from "../functions/bitly.js";
7
- import cryptoMarket from "../functions/cryptoList.js";
8
- import githubInfo from "../functions/gitUser.js";
9
5
  import animeSearch from "../functions/animeInfo.js";
10
6
  import movieDB from "../functions/moviesInfo.js";
11
7
  import twitchInfo from "../functions/twitch.js";
12
8
 
13
9
  // fields
14
10
  import {
15
- bitlyQuery,
16
11
  promptParams,
17
12
  promptKey
18
13
  } from "../validations/infoValidations.js";
19
14
 
20
15
  /** query tools */
21
16
  const queryTools = {
22
- github_info(refreshCallback) {
23
- console.clear();
24
- inquirer.prompt([promptParams("gitUser", "enter a github user for search")])
25
- .then(({ gitUser }) => {
26
- githubInfo(gitUser);
27
- setTimeout(refreshCallback, 2e3);
28
- });
29
- },
17
+
30
18
  anime_Search(refreshCallback) {
31
19
  console.clear();
32
20
  inquirer.prompt([promptParams("query", "")])
@@ -35,14 +23,6 @@ const queryTools = {
35
23
  setTimeout(refreshCallback, 2e3);
36
24
  });
37
25
  },
38
- bitly_info(refreshCallback) {
39
- console.clear();
40
- inquirer.prompt([bitlyQuery, promptKey("token", "enter a bitly token")])
41
- .then(({ bitlyLink, token }) => {
42
- bitlyInfo(bitlyLink, token);
43
- setTimeout(refreshCallback, 2e3);
44
- });
45
- },
46
26
  movie_info(refreshCallback) {
47
27
  console.clear();
48
28
  inquirer.prompt([
@@ -57,24 +37,15 @@ const queryTools = {
57
37
  twitch_info(refreshCallback) {
58
38
  console.clear();
59
39
  inquirer.prompt([
60
- promptParams("twitchUser", "enter a twitch user"),
40
+ promptParams("twitchSeparator", "enter a separator for split"),
41
+ promptParams("twitchUsers", "enter a twitch user"),
61
42
  promptKey("twitchClient", "enter a twitch client ID"),
62
43
  promptKey("twitchToken", "enter a twitch token"),
63
44
  ])
64
- .then(({twitchUser, twitchClient, twitchToken}) => {
65
- twitchInfo(twitchUser, twitchClient, twitchToken);
45
+ .then(({ twitchSeparator, twitchUsers, twitchClient, twitchToken }) => {
46
+ twitchInfo({ twitchSeparator, twitchUsers, twitchClient, twitchToken });
66
47
  setTimeout(refreshCallback, 2e3);
67
48
  });
68
- },
69
- crypto_market(refreshCallback) {
70
- console.clear();
71
- cryptoMarket();
72
- setTimeout(refreshCallback, 5e3);
73
- },
74
- password(refreshCallback) {
75
- console.clear();
76
- genPassword();
77
- setTimeout(refreshCallback, 3e3);
78
49
  }
79
50
  };
80
51
 
@@ -0,0 +1,21 @@
1
+ // functions
2
+ import genPassword from "../functions/password.js";
3
+ import hardware from "../functions/hardware.js";
4
+
5
+ // opts
6
+ import { menuHardwareOpts } from "../utils.js";
7
+
8
+ const utilityTools = {
9
+ password(refreshCallback) {
10
+ console.clear();
11
+ genPassword();
12
+ setTimeout(refreshCallback, 3e3);
13
+ },
14
+ async hardware(refreshCallback) {
15
+ console.clear();
16
+ hardware();
17
+ setTimeout(refreshCallback, 3e3);
18
+ }
19
+ };
20
+
21
+ export default utilityTools;
package/index.cjs CHANGED
@@ -443,6 +443,26 @@ const password = () => {
443
443
  return password;
444
444
  };
445
445
 
446
+ const bundlephobia = async (pkg) {
447
+ try {
448
+ const { data } = await axios.get("https://bundlephobia.com/api/size", {
449
+ params: { package: pkg }
450
+ });
451
+
452
+ console.table({
453
+ module_name: data.name,
454
+ module_version: data.version,
455
+ module_repo: data.repository,
456
+ module_size: kilobyteConvert(data.size),
457
+ module_gzip: kilobyteConvert(data.gzip),
458
+ });
459
+
460
+ stackSave(`${pkg}-pkg-info.json`, JSON.stringify(data, null, 2));
461
+ } catch (err) {
462
+ console.error(colors.red(err.message));
463
+ }
464
+ };
465
+
446
466
  // exports
447
467
  module.exports = {
448
468
  animeSearch,
@@ -462,5 +482,6 @@ module.exports = {
462
482
  singleStack,
463
483
  twitchInfo,
464
484
  scrape,
465
- password
485
+ password,
486
+ bundlephobia
466
487
  };
package/index.mjs CHANGED
@@ -442,6 +442,26 @@ const password = () => {
442
442
  return password;
443
443
  };
444
444
 
445
+ const bundlephobia = async (pkg) {
446
+ try {
447
+ const { data } = await axios.get("https://bundlephobia.com/api/size", {
448
+ params: { package: pkg }
449
+ });
450
+
451
+ console.table({
452
+ module_name: data.name,
453
+ module_version: data.version,
454
+ module_repo: data.repository,
455
+ module_size: kilobyteConvert(data.size),
456
+ module_gzip: kilobyteConvert(data.gzip),
457
+ });
458
+
459
+ stackSave(`${pkg}-pkg-info.json`, JSON.stringify(data, null, 2));
460
+ } catch (err) {
461
+ console.error(colors.red(err.message));
462
+ }
463
+ };
464
+
445
465
  // exports
446
466
  export {
447
467
  animeSearch,
@@ -461,5 +481,6 @@ export {
461
481
  singleStack,
462
482
  twitchInfo,
463
483
  scrape,
464
- password
484
+ password,
485
+ bundlephobia
465
486
  };
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stack-analyze",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "type": "module",
5
5
  "description": "cli tech stack analyze and pagespeed with node.js using the wappalyzer module. with google pagespeed api, hardware and crypto market",
6
6
  "main": "index.mjs",
@@ -14,23 +14,23 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "axios": "^1.1.3",
17
+ "axios": "^1.3.4",
18
18
  "cheerio": "^1.0.0-rc.12",
19
- "cli-progress": "^3.11.2",
19
+ "cli-progress": "^3.12.0",
20
20
  "colors": "^1.4.0",
21
21
  "console-table-printer": "^2.11.1",
22
22
  "figlet": "^1.5.2",
23
23
  "gauge": "^5.0.0",
24
24
  "inquirer": "^9.1.4",
25
- "systeminformation": "^5.12.11",
25
+ "systeminformation": "^5.17.12",
26
26
  "timeago.js": "^4.0.2",
27
- "wappalyzer": "^6.10.41"
27
+ "wappalyzer": "^6.10.55"
28
28
  },
29
29
  "devDependencies": {
30
- "eslint": "^8.26.0",
31
- "gh-pages": "^4.0.0",
32
- "jest": "^29.2.2",
33
- "jsdoc": "^3.6.11"
30
+ "eslint": "^8.35.0",
31
+ "gh-pages": "^5.0.0",
32
+ "jest": "^29.4.3",
33
+ "jsdoc": "^4.0.2"
34
34
  },
35
35
  "scripts": {
36
36
  "start": "node cli.js",
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # stack analyze
2
2
 
3
- ![logo](logo-module.png)
3
+ ![logo](logo-module.webp)
4
4
 
5
5
  ***
6
6
  [![StackShare](https://img.shields.io/badge/tech-stack-0690fa.svg?style=flat)](https://stackshare.io/intermachine-developers/stack-analyze-cli)
package/utils.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { writeFile } from "node:fs/promises";
2
+
1
3
  const listFormat = new Intl.ListFormat("en", {
2
4
  style: "short",
3
5
  type: "conjunction"
@@ -9,15 +11,24 @@ const currency = new Intl.NumberFormat("en-us", {
9
11
 
10
12
  const returnMainOpts = "return main menu";
11
13
 
12
- const menuOpts = ["web", "query", "hardware", "about", "exit"];
14
+ const menuOpts = [
15
+ "web", "info", "query", "utility", "about", "exit"
16
+ ];
13
17
 
14
18
  const menuWebOpts = [
15
19
  "single", "multiple", "pagespeed", "scraping", returnMainOpts
16
20
  ];
17
21
 
22
+ const menuInfoOpts = [
23
+ "github_info", "crypto_market", "bitly_info", "bundlephobia_info", returnMainOpts
24
+ ];
25
+
18
26
  const menuQueryOpts = [
19
- "github_info", "anime_Search", "bitly_info", "movie_info",
20
- "twitch_info", "crypto_market", "password", returnMainOpts
27
+ "anime_Search", "movie_info", "twitch_info", returnMainOpts
28
+ ];
29
+
30
+ const menuUtilityOpts = [
31
+ "hardware", "password", returnMainOpts
21
32
  ];
22
33
 
23
34
  const menuHardwareOpts = [
@@ -35,6 +46,30 @@ const scrapingOpts = [
35
46
  "tableHead", "tableData", "links", "cites"
36
47
  ];
37
48
 
49
+ /**
50
+ *
51
+ * @param {string} filename
52
+ * @param {any} data
53
+ * @returns {Promise<void>}
54
+ */
55
+ const stackSave = async (filename, data) => {
56
+ if (!data) {
57
+ console.error("stackSave no using falsy values");
58
+ return;
59
+ }
60
+
61
+ if(typeof data === "boolean") {
62
+ console.info("stackSave no using boolean types");
63
+ return;
64
+ }
65
+
66
+ try {
67
+ await writeFile(filename, data);
68
+ } catch (err) {
69
+ console.info(err.message);
70
+ }
71
+ };
72
+
38
73
  const exitCli = "thanks for use stack-analyze";
39
74
 
40
75
  export {
@@ -42,10 +77,13 @@ export {
42
77
  currency,
43
78
  menuOpts,
44
79
  menuWebOpts,
80
+ menuInfoOpts,
45
81
  menuQueryOpts,
82
+ menuUtilityOpts,
46
83
  menuHardwareOpts,
47
84
  menuAboutOpts,
48
85
  scrapingOpts,
86
+ stackSave,
49
87
  exitCli
50
88
  };
51
89
 
package/logo-module.png DELETED
Binary file