Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
46e50e622b | |||
7cfa1df0b2 | |||
8a63648339 | |||
bb6b026720 | |||
2a13b314dc | |||
4506b3f6d4 | |||
804abef0de | |||
7e932b920e | |||
46fdfbc507 | |||
a4ff8607c5 | |||
7fe4eeda57 | |||
9f25cddaa4 | |||
eb64fe60d0 | |||
36f404e17d | |||
5398590939 |
@ -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.2",
|
"version": "8.2.2",
|
||||||
"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")
|
||||||
);
|
);
|
||||||
|
@ -478,6 +478,12 @@
|
|||||||
"error.ftl" == pageId &&
|
"error.ftl" == pageId &&
|
||||||
are_same_path(path, ["realm"]) &&
|
are_same_path(path, ["realm"]) &&
|
||||||
!["name", "displayName", "displayNameHtml", "internationalizationEnabled", "registrationEmailAsUsername" ]?seq_contains(key)
|
!["name", "displayName", "displayNameHtml", "internationalizationEnabled", "registrationEmailAsUsername" ]?seq_contains(key)
|
||||||
|
) || (
|
||||||
|
"applications.ftl" == pageId &&
|
||||||
|
are_same_path(path, ["applications", "applications", "*", "client", "realm"])
|
||||||
|
) || (
|
||||||
|
"applications.ftl" == pageId &&
|
||||||
|
"masterAdminClient" == key
|
||||||
)
|
)
|
||||||
>
|
>
|
||||||
<#local out_seq += ["/*If you need '" + key + "' on " + pageId + ", please submit an issue to the Keycloakify repo*/"]>
|
<#local out_seq += ["/*If you need '" + key + "' on " + pageId + ", please submit an issue to the Keycloakify repo*/"]>
|
||||||
|
@ -20,7 +20,6 @@ export async function downloadKeycloakStaticResources(
|
|||||||
keycloakVersion: string;
|
keycloakVersion: string;
|
||||||
usedResources: {
|
usedResources: {
|
||||||
resourcesCommonFilePaths: string[];
|
resourcesCommonFilePaths: string[];
|
||||||
resourcesFilePaths: string[];
|
|
||||||
} | undefined
|
} | undefined
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
import { crawl } from "../../tools/crawl";
|
import { crawl } from "../../tools/crawl";
|
||||||
import { join as pathJoin } from "path";
|
import { join as pathJoin, sep as pathSep } from "path";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import type { ThemeType } from "../generateFtl";
|
import type { ThemeType } from "../generateFtl";
|
||||||
|
|
||||||
/** Assumes the theme type exists */
|
/** Assumes the theme type exists */
|
||||||
export function readStaticResourcesUsage(params: { keycloakifySrcDirPath: string; themeSrcDirPath: string; themeType: ThemeType }): {
|
export function readStaticResourcesUsage(params: { keycloakifySrcDirPath: string; themeSrcDirPath: string; themeType: ThemeType }): {
|
||||||
resourcesCommonFilePaths: string[];
|
resourcesCommonFilePaths: string[];
|
||||||
resourcesFilePaths: string[];
|
|
||||||
} {
|
} {
|
||||||
const { keycloakifySrcDirPath, themeSrcDirPath, themeType } = params;
|
const { keycloakifySrcDirPath, themeSrcDirPath, themeType } = params;
|
||||||
|
|
||||||
const resourcesCommonFilePaths = new Set<string>();
|
const resourcesCommonFilePaths = new Set<string>();
|
||||||
const resourcesFilePaths = new Set<string>();
|
|
||||||
|
|
||||||
for (const srcDirPath of [pathJoin(keycloakifySrcDirPath, themeType), pathJoin(themeSrcDirPath, themeType)]) {
|
for (const srcDirPath of [pathJoin(keycloakifySrcDirPath, themeType), pathJoin(themeSrcDirPath, themeType)]) {
|
||||||
const filePaths = crawl({ "dirPath": srcDirPath, "returnedPathsType": "absolute" }).filter(filePath => /\.(ts|tsx|js|jsx)$/.test(filePath));
|
const filePaths = crawl({ "dirPath": srcDirPath, "returnedPathsType": "absolute" }).filter(filePath => /\.(ts|tsx|js|jsx)$/.test(filePath));
|
||||||
@ -26,58 +24,53 @@ export function readStaticResourcesUsage(params: { keycloakifySrcDirPath: string
|
|||||||
const wrap = readPaths({ rawSourceFile });
|
const wrap = readPaths({ rawSourceFile });
|
||||||
|
|
||||||
wrap.resourcesCommonFilePaths.forEach(filePath => resourcesCommonFilePaths.add(filePath));
|
wrap.resourcesCommonFilePaths.forEach(filePath => resourcesCommonFilePaths.add(filePath));
|
||||||
wrap.resourcesFilePaths.forEach(filePath => resourcesFilePaths.add(filePath));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"resourcesCommonFilePaths": Array.from(resourcesCommonFilePaths),
|
"resourcesCommonFilePaths": Array.from(resourcesCommonFilePaths)
|
||||||
"resourcesFilePaths": Array.from(resourcesFilePaths)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Exported for testing purpose */
|
/** Exported for testing purpose */
|
||||||
export function readPaths(params: { rawSourceFile: string }): {
|
export function readPaths(params: { rawSourceFile: string }): {
|
||||||
resourcesCommonFilePaths: string[];
|
resourcesCommonFilePaths: string[];
|
||||||
resourcesFilePaths: string[];
|
|
||||||
} {
|
} {
|
||||||
const { rawSourceFile } = params;
|
const { rawSourceFile } = params;
|
||||||
|
|
||||||
const resourcesCommonFilePaths = new Set<string>();
|
const resourcesCommonFilePaths = new Set<string>();
|
||||||
const resourcesFilePaths = new Set<string>();
|
|
||||||
|
|
||||||
for (const isCommon of [true, false]) {
|
{
|
||||||
const set = isCommon ? resourcesCommonFilePaths : resourcesFilePaths;
|
const regexp = new RegExp(`resourcesCommonPath\\s*}([^\`]+)\``, "g");
|
||||||
|
|
||||||
{
|
const matches = [...rawSourceFile.matchAll(regexp)];
|
||||||
const regexp = new RegExp(`resources${isCommon ? "Common" : ""}Path\\s*}([^\`]+)\``, "g");
|
|
||||||
|
|
||||||
const matches = [...rawSourceFile.matchAll(regexp)];
|
for (const match of matches) {
|
||||||
|
const filePath = match[1];
|
||||||
|
|
||||||
for (const match of matches) {
|
resourcesCommonFilePaths.add(filePath);
|
||||||
const filePath = match[1];
|
|
||||||
|
|
||||||
set.add(filePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
const regexp = new RegExp(`resources${isCommon ? "Common" : ""}Path\\s*[+,]\\s*["']([^"'\`]+)["'\`]`, "g");
|
|
||||||
|
|
||||||
const matches = [...rawSourceFile.matchAll(regexp)];
|
|
||||||
|
|
||||||
for (const match of matches) {
|
|
||||||
const filePath = match[1];
|
|
||||||
|
|
||||||
set.add(filePath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const removePrefixSlash = (filePath: string) => (filePath.startsWith("/") ? filePath.slice(1) : filePath);
|
{
|
||||||
|
const regexp = new RegExp(`resourcesCommonPath\\s*[+,]\\s*["']([^"'\`]+)["'\`]`, "g");
|
||||||
|
|
||||||
|
const matches = [...rawSourceFile.matchAll(regexp)];
|
||||||
|
|
||||||
|
for (const match of matches) {
|
||||||
|
const filePath = match[1];
|
||||||
|
|
||||||
|
resourcesCommonFilePaths.add(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const normalizePath = (filePath: string) => {
|
||||||
|
filePath = filePath.startsWith("/") ? filePath.slice(1) : filePath;
|
||||||
|
filePath = filePath.replace(/\//g, pathSep);
|
||||||
|
return filePath;
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"resourcesCommonFilePaths": Array.from(resourcesCommonFilePaths).map(removePrefixSlash),
|
"resourcesCommonFilePaths": Array.from(resourcesCommonFilePaths).map(normalizePath)
|
||||||
"resourcesFilePaths": Array.from(resourcesFilePaths).map(removePrefixSlash)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
@ -9,8 +9,7 @@ describe("Ensure it's able to extract used Keycloak resources", () => {
|
|||||||
"node_modules/patternfly/dist/css/patternfly-additions.min.css",
|
"node_modules/patternfly/dist/css/patternfly-additions.min.css",
|
||||||
"lib/zocial/zocial.css",
|
"lib/zocial/zocial.css",
|
||||||
"node_modules/jquery/dist/jquery.min.js"
|
"node_modules/jquery/dist/jquery.min.js"
|
||||||
],
|
]
|
||||||
"resourcesFilePaths": ["css/login.css"]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
it("works with coding style n°1", () => {
|
it("works with coding style n°1", () => {
|
||||||
|
Reference in New Issue
Block a user