Skip to content

Commit

Permalink
Add prune command for deleting all the deployments on startup.
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga committed Jan 16, 2025
1 parent f270e6d commit 6e8a219
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -21,6 +23,14 @@ void (async (): Promise<void> => {

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();
Expand Down

0 comments on commit 6e8a219

Please sign in to comment.