keycloakify 10.0.0-rc.121 → 10.0.0-rc.122
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/453.index.js
CHANGED
@@ -41,11 +41,63 @@ async function command(params) {
|
|
41
41
|
cliCommandOptions
|
42
42
|
});
|
43
43
|
console.log(chalk__WEBPACK_IMPORTED_MODULE_9___default().cyan("Theme type:"));
|
44
|
-
const
|
45
|
-
values
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
const themeType = await (async () => {
|
45
|
+
const values = _shared_constants__WEBPACK_IMPORTED_MODULE_2__/* .THEME_TYPES.filter */ .Jh.filter(themeType => {
|
46
|
+
switch (themeType) {
|
47
|
+
case "account":
|
48
|
+
return buildContext.implementedThemeTypes.account.isImplemented;
|
49
|
+
case "login":
|
50
|
+
return buildContext.implementedThemeTypes.login.isImplemented;
|
51
|
+
}
|
52
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(false);
|
53
|
+
});
|
54
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(values.length > 0, "No theme is implemented in this project");
|
55
|
+
if (values.length === 1) {
|
56
|
+
return values[0];
|
57
|
+
}
|
58
|
+
const { value } = await cli_select__WEBPACK_IMPORTED_MODULE_1___default()({
|
59
|
+
values
|
60
|
+
}).catch(() => {
|
61
|
+
process.exit(-1);
|
62
|
+
});
|
63
|
+
return value;
|
64
|
+
})();
|
65
|
+
if (themeType === "account" &&
|
66
|
+
((0,tsafe_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(buildContext.implementedThemeTypes.account.isImplemented),
|
67
|
+
buildContext.implementedThemeTypes.account.type === "Single-Page")) {
|
68
|
+
const srcDirPath = (0,path__WEBPACK_IMPORTED_MODULE_5__.join)((0,path__WEBPACK_IMPORTED_MODULE_5__.dirname)(buildContext.packageJsonFilePath), "node_modules", "@keycloakify", "keycloak-account-ui", "src");
|
69
|
+
console.log([
|
70
|
+
`There isn't an interactive CLI to eject components of the Single-Page Account theme.`,
|
71
|
+
`You can however copy paste into your codebase the any file or directory from the following source directory:`,
|
72
|
+
``,
|
73
|
+
`${chalk__WEBPACK_IMPORTED_MODULE_9___default().bold((0,path__WEBPACK_IMPORTED_MODULE_5__.join)((0,path__WEBPACK_IMPORTED_MODULE_5__.relative)(process.cwd(), srcDirPath)))}`,
|
74
|
+
``
|
75
|
+
].join("\n"));
|
76
|
+
eject_entrypoint: {
|
77
|
+
const kcAccountUiTsxFileRelativePath = "KcAccountUi.tsx";
|
78
|
+
const accountThemeSrcDirPath = (0,path__WEBPACK_IMPORTED_MODULE_5__.join)(buildContext.themeSrcDirPath, "account");
|
79
|
+
const targetFilePath = (0,path__WEBPACK_IMPORTED_MODULE_5__.join)(accountThemeSrcDirPath, kcAccountUiTsxFileRelativePath);
|
80
|
+
if (fs__WEBPACK_IMPORTED_MODULE_4__.existsSync(targetFilePath)) {
|
81
|
+
break eject_entrypoint;
|
82
|
+
}
|
83
|
+
fs__WEBPACK_IMPORTED_MODULE_4__.cpSync((0,path__WEBPACK_IMPORTED_MODULE_5__.join)(srcDirPath, kcAccountUiTsxFileRelativePath), targetFilePath);
|
84
|
+
{
|
85
|
+
const kcPageTsxFilePath = (0,path__WEBPACK_IMPORTED_MODULE_5__.join)(accountThemeSrcDirPath, "KcPage.tsx");
|
86
|
+
const kcPageTsxCode = fs__WEBPACK_IMPORTED_MODULE_4__.readFileSync(kcPageTsxFilePath).toString("utf8");
|
87
|
+
const componentName = (0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(kcAccountUiTsxFileRelativePath).replace(/.tsx$/, "");
|
88
|
+
const modifiedKcPageTsxCode = kcPageTsxCode.replace(`@keycloakify/keycloak-account-ui/${componentName}`, `./${componentName}`);
|
89
|
+
fs__WEBPACK_IMPORTED_MODULE_4__.writeFileSync(kcPageTsxFilePath, Buffer.from(modifiedKcPageTsxCode, "utf8"));
|
90
|
+
}
|
91
|
+
const routesTsxFilePath = (0,path__WEBPACK_IMPORTED_MODULE_5__.relative)(process.cwd(), (0,path__WEBPACK_IMPORTED_MODULE_5__.join)(srcDirPath, "routes.tsx"));
|
92
|
+
console.log([
|
93
|
+
`To help you get started ${chalk__WEBPACK_IMPORTED_MODULE_9___default().bold((0,path__WEBPACK_IMPORTED_MODULE_5__.relative)(process.cwd(), targetFilePath))} has been copied into your project.`,
|
94
|
+
`The next step is usually to eject ${chalk__WEBPACK_IMPORTED_MODULE_9___default().bold(routesTsxFilePath)}`,
|
95
|
+
`with \`cp ${routesTsxFilePath} ${(0,path__WEBPACK_IMPORTED_MODULE_5__.relative)(process.cwd(), accountThemeSrcDirPath)}\``,
|
96
|
+
`then update the import of routes in ${kcAccountUiTsxFileRelativePath}.`
|
97
|
+
].join("\n"));
|
98
|
+
}
|
99
|
+
process.exit(0);
|
100
|
+
}
|
49
101
|
console.log(`→ ${themeType}`);
|
50
102
|
console.log(chalk__WEBPACK_IMPORTED_MODULE_9___default().cyan("Select the page you want to customize:"));
|
51
103
|
const templateValue = "Template.tsx (Layout common to every page)";
|
package/bin/97.index.js
CHANGED
@@ -41,11 +41,33 @@ async function command(params) {
|
|
41
41
|
cliCommandOptions
|
42
42
|
});
|
43
43
|
console.log(chalk__WEBPACK_IMPORTED_MODULE_9___default().cyan("Theme type:"));
|
44
|
-
const
|
45
|
-
values
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
const themeType = await (async () => {
|
45
|
+
const values = _shared_constants__WEBPACK_IMPORTED_MODULE_2__/* .THEME_TYPES.filter */ .Jh.filter(themeType => {
|
46
|
+
switch (themeType) {
|
47
|
+
case "account":
|
48
|
+
return buildContext.implementedThemeTypes.account.isImplemented;
|
49
|
+
case "login":
|
50
|
+
return buildContext.implementedThemeTypes.login.isImplemented;
|
51
|
+
}
|
52
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(false);
|
53
|
+
});
|
54
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(values.length > 0, "No theme is implemented in this project");
|
55
|
+
if (values.length === 1) {
|
56
|
+
return values[0];
|
57
|
+
}
|
58
|
+
const { value } = await cli_select__WEBPACK_IMPORTED_MODULE_1___default()({
|
59
|
+
values
|
60
|
+
}).catch(() => {
|
61
|
+
process.exit(-1);
|
62
|
+
});
|
63
|
+
return value;
|
64
|
+
})();
|
65
|
+
if (themeType === "account" &&
|
66
|
+
((0,tsafe_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(buildContext.implementedThemeTypes.account.isImplemented),
|
67
|
+
buildContext.implementedThemeTypes.account.type === "Single-Page")) {
|
68
|
+
console.log(`${chalk__WEBPACK_IMPORTED_MODULE_9___default().red("✗")} Sorry, there is no Storybook support for Single-Page Account themes.`);
|
69
|
+
process.exit(0);
|
70
|
+
}
|
49
71
|
console.log(`→ ${themeType}`);
|
50
72
|
console.log(chalk__WEBPACK_IMPORTED_MODULE_9___default().cyan("Select the page you want to create a Storybook for:"));
|
51
73
|
const { value: pageId } = await cli_select__WEBPACK_IMPORTED_MODULE_1___default()({
|
package/package.json
CHANGED
package/src/bin/add-story.ts
CHANGED
@@ -26,11 +26,43 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|
26
26
|
|
27
27
|
console.log(chalk.cyan("Theme type:"));
|
28
28
|
|
29
|
-
const
|
30
|
-
values
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
const themeType = await (async () => {
|
30
|
+
const values = THEME_TYPES.filter(themeType => {
|
31
|
+
switch (themeType) {
|
32
|
+
case "account":
|
33
|
+
return buildContext.implementedThemeTypes.account.isImplemented;
|
34
|
+
case "login":
|
35
|
+
return buildContext.implementedThemeTypes.login.isImplemented;
|
36
|
+
}
|
37
|
+
assert<Equals<typeof themeType, never>>(false);
|
38
|
+
});
|
39
|
+
|
40
|
+
assert(values.length > 0, "No theme is implemented in this project");
|
41
|
+
|
42
|
+
if (values.length === 1) {
|
43
|
+
return values[0];
|
44
|
+
}
|
45
|
+
|
46
|
+
const { value } = await cliSelect<ThemeType>({
|
47
|
+
values
|
48
|
+
}).catch(() => {
|
49
|
+
process.exit(-1);
|
50
|
+
});
|
51
|
+
|
52
|
+
return value;
|
53
|
+
})();
|
54
|
+
|
55
|
+
if (
|
56
|
+
themeType === "account" &&
|
57
|
+
(assert(buildContext.implementedThemeTypes.account.isImplemented),
|
58
|
+
buildContext.implementedThemeTypes.account.type === "Single-Page")
|
59
|
+
) {
|
60
|
+
console.log(
|
61
|
+
`${chalk.red("✗")} Sorry, there is no Storybook support for Single-Page Account themes.`
|
62
|
+
);
|
63
|
+
|
64
|
+
process.exit(0);
|
65
|
+
}
|
34
66
|
|
35
67
|
console.log(`→ ${themeType}`);
|
36
68
|
|
package/src/bin/eject-page.ts
CHANGED
@@ -12,7 +12,12 @@ import {
|
|
12
12
|
} from "./shared/constants";
|
13
13
|
import { capitalize } from "tsafe/capitalize";
|
14
14
|
import * as fs from "fs";
|
15
|
-
import {
|
15
|
+
import {
|
16
|
+
join as pathJoin,
|
17
|
+
relative as pathRelative,
|
18
|
+
dirname as pathDirname,
|
19
|
+
basename as pathBasename
|
20
|
+
} from "path";
|
16
21
|
import { kebabCaseToCamelCase } from "./tools/kebabCaseToSnakeCase";
|
17
22
|
import { assert, Equals } from "tsafe/assert";
|
18
23
|
import type { CliCommandOptions } from "./main";
|
@@ -28,11 +33,114 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|
28
33
|
|
29
34
|
console.log(chalk.cyan("Theme type:"));
|
30
35
|
|
31
|
-
const
|
32
|
-
values
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
+
const themeType = await (async () => {
|
37
|
+
const values = THEME_TYPES.filter(themeType => {
|
38
|
+
switch (themeType) {
|
39
|
+
case "account":
|
40
|
+
return buildContext.implementedThemeTypes.account.isImplemented;
|
41
|
+
case "login":
|
42
|
+
return buildContext.implementedThemeTypes.login.isImplemented;
|
43
|
+
}
|
44
|
+
assert<Equals<typeof themeType, never>>(false);
|
45
|
+
});
|
46
|
+
|
47
|
+
assert(values.length > 0, "No theme is implemented in this project");
|
48
|
+
|
49
|
+
if (values.length === 1) {
|
50
|
+
return values[0];
|
51
|
+
}
|
52
|
+
|
53
|
+
const { value } = await cliSelect<ThemeType>({
|
54
|
+
values
|
55
|
+
}).catch(() => {
|
56
|
+
process.exit(-1);
|
57
|
+
});
|
58
|
+
|
59
|
+
return value;
|
60
|
+
})();
|
61
|
+
|
62
|
+
if (
|
63
|
+
themeType === "account" &&
|
64
|
+
(assert(buildContext.implementedThemeTypes.account.isImplemented),
|
65
|
+
buildContext.implementedThemeTypes.account.type === "Single-Page")
|
66
|
+
) {
|
67
|
+
const srcDirPath = pathJoin(
|
68
|
+
pathDirname(buildContext.packageJsonFilePath),
|
69
|
+
"node_modules",
|
70
|
+
"@keycloakify",
|
71
|
+
"keycloak-account-ui",
|
72
|
+
"src"
|
73
|
+
);
|
74
|
+
|
75
|
+
console.log(
|
76
|
+
[
|
77
|
+
`There isn't an interactive CLI to eject components of the Single-Page Account theme.`,
|
78
|
+
`You can however copy paste into your codebase the any file or directory from the following source directory:`,
|
79
|
+
``,
|
80
|
+
`${chalk.bold(pathJoin(pathRelative(process.cwd(), srcDirPath)))}`,
|
81
|
+
``
|
82
|
+
].join("\n")
|
83
|
+
);
|
84
|
+
|
85
|
+
eject_entrypoint: {
|
86
|
+
const kcAccountUiTsxFileRelativePath = "KcAccountUi.tsx";
|
87
|
+
|
88
|
+
const accountThemeSrcDirPath = pathJoin(
|
89
|
+
buildContext.themeSrcDirPath,
|
90
|
+
"account"
|
91
|
+
);
|
92
|
+
|
93
|
+
const targetFilePath = pathJoin(
|
94
|
+
accountThemeSrcDirPath,
|
95
|
+
kcAccountUiTsxFileRelativePath
|
96
|
+
);
|
97
|
+
|
98
|
+
if (fs.existsSync(targetFilePath)) {
|
99
|
+
break eject_entrypoint;
|
100
|
+
}
|
101
|
+
|
102
|
+
fs.cpSync(
|
103
|
+
pathJoin(srcDirPath, kcAccountUiTsxFileRelativePath),
|
104
|
+
targetFilePath
|
105
|
+
);
|
106
|
+
|
107
|
+
{
|
108
|
+
const kcPageTsxFilePath = pathJoin(accountThemeSrcDirPath, "KcPage.tsx");
|
109
|
+
|
110
|
+
const kcPageTsxCode = fs.readFileSync(kcPageTsxFilePath).toString("utf8");
|
111
|
+
|
112
|
+
const componentName = pathBasename(
|
113
|
+
kcAccountUiTsxFileRelativePath
|
114
|
+
).replace(/.tsx$/, "");
|
115
|
+
|
116
|
+
const modifiedKcPageTsxCode = kcPageTsxCode.replace(
|
117
|
+
`@keycloakify/keycloak-account-ui/${componentName}`,
|
118
|
+
`./${componentName}`
|
119
|
+
);
|
120
|
+
|
121
|
+
fs.writeFileSync(
|
122
|
+
kcPageTsxFilePath,
|
123
|
+
Buffer.from(modifiedKcPageTsxCode, "utf8")
|
124
|
+
);
|
125
|
+
}
|
126
|
+
|
127
|
+
const routesTsxFilePath = pathRelative(
|
128
|
+
process.cwd(),
|
129
|
+
pathJoin(srcDirPath, "routes.tsx")
|
130
|
+
);
|
131
|
+
|
132
|
+
console.log(
|
133
|
+
[
|
134
|
+
`To help you get started ${chalk.bold(pathRelative(process.cwd(), targetFilePath))} has been copied into your project.`,
|
135
|
+
`The next step is usually to eject ${chalk.bold(routesTsxFilePath)}`,
|
136
|
+
`with \`cp ${routesTsxFilePath} ${pathRelative(process.cwd(), accountThemeSrcDirPath)}\``,
|
137
|
+
`then update the import of routes in ${kcAccountUiTsxFileRelativePath}.`
|
138
|
+
].join("\n")
|
139
|
+
);
|
140
|
+
}
|
141
|
+
|
142
|
+
process.exit(0);
|
143
|
+
}
|
36
144
|
|
37
145
|
console.log(`→ ${themeType}`);
|
38
146
|
|
@@ -208,6 +208,18 @@ function decodeHtmlEntities(htmlStr){
|
|
208
208
|
) || (
|
209
209
|
key == "attributes" &&
|
210
210
|
areSamePath(path, ["realm"])
|
211
|
+
) || (
|
212
|
+
xKeycloakify.pageId == "index.ftl" &&
|
213
|
+
xKeycloakify.themeType == "account" &&
|
214
|
+
areSamePath(path, ["realm"]) &&
|
215
|
+
![
|
216
|
+
"name",
|
217
|
+
"registrationEmailAsUsername",
|
218
|
+
"editUsernameAllowed",
|
219
|
+
"isInternationalizationEnabled",
|
220
|
+
"identityFederationEnabled",
|
221
|
+
"userManagedAccessAllowed"
|
222
|
+
]?seq_contains(key)
|
211
223
|
)
|
212
224
|
>
|
213
225
|
<#-- <#local outSeq += ["/*" + path?join(".") + "." + key + " excluded*/"]> -->
|
@@ -15,6 +15,7 @@ export default meta;
|
|
15
15
|
|
16
16
|
type Story = StoryObj<typeof meta>;
|
17
17
|
|
18
|
+
// NOTE: Enable in your Keycloak realm with: https://github.com/user-attachments/assets/5fc5e49e-a172-4cb0-897a-49baac284b47
|
18
19
|
export const Default: Story = {
|
19
20
|
render: () => (
|
20
21
|
<KcPageStory
|