From 9e853020ec335e8b3a9b504dd06085fafb6cd8d4 Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Fri, 3 Jan 2025 20:21:54 +0200 Subject: [PATCH] fix(dev-env): remove `lando/compose/env` directory when environment is destroyed --- src/lib/dev-environment/dev-environment-core.ts | 9 +++++++++ types/lando/lib/utils.d.ts | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/dev-environment/dev-environment-core.ts b/src/lib/dev-environment/dev-environment-core.ts index 300445f57..ad3248870 100644 --- a/src/lib/dev-environment/dev-environment-core.ts +++ b/src/lib/dev-environment/dev-environment-core.ts @@ -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'; @@ -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.` ); diff --git a/types/lando/lib/utils.d.ts b/types/lando/lib/utils.d.ts index 5e7f796c5..b9bd9c9f0 100644 --- a/types/lando/lib/utils.d.ts +++ b/types/lando/lib/utils.d.ts @@ -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;