stack-analyze 1.3.8 → 1.3.9

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,18 @@ stack-analyze all version and notable changes, fixed, remove and new additions i
4
4
 
5
5
  ## generation 4 (ver. 1.3.0 - )
6
6
 
7
+ ### version 1.3.9
8
+
9
+ #### Added
10
+ - added new tool (tcg pocket card info):
11
+ - @tcgdex/sdk *new module*
12
+
13
+ ### version 1.3.8
14
+
15
+ #### Changed
16
+ - replace all arrays option instead using keys object for fast adaptible.
17
+ - change anime quotes to taylor swift quotes (neo-jquery easter egg)
18
+
7
19
  ### version 1.3.7
8
20
 
9
21
  #### Added
package/about.js CHANGED
@@ -1,16 +1,11 @@
1
1
  // print table
2
2
  import { printTable } from "console-table-printer";
3
- import { returnMainOpts } from "./utils.js";
3
+ import { returnMainOpts, listFormat } from "./utils.js";
4
4
 
5
5
  // package.json
6
6
  const { default: { license, version } } = await import("./package.json", { with: { type: "json" } });
7
7
 
8
8
  /**
9
- * @typedef {Object} Info
10
- * @property {string} Info.mainDeveloper
11
- * @property {string} Info.version
12
- * @property {string} Info.license
13
- *
14
9
  * @typedef {Object} DeveloperList
15
10
  * @property {string} DeveloperList.name
16
11
  * @property {string} DeveloperList.roles
@@ -27,12 +22,10 @@ const { default: { license, version } } = await import("./package.json", { with:
27
22
  * @property {string} Project.name
28
23
  * @property {string} Project.desc
29
24
  *
30
- * select types
31
25
  * @typedef {({
32
26
  * [x: string]: (
33
- * refreshCallback: () => Promise<void>,
34
- * alternativeCallback?: () => Promise<void>
35
- * ) => Promise<void> | void
27
+ * refreshCallback: () => Promise<void>,
28
+ * ) => void
36
29
  * })} Select
37
30
  */
38
31
 
@@ -43,11 +36,10 @@ const timeout = 1e3;
43
36
  /** @type {Select}*/
