🏗 Refactoring the import process WIP

This commit is contained in:
2021-11-30 22:44:06 -08:00
parent e8d21d4292
commit 1fd5f5b6cf
12 changed files with 380 additions and 1046 deletions

View File

@@ -9,7 +9,6 @@ import {
IExtractionOptions,
IFolderData,
} from "threetwo-ui-typings";
import { logger } from "./logger.utils";
import { includes, remove, indexOf } from "lodash";
const ALLOWED_IMAGE_FILE_FORMATS = [".jpg", ".jpeg", ".png"];
@@ -29,7 +28,7 @@ export const walkFolder = async (folder: string, formats: string[]): Promise<IFo
const walk = Walk.create({ sort: filterOutDotFiles });
await walk(folder, async (err, pathname, dirent) => {
if (err) {
logger.error("Failed to lstat directory", { error: err });
console.log("Failed to lstat directory", { error: err });
return false;
}
if ([...formats].includes(path.extname(dirent.name))) {
@@ -42,7 +41,7 @@ export const walkFolder = async (folder: string, formats: string[]): Promise<IFo
isFile: dirent.isFile(),
isLink: dirent.isSymbolicLink(),
};
logger.info(
console.log(
`Scanned ${dirent.name} contained in ${path.dirname(pathname)}`
);
result.push(walkResult);