Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/nx/src/command-line/reset/reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { rmSync } from 'node:fs';
import { join } from 'node:path';

import { daemonClient } from '../../daemon/client/client';
import { DAEMON_DIR_FOR_CURRENT_WORKSPACE } from '../../daemon/tmp-dir';
import { cacheDir, workspaceDataDirectory } from '../../utils/cache-directory';
import { output } from '../../utils/output';
import { getNativeFileCacheLocation } from '../../native/native-file-cache-location';
Expand Down Expand Up @@ -55,6 +56,11 @@ export async function resetHandler(args: ResetCommandOptions) {
} catch (e) {
errors.push('Failed to stop the Nx Daemon.', e.toString());
}
try {
await cleanupDaemonDir();
} catch (e) {
errors.push('Failed to clean up the daemon directory.', e.toString());
}
}
if (all || args.onlyCache) {
try {
Expand Down Expand Up @@ -105,6 +111,19 @@ async function killDaemon(): Promise<void> {
}
}

function cleanupDaemonDir() {
return incrementalBackoff(
INCREMENTAL_BACKOFF_FIRST_DELAY,
INCREMENTAL_BACKOFF_MAX_DURATION,
() => {
rmSync(DAEMON_DIR_FOR_CURRENT_WORKSPACE, {
recursive: true,
force: true,
});
}
);
}

async function resetCloudClient() {
// Remove nx cloud marker files. This helps if the use happens to run `nx-cloud start-ci-run` or
// similar commands on their local machine.
Expand Down