parent
eb64fe60d0
commit
9f25cddaa4
@ -4,7 +4,7 @@ import { crawl } from "./tools/crawl";
|
|||||||
import { join as pathJoin } from "path";
|
import { join as pathJoin } from "path";
|
||||||
import { themeTypes } from "./keycloakify/generateFtl";
|
import { themeTypes } from "./keycloakify/generateFtl";
|
||||||
|
|
||||||
const themeSrcDirBasename = "keycloak-theme";
|
const themeSrcDirBasenames = ["keycloak-theme", "keycloak_theme"];
|
||||||
|
|
||||||
/** Can't catch error, if the directory isn't found, this function will just exit the process with an error message. */
|
/** Can't catch error, if the directory isn't found, this function will just exit the process with an error message. */
|
||||||
export function getThemeSrcDirPath(params: { projectDirPath: string }) {
|
export function getThemeSrcDirPath(params: { projectDirPath: string }) {
|
||||||
@ -14,13 +14,13 @@ export function getThemeSrcDirPath(params: { projectDirPath: string }) {
|
|||||||
|
|
||||||
const themeSrcDirPath: string | undefined = crawl({ "dirPath": srcDirPath, "returnedPathsType": "relative to dirPath" })
|
const themeSrcDirPath: string | undefined = crawl({ "dirPath": srcDirPath, "returnedPathsType": "relative to dirPath" })
|
||||||
.map(fileRelativePath => {
|
.map(fileRelativePath => {
|
||||||
const split = fileRelativePath.split(themeSrcDirBasename);
|
for (const themeSrcDirBasename of themeSrcDirBasenames) {
|
||||||
|
const split = fileRelativePath.split(themeSrcDirBasename);
|
||||||
if (split.length !== 2) {
|
if (split.length === 2) {
|
||||||
return undefined;
|
return pathJoin(srcDirPath, split[0] + themeSrcDirBasename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
return pathJoin(srcDirPath, split[0] + themeSrcDirBasename);
|
|
||||||
})
|
})
|
||||||
.filter(exclude(undefined))[0];
|
.filter(exclude(undefined))[0];
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ export function getThemeSrcDirPath(params: { projectDirPath: string }) {
|
|||||||
console.error(
|
console.error(
|
||||||
[
|
[
|
||||||
"Can't locate your theme source directory. It should be either: ",
|
"Can't locate your theme source directory. It should be either: ",
|
||||||
"src/ or src/keycloak-theme.",
|
"src/ or src/keycloak-theme or src/keycloak_theme.",
|
||||||
"Example in the starter: https://github.com/keycloakify/keycloakify-starter/tree/main/src/keycloak-theme"
|
"Example in the starter: https://github.com/keycloakify/keycloakify-starter/tree/main/src/keycloak-theme"
|
||||||
].join("\n")
|
].join("\n")
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user