keycloak_theme/src/bin/download-keycloak-default-theme.ts

59 lines
1.7 KiB
TypeScript
Raw Normal View History

import { join as pathJoin, relative as pathRelative, sep as pathSep } from "path";
import { promptKeycloakVersion } from "./shared/promptKeycloakVersion";
import { readBuildOptions } from "./shared/buildOptions";
2024-05-19 10:46:26 +02:00
import { downloadKeycloakDefaultTheme } from "./shared/downloadKeycloakDefaultTheme";
import type { CliCommandOptions } from "./main";
import chalk from "chalk";
2021-02-21 23:06:42 +01:00
export async function command(params: { cliCommandOptions: CliCommandOptions }) {
const { cliCommandOptions } = params;
2023-09-03 23:26:34 +02:00
const buildOptions = readBuildOptions({
cliCommandOptions
});
2024-05-20 15:48:51 +02:00
console.log(
chalk.cyan(
"Select the Keycloak version from which you want to download the builtins theme:"
)
);
2024-05-17 05:13:41 +02:00
const { keycloakVersion } = await promptKeycloakVersion({
2024-05-20 15:48:51 +02:00
startingFromMajor: undefined,
cacheDirPath: buildOptions.cacheDirPath
2024-05-17 05:13:41 +02:00
});
console.log(`${keycloakVersion}`);
2024-05-20 15:48:51 +02:00
const destDirPath = pathJoin(
buildOptions.keycloakifyBuildDirPath,
"src",
"main",
"resources",
"theme"
);
console.log(
[
`Downloading builtins theme of Keycloak ${keycloakVersion} here:`,
2024-05-20 15:48:51 +02:00
`- ${chalk.bold(
`.${pathSep}${pathJoin(pathRelative(process.cwd(), destDirPath), "base")}`
)}`,
`- ${chalk.bold(
`.${pathSep}${pathJoin(
pathRelative(process.cwd(), destDirPath),
"keycloak"
)}`
)}`
].join("\n")
);
2024-05-19 10:46:26 +02:00
await downloadKeycloakDefaultTheme({
keycloakVersion,
2023-09-03 23:26:34 +02:00
destDirPath,
buildOptions
});
console.log(chalk.green(`✓ done`));
}