Skip to content

Commit

Permalink
Merge pull request #2181 from Automattic/remove-lando-compose-dir
Browse files Browse the repository at this point in the history
fix(dev-env): remove `lando/compose/env` directory when environment is destroyed
  • Loading branch information
sjinks authored Jan 3, 2025
2 parents 8aaba52 + 9e85302 commit 0a6d195
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/lib/dev-environment/dev-environment-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import copydir from 'copy-dir';
import debugLib from 'debug';
import ejs from 'ejs';
import { prompt } from 'enquirer';
import { dockerComposify } from 'lando/lib/utils';
import fetch from 'node-fetch';
import fs from 'node:fs';
import path from 'node:path';
Expand Down Expand Up @@ -269,6 +270,14 @@ export async function destroyEnvironment(
debug( "Lando file doesn't exist, skipping lando destroy." );
}

await fs.promises.rm(
path.join( xdgDataDirectory(), 'vip', 'lando', 'compose', dockerComposify( slug ) ),
{
force: true,
recursive: true,
}
);

if ( removeFiles ) {
await fs.promises.rm( instancePath, { recursive: true } );
console.log( `${ chalk.green( '✓' ) } Environment files deleted successfully.` );
Expand Down
2 changes: 1 addition & 1 deletion types/lando/lib/utils.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function getAppMounts( app: any ): any;
export function dockerComposify( data: any ): any;
export function dockerComposify( data: string ): string;
export function appMachineName( data: any ): string;
export function dumpComposeData( data: any, dir: any ): any;
export function loadComposeFiles( files: any, dir: any ): any;
Expand Down

0 comments on commit 0a6d195

Please sign in to comment.