From 2266e34a5f4c3608a84b3f1e6753fb5c2f45dc7d Mon Sep 17 00:00:00 2001 From: Rebecca Hum Date: Wed, 22 Nov 2023 15:15:28 -0700 Subject: [PATCH] Move trackinginfo around --- src/bin/vip-dev-env-purge.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/bin/vip-dev-env-purge.js b/src/bin/vip-dev-env-purge.js index ada503ef92..2e5ab15aee 100755 --- a/src/bin/vip-dev-env-purge.js +++ b/src/bin/vip-dev-env-purge.js @@ -46,8 +46,6 @@ command() const allEnvNames = getAllEnvironmentNames(); const lando = await bootstrapLando(); - const trackingInfo = { all: true }; - await trackEvent( 'dev_env_purge_command_execute', trackingInfo ); if ( allEnvNames.length === 0 ) { console.log( 'No environments to purge!' ); @@ -65,9 +63,9 @@ command() } } - const trackingInfoChild = getEnvTrackingInfo( slug ); + const trackingInfo = { all: true }; // eslint-disable-next-line no-await-in-loop - await trackEvent( 'dev_env_purge_command_execute', trackingInfoChild ); + await trackEvent( 'dev_env_purge_command_execute', trackingInfo ); // eslint-disable-next-line no-await-in-loop await validateDependencies( lando, '' ); @@ -83,13 +81,14 @@ command() const message = chalk.green( '✓' ) + ' Environment destroyed.\n'; console.log( message ); } catch ( error ) { + const trackingInfoChild = getEnvTrackingInfo( slug ); // eslint-disable-next-line no-await-in-loop await handleCLIException( error, 'dev_env_purge_command_error', trackingInfoChild ); process.exitCode = 1; } } // eslint-disable-next-line no-await-in-loop - await trackEvent( 'dev_env_purge_command_success', trackingInfoChild ); + await trackEvent( 'dev_env_purge_command_success', trackingInfo ); } catch ( error ) { await handleCLIException( error, 'dev_env_purge_command_error', trackingInfo ); process.exitCode = 1;