stack-analyze 1.3.4 → 1.3.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/utils.js CHANGED
@@ -1,94 +1,104 @@
1
- import { writeFile } from "node:fs/promises";
2
-
3
- const listFormat = new Intl.ListFormat("en", {
4
- style: "short",
5
- type: "conjunction"
6
- });
7
-
8
- const currency = new Intl.NumberFormat("en-us", {
9
- style: "currency", currency: "USD"
10
- });
11
-
12
- const returnMainOpts = "return main menu";
13
-
14
- const menuOpts = [
15
- "web", "info", "query", "utility", "wallpapers", "about", "exit"
16
- ];
17
-
18
- const menuWebOpts = [
19
- "single", "multiple", "pagespeed", "scraping", "css_validate",
20
- returnMainOpts
21
- ];
22
-
23
- const menuInfoOpts = [
24
- "github_info", "crypto_market", "bitly_info", "bundlephobia_info", returnMainOpts
25
- ];
26
-
27
- const menuQueryOpts = [
28
- "anime_Search", "movie_info", "pokemon_info",
29
- "twitch_info", "deezer", "potter_search", returnMainOpts
30
- ];
31
-
32
- const menuUtilityOpts = [
33
- "hardware", "password", returnMainOpts
34
- ];
35
-
36
- const menuWallpaperOpts = ["solMoon", "dimensions", "seyyahi2", returnMainOpts];
37
-
38
- const menuHardwareOpts = [
39
- "cpuInfo", "ramMemInfo", "osDetail", "diskInfo",
40
- "controllerInfo", "displayInfo", "biosInfo", returnMainOpts
41
- ];
42
-
43
- const menuAboutOpts = [
44
- "mainInfo", "lineup", "youtubeRecomendation",
45
- "twitchRecomendation", "projectsRecomendation", returnMainOpts
46
- ];
47
-
48
- const scrapingOpts = [
49
- "title", "images", "metadata", "headings",
50
- "tableHead", "tableData", "links", "cites"
51
- ];
52
-
53
- /**
54
- *
55
- * @param {string} filename
56
- * @param {any} data
57
- * @returns {Promise<void>}
58
- */
59
- const stackSave = async (filename, data) => {
60
- if (!data) {
61
- console.error("stackSave no using falsy values");
62
- return;
63
- }
64
-
65
- if(typeof data === "boolean") {
66
- console.info("stackSave no using boolean types");
67
- return;
68
- }
69
-
70
- try {
71
- await writeFile(filename, data);
72
- } catch (err) {
73
- console.info(err.message);
74
- }
75
- };
76
-
77
- const exitCli = "thanks for use stack-analyze";
78
-
79
- export {
80
- listFormat,
81
- currency,
82
- menuOpts,
83
- menuWebOpts,
84
- menuInfoOpts,
85
- menuQueryOpts,
86
- menuUtilityOpts,
87
- menuHardwareOpts,
88
- menuWallpaperOpts,
89
- menuAboutOpts,
90
- scrapingOpts,
91
- stackSave,
92
- exitCli
93
- };
94
-
1
+ import { writeFile } from "node:fs/promises";
2
+
3
+ const listFormat = new Intl.ListFormat("en", {
4
+ style: "short",
5
+ type: "conjunction"
6
+ });
7
+
8
+ const currency = new Intl.NumberFormat("en-us", {
9
+ style: "currency", currency: "USD"
10
+ });
11
+
12
+ const returnMainOpts = "return main menu";
13
+
14
+ const menuOpts = [
15
+ "web", "info", "query", "utility", "wallpapers",
16
+ "about", "exit"
17
+ ];
18
+
19
+ const menuWebOpts = [
20
+ "single", "multiple", "pagespeed", "scraping", "css_validate",
21
+ returnMainOpts
22
+ ];
23
+
24
+ const menuInfoOpts = [
25
+ "github_info", "crypto_market", "bitly_info", "bundlephobia_info", returnMainOpts
26
+ ];
27
+
28
+ const menuQueryOpts = [
29
+ "anime_Search", "movie_info", "pokemon_info",
30
+ "twitch_info", "deezer", "potter_search", returnMainOpts
31
+ ];
32
+
33
+ const menuUtilityOpts = [
34
+ "hardware", "password", "poker_game", returnMainOpts
35
+ ];
36
+
37
+ const menuWallpaperOpts = [
38
+ "solMoon", "dimensions", "seyyahi2", "ancientMistery",
39
+ "tsukyNoEmily", returnMainOpts
40
+ ];
41
+
42
+ const menuHardwareOpts = [
43
+ "cpuInfo", "ramMemInfo", "osDetail", "diskInfo",
44
+ "controllerInfo", "displayInfo", "biosInfo", returnMainOpts
45
+ ];
46
+
47
+ const menuAboutOpts = [
48
+ "mainInfo", "lineup", "youtubeRecomendation",
49
+ "twitchRecomendation", "projectsRecomendation", returnMainOpts
50
+ ];
51
+
52
+ const scrapingOpts = [
53
+ "title", "images", "metadata", "headings",
54
+ "tableHead", "tableData", "links", "cites"
55
+ ];
56
+
57
+ const pokerGameOpts = [
58
+ "go-fish", "gin-rummy", "blackjack", "slapjack",
59
+ "basics-of-poker", "texas-holdem-poker"
60
+ ];
61
+
62
+ /**
63
+ *
64
+ * @param {string} filename
65
+ * @param {any} data
66
+ * @returns {Promise<void>}
67
+ */
68
+ const stackSave = async (filename, data) => {
69
+ if (!data) {
70
+ console.error("stackSave no using falsy values");
71
+ return;
72
+ }
73
+
74
+ if(typeof data === "boolean") {
75
+ console.info("stackSave no using boolean types");
76
+ return;
77
+ }
78
+
79
+ try {
80
+ await writeFile(filename, data);
81
+ } catch (err) {
82
+ console.info(err.message);
83
+ }
84
+ };
85
+
86
+ const exitCli = "thanks for use stack-analyze";
87
+
88
+ export {
89
+ listFormat,
90
+ currency,
91
+ menuOpts,
92
+ menuWebOpts,
93
+ menuInfoOpts,
94
+ menuQueryOpts,
95
+ menuUtilityOpts,
96
+ menuHardwareOpts,
97
+ menuWallpaperOpts,
98
+ menuAboutOpts,
99
+ scrapingOpts,
100
+ stackSave,
101
+ pokerGameOpts,
102
+ exitCli
103
+ };
104
+
@@ -1,37 +1,37 @@
1
- // bitly regexp
2
- const bitlyRegexp = /bit\.ly\//g;
3
-
4
- const bitlyQuery = {
5
- name: "bitlyLink",
6
- message: "enter a short link:",
7
- validate: input => bitlyRegexp.test(input) || "only bitly link".yellow
8
- };
9
-
10
- /**
11
- * @param {string} name
12
- * @param {string} message
13
- */
14
- const promptParams = (name, message) => ({
15
- name,
16
- message,
17
- validate: input => input !== "" || "this field is required".yellow
18
- });
19
-
20
- /**
21
- * @param {string} name
22
- * @param {string} message
23
- */
24
- const promptKey = (name, message) => ({
25
- name,
26
- message,
27
- type: "password",
28
- mask: "?",
29
- validate: input => input !== "" || "token field is required".yellow
30
- });
31
-
32
- export {
33
- bitlyQuery,
34
- promptParams,
35
- promptKey
36
- };
37
-
1
+ // bitly regexp
2
+ const bitlyRegexp = /bit\.ly\//g;
3
+
4
+ const bitlyQuery = {
5
+ name: "bitlyLink",
6
+ message: "enter a short link:",
7
+ validate: input => bitlyRegexp.test(input) || "only bitly link".yellow
8
+ };
9
+
10
+ /**
11
+ * @param {string} name
12
+ * @param {string} message
13
+ */
14
+ const promptParams = (name, message) => ({
15
+ name,
16
+ message,
17
+ validate: input => input !== "" || "this field is required".yellow
18
+ });
19
+
20
+ /**
21
+ * @param {string} name
22
+ * @param {string} message
23
+ */
24
+ const promptKey = (name, message) => ({
25
+ name,
26
+ message,
27
+ type: "password",
28
+ mask: "?",
29
+ validate: input => input !== "" || "token field is required".yellow
30
+ });
31
+
32
+ export {
33
+ bitlyQuery,
34
+ promptParams,
35
+ promptKey
36
+ };
37
+
@@ -1,33 +1,33 @@
1
- import { scrapingOpts } from "../utils.js";
2
-
3
- const webRegex = /https?:\/\//g;
4
-
5
- const singleWebQuery = {
6
- name: "url",
7
- message: "enter a url:",
8
- validate: input => webRegex.test(input) || "enter a url valid".yellow
9
- };
10
-
11
- const multipleWebQuery = {
12
- name: "webList",
13
- message: "enter URLs for analyze the tech stacks with whitespace without quotes example 'http://example.com https://nodejs.org': \n",
14
- validate(input) {
15
- const pass = input.match(webRegex);
16
-
17
- return pass && pass.length === 2 || "must be 2 sites";
18
- }
19
- };
20
-
21
- const webScrapingQuery = {
22
- type: "list",
23
- pageSize: 9,
24
- name: "option",
25
- message: "select a web scraping option:",
26
- choices: scrapingOpts
27
- };
28
-
29
- export {
30
- singleWebQuery,
31
- multipleWebQuery,
32
- webScrapingQuery
33
- };
1
+ import { scrapingOpts } from "../utils.js";
2
+
3
+ const webRegex = /https?:\/\//g;
4
+
5
+ const singleWebQuery = {
6
+ name: "url",
7
+ message: "enter a url:",
8
+ validate: input => webRegex.test(input) || "enter a url valid".yellow
9
+ };
10
+
11
+ const multipleWebQuery = {
12
+ name: "webList",
13
+ message: "enter URLs for analyze the tech stacks with whitespace without quotes example 'http://example.com https://nodejs.org': \n",
14
+ validate(input) {
15
+ const pass = input.match(webRegex);
16
+
17
+ return pass && pass.length === 2 || "must be 2 sites";
18
+ }
19
+ };
20
+
21
+ const webScrapingQuery = {
22
+ type: "list",
23
+ pageSize: 9,
24
+ name: "option",
25
+ message: "select a web scraping option:",
26
+ choices: scrapingOpts
27
+ };
28
+
29
+ export {
30
+ singleWebQuery,
31
+ multipleWebQuery,
32
+ webScrapingQuery
33
+ };