Better prettier params (changelog ignore)
This commit is contained in:
@ -1,19 +1,13 @@
|
||||
import { join as pathJoin } from "path";
|
||||
import { generateKeycloakThemeResources } from "../../bin/build-keycloak-theme/generateKeycloakThemeResources";
|
||||
import {
|
||||
setupSampleReactProject,
|
||||
sampleReactProjectDirPath,
|
||||
} from "./setupSampleReactProject";
|
||||
import { setupSampleReactProject, sampleReactProjectDirPath } from "./setupSampleReactProject";
|
||||
|
||||
setupSampleReactProject();
|
||||
|
||||
generateKeycloakThemeResources({
|
||||
"themeName": "keycloakify-demo-app",
|
||||
"reactAppBuildDirPath": pathJoin(sampleReactProjectDirPath, "build"),
|
||||
"keycloakThemeBuildingDirPath": pathJoin(
|
||||
sampleReactProjectDirPath,
|
||||
"build_keycloak_theme",
|
||||
),
|
||||
"keycloakThemeBuildingDirPath": pathJoin(sampleReactProjectDirPath, "build_keycloak_theme"),
|
||||
"urlPathname": "/keycloakify-demo-app/",
|
||||
"urlOrigin": undefined,
|
||||
"extraPagesId": ["my-custom-page.ftl"],
|
||||
|
@ -1,7 +1,4 @@
|
||||
import {
|
||||
setupSampleReactProject,
|
||||
sampleReactProjectDirPath,
|
||||
} from "./setupSampleReactProject";
|
||||
import { setupSampleReactProject, sampleReactProjectDirPath } from "./setupSampleReactProject";
|
||||
import * as st from "scripting-tools";
|
||||
import { join as pathJoin } from "path";
|
||||
import { getProjectRoot } from "../../bin/tools/getProjectRoot";
|
||||
@ -16,7 +13,4 @@ st.execSyncTrace(
|
||||
{ "cwd": sampleReactProjectDirPath },
|
||||
);
|
||||
|
||||
st.execSyncTrace(
|
||||
`node ${pathJoin(binDirPath, "download-builtin-keycloak-theme")}`,
|
||||
{ "cwd": sampleReactProjectDirPath },
|
||||
);
|
||||
st.execSyncTrace(`node ${pathJoin(binDirPath, "download-builtin-keycloak-theme")}`, { "cwd": sampleReactProjectDirPath });
|
||||
|
@ -2,10 +2,7 @@ import { getProjectRoot } from "../../bin/tools/getProjectRoot";
|
||||
import { join as pathJoin } from "path";
|
||||
import { downloadAndUnzip } from "../../bin/tools/downloadAndUnzip";
|
||||
|
||||
export const sampleReactProjectDirPath = pathJoin(
|
||||
getProjectRoot(),
|
||||
"sample_react_project",
|
||||
);
|
||||
export const sampleReactProjectDirPath = pathJoin(getProjectRoot(), "sample_react_project");
|
||||
|
||||
export function setupSampleReactProject() {
|
||||
downloadAndUnzip({
|
||||
|
@ -4,20 +4,11 @@ import type { ExtendsKcContextBase } from "../../lib/getKcContext/getKcContext";
|
||||
import { same } from "evt/tools/inDepth";
|
||||
import { assert } from "tsafe/assert";
|
||||
import type { Equals } from "tsafe";
|
||||
import {
|
||||
kcContextMocks,
|
||||
kcContextCommonMock,
|
||||
} from "../../lib/getKcContext/kcContextMocks";
|
||||
import { kcContextMocks, kcContextCommonMock } from "../../lib/getKcContext/kcContextMocks";
|
||||
import { deepClone } from "../../lib/tools/deepClone";
|
||||
|
||||
{
|
||||
const authorizedMailDomains = [
|
||||
"example.com",
|
||||
"another-example.com",
|
||||
"*.yet-another-example.com",
|
||||
"*.example.com",
|
||||
"hello-world.com",
|
||||
];
|
||||
const authorizedMailDomains = ["example.com", "another-example.com", "*.yet-another-example.com", "*.example.com", "hello-world.com"];
|
||||
|
||||
const displayName = "this is an overwritten common value";
|
||||
|
||||
@ -41,9 +32,7 @@ import { deepClone } from "../../lib/tools/deepClone";
|
||||
aNonStandardValue2: string;
|
||||
};
|
||||
|
||||
const getKcContextProxy = (params: {
|
||||
mockPageId: ExtendsKcContextBase<KcContextExtended>["pageId"];
|
||||
}) => {
|
||||
const getKcContextProxy = (params: { mockPageId: ExtendsKcContextBase<KcContextExtended>["pageId"] }) => {
|
||||
const { mockPageId } = params;
|
||||
|
||||
const { kcContext } = getKcContext<KcContextExtended>({
|
||||
@ -85,11 +74,7 @@ import { deepClone } from "../../lib/tools/deepClone";
|
||||
//NOTE: deepClone for printIfExists or other functions...
|
||||
deepClone(kcContext),
|
||||
(() => {
|
||||
const mock = deepClone(
|
||||
kcContextMocks.find(
|
||||
({ pageId: pageId_i }) => pageId_i === pageId,
|
||||
)!,
|
||||
);
|
||||
const mock = deepClone(kcContextMocks.find(({ pageId: pageId_i }) => pageId_i === pageId)!);
|
||||
|
||||
mock.realm.displayName = displayName;
|
||||
|
||||
@ -123,11 +108,7 @@ import { deepClone } from "../../lib/tools/deepClone";
|
||||
same(
|
||||
deepClone(kcContext),
|
||||
(() => {
|
||||
const mock = deepClone(
|
||||
kcContextMocks.find(
|
||||
({ pageId: pageId_i }) => pageId_i === pageId,
|
||||
)!,
|
||||
);
|
||||
const mock = deepClone(kcContextMocks.find(({ pageId: pageId_i }) => pageId_i === pageId)!);
|
||||
|
||||
Object.assign(mock, { aNonStandardValue1 });
|
||||
|
||||
@ -161,11 +142,7 @@ import { deepClone } from "../../lib/tools/deepClone";
|
||||
same(
|
||||
deepClone(kcContext),
|
||||
(() => {
|
||||
const mock = deepClone(
|
||||
kcContextMocks.find(
|
||||
({ pageId: pageId_i }) => pageId_i === pageId,
|
||||
)!,
|
||||
);
|
||||
const mock = deepClone(kcContextMocks.find(({ pageId: pageId_i }) => pageId_i === pageId)!);
|
||||
|
||||
Object.assign(mock, { authorizedMailDomains });
|
||||
|
||||
@ -221,12 +198,7 @@ import { deepClone } from "../../lib/tools/deepClone";
|
||||
|
||||
assert(kcContext?.pageId === pageId);
|
||||
|
||||
assert<
|
||||
Equals<
|
||||
typeof kcContext,
|
||||
KcContextBase.Common & { pageId: typeof pageId }
|
||||
>
|
||||
>();
|
||||
assert<Equals<typeof kcContext, KcContextBase.Common & { pageId: typeof pageId }>>();
|
||||
|
||||
assert(
|
||||
same(
|
||||
@ -254,16 +226,7 @@ import { deepClone } from "../../lib/tools/deepClone";
|
||||
|
||||
assert<Equals<typeof kcContext, KcContextBase | undefined>>();
|
||||
|
||||
assert(
|
||||
same(
|
||||
deepClone(kcContext),
|
||||
deepClone(
|
||||
kcContextMocks.find(
|
||||
({ pageId: pageId_i }) => pageId_i === pageId,
|
||||
)!,
|
||||
),
|
||||
),
|
||||
);
|
||||
assert(same(deepClone(kcContext), deepClone(kcContextMocks.find(({ pageId: pageId_i }) => pageId_i === pageId)!)));
|
||||
|
||||
console.log("PASS no extension");
|
||||
}
|
||||
|
@ -2,15 +2,9 @@ import { AndByDiscriminatingKey } from "../../../lib/tools/AndByDiscriminatingKe
|
||||
import { assert } from "tsafe/assert";
|
||||
import type { Equals } from "tsafe";
|
||||
|
||||
type Base =
|
||||
| { pageId: "a"; onlyA: string }
|
||||
| { pageId: "b"; onlyB: string }
|
||||
| { pageId: "only base"; onlyBase: string };
|
||||
type Base = { pageId: "a"; onlyA: string } | { pageId: "b"; onlyB: string } | { pageId: "only base"; onlyBase: string };
|
||||
|
||||
type Extension =
|
||||
| { pageId: "a"; onlyExtA: string }
|
||||
| { pageId: "b"; onlyExtB: string }
|
||||
| { pageId: "only ext"; onlyExt: string };
|
||||
type Extension = { pageId: "a"; onlyExtA: string } | { pageId: "b"; onlyExtB: string } | { pageId: "only ext"; onlyExt: string };
|
||||
|
||||
type Got = AndByDiscriminatingKey<"pageId", Extension, Base>;
|
||||
|
||||
|
Reference in New Issue
Block a user