Skip to content

Commit 1b78fa0

Browse files
Replace raw .tmp paths with getTmpPath in simulate and run
1 parent b6a00dd commit 1b78fa0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/cli/src/commands/run/utils.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import path from 'path';
88
import fs from 'fs-extra';
99
import { bundle } from '../bundle/index.js';
10+
import { getTmpPath } from '../../core/index.js';
1011

1112
/**
1213
* Prepares a JSON config file for execution by bundling it to a temporary location.
@@ -27,11 +28,9 @@ export async function prepareBundleForRun(
2728
silent?: boolean;
2829
},
2930
): Promise<string> {
30-
// Create temp directory relative to config (ensures node_modules is findable)
31-
const configDir = path.dirname(path.resolve(configPath));
32-
const tempDir = path.join(
33-
configDir,
34-
'.tmp',
31+
// Create temp directory relative to cwd (ensures node_modules is findable)
32+
const tempDir = getTmpPath(
33+
undefined,
3534
`run-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
3635
);
3736
await fs.ensureDir(tempDir);

packages/cli/src/commands/simulate/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { simulateCore, formatSimulationResult } from './simulator.js';
22
import {
33
createCommandLogger,
44
getErrorMessage,
5+
getTmpPath,
56
isStdinPiped,
67
readStdin,
78
writeResult,
@@ -27,7 +28,7 @@ export async function simulateCommand(
2728
// Write stdin to temp file for simulateCore (expects file path)
2829
const fs = await import('fs-extra');
2930
const path = await import('path');
30-
const tmpPath = path.default.resolve('.tmp', 'stdin-simulate.json');
31+
const tmpPath = getTmpPath(undefined, 'stdin-simulate.json');
3132
await fs.default.ensureDir(path.default.dirname(tmpPath));
3233
await fs.default.writeFile(tmpPath, stdinContent, 'utf-8');
3334
config = tmpPath;

0 commit comments

Comments
 (0)