stack-analyze 1.2.5 → 1.2.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
@@ -4,6 +4,11 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
4
4
 
5
5
  ## generation 3 (ver. 1.2.0 -)
6
6
 
7
+ ### version 1.2.6
8
+ #### Changed
9
+ - redesign poke info tool
10
+ - remove module info in readme
11
+
7
12
  ### version 1.2.5
8
13
  #### Added
9
14
  - pokemon info tool.
@@ -1,9 +1,44 @@
1
1
  // colors
2
2
  import colors from "colors";
3
+ import boxen from "boxen";
4
+ import CliProgress from "cli-progress";
3
5
 
4
6
  // utils
5
7
  import { listFormat, stackSave } from "../utils.js";
6
8
 
9
+ const pokeStats = {
10
+ hp: 255,
11
+ attack: 194,
12
+ defense: 230,
13
+ "special-attack": 180,
14
+ "special-defense": 230,
15
+ speed: 200,
16
+ xp: 635
17
+ };
18
+
19
+ /**
20
+ * @param {string}
21
+ * @returns {string}
22
+ */
23
+ const barColor = stat => {
24
+ switch(stat) {
25
+ case "hp":
26
+ return "{bar}".red;
27
+ case "attack":
28
+ return "{bar}".yellow;
29
+ case "defense":
30
+ return "{bar}".brightYellow;
31
+ case "special-attack":
32
+ return "{bar}".blue;
33
+ case "special-defense":
34
+ return "{bar}".green;
35
+ case "speed":
36
+ return "{bar}".magenta;
37
+ default:
38
+ return "{bar}".cyan;
39
+ }
40
+ };
41
+
7
42
  /**
8
43
  * @async
9
44
  * @param {number | string} pokemon
@@ -12,6 +47,14 @@ import { listFormat, stackSave } from "../utils.js";
12
47
  export default async function pokemonInfo(pokemon) {
13
48
  console.clear();
14
49
 
50
+ const multibar = new CliProgress.MultiBar({
51
+ format: "{stats} | {bar} | {value}/{total}",
52
+ clearOnComplete: false,
53
+ stopOnComplete: true,
54
+ hideCursor: true,
55
+ forceRedraw: true,
56
+ }, CliProgress.Presets.shades_grey);
57
+
15
58
  try {
16
59
  const data = await (
17
60
  await fetch(`https://pokeapi.co/api/v2/pokemon/${pokemon}`)
@@ -33,14 +76,28 @@ export default async function pokemonInfo(pokemon) {
33
76
  height,
34
77
  base_experience,
35
78
  weight,
36
- types: listFormat.format(types.map(({ type }) => type.name))
79
+ types: listFormat.format(types.map(({ type }) => type.name)),
37
80
  };
38
81
 
39
- stats.forEach(({ base_stat, stat }) => {
82
+ const PokeInfo = boxen(info.types, {title: `${id} - ${name}`});
83
+
84
+ multibar.create(pokeStats.xp, 0, { stats: "xp" }, {
85
+ format: `{stats} | ${barColor("xp")} | {value}/{total}`,
86
+ }).update(base_experience);
87
+
88
+ stats.forEach(({base_stat, stat}) => {
89
+ multibar.create(pokeStats[stat.name], 0, { stats: stat.name }, {
90
+ format: `{stats} | ${barColor(stat.name)} | {value}/{total}`,
91
+ }).update(base_stat);
92
+
40
93
  info[stat.name] = base_stat;
41
94
  });
42
95
 
43
- console.info(info);
96
+ multibar.log(`${PokeInfo}\n`);
97
+
98
+ setTimeout(() => {
99
+ multibar.stop();
100
+ }, 3000);
44
101
 
45
102
  stackSave("poke-info.json", JSON.stringify(info, null, 2));
46
103
  } catch(err) {
@@ -73,7 +73,7 @@ const queryTools = {
73
73
  ])
74
74
  .then(anw => {
75
75
  pokemonInfo(anw?.pokeName || anw?.pokeId);
76
- setTimeout(refreshCallback, 2e3);
76
+ setTimeout(refreshCallback, 6e3);
77
77
  });
78
78
  },
79
79
  twitch_info(refreshCallback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stack-analyze",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
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",
@@ -8,21 +8,22 @@
8
8
  "stack-analyze": "cli.js"
9
9
  },
10
10
  "dependencies": {
11
- "axios": "^1.4.0",
11
+ "axios": "^1.5.0",
12
+ "boxen": "^7.1.1",
12
13
  "cheerio": "^1.0.0-rc.12",
13
14
  "cli-progress": "^3.12.0",
14
15
  "colors": "^1.4.0",
15
16
  "console-table-printer": "^2.11.2",
16
17
  "figlet": "^1.6.0",
17
18
  "gauge": "^5.0.1",
18
- "inquirer": "^9.2.7",
19
- "systeminformation": "^5.18.6",
19
+ "inquirer": "^9.2.10",
20
+ "systeminformation": "^5.21.3",
20
21
  "timeago.js": "^4.0.2",
21
22
  "wappalyzer": "^6.10.63"
22
23
  },
23
24
  "devDependencies": {
24
- "eslint": "^8.44.0",
25
- "gh-pages": "^5.0.0",
25
+ "eslint": "^8.48.0",
26
+ "gh-pages": "^6.0.0",
26
27
  "jsdoc": "^4.0.2"
27
28
  },
28
29
  "scripts": {
package/readme.md CHANGED
@@ -16,11 +16,11 @@ cli tech stack analyze with **node.js** using the wappalyzer and google pagespee
16
16
 
17
17
  ## cli module
18
18
  ``` sh
19
- # old npm mode
19
+ # npm mode a
20
20
  npm i -g stack-analyze
21
21
 
22
- # new npm mode
23
- npm i --location=global
22
+ # npm mode b
23
+ npm i --location=global stack-analyze
24
24
 
25
25
  # if using global install
26
26
  stack-analyze
@@ -29,25 +29,6 @@ stack-analyze
29
29
  npx stack-analyze
30
30
  ```
31
31
 
32
- ## module
33
-
34
- ``` sh
35
- npm i stack-analyze
36
- ```
37
-
38
- ``` js
39
- // cjs
40
- const stackAnalyze = require('stack-analyze') // full
41
- const { password } = require('stack-analyze') // destructuring
42
-
43
- // esm
44
- import stackAnalyze from 'stack-analyze' // full
45
- import { password } from 'stack-analyze' // destructuring
46
-
47
- // examples
48
- password()
49
- ```
50
-
51
32
  >note: if global install fail using npx
52
33
 
53
34
  [github repo](https://github.com/stack-analyze/stack-analyze.git)