mirror of
https://github.com/zoriya/flood.git
synced 2026-06-09 13:01:54 +00:00
run, scripts: remove unused files
This commit is contained in:
@@ -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.
|
|
||||||
@@ -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.
|
|
||||||
@@ -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,
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user