feat: add purchases generation

This commit is contained in:
2024-11-24 11:16:42 +01:00
parent d5fd74b0c5
commit a73f5b883c
16 changed files with 408 additions and 132 deletions

18
src/utils/createFolder.ts Normal file
View File

@@ -0,0 +1,18 @@
import { promises as fs } from 'fs';
export async function createFolderIfNotExists(
folderPath: string
): Promise<void> {
try {
await fs.access(folderPath);
console.log('Folder already exists');
} catch {
try {
await fs.mkdir(folderPath, { recursive: true });
console.log('Folder created successfully');
} catch (error) {
console.error('Error creating folder:', error);
throw error;
}
}
}