fix: logs folder doesn't exist (#3759)

This commit is contained in:
Jérémy M 2024-02-01 16:47:36 +01:00 committed by GitHub
parent 3c89a97a9f
commit 9799326533
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,6 @@
import { Injectable } from '@nestjs/common';
import { existsSync } from 'fs';
import fs from 'fs/promises';
import { WorkspaceSyncStorage } from 'src/workspace/workspace-sync-metadata/storage/workspace-sync.storage';
@ -13,6 +14,11 @@ export class WorkspaceLogsService {
storage: WorkspaceSyncStorage,
workspaceMigrations: WorkspaceMigrationEntity[],
) {
// Check if `logs` folder exists
if (existsSync('./logs') === false) {
await fs.mkdir('./logs', { recursive: true });
}
// Save workspace migrations
await fs.writeFile(
'./logs/workspace-migrations.json',