stack-analyze 1.2.5 → 1.2.7

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,17 @@ 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.7
8
+ #### Added
9
+ - wallpaper tool download (sol, moon)
10
+ #### changed
11
+ - default case in range color 91 to 100
12
+
13
+ ### version 1.2.6
14
+ #### Changed
15
+ - redesign poke info tool
16
+ - remove module info in readme
17
+
7
18
  ### version 1.2.5
8
19
  #### Added
9
20
  - pokemon info tool.
package/about.js CHANGED
@@ -13,31 +13,31 @@ const timeout = 1e3;
13
13
  /**
14
14
  * types for about tools
15
15
  *
16
- * @typedef {Object} info
17
- * @property {string} info.mainDeveloper
18
- * @property {string} info.version
19
- * @property {string} info.license
16
+ * @typedef {Object} Info
17
+ * @property {string} Info.mainDeveloper
18
+ * @property {string} Info.version
19
+ * @property {string} Info.license
20
20
  *
21
- * @typedef {Object} developerList
22
- * @property {string} developerList.name
23
- * @property {string} developerList.roles
21
+ * @typedef {Object} DeveloperList
22
+ * @property {string} DeveloperList.name
23
+ * @property {string} DeveloperList.roles
24
24
  *
25
- * @typedef {Object} youtube
26
- * @property {string} youtubeChannel
27
- * @property {string} recomendation
25
+ * @typedef {Object} Youtube
26
+ * @property {string} Youtube.youtubeChannel
27
+ * @property {string} Youtube.recomendation
28
28
  *
29
- * @typedef {Object} twitch
30
- * @property {string} twitch.user
31
- * @property {string} [twitch.details]
29
+ * @typedef {Object} Twitch
30
+ * @property {string} Twitch.user
31
+ * @property {string} [Twitch.details]
32
32
  *
33
- * @typedef {Object} project
34
- * @property {string} project.name
35
- * @property {string} project.desc
33
+ * @typedef {Object} Project
34
+ * @property {string} Project.name
35
+ * @property {string} Project.desc
36
36
  */
37
37
 
