Rename reactAppRootDirPath -> projectDirPath and reactAppBuildDirPath -> projectBuildDirPath

This commit is contained in:
Joseph Garrone
2024-06-09 09:03:43 +02:00
parent 6e95dacd3a
commit 3453a17c15
18 changed files with 73 additions and 76 deletions

View File

@ -19,7 +19,7 @@ export type BuildOptionsLike = {
bundler: "vite" | "webpack";
themeVersion: string;
urlPathname: string | undefined;
reactAppBuildDirPath: string;
projectBuildDirPath: string;
assetsDirPath: string;
kcContextExclusionsFtlCode: string | undefined;
};

View File

@ -46,10 +46,10 @@ export type BuildOptionsLike = BuildOptionsLike_kcContextExclusionsFtlCode &
bundler: "vite" | "webpack";
extraThemeProperties: string[] | undefined;
loginThemeResourcesFromKeycloakVersion: string;
reactAppBuildDirPath: string;
projectBuildDirPath: string;
assetsDirPath: string;
urlPathname: string | undefined;
reactAppRootDirPath: string;
projectDirPath: string;
keycloakifyBuildDirPath: string;
environmentVariables: { name: string; default: string }[];
};
@ -63,7 +63,7 @@ export async function generateSrcMainResourcesForMainTheme(params: {
const { themeName, buildOptions } = params;
const { themeSrcDirPath } = getThemeSrcDirPath({
reactAppRootDirPath: buildOptions.reactAppRootDirPath
projectDirPath: buildOptions.projectDirPath
});
const getThemeTypeDirPath = (params: { themeType: ThemeType | "email" }) => {
@ -124,7 +124,7 @@ export async function generateSrcMainResourcesForMainTheme(params: {
}
transformCodebase({
srcDirPath: buildOptions.reactAppBuildDirPath,
srcDirPath: buildOptions.projectBuildDirPath,
destDirPath,
transformSourceCode: ({ filePath, sourceCode }) => {
//NOTE: Prevent cycles, excludes the folder we generated for debug in public/
@ -132,7 +132,7 @@ export async function generateSrcMainResourcesForMainTheme(params: {
if (
isInside({
dirPath: pathJoin(
buildOptions.reactAppBuildDirPath,
buildOptions.projectBuildDirPath,
keycloak_resources
),
filePath
@ -179,7 +179,7 @@ export async function generateSrcMainResourcesForMainTheme(params: {
const { generateFtlFilesCode } = generateFtlFilesCodeFactory({
themeName,
indexHtmlCode: fs
.readFileSync(pathJoin(buildOptions.reactAppBuildDirPath, "index.html"))
.readFileSync(pathJoin(buildOptions.projectBuildDirPath, "index.html"))
.toString("utf8"),
cssGlobalsToDefine,
buildOptions,

View File

@ -84,7 +84,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
}
child_process.execSync("npx vite", {
cwd: buildOptions.reactAppRootDirPath,
cwd: buildOptions.projectDirPath,
env: {
...process.env,
[vitePluginSubScriptEnvNames.runPostBuildScript]:

View File

@ -5,7 +5,7 @@ import { replaceImportsInJsCode_webpack } from "./webpack";
import * as fs from "fs";
export type BuildOptionsLike = {
reactAppBuildDirPath: string;
projectBuildDirPath: string;
assetsDirPath: string;
urlPathname: string | undefined;
bundler: "vite" | "webpack";

View File

@ -8,7 +8,7 @@ import * as nodePath from "path";
import { replaceAll } from "../../../tools/String.prototype.replaceAll";
export type BuildOptionsLike = {
reactAppBuildDirPath: string;
projectBuildDirPath: string;
assetsDirPath: string;
urlPathname: string | undefined;
};
@ -62,7 +62,7 @@ export function replaceImportsInJsCode_vite(params: {
// Example: "assets/ or "foo/bar/"
const staticDir = (() => {
let out = pathRelative(
buildOptions.reactAppBuildDirPath,
buildOptions.projectBuildDirPath,
buildOptions.assetsDirPath
);
@ -70,7 +70,7 @@ export function replaceImportsInJsCode_vite(params: {
if (out === "/") {
throw new Error(
`The assetsDirPath must be a subdirectory of reactAppBuildDirPath`
`The assetsDirPath must be a subdirectory of projectBuildDirPath`
);
}

View File

@ -8,7 +8,7 @@ import * as nodePath from "path";
import { replaceAll } from "../../../tools/String.prototype.replaceAll";
export type BuildOptionsLike = {
reactAppBuildDirPath: string;
projectBuildDirPath: string;
assetsDirPath: string;
urlPathname: string | undefined;
};
@ -50,7 +50,7 @@ export function replaceImportsInJsCode_webpack(params: {
// Example: "static/ or "foo/bar/"
const staticDir = (() => {
let out = pathRelative(
buildOptions.reactAppBuildDirPath,
buildOptions.projectBuildDirPath,
buildOptions.assetsDirPath
);
@ -58,7 +58,7 @@ export function replaceImportsInJsCode_webpack(params: {
if (out === "/") {
throw new Error(
`The assetsDirPath must be a subdirectory of reactAppBuildDirPath`
`The assetsDirPath must be a subdirectory of projectBuildDirPath`
);
}