From ab9e16310555b890caf35f30e77c4c535303a88e Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Thu, 16 May 2024 07:47:50 +0200 Subject: [PATCH] Remove files that are no longer nessesary --- src/bin/shared/buildOptions/buildOptions.ts | 34 +++++++++++++++---- .../shared/buildOptions/getCacheDirPath.ts | 25 -------------- .../buildOptions/getReactAppRootDirPath.ts | 26 -------------- 3 files changed, 28 insertions(+), 57 deletions(-) delete mode 100644 src/bin/shared/buildOptions/getCacheDirPath.ts delete mode 100644 src/bin/shared/buildOptions/getReactAppRootDirPath.ts diff --git a/src/bin/shared/buildOptions/buildOptions.ts b/src/bin/shared/buildOptions/buildOptions.ts index c3e59595..6403978f 100644 --- a/src/bin/shared/buildOptions/buildOptions.ts +++ b/src/bin/shared/buildOptions/buildOptions.ts @@ -3,8 +3,6 @@ import { readParsedPackageJson } from "./parsedPackageJson"; import { join as pathJoin } from "path"; import { getAbsoluteAndInOsFormatPath } from "../../tools/getAbsoluteAndInOsFormatPath"; import { getResolvedViteConfig } from "./resolvedViteConfig"; -import { getCacheDirPath } from "./getCacheDirPath"; -import { getReactAppRootDirPath } from "./getReactAppRootDirPath"; import { getNpmWorkspaceRootDirPath } from "./getNpmWorkspaceRootDirPath"; import type { CliCommandOptions } from "../../main"; @@ -35,12 +33,18 @@ export type BuildOptions = { export function readBuildOptions(params: { cliCommandOptions: CliCommandOptions }): BuildOptions { const { cliCommandOptions } = params; - const { reactAppRootDirPath } = getReactAppRootDirPath({ cliCommandOptions }); + const reactAppRootDirPath = (() => { + if (cliCommandOptions.reactAppRootDirPath === undefined) { + return process.cwd(); + } - const { cacheDirPath } = getCacheDirPath({ reactAppRootDirPath }); + return getAbsoluteAndInOsFormatPath({ + "pathIsh": cliCommandOptions.reactAppRootDirPath, + "cwd": process.cwd() + }); + })(); const { resolvedViteConfig } = getResolvedViteConfig({ - cacheDirPath, reactAppRootDirPath }); @@ -145,7 +149,25 @@ export function readBuildOptions(params: { cliCommandOptions: CliCommandOptions return pathJoin(reactAppRootDirPath, resolvedViteConfig.publicDir); })(), - cacheDirPath, + "cacheDirPath": (() => { + const { npmWorkspaceRootDirPath } = getNpmWorkspaceRootDirPath({ reactAppRootDirPath }); + + const cacheDirPath = pathJoin( + (() => { + if (process.env.XDG_CACHE_HOME !== undefined) { + return getAbsoluteAndInOsFormatPath({ + "pathIsh": process.env.XDG_CACHE_HOME, + "cwd": reactAppRootDirPath + }); + } + + return pathJoin(npmWorkspaceRootDirPath, "node_modules", ".cache"); + })(), + "keycloakify" + ); + + return cacheDirPath; + })(), "urlPathname": (() => { webpack: { if (resolvedViteConfig !== undefined) { diff --git a/src/bin/shared/buildOptions/getCacheDirPath.ts b/src/bin/shared/buildOptions/getCacheDirPath.ts deleted file mode 100644 index 9089e09a..00000000 --- a/src/bin/shared/buildOptions/getCacheDirPath.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { join as pathJoin } from "path"; -import { getAbsoluteAndInOsFormatPath } from "../../tools/getAbsoluteAndInOsFormatPath"; -import { getNpmWorkspaceRootDirPath } from "./getNpmWorkspaceRootDirPath"; - -export function getCacheDirPath(params: { reactAppRootDirPath: string }) { - const { reactAppRootDirPath } = params; - - const { npmWorkspaceRootDirPath } = getNpmWorkspaceRootDirPath({ reactAppRootDirPath }); - - const cacheDirPath = pathJoin( - (() => { - if (process.env.XDG_CACHE_HOME !== undefined) { - return getAbsoluteAndInOsFormatPath({ - "pathIsh": process.env.XDG_CACHE_HOME, - "cwd": reactAppRootDirPath - }); - } - - return pathJoin(npmWorkspaceRootDirPath, "node_modules", ".cache"); - })(), - "keycloakify" - ); - - return { cacheDirPath }; -} diff --git a/src/bin/shared/buildOptions/getReactAppRootDirPath.ts b/src/bin/shared/buildOptions/getReactAppRootDirPath.ts deleted file mode 100644 index 46a970a6..00000000 --- a/src/bin/shared/buildOptions/getReactAppRootDirPath.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { getAbsoluteAndInOsFormatPath } from "../../tools/getAbsoluteAndInOsFormatPath"; -import { assert } from "tsafe/assert"; -import type { CliCommandOptions } from "../../main"; - -type CliCommandOptionsLike = { - reactAppRootDirPath: string | undefined; -}; - -assert(); - -export function getReactAppRootDirPath(params: { cliCommandOptions: CliCommandOptionsLike }) { - const { cliCommandOptions } = params; - - const reactAppRootDirPath = (() => { - if (cliCommandOptions.reactAppRootDirPath === undefined) { - return process.cwd(); - } - - return getAbsoluteAndInOsFormatPath({ - "pathIsh": cliCommandOptions.reactAppRootDirPath, - "cwd": process.cwd() - }); - })(); - - return { reactAppRootDirPath }; -}