Remove files that are no longer nessesary

This commit is contained in:
Joseph Garrone
2024-05-16 07:47:50 +02:00
parent 63f9c815e0
commit ab9e163105
3 changed files with 28 additions and 57 deletions

View File

@ -3,8 +3,6 @@ import { readParsedPackageJson } from "./parsedPackageJson";
import { join as pathJoin } from "path"; import { join as pathJoin } from "path";
import { getAbsoluteAndInOsFormatPath } from "../../tools/getAbsoluteAndInOsFormatPath"; import { getAbsoluteAndInOsFormatPath } from "../../tools/getAbsoluteAndInOsFormatPath";
import { getResolvedViteConfig } from "./resolvedViteConfig"; import { getResolvedViteConfig } from "./resolvedViteConfig";
import { getCacheDirPath } from "./getCacheDirPath";
import { getReactAppRootDirPath } from "./getReactAppRootDirPath";
import { getNpmWorkspaceRootDirPath } from "./getNpmWorkspaceRootDirPath"; import { getNpmWorkspaceRootDirPath } from "./getNpmWorkspaceRootDirPath";
import type { CliCommandOptions } from "../../main"; import type { CliCommandOptions } from "../../main";
@ -35,12 +33,18 @@ export type BuildOptions = {
export function readBuildOptions(params: { cliCommandOptions: CliCommandOptions }): BuildOptions { export function readBuildOptions(params: { cliCommandOptions: CliCommandOptions }): BuildOptions {
const { cliCommandOptions } = params; 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({ const { resolvedViteConfig } = getResolvedViteConfig({
cacheDirPath,
reactAppRootDirPath reactAppRootDirPath
}); });
@ -145,7 +149,25 @@ export function readBuildOptions(params: { cliCommandOptions: CliCommandOptions
return pathJoin(reactAppRootDirPath, resolvedViteConfig.publicDir); 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": (() => { "urlPathname": (() => {
webpack: { webpack: {
if (resolvedViteConfig !== undefined) { if (resolvedViteConfig !== undefined) {

View File

@ -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 };
}

View File

@ -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<CliCommandOptions extends CliCommandOptionsLike ? true : false>();
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 };
}