Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
7e932b920e | |||
46fdfbc507 | |||
a4ff8607c5 | |||
7fe4eeda57 | |||
9f25cddaa4 | |||
eb64fe60d0 | |||
36f404e17d | |||
5398590939 | |||
96d5cfea14 | |||
79007ebd55 |
@ -168,6 +168,15 @@
|
|||||||
"test",
|
"test",
|
||||||
"code"
|
"code"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "rome-user",
|
||||||
|
"name": "rome-user",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/114131048?v=4",
|
||||||
|
"profile": "https://github.com/rome-user",
|
||||||
|
"contributions": [
|
||||||
|
"code"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"contributorsPerLine": 7,
|
"contributorsPerLine": 7,
|
||||||
|
@ -117,6 +117,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|||||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/satanshiro"><img src="https://avatars.githubusercontent.com/u/38865738?v=4?s=100" width="100px;" alt="satanshiro"/><br /><sub><b>satanshiro</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=satanshiro" title="Code">💻</a></td>
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/satanshiro"><img src="https://avatars.githubusercontent.com/u/38865738?v=4?s=100" width="100px;" alt="satanshiro"/><br /><sub><b>satanshiro</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=satanshiro" title="Code">💻</a></td>
|
||||||
<td align="center" valign="top" width="14.28%"><a href="https://poelhekke.dev"><img src="https://avatars.githubusercontent.com/u/1632377?v=4?s=100" width="100px;" alt="Koen Poelhekke"/><br /><sub><b>Koen Poelhekke</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=kpoelhekke" title="Code">💻</a></td>
|
<td align="center" valign="top" width="14.28%"><a href="https://poelhekke.dev"><img src="https://avatars.githubusercontent.com/u/1632377?v=4?s=100" width="100px;" alt="Koen Poelhekke"/><br /><sub><b>Koen Poelhekke</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=kpoelhekke" title="Code">💻</a></td>
|
||||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/zavoloklom"><img src="https://avatars.githubusercontent.com/u/4151869?v=4?s=100" width="100px;" alt="Sergey Kupletsky"/><br /><sub><b>Sergey Kupletsky</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=zavoloklom" title="Tests">⚠️</a> <a href="https://github.com/keycloakify/keycloakify/commits?author=zavoloklom" title="Code">💻</a></td>
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/zavoloklom"><img src="https://avatars.githubusercontent.com/u/4151869?v=4?s=100" width="100px;" alt="Sergey Kupletsky"/><br /><sub><b>Sergey Kupletsky</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=zavoloklom" title="Tests">⚠️</a> <a href="https://github.com/keycloakify/keycloakify/commits?author=zavoloklom" title="Code">💻</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rome-user"><img src="https://avatars.githubusercontent.com/u/114131048?v=4?s=100" width="100px;" alt="rome-user"/><br /><sub><b>rome-user</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=rome-user" title="Code">💻</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "keycloakify",
|
"name": "keycloakify",
|
||||||
"version": "8.1.1",
|
"version": "8.2.0",
|
||||||
"description": "Create Keycloak themes using React",
|
"description": "Create Keycloak themes using React",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -51,7 +51,7 @@ export default function Account(props: PageProps<Extract<KcContext, { pageId: "a
|
|||||||
id="username"
|
id="username"
|
||||||
name="username"
|
name="username"
|
||||||
disabled={!realm.editUsernameAllowed}
|
disabled={!realm.editUsernameAllowed}
|
||||||
value={account.username ?? ""}
|
defaultValue={account.username ?? ""}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -66,7 +66,7 @@ export default function Account(props: PageProps<Extract<KcContext, { pageId: "a
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-sm-10 col-md-10">
|
<div className="col-sm-10 col-md-10">
|
||||||
<input type="text" className="form-control" id="email" name="email" autoFocus value={account.email ?? ""} />
|
<input type="text" className="form-control" id="email" name="email" autoFocus defaultValue={account.email ?? ""} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ export default function Account(props: PageProps<Extract<KcContext, { pageId: "a
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-sm-10 col-md-10">
|
<div className="col-sm-10 col-md-10">
|
||||||
<input type="text" className="form-control" id="firstName" name="firstName" value={account.firstName ?? ""} />
|
<input type="text" className="form-control" id="firstName" name="firstName" defaultValue={account.firstName ?? ""} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ export default function Account(props: PageProps<Extract<KcContext, { pageId: "a
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-sm-10 col-md-10">
|
<div className="col-sm-10 col-md-10">
|
||||||
<input type="text" className="form-control" id="lastName" name="lastName" value={account.lastName ?? ""} />
|
<input type="text" className="form-control" id="lastName" name="lastName" defaultValue={account.lastName ?? ""} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -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")
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { transformCodebase } from "../../tools/transformCodebase";
|
import { transformCodebase } from "../../tools/transformCodebase";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { join as pathJoin, relative as pathRelative } from "path";
|
import { join as pathJoin, relative as pathRelative, dirname as pathDirname } from "path";
|
||||||
import type { ThemeType } from "../generateFtl";
|
import type { ThemeType } from "../generateFtl";
|
||||||
import { downloadBuiltinKeycloakTheme } from "../../download-builtin-keycloak-theme";
|
import { downloadBuiltinKeycloakTheme } from "../../download-builtin-keycloak-theme";
|
||||||
import {
|
import {
|
||||||
@ -9,6 +9,7 @@ import {
|
|||||||
basenameOfKeycloakDirInPublicDir
|
basenameOfKeycloakDirInPublicDir
|
||||||
} from "../../mockTestingResourcesPath";
|
} from "../../mockTestingResourcesPath";
|
||||||
import * as crypto from "crypto";
|
import * as crypto from "crypto";
|
||||||
|
import { assert } from "tsafe/assert";
|
||||||
|
|
||||||
export async function downloadKeycloakStaticResources(
|
export async function downloadKeycloakStaticResources(
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
@ -23,7 +24,32 @@ export async function downloadKeycloakStaticResources(
|
|||||||
} | undefined
|
} | undefined
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
const { projectDirPath, themeType, themeDirPath, keycloakVersion, usedResources } = params;
|
const { projectDirPath, themeType, themeDirPath, keycloakVersion } = params;
|
||||||
|
|
||||||
|
// NOTE: Hack for 427
|
||||||
|
const usedResources = (() => {
|
||||||
|
const { usedResources } = params;
|
||||||
|
|
||||||
|
if (usedResources === undefined) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(usedResources !== undefined);
|
||||||
|
|
||||||
|
return {
|
||||||
|
"resourcesCommonDirPaths": usedResources.resourcesCommonFilePaths.map(filePath => {
|
||||||
|
{
|
||||||
|
const splitArg = "/dist/";
|
||||||
|
|
||||||
|
if (filePath.includes(splitArg)) {
|
||||||
|
return filePath.split(splitArg)[0] + splitArg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pathDirname(filePath);
|
||||||
|
})
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
const tmpDirPath = pathJoin(
|
const tmpDirPath = pathJoin(
|
||||||
themeDirPath,
|
themeDirPath,
|
||||||
@ -39,17 +65,7 @@ export async function downloadKeycloakStaticResources(
|
|||||||
|
|
||||||
transformCodebase({
|
transformCodebase({
|
||||||
"srcDirPath": pathJoin(tmpDirPath, "keycloak", themeType, "resources"),
|
"srcDirPath": pathJoin(tmpDirPath, "keycloak", themeType, "resources"),
|
||||||
"destDirPath": pathJoin(themeDirPath, pathRelative(basenameOfKeycloakDirInPublicDir, resourcesDirPathRelativeToPublicDir)),
|
"destDirPath": pathJoin(themeDirPath, pathRelative(basenameOfKeycloakDirInPublicDir, resourcesDirPathRelativeToPublicDir))
|
||||||
"transformSourceCode":
|
|
||||||
usedResources === undefined
|
|
||||||
? undefined
|
|
||||||
: ({ fileRelativePath, sourceCode }) => {
|
|
||||||
if (!usedResources.resourcesFilePaths.includes(fileRelativePath)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
return { "modifiedSourceCode": sourceCode };
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
transformCodebase({
|
transformCodebase({
|
||||||
@ -59,7 +75,7 @@ export async function downloadKeycloakStaticResources(
|
|||||||
usedResources === undefined
|
usedResources === undefined
|
||||||
? undefined
|
? undefined
|
||||||
: ({ fileRelativePath, sourceCode }) => {
|
: ({ fileRelativePath, sourceCode }) => {
|
||||||
if (!usedResources.resourcesCommonFilePaths.includes(fileRelativePath)) {
|
if (usedResources.resourcesCommonDirPaths.find(dirPath => fileRelativePath.startsWith(dirPath)) === undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,24 +23,21 @@ export function usePrepareTemplate(params: {
|
|||||||
const removeArray: (() => void)[] = [];
|
const removeArray: (() => void)[] = [];
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const prLoadedArray: Promise<void>[] = [];
|
for (const style of [...styles].reverse()) {
|
||||||
|
|
||||||
styles.reverse().forEach(href => {
|
|
||||||
const { prLoaded, remove } = headInsert({
|
const { prLoaded, remove } = headInsert({
|
||||||
"type": "css",
|
"type": "css",
|
||||||
"position": "prepend",
|
"position": "prepend",
|
||||||
href
|
"href": style
|
||||||
});
|
});
|
||||||
|
|
||||||
removeArray.push(remove);
|
removeArray.push(remove);
|
||||||
|
|
||||||
prLoadedArray.push(prLoaded);
|
// TODO: Find a way to do that in parallel (without breaking the order)
|
||||||
});
|
await prLoaded;
|
||||||
|
|
||||||
await Promise.all(prLoadedArray);
|
if (isUnmounted) {
|
||||||
|
return;
|
||||||
if (isUnmounted) {
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setReady();
|
setReady();
|
||||||
|
Reference in New Issue
Block a user