keycloakify 11.2.10 → 11.3.0-rc.0
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/193.index.js +1 -5
- package/bin/453.index.js +21 -26
- package/bin/526.index.js +1 -5
- package/bin/573.index.js +1 -5
- package/bin/780.index.js +1 -5
- package/bin/786.index.js +3 -8
- package/bin/932.index.js +9 -12
- package/bin/97.index.js +11 -16
- package/bin/main.js +5289 -277
- package/bin/shared/buildContext.d.ts +1 -2
- package/bin/shared/buildContext.js.map +1 -1
- package/bin/shared/constants.d.ts +4 -0
- package/bin/shared/constants.js +4 -0
- package/bin/shared/constants.js.map +1 -1
- package/bin/shared/customHandler.d.ts +11 -0
- package/bin/shared/customHandler.js +20 -0
- package/bin/shared/customHandler.js.map +1 -0
- package/bin/shared/customHandler_caller.d.ts +6 -0
- package/bin/shared/customHandler_caller.js.map +1 -0
- package/package.json +8 -3
- package/src/bin/add-story.ts +3 -8
- package/src/bin/copy-keycloak-resources-to-public.ts +3 -6
- package/src/bin/eject-page.ts +3 -8
- package/src/bin/initialize-account-theme/initialize-account-theme.ts +3 -6
- package/src/bin/initialize-email-theme.ts +3 -6
- package/src/bin/keycloakify/keycloakify.ts +3 -6
- package/src/bin/main.ts +181 -124
- package/src/bin/shared/buildContext.ts +3 -6
- package/src/bin/shared/constants.ts +5 -0
- package/src/bin/shared/customHandler.ts +35 -0
- package/src/bin/shared/customHandler_caller.ts +47 -0
- package/src/bin/start-keycloak/start-keycloak.ts +10 -12
- package/src/bin/update-kc-gen.ts +3 -8
- package/src/vite-plugin/vite-plugin.ts +1 -3
- package/vite-plugin/index.js +8 -6
- package/bin/31.index.js +0 -883
- package/bin/347.index.js +0 -4081
package/bin/193.index.js
CHANGED
@@ -84,14 +84,10 @@ function copyKeycloakResourcesToPublic(params) {
|
|
84
84
|
external_fs_.writeFileSync(keycloakifyBuildinfoFilePath, Buffer.from(keycloakifyBuildinfoRaw, "utf8"));
|
85
85
|
}
|
86
86
|
//# sourceMappingURL=copyKeycloakResourcesToPublic.js.map
|
87
|
-
// EXTERNAL MODULE: ./dist/bin/shared/buildContext.js + 1 modules
|
88
|
-
var shared_buildContext = __webpack_require__(56031);
|
89
87
|
;// CONCATENATED MODULE: ./dist/bin/copy-keycloak-resources-to-public.js
|
90
88
|
|
91
|
-
|
92
89
|
async function command(params) {
|
93
|
-
const {
|
94
|
-
const buildContext = (0,shared_buildContext/* getBuildContext */.s)({ cliCommandOptions });
|
90
|
+
const { buildContext } = params;
|
95
91
|
copyKeycloakResourcesToPublic({
|
96
92
|
buildContext
|
97
93
|
});
|
package/bin/453.index.js
CHANGED
@@ -14,17 +14,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
14
14
|
/* harmony import */ var cli_select__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99398);
|
15
15
|
/* harmony import */ var cli_select__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(cli_select__WEBPACK_IMPORTED_MODULE_1__);
|
16
16
|
/* harmony import */ var _shared_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(173);
|
17
|
-
/* harmony import */ var
|
17
|
+
/* harmony import */ var tsafe_capitalize__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(14899);
|
18
18
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(57147);
|
19
19
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_3__);
|
20
20
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71017);
|
21
21
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_4__);
|
22
|
-
/* harmony import */ var
|
22
|
+
/* harmony import */ var _tools_kebabCaseToSnakeCase__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(17192);
|
23
23
|
/* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29041);
|
24
|
-
/* harmony import */ var
|
25
|
-
/* harmony import */ var
|
26
|
-
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_7__);
|
27
|
-
|
24
|
+
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(78818);
|
25
|
+
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_6__);
|
28
26
|
|
29
27
|
|
30
28
|
|
@@ -35,11 +33,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
35
33
|
|
36
34
|
|
37
35
|
async function command(params) {
|
38
|
-
const {
|
39
|
-
|
40
|
-
cliCommandOptions
|
41
|
-
});
|
42
|
-
console.log(chalk__WEBPACK_IMPORTED_MODULE_7___default().cyan("Theme type:"));
|
36
|
+
const { buildContext } = params;
|
37
|
+
console.log(chalk__WEBPACK_IMPORTED_MODULE_6___default().cyan("Theme type:"));
|
43
38
|
const themeType = await (async () => {
|
44
39
|
const values = _shared_constants__WEBPACK_IMPORTED_MODULE_2__/* .THEME_TYPES.filter */ .Jh.filter(themeType => {
|
45
40
|
switch (themeType) {
|
@@ -69,7 +64,7 @@ async function command(params) {
|
|
69
64
|
`There isn't an interactive CLI to eject components of the Single-Page Account theme.`,
|
70
65
|
`You can however copy paste into your codebase the any file or directory from the following source directory:`,
|
71
66
|
``,
|
72
|
-
`${
|
67
|
+
`${chalk__WEBPACK_IMPORTED_MODULE_6___default().bold((0,path__WEBPACK_IMPORTED_MODULE_4__.join)((0,path__WEBPACK_IMPORTED_MODULE_4__.relative)(process.cwd(), srcDirPath)))}`,
|
73
68
|
``
|
74
69
|
].join("\n"));
|
75
70
|
eject_entrypoint: {
|
@@ -89,8 +84,8 @@ async function command(params) {
|
|
89
84
|
}
|
90
85
|
const routesTsxFilePath = (0,path__WEBPACK_IMPORTED_MODULE_4__.relative)(process.cwd(), (0,path__WEBPACK_IMPORTED_MODULE_4__.join)(srcDirPath, "routes.tsx"));
|
91
86
|
console.log([
|
92
|
-
`To help you get started ${
|
93
|
-
`The next step is usually to eject ${
|
87
|
+
`To help you get started ${chalk__WEBPACK_IMPORTED_MODULE_6___default().bold((0,path__WEBPACK_IMPORTED_MODULE_4__.relative)(process.cwd(), targetFilePath))} has been copied into your project.`,
|
88
|
+
`The next step is usually to eject ${chalk__WEBPACK_IMPORTED_MODULE_6___default().bold(routesTsxFilePath)}`,
|
94
89
|
`with \`cp ${routesTsxFilePath} ${(0,path__WEBPACK_IMPORTED_MODULE_4__.relative)(process.cwd(), accountThemeSrcDirPath)}\``,
|
95
90
|
`then update the import of routes in ${kcAccountUiTsxFileRelativePath}.`
|
96
91
|
].join("\n"));
|
@@ -98,7 +93,7 @@ async function command(params) {
|
|
98
93
|
process.exit(0);
|
99
94
|
}
|
100
95
|
console.log(`→ ${themeType}`);
|
101
|
-
console.log(
|
96
|
+
console.log(chalk__WEBPACK_IMPORTED_MODULE_6___default().cyan("Select the page you want to customize:"));
|
102
97
|
const templateValue = "Template.tsx (Layout common to every page)";
|
103
98
|
const userProfileFormFieldsValue = "UserProfileFormFields.tsx (Renders the form of the register.ftl, login-update-profile.ftl, update-email.ftl and idp-review-user-profile.ftl)";
|
104
99
|
const { value: pageIdOrComponent } = await cli_select__WEBPACK_IMPORTED_MODULE_1___default()({
|
@@ -126,7 +121,7 @@ async function command(params) {
|
|
126
121
|
if (pageIdOrComponent === userProfileFormFieldsValue) {
|
127
122
|
return "UserProfileFormFields.tsx";
|
128
123
|
}
|
129
|
-
return (0,
|
124
|
+
return (0,tsafe_capitalize__WEBPACK_IMPORTED_MODULE_7__/* .capitalize */ .k)((0,_tools_kebabCaseToSnakeCase__WEBPACK_IMPORTED_MODULE_8__/* .kebabCaseToCamelCase */ .A)(pageIdOrComponent)).replace(/ftl$/, "tsx");
|
130
125
|
})();
|
131
126
|
const pagesOrDot = (() => {
|
132
127
|
if (pageIdOrComponent === templateValue ||
|
@@ -149,7 +144,7 @@ async function command(params) {
|
|
149
144
|
}
|
150
145
|
}
|
151
146
|
fs__WEBPACK_IMPORTED_MODULE_3__.writeFileSync(targetFilePath, Buffer.from(componentCode, "utf8"));
|
152
|
-
console.log(`${
|
147
|
+
console.log(`${chalk__WEBPACK_IMPORTED_MODULE_6___default().green("✓")} ${chalk__WEBPACK_IMPORTED_MODULE_6___default().bold((0,path__WEBPACK_IMPORTED_MODULE_4__.join)(".", (0,path__WEBPACK_IMPORTED_MODULE_4__.relative)(process.cwd(), targetFilePath)))} copy pasted from the Keycloakify source code into your project`);
|
153
148
|
edit_KcApp: {
|
154
149
|
if (pageIdOrComponent !== templateValue &&
|
155
150
|
pageIdOrComponent !== userProfileFormFieldsValue) {
|
@@ -167,11 +162,11 @@ async function command(params) {
|
|
167
162
|
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .h)(false);
|
168
163
|
})();
|
169
164
|
if (kcAppTsxCode === modifiedKcAppTsxCode) {
|
170
|
-
console.log(
|
165
|
+
console.log(chalk__WEBPACK_IMPORTED_MODULE_6___default().red("Unable to automatically update KcPage.tsx, please update it manually"));
|
171
166
|
return;
|
172
167
|
}
|
173
168
|
fs__WEBPACK_IMPORTED_MODULE_3__.writeFileSync(kcAppTsxPath, Buffer.from(modifiedKcAppTsxCode, "utf8"));
|
174
|
-
console.log(`${
|
169
|
+
console.log(`${chalk__WEBPACK_IMPORTED_MODULE_6___default().green("✓")} ${chalk__WEBPACK_IMPORTED_MODULE_6___default().bold((0,path__WEBPACK_IMPORTED_MODULE_4__.join)(".", (0,path__WEBPACK_IMPORTED_MODULE_4__.relative)(process.cwd(), kcAppTsxPath)))} Updated`);
|
175
170
|
return;
|
176
171
|
}
|
177
172
|
const userProfileFormFieldComponentName = "UserProfileFormFields";
|
@@ -180,11 +175,11 @@ async function command(params) {
|
|
180
175
|
``,
|
181
176
|
`You now need to update your page router:`,
|
182
177
|
``,
|
183
|
-
`${
|
184
|
-
|
178
|
+
`${chalk__WEBPACK_IMPORTED_MODULE_6___default().bold((0,path__WEBPACK_IMPORTED_MODULE_4__.join)(".", (0,path__WEBPACK_IMPORTED_MODULE_4__.relative)(process.cwd(), buildContext.themeSrcDirPath), themeType, "KcPage.tsx"))}:`,
|
179
|
+
chalk__WEBPACK_IMPORTED_MODULE_6___default().grey("```"),
|
185
180
|
`// ...`,
|
186
181
|
``,
|
187
|
-
|
182
|
+
chalk__WEBPACK_IMPORTED_MODULE_6___default().green(`+const ${componentName} = lazy(() => import("./pages/${componentName}"));`),
|
188
183
|
...[
|
189
184
|
``,
|
190
185
|
` export default function KcPage(props: { kcContext: KcContext; }) {`,
|
@@ -217,14 +212,14 @@ async function command(params) {
|
|
217
212
|
` }`
|
218
213
|
].map(line => {
|
219
214
|
if (line.startsWith("+")) {
|
220
|
-
return
|
215
|
+
return chalk__WEBPACK_IMPORTED_MODULE_6___default().green(line);
|
221
216
|
}
|
222
217
|
if (line.startsWith("-")) {
|
223
|
-
return
|
218
|
+
return chalk__WEBPACK_IMPORTED_MODULE_6___default().red(line);
|
224
219
|
}
|
225
|
-
return
|
220
|
+
return chalk__WEBPACK_IMPORTED_MODULE_6___default().grey(line);
|
226
221
|
}),
|
227
|
-
|
222
|
+
chalk__WEBPACK_IMPORTED_MODULE_6___default().grey("```")
|
228
223
|
].join("\n"));
|
229
224
|
}
|
230
225
|
//# sourceMappingURL=eject-page.js.map
|
package/bin/526.index.js
CHANGED
@@ -14,8 +14,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
14
14
|
"command": () => (/* reexport */ command)
|
15
15
|
});
|
16
16
|
|
17
|
-
// EXTERNAL MODULE: ./dist/bin/shared/buildContext.js + 1 modules
|
18
|
-
var shared_buildContext = __webpack_require__(56031);
|
19
17
|
// EXTERNAL MODULE: ./node_modules/tsafe/esm/exclude.mjs
|
20
18
|
var exclude = __webpack_require__(83101);
|
21
19
|
// EXTERNAL MODULE: ./dist/bin/shared/promptKeycloakVersion.js
|
@@ -214,7 +212,6 @@ var downloadAndExtractArchive = __webpack_require__(38367);
|
|
214
212
|
|
215
213
|
|
216
214
|
|
217
|
-
|
218
215
|
|
219
216
|
|
220
217
|
async function command(params) {
|
@@ -255,8 +252,7 @@ async function command(params) {
|
|
255
252
|
].join(" "));
|
256
253
|
process.exit(1);
|
257
254
|
}
|
258
|
-
const { cliCommandOptions } = params;
|
259
|
-
const buildContext = (0,shared_buildContext/* getBuildContext */.s)({ cliCommandOptions });
|
255
|
+
const { cliCommandOptions, buildContext } = params;
|
260
256
|
const { dockerImageTag } = await (async () => {
|
261
257
|
if (cliCommandOptions.keycloakVersion !== undefined) {
|
262
258
|
return { dockerImageTag: cliCommandOptions.keycloakVersion };
|
package/bin/573.index.js
CHANGED
@@ -1110,8 +1110,6 @@ async function generateResources(params) {
|
|
1110
1110
|
;// CONCATENATED MODULE: ./dist/bin/keycloakify/generateResources/index.js
|
1111
1111
|
|
1112
1112
|
//# sourceMappingURL=index.js.map
|
1113
|
-
// EXTERNAL MODULE: ./dist/bin/shared/buildContext.js + 1 modules
|
1114
|
-
var shared_buildContext = __webpack_require__(56031);
|
1115
1113
|
;// CONCATENATED MODULE: ./dist/bin/keycloakify/buildJars/extensionVersions.js
|
1116
1114
|
// NOTE: v0.5 is a dummy version.
|
1117
1115
|
const keycloakAccountV1Versions = [null, "0.3", "0.4", "0.6"];
|
@@ -1422,10 +1420,8 @@ var external_os_ = __webpack_require__(22037);
|
|
1422
1420
|
|
1423
1421
|
|
1424
1422
|
|
1425
|
-
|
1426
1423
|
async function command(params) {
|
1427
|
-
const {
|
1428
|
-
const buildContext = (0,shared_buildContext/* getBuildContext */.s)({ cliCommandOptions });
|
1424
|
+
const { buildContext } = params;
|
1429
1425
|
exit_if_maven_not_installed: {
|
1430
1426
|
let commandOutput = undefined;
|
1431
1427
|
try {
|
package/bin/780.index.js
CHANGED
@@ -14,8 +14,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
14
14
|
"command": () => (/* reexport */ command)
|
15
15
|
});
|
16
16
|
|
17
|
-
// EXTERNAL MODULE: ./dist/bin/shared/buildContext.js + 1 modules
|
18
|
-
var shared_buildContext = __webpack_require__(56031);
|
19
17
|
// EXTERNAL MODULE: ./node_modules/cli-select/dist/index.js
|
20
18
|
var dist = __webpack_require__(99398);
|
21
19
|
var dist_default = /*#__PURE__*/__webpack_require__.n(dist);
|
@@ -95,10 +93,8 @@ var generateKcGenTs = __webpack_require__(58585);
|
|
95
93
|
|
96
94
|
|
97
95
|
|
98
|
-
|
99
96
|
async function command(params) {
|
100
|
-
const {
|
101
|
-
const buildContext = (0,shared_buildContext/* getBuildContext */.s)({ cliCommandOptions });
|
97
|
+
const { buildContext } = params;
|
102
98
|
const accountThemeSrcDirPath = (0,external_path_.join)(buildContext.themeSrcDirPath, "account");
|
103
99
|
if (external_fs_.existsSync(accountThemeSrcDirPath) &&
|
104
100
|
external_fs_.readdirSync(accountThemeSrcDirPath).length > 0) {
|
package/bin/786.index.js
CHANGED
@@ -165,16 +165,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
165
165
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
166
166
|
/* harmony export */ "command": () => (/* binding */ command)
|
167
167
|
/* harmony export */ });
|
168
|
-
/* harmony import */ var
|
169
|
-
/* harmony import */ var _shared_generateKcGenTs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58585);
|
170
|
-
|
168
|
+
/* harmony import */ var _shared_generateKcGenTs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(58585);
|
171
169
|
|
172
170
|
async function command(params) {
|
173
|
-
const {
|
174
|
-
|
175
|
-
cliCommandOptions
|
176
|
-
});
|
177
|
-
await (0,_shared_generateKcGenTs__WEBPACK_IMPORTED_MODULE_1__/* .generateKcGenTs */ .b)({ buildContext });
|
171
|
+
const { buildContext } = params;
|
172
|
+
await (0,_shared_generateKcGenTs__WEBPACK_IMPORTED_MODULE_0__/* .generateKcGenTs */ .b)({ buildContext });
|
178
173
|
}
|
179
174
|
//# sourceMappingURL=update-kc-gen.js.map
|
180
175
|
|
package/bin/932.index.js
CHANGED
@@ -14,22 +14,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
14
14
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
|
15
15
|
/* harmony import */ var _tools_transformCodebase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(60332);
|
16
16
|
/* harmony import */ var _shared_promptKeycloakVersion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(82635);
|
17
|
-
/* harmony import */ var
|
18
|
-
/* harmony import */ var
|
19
|
-
/* harmony import */ var
|
20
|
-
/* harmony import */ var _tools_downloadAndExtractArchive__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(38367);
|
21
|
-
|
17
|
+
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(57147);
|
18
|
+
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_3__);
|
19
|
+
/* harmony import */ var _tools_downloadAndExtractArchive__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(38367);
|
22
20
|
|
23
21
|
|
24
22
|
|
25
23
|
|
26
24
|
|
27
25
|
async function command(params) {
|
28
|
-
const {
|
29
|
-
const buildContext = (0,_shared_buildContext__WEBPACK_IMPORTED_MODULE_3__/* .getBuildContext */ .s)({ cliCommandOptions });
|
26
|
+
const { buildContext } = params;
|
30
27
|
const emailThemeSrcDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(buildContext.themeSrcDirPath, "email");
|
31
|
-
if (
|
32
|
-
|
28
|
+
if (fs__WEBPACK_IMPORTED_MODULE_3__.existsSync(emailThemeSrcDirPath) &&
|
29
|
+
fs__WEBPACK_IMPORTED_MODULE_3__.readdirSync(emailThemeSrcDirPath).length > 0) {
|
33
30
|
console.warn(`There is already a non empty ${(0,path__WEBPACK_IMPORTED_MODULE_0__.relative)(process.cwd(), emailThemeSrcDirPath)} directory in your project. Aborting.`);
|
34
31
|
process.exit(-1);
|
35
32
|
}
|
@@ -41,7 +38,7 @@ async function command(params) {
|
|
41
38
|
doOmitPatch: false,
|
42
39
|
buildContext
|
43
40
|
});
|
44
|
-
const { extractedDirPath } = await (0,
|
41
|
+
const { extractedDirPath } = await (0,_tools_downloadAndExtractArchive__WEBPACK_IMPORTED_MODULE_4__/* .downloadAndExtractArchive */ .I)({
|
45
42
|
url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
|
46
43
|
cacheDirPath: buildContext.cacheDirPath,
|
47
44
|
fetchOptions: buildContext.fetchOptions,
|
@@ -60,9 +57,9 @@ async function command(params) {
|
|
60
57
|
});
|
61
58
|
{
|
62
59
|
const themePropertyFilePath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(emailThemeSrcDirPath, "theme.properties");
|
63
|
-
|
60
|
+
fs__WEBPACK_IMPORTED_MODULE_3__.writeFileSync(themePropertyFilePath, Buffer.from([
|
64
61
|
`parent=base`,
|
65
|
-
|
62
|
+
fs__WEBPACK_IMPORTED_MODULE_3__.readFileSync(themePropertyFilePath).toString("utf8")
|
66
63
|
].join("\n"), "utf8"));
|
67
64
|
}
|
68
65
|
console.log(`The \`${(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(".", (0,path__WEBPACK_IMPORTED_MODULE_0__.relative)(process.cwd(), emailThemeSrcDirPath))}\` directory have been created.`);
|
package/bin/97.index.js
CHANGED
@@ -14,17 +14,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
14
14
|
/* harmony import */ var cli_select__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99398);
|
15
15
|
/* harmony import */ var cli_select__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(cli_select__WEBPACK_IMPORTED_MODULE_1__);
|
16
16
|
/* harmony import */ var _shared_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(173);
|
17
|
-
/* harmony import */ var
|
17
|
+
/* harmony import */ var tsafe_capitalize__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(14899);
|
18
18
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(57147);
|
19
19
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_3__);
|
20
20
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71017);
|
21
21
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_4__);
|
22
|
-
/* harmony import */ var
|
22
|
+
/* harmony import */ var _tools_kebabCaseToSnakeCase__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(17192);
|
23
23
|
/* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29041);
|
24
|
-
/* harmony import */ var
|
25
|
-
/* harmony import */ var
|
26
|
-
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_7__);
|
27
|
-
|
24
|
+
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(78818);
|
25
|
+
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_6__);
|
28
26
|
|
29
27
|
|
30
28
|
|
@@ -35,11 +33,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
35
33
|
|
36
34
|
|
37
35
|
async function command(params) {
|
38
|
-
const {
|
39
|
-
|
40
|
-
cliCommandOptions
|
41
|
-
});
|
42
|
-
console.log(chalk__WEBPACK_IMPORTED_MODULE_7___default().cyan("Theme type:"));
|
36
|
+
const { buildContext } = params;
|
37
|
+
console.log(chalk__WEBPACK_IMPORTED_MODULE_6___default().cyan("Theme type:"));
|
43
38
|
const themeType = await (async () => {
|
44
39
|
const values = _shared_constants__WEBPACK_IMPORTED_MODULE_2__/* .THEME_TYPES.filter */ .Jh.filter(themeType => {
|
45
40
|
switch (themeType) {
|
@@ -64,11 +59,11 @@ async function command(params) {
|
|
64
59
|
if (themeType === "account" &&
|
65
60
|
((0,tsafe_assert__WEBPACK_IMPORTED_MODULE_5__/* .assert */ .h)(buildContext.implementedThemeTypes.account.isImplemented),
|
66
61
|
buildContext.implementedThemeTypes.account.type === "Single-Page")) {
|
67
|
-
console.log(`${
|
62
|
+
console.log(`${chalk__WEBPACK_IMPORTED_MODULE_6___default().red("✗")} Sorry, there is no Storybook support for Single-Page Account themes.`);
|
68
63
|
process.exit(0);
|
69
64
|
}
|
70
65
|
console.log(`→ ${themeType}`);
|
71
|
-
console.log(
|
66
|
+
console.log(chalk__WEBPACK_IMPORTED_MODULE_6___default().cyan("Select the page you want to create a Storybook for:"));
|
72
67
|
const { value: pageId } = await cli_select__WEBPACK_IMPORTED_MODULE_1___default()({
|
73
68
|
values: (() => {
|
74
69
|
switch (themeType) {
|
@@ -83,7 +78,7 @@ async function command(params) {
|
|
83
78
|
process.exit(-1);
|
84
79
|
});
|
85
80
|
console.log(`→ ${pageId}`);
|
86
|
-
const componentBasename = (0,
|
81
|
+
const componentBasename = (0,tsafe_capitalize__WEBPACK_IMPORTED_MODULE_7__/* .capitalize */ .k)((0,_tools_kebabCaseToSnakeCase__WEBPACK_IMPORTED_MODULE_8__/* .kebabCaseToCamelCase */ .A)(pageId)).replace(/ftl$/, "stories.tsx");
|
87
82
|
const targetFilePath = (0,path__WEBPACK_IMPORTED_MODULE_4__.join)(buildContext.themeSrcDirPath, themeType, "pages", componentBasename);
|
88
83
|
if (fs__WEBPACK_IMPORTED_MODULE_3__.existsSync(targetFilePath)) {
|
89
84
|
console.log(`${(0,path__WEBPACK_IMPORTED_MODULE_4__.relative)(process.cwd(), targetFilePath)} already exists`);
|
@@ -101,8 +96,8 @@ async function command(params) {
|
|
101
96
|
}
|
102
97
|
fs__WEBPACK_IMPORTED_MODULE_3__.writeFileSync(targetFilePath, Buffer.from(componentCode, "utf8"));
|
103
98
|
console.log([
|
104
|
-
`${
|
105
|
-
`You can start storybook with ${
|
99
|
+
`${chalk__WEBPACK_IMPORTED_MODULE_6___default().green("✓")} ${chalk__WEBPACK_IMPORTED_MODULE_6___default().bold((0,path__WEBPACK_IMPORTED_MODULE_4__.join)(".", (0,path__WEBPACK_IMPORTED_MODULE_4__.relative)(process.cwd(), targetFilePath)))} copy pasted from the Keycloakify source code into your project`,
|
100
|
+
`You can start storybook with ${chalk__WEBPACK_IMPORTED_MODULE_6___default().bold("npm run storybook")}`
|
106
101
|
].join("\n"));
|
107
102
|
}
|
108
103
|
//# sourceMappingURL=add-story.js.map
|