run, scripts: remove unused files

This commit is contained in:
Jesse Chan
2020-11-15 20:45:37 +08:00
parent 9ec5aeff30
commit 2d77aee64c
3 changed files with 0 additions and 49 deletions

View File

@@ -1,3 +0,0 @@
### By default, this folder stores database of Flood.
### You should grant Flood R/W permissions to this folder and its contents.

View File

@@ -1,3 +0,0 @@
### By default, this folder stores temporary files of Flood.
### You should grant Flood R/W permissions to this folder and its contents.

View File

@@ -1,43 +0,0 @@
const fs = require('fs');
const prettier = require('prettier');
const readFile = (filePath) => {
return new Promise((resolve, reject) => {
fs.readFile(filePath, 'utf8', (error, fileContent) => {
if (error != null) {
reject(error);
return;
}
resolve(fileContent);
});
});
};
const writeFile = (filePath, fileContent) => {
return new Promise((resolve, reject) => {
fs.writeFile(filePath, fileContent, (writeFileError) => {
if (writeFileError) {
reject(writeFileError);
return;
}
resolve(filePath);
});
});
};
const formatFile = async (inputFilePath, outputFilePath) => {
const fileContent = await readFile(inputFilePath);
const prettierConfig = await prettier.resolveConfig(inputFilePath);
const writtenFilePath = await writeFile(
outputFilePath,
prettier.format(fileContent, {...prettierConfig, filepath: inputFilePath}),
);
return writtenFilePath;
};
module.exports = {
formatFile,
};