keycloakify 6.0.0-beta.7 → 6.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/keycloakify/replacers/replaceImportsFromStaticInJsCode.js +2 -2
- package/bin/keycloakify/replacers/replaceImportsFromStaticInJsCode.js.map +1 -1
- package/bin/link_in_test_app.js +27 -8
- package/bin/link_in_test_app.js.map +1 -1
- package/bin/tsconfig.tsbuildinfo +1 -1
- package/lib/components/KcApp.d.ts +1 -1
- package/lib/components/Login.js +1 -1
- package/lib/components/Login.js.map +1 -1
- package/lib/components/LoginConfigTotp.js +1 -1
- package/lib/components/LoginConfigTotp.js.map +1 -1
- package/lib/components/LoginIdpLinkConfirm.js +1 -1
- package/lib/components/LoginIdpLinkConfirm.js.map +1 -1
- package/lib/components/LoginOtp.js +1 -1
- package/lib/components/LoginOtp.js.map +1 -1
- package/lib/components/LoginResetPassword.js +1 -1
- package/lib/components/LoginResetPassword.js.map +1 -1
- package/lib/components/LoginUpdatePassword.js +1 -1
- package/lib/components/LoginUpdatePassword.js.map +1 -1
- package/lib/components/LoginUpdateProfile.js +1 -1
- package/lib/components/LoginUpdateProfile.js.map +1 -1
- package/lib/components/LogoutConfirm.js +1 -1
- package/lib/components/LogoutConfirm.js.map +1 -1
- package/lib/components/Register.js +1 -1
- package/lib/components/Register.js.map +1 -1
- package/lib/components/RegisterUserProfile.js +1 -1
- package/lib/components/RegisterUserProfile.js.map +1 -1
- package/lib/components/Template.js +1 -1
- package/lib/components/Template.js.map +1 -1
- package/lib/components/Terms.js +1 -1
- package/lib/components/Terms.js.map +1 -1
- package/lib/tools/useCssAndCx.d.ts +4 -0
- package/lib/tools/useCssAndCx.js +9 -0
- package/lib/tools/useCssAndCx.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -6
- package/src/bin/keycloakify/replacers/replaceImportsFromStaticInJsCode.ts +3 -0
- package/src/bin/link_in_test_app.ts +35 -9
- package/src/lib/components/Login.tsx +1 -1
- package/src/lib/components/LoginConfigTotp.tsx +1 -1
- package/src/lib/components/LoginIdpLinkConfirm.tsx +1 -1
- package/src/lib/components/LoginOtp.tsx +1 -1
- package/src/lib/components/LoginResetPassword.tsx +1 -1
- package/src/lib/components/LoginUpdatePassword.tsx +1 -1
- package/src/lib/components/LoginUpdateProfile.tsx +1 -1
- package/src/lib/components/LogoutConfirm.tsx +1 -1
- package/src/lib/components/Register.tsx +1 -1
- package/src/lib/components/RegisterUserProfile.tsx +1 -1
- package/src/lib/components/Template.tsx +1 -1
- package/src/lib/components/Terms.tsx +1 -1
- package/src/lib/tools/useCssAndCx.ts +11 -0
- package/src/test/bin/replaceImportFromStatic.ts +30 -18
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "keycloakify",
|
3
|
-
"version": "6.0.0-beta.
|
3
|
+
"version": "6.0.0-beta.8",
|
4
4
|
"description": "Keycloak theme generator for Reacts app",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -320,6 +320,7 @@
|
|
320
320
|
"src/lib/tools/emailRegExp.ts",
|
321
321
|
"src/lib/tools/headInsert.ts",
|
322
322
|
"src/lib/tools/pathBasename.ts",
|
323
|
+
"src/lib/tools/useCssAndCx.ts",
|
323
324
|
"src/lib/tsconfig.json",
|
324
325
|
"src/lib/useFormValidationSlice.tsx",
|
325
326
|
"src/test/bin/generateKeycloakThemeResources.ts",
|
@@ -1210,6 +1211,9 @@
|
|
1210
1211
|
"lib/tools/pathBasename.d.ts",
|
1211
1212
|
"lib/tools/pathBasename.js",
|
1212
1213
|
"lib/tools/pathBasename.js.map",
|
1214
|
+
"lib/tools/useCssAndCx.d.ts",
|
1215
|
+
"lib/tools/useCssAndCx.js",
|
1216
|
+
"lib/tools/useCssAndCx.js.map",
|
1213
1217
|
"lib/tsconfig.tsbuildinfo",
|
1214
1218
|
"lib/useFormValidationSlice.d.ts",
|
1215
1219
|
"lib/useFormValidationSlice.js",
|
@@ -1248,15 +1252,15 @@
|
|
1248
1252
|
"@octokit/rest": "^18.12.0",
|
1249
1253
|
"cheerio": "^1.0.0-rc.5",
|
1250
1254
|
"cli-select": "^1.1.2",
|
1251
|
-
"evt": "^2.
|
1255
|
+
"evt": "^2.4.0",
|
1252
1256
|
"memoizee": "^0.4.15",
|
1253
|
-
"minimal-polyfills": "^2.2.
|
1257
|
+
"minimal-polyfills": "^2.2.2",
|
1254
1258
|
"path-browserify": "^1.0.1",
|
1255
|
-
"powerhooks": "^0.20.
|
1259
|
+
"powerhooks": "^0.20.15",
|
1256
1260
|
"react-markdown": "^5.0.3",
|
1257
1261
|
"scripting-tools": "^0.19.13",
|
1258
|
-
"tsafe": "^0.
|
1259
|
-
"tss-react": "^
|
1262
|
+
"tsafe": "^1.0.1",
|
1263
|
+
"tss-react": "^4.0.0",
|
1260
1264
|
"zod": "^3.17.10"
|
1261
1265
|
}
|
1262
1266
|
}
|
@@ -44,6 +44,8 @@ export function replaceImportsFromStaticInJsCode(params: { jsCode: string; build
|
|
44
44
|
new RegExp(`([a-zA-Z]+)\\.([a-zA-Z]+)=function\\(([a-zA-Z]+)\\){return"static\\/${language}\\/"`, "g"),
|
45
45
|
(...[, n, u, e]) => `
|
46
46
|
${n}[(function(){
|
47
|
+
var pd= Object.getOwnPropertyDescriptor(n, "p");
|
48
|
+
if( pd === undefined || pd.configurable ){
|
47
49
|
${
|
48
50
|
buildOptions.isStandalone
|
49
51
|
? `
|
@@ -59,6 +61,7 @@ export function replaceImportsFromStaticInJsCode(params: { jsCode: string; build
|
|
59
61
|
set: function (value){ p = value;}
|
60
62
|
});
|
61
63
|
`
|
64
|
+
}
|
62
65
|
}
|
63
66
|
return "${u}";
|
64
67
|
})()] = function(${e}) { return "${buildOptions.isStandalone ? "/build/" : ""}static/${language}/"`
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { execSync } from "child_process";
|
2
2
|
import { join as pathJoin, relative as pathRelative } from "path";
|
3
|
+
import { exclude } from "tsafe/exclude";
|
3
4
|
import * as fs from "fs";
|
4
5
|
|
5
6
|
const keycloakifyDirPath = pathJoin(__dirname, "..", "..");
|
@@ -60,11 +61,34 @@ const execYarnLink = (params: { targetModuleName?: string; cwd: string }) => {
|
|
60
61
|
});
|
61
62
|
};
|
62
63
|
|
63
|
-
const
|
64
|
+
const testAppPaths = (() => {
|
65
|
+
const arg = process.argv[2];
|
64
66
|
|
65
|
-
const
|
67
|
+
const testAppNames = arg !== undefined ? [arg] : ["keycloakify-starter", "keycloakify-advanced-starter"];
|
66
68
|
|
67
|
-
testAppNames
|
69
|
+
return testAppNames
|
70
|
+
.map(testAppName => {
|
71
|
+
const testAppPath = pathJoin(keycloakifyDirPath, "..", testAppName);
|
72
|
+
|
73
|
+
if (fs.existsSync(testAppPath)) {
|
74
|
+
return testAppPath;
|
75
|
+
}
|
76
|
+
|
77
|
+
console.warn(`Skipping ${testAppName} since it cant be found here: ${testAppPath}`);
|
78
|
+
|
79
|
+
return undefined;
|
80
|
+
})
|
81
|
+
.filter(exclude(undefined));
|
82
|
+
})();
|
83
|
+
|
84
|
+
console.log(testAppPaths);
|
85
|
+
|
86
|
+
if (testAppPaths.length === 0) {
|
87
|
+
console.error("No test app to link into!");
|
88
|
+
process.exit(-1);
|
89
|
+
}
|
90
|
+
|
91
|
+
testAppPaths.forEach(testAppPath => execSync("yarn install", { "cwd": testAppPath }));
|
68
92
|
|
69
93
|
console.log("=== Linking common dependencies ===");
|
70
94
|
|
@@ -81,22 +105,24 @@ commonThirdPartyDeps.forEach(commonThirdPartyDep => {
|
|
81
105
|
);
|
82
106
|
|
83
107
|
execYarnLink({ "cwd": localInstallPath });
|
108
|
+
});
|
84
109
|
|
85
|
-
|
110
|
+
commonThirdPartyDeps.forEach(commonThirdPartyDep =>
|
111
|
+
testAppPaths.forEach(testAppPath =>
|
86
112
|
execYarnLink({
|
87
|
-
"cwd":
|
113
|
+
"cwd": testAppPath,
|
88
114
|
"targetModuleName": commonThirdPartyDep
|
89
115
|
})
|
90
|
-
)
|
91
|
-
|
116
|
+
)
|
117
|
+
);
|
92
118
|
|
93
119
|
console.log("=== Linking in house dependencies ===");
|
94
120
|
|
95
121
|
execYarnLink({ "cwd": pathJoin(keycloakifyDirPath, "dist") });
|
96
122
|
|
97
|
-
|
123
|
+
testAppPaths.forEach(testAppPath =>
|
98
124
|
execYarnLink({
|
99
|
-
"cwd":
|
125
|
+
"cwd": testAppPath,
|
100
126
|
"targetModuleName": "keycloakify"
|
101
127
|
})
|
102
128
|
);
|
@@ -2,7 +2,7 @@ import React, { useState, memo } from "react";
|
|
2
2
|
import Template from "./Template";
|
3
3
|
import type { KcProps } from "./KcProps";
|
4
4
|
import type { KcContextBase } from "../getKcContext/KcContextBase";
|
5
|
-
import { useCssAndCx } from "
|
5
|
+
import { useCssAndCx } from "../tools/useCssAndCx";
|
6
6
|
import { useConstCallback } from "powerhooks/useConstCallback";
|
7
7
|
import type { FormEventHandler } from "react";
|
8
8
|
import type { I18n } from "../i18n";
|
@@ -2,7 +2,7 @@ import React, { memo } from "react";
|
|
2
2
|
import Template from "./Template";
|
3
3
|
import type { KcProps } from "./KcProps";
|
4
4
|
import type { KcContextBase } from "../getKcContext/KcContextBase";
|
5
|
-
import { useCssAndCx } from "
|
5
|
+
import { useCssAndCx } from "../tools/useCssAndCx";
|
6
6
|
import type { I18n } from "../i18n";
|
7
7
|
|
8
8
|
const LoginConfigTotp = memo(({ kcContext, i18n, ...props }: { kcContext: KcContextBase.LoginConfigTotp; i18n: I18n } & KcProps) => {
|
@@ -2,7 +2,7 @@ import React, { memo } from "react";
|
|
2
2
|
import Template from "./Template";
|
3
3
|
import type { KcProps } from "./KcProps";
|
4
4
|
import type { KcContextBase } from "../getKcContext/KcContextBase";
|
5
|
-
import { useCssAndCx } from "
|
5
|
+
import { useCssAndCx } from "../tools/useCssAndCx";
|
6
6
|
import type { I18n } from "../i18n";
|
7
7
|
|
8
8
|
const LoginIdpLinkConfirm = memo(({ kcContext, i18n, ...props }: { kcContext: KcContextBase.LoginIdpLinkConfirm; i18n: I18n } & KcProps) => {
|
@@ -4,7 +4,7 @@ import type { KcProps } from "./KcProps";
|
|
4
4
|
import type { KcContextBase } from "../getKcContext/KcContextBase";
|
5
5
|
import { headInsert } from "../tools/headInsert";
|
6
6
|
import { pathJoin } from "../../bin/tools/pathJoin";
|
7
|
-
import { useCssAndCx } from "
|
7
|
+
import { useCssAndCx } from "../tools/useCssAndCx";
|
8
8
|
import type { I18n } from "../i18n";
|
9
9
|
|
10
10
|
const LoginOtp = memo(({ kcContext, i18n, ...props }: { kcContext: KcContextBase.LoginOtp; i18n: I18n } & KcProps) => {
|
@@ -2,7 +2,7 @@ import React, { memo } from "react";
|
|
2
2
|
import Template from "./Template";
|
3
3
|
import type { KcProps } from "./KcProps";
|
4
4
|
import type { KcContextBase } from "../getKcContext/KcContextBase";
|
5
|
-
import { useCssAndCx } from "
|
5
|
+
import { useCssAndCx } from "../tools/useCssAndCx";
|
6
6
|
import type { I18n } from "../i18n";
|
7
7
|
|
8
8
|
const LoginResetPassword = memo(({ kcContext, i18n, ...props }: { kcContext: KcContextBase.LoginResetPassword; i18n: I18n } & KcProps) => {
|
@@ -2,7 +2,7 @@ import React, { memo } from "react";
|
|
2
2
|
import Template from "./Template";
|
3
3
|
import type { KcProps } from "./KcProps";
|
4
4
|
import type { KcContextBase } from "../getKcContext/KcContextBase";
|
5
|
-
import { useCssAndCx } from "
|
5
|
+
import { useCssAndCx } from "../tools/useCssAndCx";
|
6
6
|
import type { I18n } from "../i18n";
|
7
7
|
|
8
8
|
const LoginUpdatePassword = memo(({ kcContext, i18n, ...props }: { kcContext: KcContextBase.LoginUpdatePassword; i18n: I18n } & KcProps) => {
|
@@ -2,7 +2,7 @@ import React, { memo } from "react";
|
|
2
2
|
import Template from "./Template";
|
3
3
|
import type { KcProps } from "./KcProps";
|
4
4
|
import type { KcContextBase } from "../getKcContext/KcContextBase";
|
5
|
-
import { useCssAndCx } from "
|
5
|
+
import { useCssAndCx } from "../tools/useCssAndCx";
|
6
6
|
import type { I18n } from "../i18n";
|
7
7
|
|
8
8
|
const LoginUpdateProfile = memo(({ kcContext, i18n, ...props }: { kcContext: KcContextBase.LoginUpdateProfile; i18n: I18n } & KcProps) => {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { memo } from "react";
|
2
|
-
import { useCssAndCx } from "
|
2
|
+
import { useCssAndCx } from "../tools/useCssAndCx";
|
3
3
|
import Template from "./Template";
|
4
4
|
import type { KcProps } from "./KcProps";
|
5
5
|
import type { KcContextBase } from "../getKcContext/KcContextBase";
|
@@ -2,7 +2,7 @@ import React, { memo } from "react";
|
|
2
2
|
import Template from "./Template";
|
3
3
|
import type { KcProps } from "./KcProps";
|
4
4
|
import type { KcContextBase } from "../getKcContext/KcContextBase";
|
5
|
-
import { useCssAndCx } from "
|
5
|
+
import { useCssAndCx } from "../tools/useCssAndCx";
|
6
6
|
import type { I18n } from "../i18n";
|
7
7
|
|
8
8
|
const Register = memo(({ kcContext, i18n, ...props }: { kcContext: KcContextBase.Register; i18n: I18n } & KcProps) => {
|
@@ -2,7 +2,7 @@ import React, { useMemo, memo, useEffect, useState, Fragment } from "react";
|
|
2
2
|
import Template from "./Template";
|
3
3
|
import type { KcProps } from "./KcProps";
|
4
4
|
import type { KcContextBase, Attribute } from "../getKcContext/KcContextBase";
|
5
|
-
import { useCssAndCx } from "
|
5
|
+
import { useCssAndCx } from "../tools/useCssAndCx";
|
6
6
|
import type { ReactComponent } from "../tools/ReactComponent";
|
7
7
|
import { useCallbackFactory } from "powerhooks/useCallbackFactory";
|
8
8
|
import { useFormValidationSlice } from "../useFormValidationSlice";
|
@@ -7,7 +7,7 @@ import { headInsert } from "../tools/headInsert";
|
|
7
7
|
import { pathJoin } from "../../bin/tools/pathJoin";
|
8
8
|
import { useConstCallback } from "powerhooks/useConstCallback";
|
9
9
|
import type { KcTemplateProps } from "./KcProps";
|
10
|
-
import { useCssAndCx } from "
|
10
|
+
import { useCssAndCx } from "../tools/useCssAndCx";
|
11
11
|
import type { I18n } from "../i18n";
|
12
12
|
|
13
13
|
export type TemplateProps = {
|
@@ -2,7 +2,7 @@ import React, { useEffect, memo } from "react";
|
|
2
2
|
import Template from "./Template";
|
3
3
|
import type { KcProps } from "./KcProps";
|
4
4
|
import type { KcContextBase } from "../getKcContext/KcContextBase";
|
5
|
-
import { useCssAndCx } from "
|
5
|
+
import { useCssAndCx } from "../tools/useCssAndCx";
|
6
6
|
import { Evt } from "evt";
|
7
7
|
import { useRerenderOnStateChange } from "evt/hooks";
|
8
8
|
import { assert } from "tsafe/assert";
|
@@ -55,10 +55,13 @@ import { assetIsSameCode } from "../tools/assertIsSameCode";
|
|
55
55
|
}
|
56
56
|
|
57
57
|
n[(function (){
|
58
|
-
Object.
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
var pd= Object.getOwnPropertyDescriptor(n, "p");
|
59
|
+
if( pd === undefined || pd.configurable ){
|
60
|
+
Object.defineProperty(n, "p", {
|
61
|
+
get: function() { return window.kcContext.url.resourcesPath; },
|
62
|
+
set: function (){}
|
63
|
+
});
|
64
|
+
}
|
62
65
|
return "u";
|
63
66
|
})()] = function(e) {
|
64
67
|
return "/build/static/js/" + e + "." + {
|
@@ -69,10 +72,13 @@ import { assetIsSameCode } from "../tools/assertIsSameCode";
|
|
69
72
|
}
|
70
73
|
|
71
74
|
t[(function (){
|
72
|
-
Object.
|
73
|
-
|
74
|
-
|
75
|
-
|
75
|
+
var pd= Object.getOwnPropertyDescriptor(n, "p");
|
76
|
+
if( pd === undefined || pd.configurable ){
|
77
|
+
Object.defineProperty(t, "p", {
|
78
|
+
get: function() { return window.kcContext.url.resourcesPath; },
|
79
|
+
set: function (){}
|
80
|
+
});
|
81
|
+
}
|
76
82
|
return "miniCssF";
|
77
83
|
})()] = function(e) {
|
78
84
|
return "/build/static/css/" + e + "." + {
|
@@ -109,11 +115,14 @@ import { assetIsSameCode } from "../tools/assertIsSameCode";
|
|
109
115
|
}
|
110
116
|
|
111
117
|
n[(function (){
|
112
|
-
var
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
118
|
+
var pd= Object.getOwnPropertyDescriptor(n, "p");
|
119
|
+
if( pd === undefined || pd.configurable ){
|
120
|
+
var p= "";
|
121
|
+
Object.defineProperty(n, "p", {
|
122
|
+
get: function() { return ("kcContext" in window ? "https://demo-app.keycloakify.dev" : "") + p; },
|
123
|
+
set: function (value){ p = value; }
|
124
|
+
});
|
125
|
+
}
|
117
126
|
return "u";
|
118
127
|
})()] = function(e) {
|
119
128
|
return "static/js/" + e + "." + {
|
@@ -124,11 +133,14 @@ import { assetIsSameCode } from "../tools/assertIsSameCode";
|
|
124
133
|
}
|
125
134
|
|
126
135
|
t[(function (){
|
127
|
-
var
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
136
|
+
var pd= Object.getOwnPropertyDescriptor(n, "p");
|
137
|
+
if( pd === undefined || pd.configurable ){
|
138
|
+
var p= "";
|
139
|
+
Object.defineProperty(t, "p", {
|
140
|
+
get: function() { return ("kcContext" in window ? "https://demo-app.keycloakify.dev" : "") + p; },
|
141
|
+
set: function (value){ p = value; }
|
142
|
+
});
|
143
|
+
}
|
132
144
|
return "miniCssF";
|
133
145
|
})()] = function(e) {
|
134
146
|
return "static/css/" + e + "." + {
|