From adbe8d9776d35484c076d14840d3a85e3d36eaea Mon Sep 17 00:00:00 2001 From: mohamed yahia Date: Wed, 15 Nov 2023 13:43:08 +0200 Subject: [PATCH 1/3] Remove unused import at src/lib/indexFolderToObjects.ts Co-authored-by: Ola Rubaj <52197250+olayway@users.noreply.github.com> --- src/lib/indexFolderToObjects.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/indexFolderToObjects.ts b/src/lib/indexFolderToObjects.ts index 6c647cd..0b61c50 100644 --- a/src/lib/indexFolderToObjects.ts +++ b/src/lib/indexFolderToObjects.ts @@ -2,7 +2,7 @@ import { getUniqueValues, recursiveWalkDir } from "../utils/index.js"; import type { WikiLink } from "../utils/index.js"; import { extractFileSchemeFromObject } from "../utils/extractFileSchemeFromObject.js"; import { readLocalMarkdownFileToObject } from "./readLocalMarkdownFileToObject.js"; -import type { File, FileTag, Link, Tag } from "./types/schemaTypes.js"; +import type { File, FileTag, Link } from "./types/schemaTypes.js"; export function indexFolderToObjects( folderPath: string, From 1f336267c40221cd24719ecdc221e174395ca7e3 Mon Sep 17 00:00:00 2001 From: mohamed yahia Date: Wed, 15 Nov 2023 13:43:58 +0200 Subject: [PATCH 2/3] Update src/lib/readLocalMarkdownFileToObject.ts imports Co-authored-by: Ola Rubaj <52197250+olayway@users.noreply.github.com> --- src/lib/readLocalMarkdownFileToObject.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/readLocalMarkdownFileToObject.ts b/src/lib/readLocalMarkdownFileToObject.ts index 1fafb71..cc50993 100644 --- a/src/lib/readLocalMarkdownFileToObject.ts +++ b/src/lib/readLocalMarkdownFileToObject.ts @@ -1,10 +1,12 @@ import fs from "fs"; import path from "path"; -import { parseMarkdownContent } from "../utils/index.js"; +import { + parseMarkdownContent, + generateFileIdFromPath, + getFileExtensionFromPath +} from "../utils/index.js"; import type { FileObject } from "./types/FileObject.js"; import { MddbFile } from "./schema.js"; -import { generateFileIdFromPath } from "../utils/index.js"; -import { getFileExtensionFromPath } from "../utils/index.js"; export function readLocalMarkdownFileToObject( folderPath: string, From 1655f7419d62dcb00cd0c677765fa7dc56eb3d2f Mon Sep 17 00:00:00 2001 From: mohamed yahia Date: Wed, 15 Nov 2023 13:49:00 +0200 Subject: [PATCH 3/3] Update src/lib/readLocalMarkdownFileToObject.ts Co-authored-by: Ola Rubaj <52197250+olayway@users.noreply.github.com> --- src/lib/readLocalMarkdownFileToObject.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/lib/readLocalMarkdownFileToObject.ts b/src/lib/readLocalMarkdownFileToObject.ts index cc50993..466afee 100644 --- a/src/lib/readLocalMarkdownFileToObject.ts +++ b/src/lib/readLocalMarkdownFileToObject.ts @@ -27,12 +27,11 @@ export function readLocalMarkdownFileToObject( links: [], }; - // if not md or mdx return this - const isExtensionNotSupported = - !MddbFile.supportedExtensions.includes(extension); - if (isExtensionNotSupported) { - return fileObject; - } +const isExtensionSupported = MddbFile.supportedExtensions.includes(extension); + +if (!isExtensionSupported) { + return fileObject; +} // url_path const pathRelativeToFolder = path.relative(folderPath, filePath);