diff --git a/src/index.ts b/src/index.ts index 702ea0d..8a0b7a5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,8 @@ import colors from 'colors'; import dotenv from 'dotenv'; +import fs from 'fs/promises'; +import path from 'path'; import { initializeAPI } from './api'; import { autoDeployApps } from './utils/autoDeploy'; import { appsDirectory } from './utils/config'; @@ -21,6 +23,14 @@ void (async (): Promise => { await ensureFolderExists(appsDirectory); + // Clear all deployments + if (args.includes('--prune')) { + // Delete appsDirectory files + for (const file of await fs.readdir(appsDirectory)) { + await fs.unlink(path.join(appsDirectory, file)); + } + } + await autoDeployApps(appsDirectory); const app = initializeAPI();