38
38
  const aboutTool = {
39
39
  mainInfo(refreshCallback) {
40
- /** @type {info} */
40
+ /** @type {Info} */
41
41
  const aboutApp = {
42
42
  mainDeveloper: "omega5300",
43
43
  license,
@@ -50,7 +50,7 @@ const aboutTool = {
50
50
  setTimeout(refreshCallback, timeout);
51
51
  },
52
52
  lineup(refreshCallback) {
53
- /** @type {developerList[]} */
53
+ /** @type {DeveloperList[]} */
54
54
  const developers = [
55
55
  {
56
56
  name: "omega5300",
@@ -63,7 +63,7 @@ const aboutTool = {
63
63
  setTimeout(refreshCallback, timeout);
64
64
  },
65
65
  youtubeRecomendation(refreshCallback) {
66
- /** @type {youtube[]} */
66
+ /** @type {Youtube[]} */
67
67
  const youtubeDev = [
68
68
  { youtubeChannel: "fazt", recomendation: "recommend" },
69
69
  { youtubeChannel: "doriandesings", recomendation: "recommend" },
@@ -78,7 +78,7 @@ const aboutTool = {
78
78
  setTimeout(refreshCallback, timeout);
79
79
  },
80
80
  twitchRecomendation(refreshCallback) {
81
- /** @type {twitch[]} */
81
+ /** @type {Twitch[]} */
82
82
  const twitchUsers = [
83
83
  {
84
84
  user: "DannyAgii",
@@ -98,7 +98,7 @@ const aboutTool = {
98
98
  setTimeout(refreshCallback, timeout);
99
99
  },
100
100
  projectsRecomendation(refreshCallback) {
101
- /** @type {project[]} */
101
+ /** @type {Project[]} */
102
102
  const projects = [
103
103
  {
104
104
  name: "Doofy's Projects",
package/cli.js CHANGED
@@ -8,6 +8,7 @@ import webTools from "./hash/webTools.js";
8
8
  import queryTools from "./hash/queryTools.js";
9
9
  import infoTools from "./hash/infoTools.js";
10
10
  import utilityTools from "./hash/utilityTools.js";
11
+ import wallpaperSelect from "./hash/wallpaperSelect.js";
11
12
  import aboutTool from "./about.js";
12
13
 
13
14
  import {
@@ -16,6 +17,7 @@ import {
16
17
  menuWebOpts,
17
18
  menuAboutOpts,
18
19
  menuInfoOpts,
20
+ menuWallpaperOpts,
19
21
  menuUtilityOpts
20
22
  } from "./utils.js";
21
23
 
@@ -81,6 +83,24 @@ async function queryOpts() {
81
83
  : queryTools[query](returnMain);
82
84
  }
83
85
 
86
+ /**
87
+ * @async
88
+ * @returns {Promise<void>}
89
+ */
90
+ async function wallpapersOpts() {
91
+ const { wallpaper } = await inquirer.prompt({
92
+ type: "list",
93
+ pageSize,
94
+ name: "wallpaper",
95
+ message: "enter a wallpaper selector",
96
+ choices: menuWallpaperOpts
97
+ });
98
+
99
+ wallpaper === "return main menu"
100
+ ? mainMenu()
101
+ : wallpaperSelect[wallpaper](returnMain, wallpapersOpts);
102
+ }
103
+
84
104
  /**
85
105
  * @async
86
106
  * @returns {Promise<void>}
@@ -149,6 +169,10 @@ async function mainMenu() {
149
169
  console.clear();
150
170
  utilityOpts();
151
171
  },
172
+ wallpapers() {
173
+ console.clear();
174
+ wallpapersOpts();
175
+ },
152
176
  about() {
153
177
  console.clear();
154
178
  aboutOpts();
@@ -0,0 +1,28 @@
1
+ // save password
2
+ import { stackSave } from "../utils.js";
3
+
4
+ /**
5
+ * sol, moon wallpapers downloader
6
+ * @async
7
+ * @param {string} filename
8
+ * @returns {Promise<void>}
9
+ */
10
+ export const solMoonDownload = async (filename) => {
11
+ console.info(filename);
12
+
13
+ const url = `https://sol-moon-wallpapers.vercel.app/api/download/${filename}`;
14
+
15
+ try {
16
+ const res = await fetch(url);
17
+
18
+ if(!res.ok) {
19
+ throw new Error(`Error HTTP: ${res.status}`);
20
+ }
21
+
22
+ const data = await res.blob();
23
+
24
+ stackSave(filename, data.stream());
25
+ } catch(err) {
26
+ console.error(colors.red(err.message));
27
+ }
28
+ };
@@ -20,14 +20,12 @@ const barColor = score => {
20
20
  const bar = "{bar}";
21
21
 
22
22
  switch (true) {
23
- case score === 1 || score <= 49:
23
+ case score === 0 || score <= 49:
24
24
  return bar.red;
25
25
  case score === 50 || score <= 89:
26
26
  return bar.yellow;
27
- case score >= 90 || score === maxScore:
28
- return bar.green;
29
27
  default:
30
- return bar.magenta;
28
+ return bar.green;
31
29
  }
32
30
  };
33
31
 
@@ -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) {
@@ -0,0 +1,36 @@
1
+ // stock module
2
+ import { performance } from "node:perf_hooks";
3
+
4
+ // inquirer
5
+ import inquirer from "inquirer";
6
+ import colors from "colors";
7
+
8
+ import { solMoonDownload } from "../functions/download.js";
9
+
10
+ const wallpaperSelect = {
11
+ // refreshCallback
12
+ solMoon(refreshCallback, alternativeCallback) {
13
+ const solMoonWallpapers = [...Array(20).keys()]
14
+ .map(i => `sol-moon${i + 1}.jpeg`);
15
+
16
+ inquirer.prompt([
17
+ {
18
+ type: "list",
19
+ name: "wallpaper",
20
+ message: "select a wallpaper for download:",
21
+ choices: [...solMoonWallpapers, "back to menu"]
22
+ }
23
+ ])
24
+ .then(({ wallpaper }) => {
25
+ if (wallpaper === "back to menu") {
26
+ alternativeCallback();
27
+ } else {
28
+ solMoonDownload(wallpaper);
29
+ setTimeout(refreshCallback, 5000);
30
+ }
31
+ })
32
+ .catch(err => console.error(colors.red(err.message)));
33
+ }
34
+ };
35
+
36
+ export default wallpaperSelect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stack-analyze",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
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.6.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
- "figlet": "^1.6.0",
17
+ "figlet": "^1.7.0",
17
18
  "gauge": "^5.0.1",
18
- "inquirer": "^9.2.7",
19
- "systeminformation": "^5.18.6",
19
+ "inquirer": "^9.2.11",
20
+ "systeminformation": "^5.21.15",
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.53.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)
package/utils.js CHANGED
@@ -12,7 +12,7 @@ const currency = new Intl.NumberFormat("en-us", {
12
12
  const returnMainOpts = "return main menu";
13
13
 
14
14
  const menuOpts = [
15
- "web", "info", "query", "utility", "about", "exit"
15
+ "web", "info", "query", "utility", "wallpapers", "about", "exit"
16
16
  ];
17
17
 
18
18
  const menuWebOpts = [
@@ -31,6 +31,8 @@ const menuUtilityOpts = [
31
31
  "hardware", "password", returnMainOpts
32
32
  ];
33
33
 
34
+ const menuWallpaperOpts = ["solMoon", returnMainOpts];
35
+
34
36
  const menuHardwareOpts = [
35
37
  "cpuInfo", "ramMemInfo", "osDetail", "diskInfo",
36
38
  "controllerInfo", "displayInfo", "biosInfo", returnMainOpts
@@ -81,6 +83,7 @@ export {
81
83
  menuQueryOpts,
82
84
  menuUtilityOpts,
83
85
  menuHardwareOpts,
86
+ menuWallpaperOpts,
84
87
  menuAboutOpts,
85
88
  scrapingOpts,
86
89
  stackSave,