stack-analyze 1.3.5 → 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,101 +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",
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 = ["solMoon", "dimensions", "seyyahi2", returnMainOpts];
38
-
39
- const menuHardwareOpts = [
40
- "cpuInfo", "ramMemInfo", "osDetail", "diskInfo",
41
- "controllerInfo", "displayInfo", "biosInfo", returnMainOpts
42
- ];
43
-
44
- const menuAboutOpts = [
45
- "mainInfo", "lineup", "youtubeRecomendation",
46
- "twitchRecomendation", "projectsRecomendation", returnMainOpts
47
- ];
48
-
49
- const scrapingOpts = [
50
- "title", "images", "metadata", "headings",
51
- "tableHead", "tableData", "links", "cites"
52
- ];
53
-
54
- const pokerGameOpts = [
55
- "go-fish", "gin-rummy", "blackjack", "slapjack",
56
- "basics-of-poker", "texas-holdem-poker"
57
- ];
58
-
59
- /**
60
- *
61
- * @param {string} filename
62
- * @param {any} data
63
- * @returns {Promise<void>}
64
- */
65
- const stackSave = async (filename, data) => {
66
- if (!data) {
67
- console.error("stackSave no using falsy values");
68
- return;
69
- }
70
-
71
- if(typeof data === "boolean") {
72
- console.info("stackSave no using boolean types");
73
- return;
74
- }
75
-
76
- try {
77
- await writeFile(filename, data);
78
- } catch (err) {
79
- console.info(err.message);
80
- }
81
- };
82
-
83
- const exitCli = "thanks for use stack-analyze";
84
-
85
- export {
86
- listFormat,
87
- currency,
88
- menuOpts,
89
- menuWebOpts,
90
- menuInfoOpts,
91
- menuQueryOpts,
92
- menuUtilityOpts,
93
- menuHardwareOpts,
94
- menuWallpaperOpts,
95
- menuAboutOpts,
96
- scrapingOpts,
97
- stackSave,
98
- pokerGameOpts,
99
- exitCli
100
- };
101
-
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
+ };