Avoir introducing breaking changes for CSS only setup
This commit is contained in:
@ -18,8 +18,8 @@
|
|||||||
"_format": "prettier '**/*.{ts,tsx,json,md}'",
|
"_format": "prettier '**/*.{ts,tsx,json,md}'",
|
||||||
"format": "yarn _format --write",
|
"format": "yarn _format --write",
|
||||||
"format:check": "yarn _format --list-different",
|
"format:check": "yarn _format --list-different",
|
||||||
"link-in-app": "ts-node --skipProject src/scripts/link-in-app.ts",
|
|
||||||
"generate-messages": "ts-node --skipProject src/scripts/generate-i18n-messages.ts",
|
"generate-messages": "ts-node --skipProject src/scripts/generate-i18n-messages.ts",
|
||||||
|
"link-in-app": "ts-node --skipProject src/scripts/link-in-app.ts",
|
||||||
"link-in-starter": "yarn link-in-app keycloakify-advanced-starter",
|
"link-in-starter": "yarn link-in-app keycloakify-advanced-starter",
|
||||||
"tsc-watch": "tsc -p src/bin -w & tsc -p src/lib -w "
|
"tsc-watch": "tsc -p src/bin -w & tsc -p src/lib -w "
|
||||||
},
|
},
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import React, { lazy, Suspense } from "react";
|
import React, { lazy, Suspense } from "react";
|
||||||
import { __unsafe_useI18n as useI18n } from "./i18n";
|
import { __unsafe_useI18n as useI18n } from "./i18n";
|
||||||
import DefaultTemplate from "./pages/Template";
|
import DefaultTemplate from "./pages/Template";
|
||||||
import type { KcContextBase } from "./kcContext/KcContextBase";
|
import type { KcContextBase } from "./getKcContext/KcContextBase";
|
||||||
import type { PageProps } from "./KcProps";
|
import type { PageProps } from "./KcProps";
|
||||||
import type { I18nBase } from "./i18n";
|
import type { I18nBase } from "./i18n";
|
||||||
|
import type { SetOptional } from "./tools/SetOptional";
|
||||||
|
|
||||||
const Login = lazy(() => import("./pages/Login"));
|
const Login = lazy(() => import("./pages/Login"));
|
||||||
const Register = lazy(() => import("./pages/Register"));
|
const Register = lazy(() => import("./pages/Register"));
|
||||||
@ -27,7 +28,7 @@ const LogoutConfirm = lazy(() => import("./pages/LogoutConfirm"));
|
|||||||
const UpdateUserProfile = lazy(() => import("./pages/UpdateUserProfile"));
|
const UpdateUserProfile = lazy(() => import("./pages/UpdateUserProfile"));
|
||||||
const IdpReviewUserProfile = lazy(() => import("./pages/IdpReviewUserProfile"));
|
const IdpReviewUserProfile = lazy(() => import("./pages/IdpReviewUserProfile"));
|
||||||
|
|
||||||
export default function KcApp(props_: PageProps<KcContextBase, I18nBase>) {
|
export default function KcApp(props_: SetOptional<PageProps<KcContextBase, I18nBase>, "Template">) {
|
||||||
const { kcContext, i18n: userProvidedI18n, Template = DefaultTemplate, ...kcProps } = props_;
|
const { kcContext, i18n: userProvidedI18n, Template = DefaultTemplate, ...kcProps } = props_;
|
||||||
|
|
||||||
const i18n = (function useClosure() {
|
const i18n = (function useClosure() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { allPropertiesValuesToUndefined } from "./tools/allPropertiesValuesToUndefined";
|
import { allPropertiesValuesToUndefined } from "./tools/allPropertiesValuesToUndefined";
|
||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import type { KcContextBase } from "./kcContext";
|
import type { KcContextBase } from "./getKcContext";
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import { I18nBase } from "./i18n";
|
import { I18nBase } from "./i18n";
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import { headInsert } from "./tools/headInsert";
|
|||||||
import { pathJoin } from "../bin/tools/pathJoin";
|
import { pathJoin } from "../bin/tools/pathJoin";
|
||||||
import { clsx } from "./tools/clsx";
|
import { clsx } from "./tools/clsx";
|
||||||
import type { TemplateProps } from "./KcProps";
|
import type { TemplateProps } from "./KcProps";
|
||||||
import type { KcContextBase } from "./kcContext/KcContextBase";
|
import type { KcContextBase } from "./getKcContext/KcContextBase";
|
||||||
import type { I18nBase } from "./i18n";
|
import type { I18nBase } from "./i18n";
|
||||||
|
|
||||||
export default function Template(props: TemplateProps<KcContextBase.Common, I18nBase>) {
|
export default function Template(props: TemplateProps<KcContextBase.Common, I18nBase>) {
|
||||||
|
@ -3,7 +3,7 @@ import "minimal-polyfills/Object.fromEntries";
|
|||||||
import React, { useEffect, useState, useRef } from "react";
|
import React, { useEffect, useState, useRef } from "react";
|
||||||
import type baseMessages from "./generated_messages/18.0.1/login/en";
|
import type baseMessages from "./generated_messages/18.0.1/login/en";
|
||||||
import { assert } from "tsafe/assert";
|
import { assert } from "tsafe/assert";
|
||||||
import type { KcContextBase } from "../kcContext/KcContextBase";
|
import type { KcContextBase } from "../getKcContext/KcContextBase";
|
||||||
import { Markdown } from "../tools/Markdown";
|
import { Markdown } from "../tools/Markdown";
|
||||||
|
|
||||||
export const fallbackLanguageTag = "en";
|
export const fallbackLanguageTag = "en";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export * from "./kcContext";
|
export * from "./getKcContext";
|
||||||
|
|
||||||
export * from "./i18n";
|
export * from "./i18n";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import { UserProfileFormFields } from "./shared/UserProfileCommons";
|
import { UserProfileFormFields } from "./shared/UserProfileCommons";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { assert } from "../tools/assert";
|
import { assert } from "../tools/assert";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import React, { useState } from "react";
|
|||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import { useConstCallback } from "../tools/useConstCallback";
|
import { useConstCallback } from "../tools/useConstCallback";
|
||||||
import type { FormEventHandler } from "react";
|
import type { FormEventHandler } from "react";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import React, { useEffect } from "react";
|
|||||||
import { headInsert } from "../tools/headInsert";
|
import { headInsert } from "../tools/headInsert";
|
||||||
import { pathJoin } from "../../bin/tools/pathJoin";
|
import { pathJoin } from "../../bin/tools/pathJoin";
|
||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import React, { useState } from "react";
|
|||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import { useConstCallback } from "../tools/useConstCallback";
|
import { useConstCallback } from "../tools/useConstCallback";
|
||||||
import type { FormEventHandler } from "react";
|
import type { FormEventHandler } from "react";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import React, { useState } from "react";
|
|||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import { useConstCallback } from "../tools/useConstCallback";
|
import { useConstCallback } from "../tools/useConstCallback";
|
||||||
import type { FormEventHandler } from "react";
|
import type { FormEventHandler } from "react";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import { UserProfileFormFields } from "./shared/UserProfileCommons";
|
import { UserProfileFormFields } from "./shared/UserProfileCommons";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useReducer, useEffect } from "react";
|
import React, { useReducer, useEffect } from "react";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import { assert } from "../tools/assert";
|
import { assert } from "../tools/assert";
|
||||||
import { useCallbackFactory } from "../tools/useCallbackFactory";
|
import { useCallbackFactory } from "../tools/useCallbackFactory";
|
||||||
import { headInsert } from "../tools/headInsert";
|
import { headInsert } from "../tools/headInsert";
|
||||||
|
@ -9,7 +9,7 @@ import { useConst } from "../tools/useConst";
|
|||||||
import { useConstCallback } from "../tools/useConstCallback";
|
import { useConstCallback } from "../tools/useConstCallback";
|
||||||
import { Markdown } from "../tools/Markdown";
|
import { Markdown } from "../tools/Markdown";
|
||||||
import type { Extends } from "tsafe";
|
import type { Extends } from "tsafe";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { clsx } from "../tools/clsx";
|
import { clsx } from "../tools/clsx";
|
||||||
import { UserProfileFormFields } from "./shared/UserProfileCommons";
|
import { UserProfileFormFields } from "./shared/UserProfileCommons";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import { clsx } from "../tools/clsx";
|
|||||||
import type { MessageKeyBase } from "../i18n";
|
import type { MessageKeyBase } from "../i18n";
|
||||||
import { base64url } from "rfc4648";
|
import { base64url } from "rfc4648";
|
||||||
import { useConstCallback } from "../tools/useConstCallback";
|
import { useConstCallback } from "../tools/useConstCallback";
|
||||||
import type { KcContextBase } from "../kcContext";
|
import type { KcContextBase } from "../getKcContext";
|
||||||
import type { PageProps } from "../KcProps";
|
import type { PageProps } from "../KcProps";
|
||||||
import type { I18nBase } from "../i18n";
|
import type { I18nBase } from "../i18n";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useEffect, Fragment } from "react";
|
import React, { useEffect, Fragment } from "react";
|
||||||
import type { KcProps } from "../../KcProps";
|
import type { KcProps } from "../../KcProps";
|
||||||
import type { Attribute } from "../../kcContext/KcContextBase";
|
import type { Attribute } from "../../getKcContext/KcContextBase";
|
||||||
import { clsx } from "../../tools/clsx";
|
import { clsx } from "../../tools/clsx";
|
||||||
import type { ReactComponent } from "../../tools/ReactComponent";
|
import type { ReactComponent } from "../../tools/ReactComponent";
|
||||||
import { useCallbackFactory } from "../../tools/useCallbackFactory";
|
import { useCallbackFactory } from "../../tools/useCallbackFactory";
|
||||||
|
1
src/lib/tools/SetOptional.ts
Normal file
1
src/lib/tools/SetOptional.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export type SetOptional<T extends Record<string, unknown>, K extends keyof T> = Omit<T, K> & Partial<Record<K, T[K]>>;
|
@ -1,6 +1,6 @@
|
|||||||
import "./tools/Array.prototype.every";
|
import "./tools/Array.prototype.every";
|
||||||
import React, { useMemo, useReducer, Fragment } from "react";
|
import React, { useMemo, useReducer, Fragment } from "react";
|
||||||
import type { KcContextBase, Validators, Attribute } from "./kcContext/KcContextBase";
|
import type { KcContextBase, Validators, Attribute } from "./getKcContext/KcContextBase";
|
||||||
import type { I18nBase, MessageKeyBase } from "./i18n";
|
import type { I18nBase, MessageKeyBase } from "./i18n";
|
||||||
import { useConstCallback } from "./tools/useConstCallback";
|
import { useConstCallback } from "./tools/useConstCallback";
|
||||||
import { id } from "tsafe/id";
|
import { id } from "tsafe/id";
|
||||||
|
@ -54,37 +54,24 @@ const commonThirdPartyDeps = (() => {
|
|||||||
];
|
];
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const { yarnLinkFolderPath, yarnGlobalFolderPath } = (() => {
|
|
||||||
const yarnGlobalDirPath = pathJoin(rootDirPath, ".yarn_home");
|
const yarnGlobalDirPath = pathJoin(rootDirPath, ".yarn_home");
|
||||||
|
|
||||||
return {
|
fs.rmSync(yarnGlobalDirPath, { "recursive": true, "force": true });
|
||||||
"yarnLinkFolderPath": pathJoin(yarnGlobalDirPath, "link"),
|
fs.mkdirSync(yarnGlobalDirPath);
|
||||||
"yarnGlobalFolderPath": pathJoin(yarnGlobalDirPath, "global")
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
|
|
||||||
[yarnLinkFolderPath, yarnGlobalFolderPath].forEach(path => {
|
|
||||||
fs.rmSync(path, { "recursive": true, "force": true });
|
|
||||||
fs.mkdirSync(path, { "recursive": true });
|
|
||||||
});
|
|
||||||
|
|
||||||
const execYarnLink = (params: { targetModuleName?: string; cwd: string }) => {
|
const execYarnLink = (params: { targetModuleName?: string; cwd: string }) => {
|
||||||
const { targetModuleName, cwd } = params;
|
const { targetModuleName, cwd } = params;
|
||||||
|
|
||||||
const cmd = [
|
const cmd = ["yarn", "link", ...(targetModuleName !== undefined ? [targetModuleName] : ["--no-bin-links"])].join(" ");
|
||||||
"yarn",
|
|
||||||
"link",
|
|
||||||
...(targetModuleName !== undefined ? [targetModuleName] : []),
|
|
||||||
"--link-folder",
|
|
||||||
yarnLinkFolderPath,
|
|
||||||
"--global-folder",
|
|
||||||
yarnGlobalFolderPath
|
|
||||||
].join(" ");
|
|
||||||
|
|
||||||
console.log(`$ cd ${pathRelative(rootDirPath, cwd) || "."} && ${cmd}`);
|
console.log(`$ cd ${pathRelative(rootDirPath, cwd) || "."} && ${cmd}`);
|
||||||
|
|
||||||
execSync(cmd, {
|
execSync(cmd, {
|
||||||
cwd
|
cwd,
|
||||||
|
"env": {
|
||||||
|
...process.env,
|
||||||
|
"HOME": yarnGlobalDirPath
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user