This commit is contained in:
Joseph Garrone 2024-09-05 01:19:50 +02:00
parent dbae909903
commit c5ef4c973b

View File

@ -12,6 +12,10 @@ import * as os from "os";
import { rmSync } from "../tools/fs.rmSync"; import { rmSync } from "../tools/fs.rmSync";
export async function command(params: { cliCommandOptions: CliCommandOptions }) { export async function command(params: { cliCommandOptions: CliCommandOptions }) {
const { cliCommandOptions } = params;
const buildContext = getBuildContext({ cliCommandOptions });
exit_if_maven_not_installed: { exit_if_maven_not_installed: {
let commandOutput: Buffer | undefined = undefined; let commandOutput: Buffer | undefined = undefined;
@ -25,6 +29,22 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
break exit_if_maven_not_installed; break exit_if_maven_not_installed;
} }
if (
fs
.readFileSync(buildContext.packageJsonFilePath)
.toString("utf8")
.includes(`"mvn"`)
) {
console.log(
chalk.red(
[
"Please remove the 'mvn' package from your package.json'dependencies list,",
"reinstall your dependencies and try again.",
"We need the Apache Maven CLI, not this: https://www.npmjs.com/package/mvn"
].join(" ")
)
);
} else {
const installationCommand = (() => { const installationCommand = (() => {
switch (os.platform()) { switch (os.platform()) {
case "darwin": case "darwin":
@ -42,14 +62,11 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
installationCommand installationCommand
)}\` (for example)` )}\` (for example)`
); );
}
process.exit(1); process.exit(1);
} }
const { cliCommandOptions } = params;
const buildContext = getBuildContext({ cliCommandOptions });
console.log( console.log(
[ [
chalk.cyan(`keycloakify v${readThisNpmPackageVersion()}`), chalk.cyan(`keycloakify v${readThisNpmPackageVersion()}`),