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 path from 'path';
import { ipcRenderer } from 'electron'; import { ipcRenderer } from 'electron';
import { ElectronFile } from '../types'; import { ElectronFile } from '../types';
import { getElectronFile, getFilesFromDir } from '../services/fs'; import { getElectronFile } from '../services/fs';
import { getWatchMappings, setWatchMappings } from '../services/watch'; import { getWatchMappings, setWatchMappings } from '../services/watch';
export async function addWatchMapping( export async function addWatchMapping(
@ -50,12 +50,6 @@ export async function removeWatchMapping(folderPath: string) {
setWatchMappings(watchMappings); 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( export function registerWatcherFunctions(
addFile: (file: ElectronFile) => Promise<void>, addFile: (file: ElectronFile) => Promise<void>,
removeFile: (path: string) => Promise<void>, removeFile: (path: string) => Promise<void>,

View file

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