;
@@ -57,16 +57,16 @@ export const generateTableRows = (tagsPatterns: TagsPatterns) => {
${
!(tag === "keywords" && !value.countKeywords)
? !(tag === "lastSentence" && !value.countWordsInLast)
- ? !isNaN(value.count)
+ ? !isNaN(value.quantity)
? value.maxLength && value.minLength
? value.multipleTags
- ? `Warning! Number of ${tag} on the page: ${value.count} | Check the code | `
+ ? `Warning! Number of ${tag} on the page: ${value.quantity} | Check the code | `
: `Length of ${tag}: ${value.count}${
+ }">${value.quantity}${
value.forbiddenCharacters &&
value.forbiddenCharacters.length > 0
? ` (Contains forbidden words: ${value.forbiddenCharacters})`
@@ -78,8 +78,8 @@ export const generateTableRows = (tagsPatterns: TagsPatterns) => {
: ` | Does not contain keywords`
: ``
} | ${value.requirement} | `
diff --git a/packages/landing-friend-core/src/functions/config.ts b/packages/landing-friend-core/src/functions/config/index.ts
similarity index 98%
rename from packages/landing-friend-core/src/functions/config.ts
rename to packages/landing-friend-core/src/functions/config/index.ts
index cb00323..45962b2 100644
--- a/packages/landing-friend-core/src/functions/config.ts
+++ b/packages/landing-friend-core/src/functions/config/index.ts
@@ -1,4 +1,4 @@
-import { message } from "../index.js";
+import { message } from "../../index.js";
import fs from "fs";
import path from "path";
diff --git a/packages/landing-friend-core/src/functions/index.ts b/packages/landing-friend-core/src/functions/index.ts
index ff90915..e4fa104 100644
--- a/packages/landing-friend-core/src/functions/index.ts
+++ b/packages/landing-friend-core/src/functions/index.ts
@@ -1,3 +1,2 @@
-export * from "./config.js";
-export * from "./basicAnalyzer.js";
-export * from "./prepareHTML.js";
+export * from "./analyzer/index.js";
+export * from "./config/index.js";
diff --git a/packages/landing-friend-core/src/index.ts b/packages/landing-friend-core/src/index.ts
index d632ad0..d88aae2 100644
--- a/packages/landing-friend-core/src/index.ts
+++ b/packages/landing-friend-core/src/index.ts
@@ -4,3 +4,4 @@ export * from "./sitemap.js";
export * from "./analyzer.js";
export * from "./data/index.js";
export * from "./functions/index.js";
+export * from "./types/index.js";
diff --git a/packages/landing-friend-core/src/types/analyzerTypes.ts b/packages/landing-friend-core/src/types/analyzerTypes.ts
new file mode 100644
index 0000000..c420753
--- /dev/null
+++ b/packages/landing-friend-core/src/types/analyzerTypes.ts
@@ -0,0 +1,45 @@
+export type AdvancedTagsName = "og" | "twitter";
+
+export type TagsName = "h1" | "title" | "description";
+
+export type AdditionalTagsName = "lastSentence" | "keywords";
+
+export type AllTagsName = TagsName | AdditionalTagsName;
+
+export type TagsProps = Record<
+ TagsName,
+ {
+ minLength: number;
+ maxLength: number;
+ }
+> &
+ Record;
+
+export type AdvancedTagsProps = Record;
+
+export type TagsWithReason = {
+ quantity: number;
+ minLength?: number;
+ maxLength?: number;
+ countKeywords?: boolean;
+ countWordsInLast?: boolean;
+ content?: string;
+ requirement?: string;
+ multipleTags?: boolean;
+ keywordsIncluded?: string[];
+ forbiddenCharacters?: string[];
+};
+
+export type AdvancedTagsWithReason = {
+ tagAmount: number;
+ content?: string;
+ metaName?: string;
+ forbiddenCharacters?: string[];
+};
+
+export type TagsPatterns = Record>;
+
+export type AdvancedTagsPatterns = Record<
+ string,
+ Record
+>;
diff --git a/packages/landing-friend-core/src/types/configTypes.ts b/packages/landing-friend-core/src/types/configTypes.ts
new file mode 100644
index 0000000..8a940eb
--- /dev/null
+++ b/packages/landing-friend-core/src/types/configTypes.ts
@@ -0,0 +1,22 @@
+import { LanguageCode } from "iso-639-1";
+import { AdvancedTagsProps, TagsProps } from "./index.js";
+
+export type SitemapSettings = {
+ locale: {
+ defaultLocale: LanguageCode;
+ localeWildcard: string;
+ };
+ trailingSlash: boolean;
+ sortBy: "priority" | "alphabetically-asc" | "alphabetically-desc";
+};
+
+export type ConfigFile = {
+ domain: string;
+ input: string;
+ output: string;
+ robots: boolean;
+ excludedPage: string[];
+ sitemap?: SitemapSettings;
+ analyzer?: TagsProps;
+ advancedAnalyzer?: AdvancedTagsProps;
+};
diff --git a/packages/landing-friend-core/src/types/index.ts b/packages/landing-friend-core/src/types/index.ts
new file mode 100644
index 0000000..80bcb93
--- /dev/null
+++ b/packages/landing-friend-core/src/types/index.ts
@@ -0,0 +1,2 @@
+export * from "./analyzerTypes.js";
+export * from "./configTypes.js";
diff --git a/packages/landing-friend/src/functions/configInit.ts b/packages/landing-friend/src/functions/configInit.ts
index 68ec4fe..00ee439 100644
--- a/packages/landing-friend/src/functions/configInit.ts
+++ b/packages/landing-friend/src/functions/configInit.ts
@@ -162,22 +162,21 @@ export const configInit = async () => {
},
{
type: "confirm",
- name: "analyzer.keywords.countKeywords",
+ name: "analyzer.keywords.count",
message: "Do you want to count keywords?",
default:
EXTENDED_ANALYZER_GLOBAL_CONFIG_FILE.analyzer instanceof Object &&
"keywords" in EXTENDED_ANALYZER_GLOBAL_CONFIG_FILE.analyzer &&
- EXTENDED_ANALYZER_GLOBAL_CONFIG_FILE.analyzer.keywords.countKeywords,
+ EXTENDED_ANALYZER_GLOBAL_CONFIG_FILE.analyzer.keywords.count,
},
{
type: "confirm",
- name: "analyzer.lastSentence.countWordsInLast",
+ name: "analyzer.lastSentence.count",
message: "Do you want to check for matching keywords in last the div?",
default:
EXTENDED_ANALYZER_GLOBAL_CONFIG_FILE.analyzer instanceof Object &&
"lastSentence" in EXTENDED_ANALYZER_GLOBAL_CONFIG_FILE.analyzer &&
- EXTENDED_ANALYZER_GLOBAL_CONFIG_FILE.analyzer.lastSentence
- .countWordsInLast,
+ EXTENDED_ANALYZER_GLOBAL_CONFIG_FILE.analyzer.lastSentence.count,
},
]);
const { extendAdvanceAnalyzer } = await inquirer.prompt<{
@@ -194,10 +193,18 @@ export const configInit = async () => {
{
type: "confirm",
name: "advancedAnalyzer.og",
- message: "Do you want to check all og protocols ?",
+ message: "Do you want to check all og protocols?",
default:
EXTENDED_ADVANCED_ANALYZER_GLOBAL_CONFIG_FILE.advancedAnalyzer?.og,
},
+ {
+ type: "confirm",
+ name: "advancedAnalyzer.twitter",
+ message: "Do you want to check all twitter metadata?",
+ default:
+ EXTENDED_ADVANCED_ANALYZER_GLOBAL_CONFIG_FILE.advancedAnalyzer
+ ?.twitter,
+ },
]);
}
}