Prettier support

This commit is contained in:
2021-03-10 21:14:32 -06:00
parent c51b527707
commit 0924490a6f
99 changed files with 5504 additions and 3979 deletions

View File

@@ -3,18 +3,19 @@ const fs = require('fs');
const helpers = require('../../helpers');
const path = require('path');
const getDirectories = source => {
const getDirectories = (source) => {
try {
return fs.readdirSync(source, {withFileTypes: true})
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name);
return fs
.readdirSync(source, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);
} catch {
return [];
}
}
};
const addListeners = ipcMain => {
ipcMain.on(Constants.IPC_Get_State, event => {
const addListeners = (ipcMain) => {
ipcMain.on(Constants.IPC_Get_State, (event) => {
helpers.mkDirByPathSync(helpers.getDataDirectory());
let data = {};
@@ -32,14 +33,16 @@ const addListeners = ipcMain => {
AutoMount: false,
AutoRestart: true,
MountLocation: '',
}
};
}
}
data.RemoteMounts = data.RemoteMounts || [];
data.S3Mounts = data.S3Mounts || [];
const remoteItems = getDirectories(path.join(helpers.getRepertoryDirectory(), 'remote'));
const remoteItems = getDirectories(
path.join(helpers.getRepertoryDirectory(), 'remote')
);
for (const dir of remoteItems) {
const name = 'Remote' + dir.replace('_', ':');
if (!data.RemoteMounts || data.RemoteMounts.indexOf(name) === -1) {
@@ -52,7 +55,9 @@ const addListeners = ipcMain => {
}
}
const s3Items = getDirectories(path.join(helpers.getRepertoryDirectory(), 's3'));
const s3Items = getDirectories(
path.join(helpers.getRepertoryDirectory(), 's3')
);
for (const dir of s3Items) {
const name = 'S3' + dir;
if (!data.S3Mounts || data.S3Mounts.indexOf(name) === -1) {
@@ -76,6 +81,4 @@ const addListeners = ipcMain => {
});
};
module.exports = {
addListeners
};
module.exports = { addListeners };