Skip to content

Commit

Permalink
chore: Refactor code to create necessary folders and files on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyphen1223 committed May 16, 2024
1 parent 0c4cddf commit e07b0cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
10 changes: 4 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@ function createFolderIfNotExists(folderPath) {
}
}

const dataFolderPath = path.join(__dirname, 'data');
const logFolderPath = path.join(__dirname, 'log');
const cacheFolderPath = path.join(__dirname, 'cache');
createFolderIfNotExists(dataFolderPath);
createFolderIfNotExists(logFolderPath);
createFolderIfNotExists(cacheFolderPath);
const folders = ['./data', './log', './cache'];
folders.forEach((folderPath) => {
createFolderIfNotExists(folderPath);
});

function createFileIfNotExists(filePath) {
if (!fs.existsSync(filePath)) {
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e07b0cb

Please sign in to comment.