Debug commit TO DELETE

This commit is contained in:
Joseph Garrone 2024-06-23 02:08:33 +02:00
parent 9333400322
commit 777d8690c2
3 changed files with 40 additions and 1 deletions

View File

@ -12,6 +12,12 @@ import * as os from "os";
import { rmSync } from "../tools/fs.rmSync";
export async function command(params: { cliCommandOptions: CliCommandOptions }) {
console.log("DEBUG:", {
__filename,
__dirname,
"process.cwd()": process.cwd()
});
exit_if_maven_not_installed: {
let commandOutput: Buffer | undefined = undefined;

View File

@ -90,6 +90,8 @@ export function getBuildContext(params: {
}): BuildContext {
const { cliCommandOptions } = params;
console.log("DEBUG:", { cliCommandOptions });
const projectDirPath = (() => {
if (cliCommandOptions.projectDirPath === undefined) {
return process.cwd();
@ -101,6 +103,8 @@ export function getBuildContext(params: {
});
})();
console.log("DEBUG:", { projectDirPath });
const { resolvedViteConfig } = (() => {
if (
fs
@ -135,6 +139,8 @@ export function getBuildContext(params: {
return { resolvedViteConfig };
})();
console.log("DEBUG:", { resolvedViteConfig });
const parsedPackageJson = (() => {
type BuildOptions_packageJson = BuildOptions & {
projectBuildDirPath?: string;
@ -235,11 +241,15 @@ export function getBuildContext(params: {
);
})();
console.log("DEBUG:", { parsedPackageJson });
const buildOptions = {
...parsedPackageJson.keycloakify,
...resolvedViteConfig?.buildOptions
};
console.log("DEBUG:", { buildOptions });
const { themeSrcDirPath } = (() => {
const srcDirPath = pathJoin(projectDirPath, "src");
@ -288,6 +298,8 @@ export function getBuildContext(params: {
])
);
console.log("DEBUG:", { themeSrcDirPath });
const themeNames = ((): [string, ...string[]] => {
if (buildOptions.themeName === undefined) {
return [
@ -309,6 +321,8 @@ export function getBuildContext(params: {
return [mainThemeName, ...themeVariantNames];
})();
console.log("DEBUG:", { themeNames });
const projectBuildDirPath = (() => {
webpack: {
if (resolvedViteConfig !== undefined) {
@ -328,14 +342,18 @@ export function getBuildContext(params: {
return pathJoin(projectDirPath, resolvedViteConfig.buildDir);
})();
console.log("DEBUG:", { projectBuildDirPath });
const { npmWorkspaceRootDirPath } = getNpmWorkspaceRootDirPath({
projectDirPath,
dependencyExpected: "keycloakify"
});
console.log("DEBUG:", { npmWorkspaceRootDirPath });
const bundler = resolvedViteConfig !== undefined ? "vite" : "webpack";
return {
const buildContext: BuildContext = {
bundler,
themeVersion: buildOptions.themeVersion ?? parsedPackageJson.version ?? "0.0.0",
themeNames,
@ -765,4 +783,8 @@ export function getBuildContext(params: {
return jarTargets;
})()
};
console.log("DEBUG:", JSON.stringify({ buildContext }, null, 2));
return buildContext;
}

View File

@ -9,11 +9,18 @@ export function getNpmWorkspaceRootDirPath(params: {
}) {
const { projectDirPath, dependencyExpected } = params;
console.log("DEBUG getNpmWorkspaceRootDirPath:", {
projectDirPath,
dependencyExpected
});
const npmWorkspaceRootDirPath = (function callee(depth: number): string {
const cwd = pathResolve(
pathJoin(...[projectDirPath, ...Array(depth).fill("..")])
);
console.log("DEBUG getNpmWorkspaceRootDirPath:", { cwd });
assert(cwd !== pathSep, "NPM workspace not found");
try {
@ -22,6 +29,8 @@ export function getNpmWorkspaceRootDirPath(params: {
stdio: "ignore"
});
} catch (error) {
console.log("DEBUG getNpmWorkspaceRootDirPath: got error npm config get");
if (String(error).includes("ENOWORKSPACES")) {
return callee(depth + 1);
}
@ -29,6 +38,8 @@ export function getNpmWorkspaceRootDirPath(params: {
throw error;
}
console.log("DEBUG getNpmWorkspaceRootDirPath: npm workspace found");
const packageJsonFilePath = pathJoin(cwd, "package.json");
if (!fs.existsSync(packageJsonFilePath)) {