Rename generateTheme to generateSrcMainResources
This commit is contained in:
parent
64f71d4265
commit
a80449333c
@ -12,8 +12,11 @@ export type BuildOptionsLike = BuildOptionsLike_buildJar & {
|
|||||||
|
|
||||||
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
||||||
|
|
||||||
export async function buildJars(params: { doesImplementAccountTheme: boolean; buildOptions: BuildOptionsLike }): Promise<void> {
|
export async function buildJars(params: { buildOptions: BuildOptionsLike }): Promise<void> {
|
||||||
const { doesImplementAccountTheme, buildOptions } = params;
|
const { buildOptions } = params;
|
||||||
|
|
||||||
|
// TODO:
|
||||||
|
const doesImplementAccountTheme= ;
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
keycloakAccountV1Versions
|
keycloakAccountV1Versions
|
||||||
|
@ -1,27 +1,26 @@
|
|||||||
import type { BuildOptions } from "../../shared/buildOptions";
|
import type { BuildOptions } from "../../shared/buildOptions";
|
||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import { generateSrcMainResources, type BuildOptionsLike as BuildOptionsLike_generateSrcMainResources } from "./generateSrcMainResources";
|
import { generateSrcMainResourcesForMainTheme, type BuildOptionsLike as BuildOptionsLike_generateSrcMainResourcesForMainTheme } from "./generateSrcMainResourcesForMainTheme";
|
||||||
import { generateThemeVariations } from "./generateThemeVariants";
|
import { generateSrcMainResourcesForThemeVariant } from "./generateSrcMainResourcesForThemeVariant";
|
||||||
|
|
||||||
export type BuildOptionsLike = BuildOptionsLike_generateSrcMainResources & {
|
export type BuildOptionsLike = BuildOptionsLike_generateSrcMainResourcesForMainTheme & {
|
||||||
keycloakifyBuildDirPath: string;
|
|
||||||
themeNames: string[];
|
themeNames: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
||||||
|
|
||||||
export async function generateTheme(params: { buildOptions: BuildOptionsLike }): Promise<void> {
|
export async function generateSrcMainResources(params: { buildOptions: BuildOptionsLike }): Promise<void> {
|
||||||
const { buildOptions } = params;
|
const { buildOptions } = params;
|
||||||
|
|
||||||
const [themeName, ...themeVariantNames] = buildOptions.themeNames;
|
const [themeName, ...themeVariantNames] = buildOptions.themeNames;
|
||||||
|
|
||||||
await generateSrcMainResources({
|
await generateSrcMainResourcesForMainTheme({
|
||||||
themeName,
|
themeName,
|
||||||
buildOptions
|
buildOptions
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const themeVariantName of themeVariantNames) {
|
for (const themeVariantName of themeVariantNames) {
|
||||||
generateThemeVariations({
|
generateSrcMainResourcesForThemeVariant({
|
||||||
themeName,
|
themeName,
|
||||||
themeVariantName,
|
themeVariantName,
|
||||||
buildOptions
|
buildOptions
|
@ -40,7 +40,10 @@ export type BuildOptionsLike = {
|
|||||||
|
|
||||||
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
||||||
|
|
||||||
export async function generateSrcMainResources(params: { themeName: string; buildOptions: BuildOptionsLike }): Promise<void> {
|
export async function generateSrcMainResourcesForMainTheme(params: {
|
||||||
|
themeName: string;
|
||||||
|
buildOptions: BuildOptionsLike
|
||||||
|
}): Promise<void> {
|
||||||
const { themeName, buildOptions } = params;
|
const { themeName, buildOptions } = params;
|
||||||
|
|
||||||
const { themeSrcDirPath } = getThemeSrcDirPath({ "reactAppRootDirPath": buildOptions.reactAppRootDirPath });
|
const { themeSrcDirPath } = getThemeSrcDirPath({ "reactAppRootDirPath": buildOptions.reactAppRootDirPath });
|
@ -10,7 +10,7 @@ export type BuildOptionsLike = {
|
|||||||
|
|
||||||
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
||||||
|
|
||||||
export function generateThemeVariations(params: { themeName: string; themeVariantName: string; buildOptions: BuildOptionsLike }) {
|
export function generateSrcMainResourcesForThemeVariant(params: { themeName: string; themeVariantName: string; buildOptions: BuildOptionsLike }) {
|
||||||
const { themeName, themeVariantName, buildOptions } = params;
|
const { themeName, themeVariantName, buildOptions } = params;
|
||||||
|
|
||||||
const mainThemeDirPath = pathJoin(buildOptions.keycloakifyBuildDirPath, "src", "main", "resources", "theme", themeName);
|
const mainThemeDirPath = pathJoin(buildOptions.keycloakifyBuildDirPath, "src", "main", "resources", "theme", themeName);
|
1
src/bin/keycloakify/generateSrcMainResources/index.ts
Normal file
1
src/bin/keycloakify/generateSrcMainResources/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./generateSrcMainResources";
|
@ -1 +0,0 @@
|
|||||||
export * from "./generateTheme";
|
|
@ -1,4 +1,4 @@
|
|||||||
import { generateTheme } from "./generateTheme";
|
import { generateSrcMainResources } from "./generateSrcMainResources";
|
||||||
import { join as pathJoin, relative as pathRelative, sep as pathSep } from "path";
|
import { join as pathJoin, relative as pathRelative, sep as pathSep } from "path";
|
||||||
import * as child_process from "child_process";
|
import * as child_process from "child_process";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
@ -25,7 +25,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|||||||
fs.writeFileSync(pathJoin(buildOptions.keycloakifyBuildDirPath, ".gitignore"), Buffer.from("*", "utf8"));
|
fs.writeFileSync(pathJoin(buildOptions.keycloakifyBuildDirPath, ".gitignore"), Buffer.from("*", "utf8"));
|
||||||
}
|
}
|
||||||
|
|
||||||
await generateTheme({ buildOptions });
|
await generateSrcMainResources({ buildOptions });
|
||||||
|
|
||||||
run_post_build_script: {
|
run_post_build_script: {
|
||||||
if (buildOptions.bundler !== "vite") {
|
if (buildOptions.bundler !== "vite") {
|
||||||
@ -41,13 +41,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: find from META-INF/keycloak-themes.json
|
await buildJars({ buildOptions });
|
||||||
const doesImplementAccountTheme = true;
|
|
||||||
|
|
||||||
await buildJars({
|
|
||||||
doesImplementAccountTheme,
|
|
||||||
buildOptions
|
|
||||||
});
|
|
||||||
|
|
||||||
logger.log(
|
logger.log(
|
||||||
`✅ Your keycloak theme has been generated and bundled into .${pathSep}${pathJoin(
|
`✅ Your keycloak theme has been generated and bundled into .${pathSep}${pathJoin(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user