44
37
  const aboutTool = {
45
38
  mainInfo(refreshCallback) {
46
- /** @type {Info} */
39
+ /** @type {Object<string, string>} */
47
40
  const aboutApp = {
48
41
  mainDeveloper: "omega5300",
49
- license,
50
- version
42
+ license, version
51
43
  };
52
44
 
53
45
  console.clear();
@@ -55,9 +47,7 @@ const aboutTool = {
55
47
 
56
48
  setTimeout(refreshCallback, timeout);
57
49
  },
58
- async lineup(refreshCallback) {
59
- const { listFormat } = await import("./utils.js");
60
-
50
+ lineup(refreshCallback) {
61
51
  /** @type {DeveloperList[]} */
62
52
  const developers = [
63
53
  {
@@ -91,14 +81,6 @@ const aboutTool = {
91
81
  {
92
82
  user: "DannyAgii",
93
83
  },
94
- {
95
- user: "Lunanny",
96
- details: "art director with ADHD."
97
- },
98
- {
99
- user: "Japon_HR",
100
- details: "cosplayer, gamer, dance & halo machinima creator"
101
- }
102
84
  ];
103
85
 
104
86
  console.clear();
@@ -116,10 +98,6 @@ const aboutTool = {
116
98
  name: "black metal catalog",
117
99
  desc: "promos albums and community"
118
100
  },
119
- {
120
- name: "slithering black records",
121
- desc: "record label & community"
122
- }
123
101
  ];
124
102
 
125
103
  console.clear();
@@ -1,20 +1,12 @@
1
1
  // modules
2
2
  import { createWriteStream } from "node:fs";
3
- import {
4
- cpu,
5
- mem,
6
- osInfo,
7
- diskLayout,
8
- graphics,
9
- bios
10
- } from "systeminformation";
3
+ import { cpu, mem, osInfo, diskLayout, graphics, bios } from "systeminformation";
11
4
  import colors from "colors";
12
5
 
13
6
  const csvHeader = (obj) => `${Object.keys(obj).join(";")}\n`;
14
7
  const csvData = (obj, spaces) => `${Object.values(obj).join(";")}${spaces}`;
15
8
 
16
9
  /**
17
- *
18
10
  * @param {number} size
19
11
  * @param {number} [base = 1073741824]
20
12
  * @returns {string}
@@ -22,7 +14,6 @@ const csvData = (obj, spaces) => `${Object.values(obj).join(";")}${spaces}`;
22
14
  const gigabyteConvert = (size, base = 1073741824) => (size / base).toFixed(2);
23
15
 
24
16
  /**
25
- *
26
17
  * @async
27
18
  * @returns {Promise<void>}
28
19
  */
@@ -0,0 +1,69 @@
1
+ import TCGdex from "@tcgdex/sdk";
2
+ import boxen from "boxen";
3
+ import colors from "colors";
4
+ import { stackSave } from "../utils.js";
5
+
6
+ /**
7
+ * @param {string} info
8
+ * @returns {string}
9
+ */
10
+ const boxInfo = (info) => boxen(info, {
11
+ title: "🎴 CARD INFORMATION",
12
+ titleAlignment: "center",
13
+ padding: 1
14
+ });
15
+
16
+ /**
17
+ * @async
18
+ * @param {string} set
19
+ * @param {number} id
20
+ * @returns {Promise<void>}
21
+ */
22
+ export default async function getTcgpCard(set, id) {
23
+ const tcgdex = new TCGdex("en");
24
+
25
+ try {
26
+ const card = await tcgdex.fetchCard(id, set);
27
+
28
+ const cardInfo = `
29
+ Name: ${card.name}
30
+ ID: ${card.id}
31
+ Type: ${card.category}
32
+
33
+ ${card.hp && `HP: ${card.hp}` || ""}
34
+ ${card.types?.length && `Types: ${card.types.join(", ")}` || ""}
35
+ Rarity: ${card.rarity}
36
+ ${card.stage && `Stage: ${card.stage}` || ""}
37
+ ${card.evolveFrom && `Evolves from: ${card.evolveFrom}\n` || ""}
38
+
39
+ ${card.abilities?.length && `⚡ Abilities:
40
+ ${card.abilities.map((ability, i) => `
41
+ ${i + 1}. ${ability.name || "Unnamed Ability"}
42
+ ${ability.effect && " Effect: "+ability.effect}
43
+ `.trim()).join("")}
44
+ \n`.trim()
45
+ || ""}
46
+
47
+ ${card.attacks?.length && `⚔️ Moveset/Attacks:
48
+ ${card.attacks.map((attack, i) => `
49
+ ${i + 1}. ${attack.name}
50
+ Energy Cost: ${attack.cost?.length ? attack.cost.join(", ") : "free" }
51
+ Damage: ${attack.damage ? attack.damage : "special"}
52
+ Effect: ${attack.effect ? attack.effect: "no effect"}
53
+ \n`).join("")}
54
+ ` || ""}
55
+
56
+ ${card.effect && `✨ Card Effect: ${card.effect} ` || ""}
57
+
58
+ ${card.weaknesses?.length && `🔻 Weaknesses:
59
+ ${card.weaknesses.map(({type, value}) => `${type}: ${value}`).join("")}\n` || ""}
60
+
61
+ ${card.retreat !== undefined && `🏃 Retreat Cost: ${card.retreat}\n` || ""} \n`
62
+ .replace(/(^[ \t]*\n)/gm, "");
63
+
64
+ console.info(boxInfo(cardInfo));
65
+ stackSave(`${card.name}.txt`, cardInfo);
66
+ } catch (err) {
67
+ console.error(colors.red(err.message));
68
+ }
69
+ }
package/hash/infoTools.js CHANGED
@@ -1,12 +1,13 @@
1
1
  // inquirer
2
- import { input, password } from "@inquirer/prompts";
2
+ import { input, password, number, select } from "@inquirer/prompts";
3
3
 
4
4
  // functions
5
5
  import bitlyInfo from "../functions/bitly.js";
6
6
  import cryptoMarket from "../functions/cryptoList.js";
7
7
  import githubInfo from "../functions/gitUser.js";
8
8
  import bundlephobia from "../functions/bundlephobia.js";
9
- import { returnMainOpts } from "../utils.js";
9
+ import { returnMainOpts, TCGP_EXPANSIONS } from "../utils.js";
10
+ import getTcgpCard from "../functions/tcgp.js";
10
11
 
11
12
  // bitly regexp
12
13
  const bitlyRegexp = /bit\.ly\//g;
@@ -15,8 +16,7 @@ const bitlyRegexp = /bit\.ly\//g;
15
16
  * select types
16
17
  * @typedef {({
17
18
  * [x: string]: (
18
- * refreshCallback: () => Promise<void>,
19
- * alternativeCallback?: () => Promise<void>
19
+ * refreshCallback: () => Promise<void>,
20
20
  * ) => Promise<void> | void
21
21
  * })} Select
22
22
  * /
@@ -67,6 +67,24 @@ const infoTools = {
67
67
  bundlephobia(pkgName);
68
68
  setTimeout(refreshCallback, 5e3);
69
69
  },
70
+ async tcgpCard(refreshCallback) {
71
+ console.clear();
72
+
73
+ const setName = await select({
74
+ message: "Select a expansion set TCGP:",
75
+ choices: Object.keys(TCGP_EXPANSIONS),
76
+ loop: true,
77
+ });
78
+
79
+ const cardID = await number({
80
+ message: `Enter a card id between 1 to ${TCGP_EXPANSIONS[setName]}:`,
81
+ min: 1, max: TCGP_EXPANSIONS[setName]
82
+ });
83
+
84
+ getTcgpCard(setName, cardID);
85
+
86
+ setTimeout(refreshCallback, 5e3);
87
+ }
70
88
  };
71
89
 
72
90
  const menuInfoOpts = [...Object.keys(infoTools), returnMainOpts];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stack-analyze",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
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": "cli.js",
@@ -8,26 +8,27 @@
8
8
  "stack-analyze": "cli.js"
9
9
  },
10
10
  "dependencies": {
11
- "@inquirer/prompts": "^7.6.0",
12
- "axios": "^1.10.0",
11
+ "@inquirer/prompts": "^7.9.0",
12
+ "@tcgdex/sdk": "^2.7.1",
13
+ "axios": "^1.13.1",
13
14
  "boxen": "^8.0.1",
14
- "cheerio": "^1.1.0",
15
+ "cheerio": "^1.1.2",
15
16
  "cli-progress": "^3.12.0",
16
17
  "colors": "^1.4.0",
17
- "console-table-printer": "^2.14.6",
18
- "figlet": "^1.8.1",
19
- "inquirer": "^12.7.0",
20
- "ora": "^8.2.0",
21
- "systeminformation": "^5.27.7",
18
+ "console-table-printer": "^2.15.0",
19
+ "figlet": "^1.9.3",
20
+ "inquirer": "^12.10.0",
21
+ "ora": "^9.0.0",
22
+ "systeminformation": "^5.27.11",
22
23
  "timeago.js": "^4.0.2",
23
24
  "w3c-css-validator": "^1.4.0",
24
25
  "wapalyzer": "^6.10.65"
25
26
  },
26
27
  "devDependencies": {
27
- "@eslint/js": "^9.30.1",
28
- "eslint": "^9.30.1",
29
- "globals": "^16.3.0",
30
- "jsdoc": "^4.0.4"
28
+ "@eslint/js": "^9.39.1",
29
+ "eslint": "^9.39.1",
30
+ "globals": "^16.5.0",
31
+ "jsdoc": "^4.0.5"
31
32
  },
32
33
  "scripts": {
33
34
  "start": "node cli.js",
package/utils.js CHANGED
@@ -23,6 +23,25 @@ const pokerGameOpts = [
23
23
  "basics-of-poker", "texas-holdem-poker"
24
24
  ];
25
25
 
26
+ /**
27
+ * @readonly
28
+ * @type {Object<string,number>}
29
+ */
30
+ const TCGP_EXPANSIONS = {
31
+ "p-a": 100,
32
+ a1: 286,
33
+ a1a: 86,
34
+ a2: 207,
35
+ a2a: 96,
36
+ a2b: 111,
37
+ a3: 239,
38
+ a3a: 103,
39
+ a3b: 107,
40
+ a4: 241,
41
+ a4a: 105,
42
+ b1: 331,
43
+ };
44
+
26
45
  /**
27
46
  * @param {string} filename
28
47
  * @param {any} data
@@ -33,13 +52,14 @@ const stackSave = async (filename, data) => {
33
52
  console.error("stackSave no using falsy values");
34
53
  return;
35
54
  }
36
-
37
- if(typeof data === "boolean") {
55
+
56
+ if (typeof data === "boolean") {
38
57
  console.info("stackSave no using boolean types");
39
58
  return;
40
59
  }
41
60
 
42
- try { await writeFile(filename, data);
61
+ try {
62
+ await writeFile(filename, data);
43
63
  } catch (err) {
44
64
  console.info(colors.red(err.message));
45
65
  }
@@ -52,14 +72,14 @@ const exitMsg = "thanks for use stack-analyze".green;
52
72
  * @returns {void}
53
73
  */
54
74
  const forceExit = (err) => {
55
- if(err.name === "ExitPromptError") {
75
+ if (err.name === "ExitPromptError") {
56
76
  console.info("👋 until next time!".green);
57
77
  process.exit(1);
58
78
  }
59
79
  };
60
80
 
61
81
  export {
62
- listFormat, currency, scrapingOpts, forceExit,
63
- stackSave, pokerGameOpts, exitMsg, returnMainOpts
82
+ listFormat, currency, scrapingOpts, forceExit,
83
+ stackSave, pokerGameOpts, exitMsg, returnMainOpts, TCGP_EXPANSIONS
64
84
  };
65
85