Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
5cf290b033 | |||
aec3da25b3 | |||
66d7cb563d | |||
551e9c041e | |||
fffb6d5b5e | |||
ac0bfeb360 | |||
7c30059ca3 |
11
CHANGELOG.md
11
CHANGELOG.md
@ -1,3 +1,14 @@
|
|||||||
|
### **2.0.6** (2021-07-08)
|
||||||
|
|
||||||
|
- Merge pull request #18 from asashay/add-custom-props-to-theme-properties
|
||||||
|
|
||||||
|
Add possibility to add custom properties to theme.properties file
|
||||||
|
- add possibility to add custom properties to theme.properties file
|
||||||
|
|
||||||
|
### **2.0.5** (2021-07-05)
|
||||||
|
|
||||||
|
- Fix broken url for big stylesheet #16
|
||||||
|
|
||||||
### **2.0.4** (2021-07-03)
|
### **2.0.4** (2021-07-03)
|
||||||
|
|
||||||
- Fix: #7
|
- Fix: #7
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "keycloakify",
|
"name": "keycloakify",
|
||||||
"version": "2.0.4",
|
"version": "2.0.6",
|
||||||
"description": "Keycloak theme generator for Reacts app",
|
"description": "Keycloak theme generator for Reacts app",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -19,6 +19,7 @@ export function main() {
|
|||||||
console.log("🔏 Building the keycloak theme...⌚");
|
console.log("🔏 Building the keycloak theme...⌚");
|
||||||
|
|
||||||
const extraPagesId: string[] = (parsedPackageJson as any)["keycloakify"]?.["extraPages"] ?? [];
|
const extraPagesId: string[] = (parsedPackageJson as any)["keycloakify"]?.["extraPages"] ?? [];
|
||||||
|
const extraThemeProperties: string[] = (parsedPackageJson as any)["keycloakify"]?.["extraThemeProperties"] ?? [];
|
||||||
|
|
||||||
generateKeycloakThemeResources({
|
generateKeycloakThemeResources({
|
||||||
keycloakThemeBuildingDirPath,
|
keycloakThemeBuildingDirPath,
|
||||||
@ -55,7 +56,8 @@ export function main() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
})(),
|
})(),
|
||||||
extraPagesId
|
extraPagesId,
|
||||||
|
extraThemeProperties
|
||||||
});
|
});
|
||||||
|
|
||||||
const { jarFilePath } = generateJavaStackFiles({
|
const { jarFilePath } = generateJavaStackFiles({
|
||||||
|
@ -23,12 +23,13 @@ export function generateKeycloakThemeResources(
|
|||||||
//If urlOrigin is not undefined then it means --externals-assets
|
//If urlOrigin is not undefined then it means --externals-assets
|
||||||
urlOrigin: undefined | string;
|
urlOrigin: undefined | string;
|
||||||
extraPagesId: string[];
|
extraPagesId: string[];
|
||||||
|
extraThemeProperties: string[];
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
|
|
||||||
const {
|
const {
|
||||||
themeName, reactAppBuildDirPath, keycloakThemeBuildingDirPath,
|
themeName, reactAppBuildDirPath, keycloakThemeBuildingDirPath,
|
||||||
urlPathname, urlOrigin, extraPagesId
|
urlPathname, urlOrigin, extraPagesId, extraThemeProperties
|
||||||
} = params;
|
} = params;
|
||||||
|
|
||||||
const themeDirPath = pathJoin(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme", themeName, "login");
|
const themeDirPath = pathJoin(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme", themeName, "login");
|
||||||
@ -166,7 +167,10 @@ export function generateKeycloakThemeResources(
|
|||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
pathJoin(themeDirPath, "theme.properties"),
|
pathJoin(themeDirPath, "theme.properties"),
|
||||||
Buffer.from("parent=keycloak", "utf8")
|
Buffer.from(
|
||||||
|
"parent=keycloak".concat("\n\n", extraThemeProperties.join("\n\n")),
|
||||||
|
"utf8"
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,19 +5,40 @@ import { ftlValuesGlobalName } from "./ftlValuesGlobalName";
|
|||||||
export function replaceImportsFromStaticInJsCode(
|
export function replaceImportsFromStaticInJsCode(
|
||||||
params: {
|
params: {
|
||||||
jsCode: string;
|
jsCode: string;
|
||||||
urlOrigin: undefined | string;
|
urlOrigin: undefined | string;
|
||||||
}
|
}
|
||||||
): { fixedJsCode: string; } {
|
): { fixedJsCode: string; } {
|
||||||
|
|
||||||
|
/*
|
||||||
|
NOTE:
|
||||||
|
|
||||||
|
When we have urlOrigin defined it means that
|
||||||
|
we are building with --external-assets
|
||||||
|
so we have to make sur that the fixed js code will run
|
||||||
|
inside and outside keycloak.
|
||||||
|
|
||||||
|
When urlOrigin isn't defined we can assume the fixedJsCode
|
||||||
|
will always run in keycloak context.
|
||||||
|
*/
|
||||||
|
|
||||||
const { jsCode, urlOrigin } = params;
|
const { jsCode, urlOrigin } = params;
|
||||||
|
|
||||||
const fixedJsCode = jsCode.replace(
|
const fixedJsCode =
|
||||||
/([a-z]+\.[a-z]+)\+"static\//g,
|
jsCode
|
||||||
(...[, group]) =>
|
.replace(
|
||||||
urlOrigin === undefined ?
|
/([a-z]+\.[a-z]+)\+"static\//g,
|
||||||
`window.${ftlValuesGlobalName}.url.resourcesPath + "/build/static/` :
|
(...[, group]) =>
|
||||||
`("${ftlValuesGlobalName}" in window ? "${urlOrigin}" : "") + ${group} + "static/`
|
urlOrigin === undefined ?
|
||||||
);
|
`window.${ftlValuesGlobalName}.url.resourcesPath + "/build/static/` :
|
||||||
|
`("${ftlValuesGlobalName}" in window ? "${urlOrigin}" : "") + ${group} + "static/`
|
||||||
|
)
|
||||||
|
.replace(
|
||||||
|
/".chunk.css",([a-z])+=([a-z]+\.[a-z]+)\+([a-z]+),/,
|
||||||
|
(...[, group1, group2, group3]) =>
|
||||||
|
urlOrigin === undefined ?
|
||||||
|
`".chunk.css",${group1} = window.${ftlValuesGlobalName}.url.resourcesPath + "/build/" + ${group3},` :
|
||||||
|
`".chunk.css",${group1} = ("${ftlValuesGlobalName}" in window ? "${urlOrigin}" : "") + ${group2} + ${group3},`
|
||||||
|
);
|
||||||
|
|
||||||
return { fixedJsCode };
|
return { fixedJsCode };
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ generateKeycloakThemeResources({
|
|||||||
"keycloakThemeBuildingDirPath": pathJoin(sampleReactProjectDirPath, "build_keycloak_theme"),
|
"keycloakThemeBuildingDirPath": pathJoin(sampleReactProjectDirPath, "build_keycloak_theme"),
|
||||||
"urlPathname": "/keycloakify-demo-app/",
|
"urlPathname": "/keycloakify-demo-app/",
|
||||||
"urlOrigin": undefined,
|
"urlOrigin": undefined,
|
||||||
"extraPagesId": ["my-custom-page.ftl"]
|
"extraPagesId": ["my-custom-page.ftl"],
|
||||||
|
"extraThemeProperties": ["env=test"]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user