fix(js): use uuid when generating tmp tsconfig (#30118)
## Current Behavior When multiple processes/tasks are running in parallel for a single project that produce tmp tsconfig files for buildable libraries, they can clobber each other. ## Expected Behavior Ensure the config file is generated with a unique id to prevent clobbering
This commit is contained in:
parent
a90de969ab
commit
46e5dcefb0
@ -19,6 +19,7 @@ import { output } from 'nx/src/utils/output';
|
|||||||
import { dirname, join, relative, extname, resolve } from 'path';
|
import { dirname, join, relative, extname, resolve } from 'path';
|
||||||
import type * as ts from 'typescript';
|
import type * as ts from 'typescript';
|
||||||
import { readTsConfigPaths } from './typescript/ts-config';
|
import { readTsConfigPaths } from './typescript/ts-config';
|
||||||
|
import { randomUUID } from 'crypto';
|
||||||
|
|
||||||
function isBuildable(target: string, node: ProjectGraphProjectNode): boolean {
|
function isBuildable(target: string, node: ProjectGraphProjectNode): boolean {
|
||||||
return (
|
return (
|
||||||
@ -443,7 +444,7 @@ export function createTmpTsConfig(
|
|||||||
'tmp',
|
'tmp',
|
||||||
projectRoot,
|
projectRoot,
|
||||||
process.env.NX_TASK_TARGET_TARGET ?? 'build',
|
process.env.NX_TASK_TARGET_TARGET ?? 'build',
|
||||||
'tsconfig.generated.json'
|
`tsconfig.generated.${randomUUID()}.json`
|
||||||
);
|
);
|
||||||
if (tsconfigPath === tmpTsConfigPath) {
|
if (tsconfigPath === tmpTsConfigPath) {
|
||||||
return tsconfigPath;
|
return tsconfigPath;
|
||||||
|
|||||||
@ -80,6 +80,7 @@ export function nxViteTsPaths(options: nxViteTsPathsOptions = {}) {
|
|||||||
projectRoot = config.root;
|
projectRoot = config.root;
|
||||||
const projectRootFromWorkspaceRoot = relative(workspaceRoot, projectRoot);
|
const projectRootFromWorkspaceRoot = relative(workspaceRoot, projectRoot);
|
||||||
let foundTsConfigPath = getTsConfig(
|
let foundTsConfigPath = getTsConfig(
|
||||||
|
process.env.NX_TSCONFIG_PATH ??
|
||||||
join(
|
join(
|
||||||
workspaceRoot,
|
workspaceRoot,
|
||||||
'tmp',
|
'tmp',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user