fix imports

This commit is contained in:
Abhinav 2022-08-26 15:03:52 +05:30
parent ea137eafcd
commit 502751a1ea
3 changed files with 11 additions and 12 deletions

7
src/api/fs.ts Normal file
View file

@ -0,0 +1,7 @@
import { getElectronFile, getFilesFromDir } from '../services/fs';
export async function getAllFilesFromDir(dirPath: string) {
const files = await getFilesFromDir(dirPath);
const electronFiles = await Promise.all(files.map(getElectronFile));
return electronFiles;
}

View file

@ -2,7 +2,7 @@ import { isMappingPresent } from '../utils/watch';
import path from 'path';
import { ipcRenderer } from 'electron';
import { ElectronFile } from '../types';
import { getElectronFile, getFilesFromDir } from '../services/fs';
import { getElectronFile } from '../services/fs';
import { getWatchMappings, setWatchMappings } from '../services/watch';
export async function addWatchMapping(
@ -50,12 +50,6 @@ export async function removeWatchMapping(folderPath: string) {
setWatchMappings(watchMappings);
}
export async function getAllFilesFromDir(dirPath: string) {
const files = await getFilesFromDir(dirPath);
const electronFiles = await Promise.all(files.map(getElectronFile));
return electronFiles;
}
export function registerWatcherFunctions(
addFile: (file: ElectronFile) => Promise<void>,
removeFile: (path: string) => Promise<void>,

View file

@ -9,10 +9,7 @@ import {
setToUploadCollection,
} from './api/upload';
import {
getAllFilesFromDir,
getWatchMappings,
registerWatcherFunctions,
setWatchMappings,
addWatchMapping,
removeWatchMapping,
} from './api/watch';
@ -33,8 +30,10 @@ import {
exists,
} from './api/export';
import { selectRootDirectory } from './api/common';
import { getElectronFile, doesFolderExists } from './services/fs';
import { doesFolderExists } from './services/fs';
import { fixHotReloadNext12 } from './utils/preload';
import { getAllFilesFromDir } from './api/fs';
import { getWatchMappings, setWatchMappings } from './services/watch';
fixHotReloadNext12();
@ -57,7 +56,6 @@ windowObject['ElectronAPIs'] = {
registerRetryFailedExportListener,
getExportRecord,
setExportRecord,
getElectronFile,
showUploadFilesDialog,
showUploadDirsDialog,
getPendingUploads,