diff --git a/src/bin/shared/buildOptions/buildOptions.ts b/src/bin/shared/buildOptions/buildOptions.ts index 6403978f..bfc4f7c8 100644 --- a/src/bin/shared/buildOptions/buildOptions.ts +++ b/src/bin/shared/buildOptions/buildOptions.ts @@ -3,7 +3,7 @@ import { readParsedPackageJson } from "./parsedPackageJson"; import { join as pathJoin } from "path"; import { getAbsoluteAndInOsFormatPath } from "../../tools/getAbsoluteAndInOsFormatPath"; import { getResolvedViteConfig } from "./resolvedViteConfig"; -import { getNpmWorkspaceRootDirPath } from "./getNpmWorkspaceRootDirPath"; +import { getNpmWorkspaceRootDirPath } from "../../tools/getNpmWorkspaceRootDirPath"; import type { CliCommandOptions } from "../../main"; /** Consolidated build option gathered form CLI arguments and config in package.json */ @@ -150,8 +150,6 @@ export function readBuildOptions(params: { cliCommandOptions: CliCommandOptions return pathJoin(reactAppRootDirPath, resolvedViteConfig.publicDir); })(), "cacheDirPath": (() => { - const { npmWorkspaceRootDirPath } = getNpmWorkspaceRootDirPath({ reactAppRootDirPath }); - const cacheDirPath = pathJoin( (() => { if (process.env.XDG_CACHE_HOME !== undefined) { diff --git a/src/bin/shared/buildOptions/getNpmWorkspaceRootDirPath.ts b/src/bin/tools/getNpmWorkspaceRootDirPath.ts similarity index 65% rename from src/bin/shared/buildOptions/getNpmWorkspaceRootDirPath.ts rename to src/bin/tools/getNpmWorkspaceRootDirPath.ts index 99215304..db2310fe 100644 --- a/src/bin/shared/buildOptions/getNpmWorkspaceRootDirPath.ts +++ b/src/bin/tools/getNpmWorkspaceRootDirPath.ts @@ -2,26 +2,9 @@ import * as child_process from "child_process"; import { join as pathJoin, resolve as pathResolve, sep as pathSep } from "path"; import { assert } from "tsafe/assert"; -let cache: - | { - reactAppRootDirPath: string; - npmWorkspaceRootDirPath: string; - } - | undefined = undefined; - export function getNpmWorkspaceRootDirPath(params: { reactAppRootDirPath: string }) { const { reactAppRootDirPath } = params; - use_cache: { - if (cache === undefined || cache.reactAppRootDirPath !== reactAppRootDirPath) { - break use_cache; - } - - const { npmWorkspaceRootDirPath } = cache; - - return { npmWorkspaceRootDirPath }; - } - const npmWorkspaceRootDirPath = (function callee(depth: number): string { const cwd = pathResolve(pathJoin(...[reactAppRootDirPath, ...Array(depth).fill("..")])); @@ -40,10 +23,5 @@ export function getNpmWorkspaceRootDirPath(params: { reactAppRootDirPath: string return cwd; })(0); - cache = { - reactAppRootDirPath, - npmWorkspaceRootDirPath - }; - return { npmWorkspaceRootDirPath }; }