keycloakify 10.0.0-rc.15 → 10.0.0-rc.16

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/main.js CHANGED
@@ -81,7 +81,7 @@ exports.command = command;
81
81
 
82
82
  /***/ }),
83
83
 
84
- /***/ 42707:
84
+ /***/ 27961:
85
85
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
86
86
 
87
87
  "use strict";
@@ -122,12 +122,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
122
122
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
123
123
  }
124
124
  };
125
+ var __importDefault = (this && this.__importDefault) || function (mod) {
126
+ return (mod && mod.__esModule) ? mod : { "default": mod };
127
+ };
125
128
  Object.defineProperty(exports, "__esModule", ({ value: true }));
126
129
  exports.command = void 0;
127
130
  var path_1 = __nccwpck_require__(71017);
128
131
  var promptKeycloakVersion_1 = __nccwpck_require__(82635);
129
132
  var buildOptions_1 = __nccwpck_require__(65172);
130
- var downloadBuiltinKeycloakTheme_1 = __nccwpck_require__(66800);
133
+ var downloadKeycloakDefaultTheme_1 = __nccwpck_require__(60597);
134
+ var chalk_1 = __importDefault(__nccwpck_require__(78818));
131
135
  function command(params) {
132
136
  return __awaiter(this, void 0, void 0, function () {
133
137
  var cliCommandOptions, buildOptions, keycloakVersion, destDirPath;
@@ -138,33 +142,35 @@ function command(params) {
138
142
  buildOptions = (0, buildOptions_1.readBuildOptions)({
139
143
  cliCommandOptions: cliCommandOptions
140
144
  });
141
- console.log("Select the Keycloak version from which you want to download the builtins theme:");
145
+ console.log(chalk_1.default.cyan("Select the Keycloak version from which you want to download the builtins theme:"));
142
146
  return [4 /*yield*/, (0, promptKeycloakVersion_1.promptKeycloakVersion)({
143
147
  "startingFromMajor": undefined,
144
148
  "cacheDirPath": buildOptions.cacheDirPath
145
149
  })];
146
150
  case 1:
147
151
  keycloakVersion = (_a.sent()).keycloakVersion;
152
+ console.log("\u2192 ".concat(keycloakVersion));
148
153
  destDirPath = (0, path_1.join)(buildOptions.keycloakifyBuildDirPath, "src", "main", "resources", "theme");
149
- console.log("Downloading builtins theme of Keycloak ".concat(keycloakVersion, " here ").concat(destDirPath));
150
- return [4 /*yield*/, (0, downloadBuiltinKeycloakTheme_1.downloadBuiltinKeycloakTheme)({
154
+ console.log("Downloading builtins theme of Keycloak ".concat(keycloakVersion, " here ").concat(chalk_1.default.bold(".".concat(path_1.sep).concat((0, path_1.relative)(process.cwd(), destDirPath)))));
155
+ return [4 /*yield*/, (0, downloadKeycloakDefaultTheme_1.downloadKeycloakDefaultTheme)({
151
156
  keycloakVersion: keycloakVersion,
152
157
  destDirPath: destDirPath,
153
158
  buildOptions: buildOptions
154
159
  })];
155
160
  case 2:
156
161
  _a.sent();
162
+ console.log(chalk_1.default.green("\u2713 done"));
157
163
  return [2 /*return*/];
158
164
  }
159
165
  });
160
166
  });
161
167
  }
162
168
  exports.command = command;
163
- //# sourceMappingURL=download-builtin-keycloak-theme.js.map
169
+ //# sourceMappingURL=download-keycloak-default-theme.js.map
164
170
 
165
171
  /***/ }),
166
172
 
167
- /***/ 71470:
173
+ /***/ 93453:
168
174
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
169
175
 
170
176
  "use strict";
@@ -268,6 +274,7 @@ var kebabCaseToSnakeCase_1 = __nccwpck_require__(17192);
268
274
  var assert_1 = __nccwpck_require__(88078);
269
275
  var getThemeSrcDirPath_1 = __nccwpck_require__(39216);
270
276
  var buildOptions_1 = __nccwpck_require__(65172);
277
+ var chalk_1 = __importDefault(__nccwpck_require__(78818));
271
278
  function command(params) {
272
279
  return __awaiter(this, void 0, void 0, function () {
273
280
  var cliCommandOptions, buildOptions, themeType, pageId, componentPageBasename, themeSrcDirPath, targetFilePath, targetDirPath, componentPageContent, userProfileFormFieldComponentName;
@@ -278,16 +285,16 @@ function command(params) {
278
285
  buildOptions = (0, buildOptions_1.readBuildOptions)({
279
286
  cliCommandOptions: cliCommandOptions
280
287
  });
281
- console.log("Theme type:");
288
+ console.log(chalk_1.default.cyan("Theme type:"));
282
289
  return [4 /*yield*/, (0, cli_select_1.default)({
283
290
  "values": __spreadArray([], __read(constants_1.themeTypes), false)
284
291
  }).catch(function () {
285
- console.log("Aborting");
286
292
  process.exit(-1);
287
293
  })];
288
294
  case 1:
289
295
  themeType = (_a.sent()).value;
290
- console.log("Select the page you want to customize:");
296
+ console.log("\u2192 ".concat(themeType));
297
+ console.log(chalk_1.default.cyan("Select the page you want to customize:"));
291
298
  return [4 /*yield*/, (0, cli_select_1.default)({
292
299
  "values": (function () {
293
300
  switch (themeType) {
@@ -299,11 +306,11 @@ function command(params) {
299
306
  (0, assert_1.assert)(false);
300
307
  })()
301
308
  }).catch(function () {
302
- console.log("Aborting");
303
309
  process.exit(-1);
304
310
  })];
305
311
  case 2:
306
312
  pageId = (_a.sent()).value;
313
+ console.log("\u2192 ".concat(pageId));
307
314
  componentPageBasename = (0, capitalize_1.capitalize)((0, kebabCaseToSnakeCase_1.kebabCaseToCamelCase)(pageId)).replace(/ftl$/, "tsx");
308
315
  themeSrcDirPath = (0, getThemeSrcDirPath_1.getThemeSrcDirPath)({ "reactAppRootDirPath": buildOptions.reactAppRootDirPath }).themeSrcDirPath;
309
316
  targetFilePath = (0, path_1.join)(themeSrcDirPath, themeType, "pages", componentPageBasename);
@@ -324,15 +331,16 @@ function command(params) {
324
331
  userProfileFormFieldComponentName = "UserProfileFormFields";
325
332
  console.log(__spreadArray(__spreadArray([
326
333
  "",
327
- "`".concat((0, path_1.join)(".", (0, path_1.relative)(process.cwd(), targetFilePath)), "` copy pasted from the Keycloakify source code into your project."),
334
+ "".concat(chalk_1.default.green("✓"), " ").concat(chalk_1.default.bold((0, path_1.join)(".", (0, path_1.relative)(process.cwd(), targetFilePath))), " copy pasted from the Keycloakify source code into your project"),
328
335
  "",
329
336
  "You now need to update your page router:",
330
337
  "",
331
- "`".concat((0, path_1.join)(".", (0, path_1.relative)(process.cwd(), themeSrcDirPath), themeType, "KcApp.tsx"), "`:"),
332
- "```",
338
+ "".concat(chalk_1.default.bold((0, path_1.join)(".", (0, path_1.relative)(process.cwd(), themeSrcDirPath), themeType, "KcApp.tsx")), ":"),
339
+ chalk_1.default.grey("```"),
333
340
  "// ...",
334
341
  "",
335
- "+const ".concat(componentPageBasename.replace(/.tsx$/, ""), " = lazy(() => import(\"./pages/").concat(componentPageBasename, "\"));"),
342
+ chalk_1.default.green("+const ".concat(componentPageBasename.replace(/.tsx$/, ""), " = lazy(() => import(\"./pages/").concat(componentPageBasename, "\"));"))
343
+ ], __read(__spreadArray(__spreadArray([
336
344
  "",
337
345
  " export default function KcApp(props: { kcContext: KcContext; }) {",
338
346
  "",
@@ -343,7 +351,7 @@ function command(params) {
343
351
  " {(() => {",
344
352
  " switch (kcContext.pageId) {",
345
353
  " // ...",
346
- " case \"".concat(pageId, "\": return ("),
354
+ "+ case \"".concat(pageId, "\": return ("),
347
355
  "+ <Login",
348
356
  "+ {...{ kcContext, i18n, classes }}",
349
357
  "+ Template={Template}"
@@ -358,8 +366,17 @@ function command(params) {
358
366
  " })()}",
359
367
  " </Suspense>",
360
368
  " );",
361
- " }",
362
- "```"
369
+ " }"
370
+ ], false).map(function (line) {
371
+ if (line.startsWith("+")) {
372
+ return chalk_1.default.green(line);
373
+ }
374
+ if (line.startsWith("-")) {
375
+ return chalk_1.default.red(line);
376
+ }
377
+ return chalk_1.default.grey(line);
378
+ })), false), [
379
+ chalk_1.default.grey("```")
363
380
  ], false).join("\n"));
364
381
  return [2 /*return*/];
365
382
  }
@@ -367,7 +384,7 @@ function command(params) {
367
384
  });
368
385
  }
369
386
  exports.command = command;
370
- //# sourceMappingURL=eject-keycloak-page.js.map
387
+ //# sourceMappingURL=eject-page.js.map
371
388
 
372
389
  /***/ }),
373
390
 
@@ -437,7 +454,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
437
454
  };
438
455
  Object.defineProperty(exports, "__esModule", ({ value: true }));
439
456
  exports.command = void 0;
440
- var downloadBuiltinKeycloakTheme_1 = __nccwpck_require__(66800);
457
+ var downloadKeycloakDefaultTheme_1 = __nccwpck_require__(60597);
441
458
  var path_1 = __nccwpck_require__(71017);
442
459
  var transformCodebase_1 = __nccwpck_require__(60332);
443
460
  var promptKeycloakVersion_1 = __nccwpck_require__(82635);
@@ -471,7 +488,7 @@ function command(params) {
471
488
  keycloakVersion = (_a.sent()).keycloakVersion;
472
489
  builtinKeycloakThemeTmpDirPath = (0, path_1.join)(buildOptions.cacheDirPath, "initialize-email-theme_tmp");
473
490
  (0, fs_rmSync_1.rmSync)(builtinKeycloakThemeTmpDirPath, { "recursive": true, "force": true });
474
- return [4 /*yield*/, (0, downloadBuiltinKeycloakTheme_1.downloadBuiltinKeycloakTheme)({
491
+ return [4 /*yield*/, (0, downloadKeycloakDefaultTheme_1.downloadKeycloakDefaultTheme)({
475
492
  keycloakVersion: keycloakVersion,
476
493
  "destDirPath": builtinKeycloakThemeTmpDirPath,
477
494
  buildOptions: buildOptions
@@ -1332,7 +1349,7 @@ var fs = __importStar(__nccwpck_require__(57147));
1332
1349
  var path_1 = __nccwpck_require__(71017);
1333
1350
  var assert_1 = __nccwpck_require__(88078);
1334
1351
  var constants_1 = __nccwpck_require__(173);
1335
- var downloadBuiltinKeycloakTheme_1 = __nccwpck_require__(66800);
1352
+ var downloadKeycloakDefaultTheme_1 = __nccwpck_require__(60597);
1336
1353
  var transformCodebase_1 = __nccwpck_require__(60332);
1337
1354
  var fs_rmSync_1 = __nccwpck_require__(89693);
1338
1355
  (0, assert_1.assert)();
@@ -1344,7 +1361,7 @@ function bringInAccountV1(params) {
1344
1361
  case 0:
1345
1362
  buildOptions = params.buildOptions;
1346
1363
  builtinKeycloakThemeTmpDirPath = (0, path_1.join)(buildOptions.cacheDirPath, "bringInAccountV1_tmp");
1347
- return [4 /*yield*/, (0, downloadBuiltinKeycloakTheme_1.downloadBuiltinKeycloakTheme)({
1364
+ return [4 /*yield*/, (0, downloadKeycloakDefaultTheme_1.downloadKeycloakDefaultTheme)({
1348
1365
  "destDirPath": builtinKeycloakThemeTmpDirPath,
1349
1366
  "keycloakVersion": constants_1.lastKeycloakVersionWithAccountV1,
1350
1367
  buildOptions: buildOptions
@@ -3310,7 +3327,7 @@ program
3310
3327
  });
3311
3328
  program
3312
3329
  .command({
3313
- "name": "download-builtin-keycloak-theme",
3330
+ "name": "download-keycloak-default-theme",
3314
3331
  "description": "Download the built-in Keycloak theme."
3315
3332
  })
3316
3333
  .task({
@@ -3319,7 +3336,7 @@ program
3319
3336
  var command;
3320
3337
  return __generator(this, function (_a) {
3321
3338
  switch (_a.label) {
3322
- case 0: return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(__nccwpck_require__(42707)); })];
3339
+ case 0: return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(__nccwpck_require__(27961)); })];
3323
3340
  case 1:
3324
3341
  command = (_a.sent()).command;
3325
3342
  return [4 /*yield*/, command({ cliCommandOptions: cliCommandOptions })];
@@ -3332,7 +3349,7 @@ program
3332
3349
  });
3333
3350
  program
3334
3351
  .command({
3335
- "name": "eject-keycloak-page",
3352
+ "name": "eject-page",
3336
3353
  "description": "Eject a Keycloak page."
3337
3354
  })
3338
3355
  .task({
@@ -3341,7 +3358,7 @@ program
3341
3358
  var command;
3342
3359
  return __generator(this, function (_a) {
3343
3360
  switch (_a.label) {
3344
- case 0: return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(__nccwpck_require__(71470)); })];
3361
+ case 0: return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(__nccwpck_require__(93453)); })];
3345
3362
  case 1:
3346
3363
  command = (_a.sent()).command;
3347
3364
  return [4 /*yield*/, command({ cliCommandOptions: cliCommandOptions })];
@@ -4069,10 +4086,10 @@ function downloadAndUnzip(params) {
4069
4086
  return [4 /*yield*/, (0, fs_rm_1.rm)(extractDirPath, { "recursive": true })];
4070
4087
  case 13:
4071
4088
  _d.sent();
4072
- upload_to_remot_cache_if_admin: {
4089
+ upload_to_remote_cache_if_admin: {
4073
4090
  githubToken = process.env["KEYCLOAKIFY_ADMIN_GITHUB_PERSONAL_ACCESS_TOKEN"];
4074
- if (githubToken === undefined) {
4075
- break upload_to_remot_cache_if_admin;
4091
+ if (!githubToken) {
4092
+ break upload_to_remote_cache_if_admin;
4076
4093
  }
4077
4094
  console.log("uploading to remote cache");
4078
4095
  try {
@@ -4144,7 +4161,7 @@ function generateFileNameFromURL(params) {
4144
4161
 
4145
4162
  /***/ }),
4146
4163
 
4147
- /***/ 66800:
4164
+ /***/ 60597:
4148
4165
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
4149
4166
 
4150
4167
  "use strict";
@@ -4234,7 +4251,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
4234
4251
  return to.concat(ar || Array.prototype.slice.call(from));
4235
4252
  };
4236
4253
  Object.defineProperty(exports, "__esModule", ({ value: true }));
4237
- exports.downloadBuiltinKeycloakTheme = void 0;
4254
+ exports.downloadKeycloakDefaultTheme = void 0;
4238
4255
  var path_1 = __nccwpck_require__(71017);
4239
4256
  var downloadAndUnzip_1 = __nccwpck_require__(48469);
4240
4257
  var assert_1 = __nccwpck_require__(88078);
@@ -4244,7 +4261,7 @@ var fs_rmSync_1 = __nccwpck_require__(89693);
4244
4261
  var constants_1 = __nccwpck_require__(173);
4245
4262
  var transformCodebase_1 = __nccwpck_require__(60332);
4246
4263
  (0, assert_1.assert)();
4247
- function downloadBuiltinKeycloakTheme(params) {
4264
+ function downloadKeycloakDefaultTheme(params) {
4248
4265
  return __awaiter(this, void 0, void 0, function () {
4249
4266
  var keycloakVersion, destDirPath, buildOptions;
4250
4267
  var _this = this;
@@ -4462,8 +4479,8 @@ function downloadBuiltinKeycloakTheme(params) {
4462
4479
  });
4463
4480
  });
4464
4481
  }
4465
- exports.downloadBuiltinKeycloakTheme = downloadBuiltinKeycloakTheme;
4466
- //# sourceMappingURL=downloadBuiltinKeycloakTheme.js.map
4482
+ exports.downloadKeycloakDefaultTheme = downloadKeycloakDefaultTheme;
4483
+ //# sourceMappingURL=downloadKeycloakDefaultTheme.js.map
4467
4484
 
4468
4485
  /***/ }),
4469
4486
 
@@ -4535,7 +4552,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
4535
4552
  exports.downloadKeycloakStaticResources = void 0;
4536
4553
  var transformCodebase_1 = __nccwpck_require__(60332);
4537
4554
  var path_1 = __nccwpck_require__(71017);
4538
- var downloadBuiltinKeycloakTheme_1 = __nccwpck_require__(66800);
4555
+ var downloadKeycloakDefaultTheme_1 = __nccwpck_require__(60597);
4539
4556
  var constants_1 = __nccwpck_require__(173);
4540
4557
  var assert_1 = __nccwpck_require__(88078);
4541
4558
  var crypto = __importStar(__nccwpck_require__(6113));
@@ -4549,7 +4566,7 @@ function downloadKeycloakStaticResources(params) {
4549
4566
  case 0:
4550
4567
  themeType = params.themeType, themeDirPath = params.themeDirPath, keycloakVersion = params.keycloakVersion, buildOptions = params.buildOptions;
4551
4568
  tmpDirPath = (0, path_1.join)(buildOptions.cacheDirPath, "downloadKeycloakStaticResources_tmp_".concat(crypto.createHash("sha256").update("".concat(themeType, "-").concat(keycloakVersion)).digest("hex").slice(0, 8)));
4552
- return [4 /*yield*/, (0, downloadBuiltinKeycloakTheme_1.downloadBuiltinKeycloakTheme)({
4569
+ return [4 /*yield*/, (0, downloadKeycloakDefaultTheme_1.downloadKeycloakDefaultTheme)({
4553
4570
  keycloakVersion: keycloakVersion,
4554
4571
  "destDirPath": tmpDirPath,
4555
4572
  buildOptions: buildOptions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "10.0.0-rc.15",
3
+ "version": "10.0.0-rc.16",
4
4
  "description": "Create Keycloak themes using React",
5
5
  "repository": {
6
6
  "type": "git",
@@ -73,8 +73,8 @@
73
73
  "src/account/pages/Sessions.tsx",
74
74
  "src/account/pages/Totp.tsx",
75
75
  "src/bin/copy-keycloak-resources-to-public.ts",
76
- "src/bin/download-builtin-keycloak-theme.ts",
77
- "src/bin/eject-keycloak-page.ts",
76
+ "src/bin/download-keycloak-default-theme.ts",
77
+ "src/bin/eject-page.ts",
78
78
  "src/bin/initialize-email-theme.ts",
79
79
  "src/bin/keycloakify/buildJars/buildJar.ts",
80
80
  "src/bin/keycloakify/buildJars/buildJars.ts",
@@ -108,7 +108,7 @@
108
108
  "src/bin/shared/constants.ts",
109
109
  "src/bin/shared/copyKeycloakResourcesToPublic.ts",
110
110
  "src/bin/shared/downloadAndUnzip.ts",
111
- "src/bin/shared/downloadBuiltinKeycloakTheme.ts",
111
+ "src/bin/shared/downloadKeycloakDefaultTheme.ts",
112
112
  "src/bin/shared/downloadKeycloakStaticResources.ts",
113
113
  "src/bin/shared/getJarFileBasename.ts",
114
114
  "src/bin/shared/getThemeSrcDirPath.ts",
@@ -1,8 +1,9 @@
1
- import { join as pathJoin } from "path";
1
+ import { join as pathJoin, relative as pathRelative, sep as pathSep } from "path";
2
2
  import { promptKeycloakVersion } from "./shared/promptKeycloakVersion";
3
3
  import { readBuildOptions } from "./shared/buildOptions";
4
- import { downloadBuiltinKeycloakTheme } from "./shared/downloadBuiltinKeycloakTheme";
4
+ import { downloadKeycloakDefaultTheme } from "./shared/downloadKeycloakDefaultTheme";
5
5
  import type { CliCommandOptions } from "./main";
6
+ import chalk from "chalk";
6
7
 
7
8
  export async function command(params: { cliCommandOptions: CliCommandOptions }) {
8
9
  const { cliCommandOptions } = params;
@@ -11,20 +12,26 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
11
12
  cliCommandOptions
12
13
  });
13
14
 
14
- console.log("Select the Keycloak version from which you want to download the builtins theme:");
15
+ console.log(chalk.cyan("Select the Keycloak version from which you want to download the builtins theme:"));
15
16
 
16
17
  const { keycloakVersion } = await promptKeycloakVersion({
17
18
  "startingFromMajor": undefined,
18
19
  "cacheDirPath": buildOptions.cacheDirPath
19
20
  });
20
21
 
22
+ console.log(`→ ${keycloakVersion}`);
23
+
21
24
  const destDirPath = pathJoin(buildOptions.keycloakifyBuildDirPath, "src", "main", "resources", "theme");
22
25
 
23
- console.log(`Downloading builtins theme of Keycloak ${keycloakVersion} here ${destDirPath}`);
26
+ console.log(
27
+ `Downloading builtins theme of Keycloak ${keycloakVersion} here ${chalk.bold(`.${pathSep}${pathRelative(process.cwd(), destDirPath)}`)}`
28
+ );
24
29
 
25
- await downloadBuiltinKeycloakTheme({
30
+ await downloadKeycloakDefaultTheme({
26
31
  keycloakVersion,
27
32
  destDirPath,
28
33
  buildOptions
29
34
  });
35
+
36
+ console.log(chalk.green(`✓ done`));
30
37
  }
@@ -18,6 +18,7 @@ import { assert, Equals } from "tsafe/assert";
18
18
  import { getThemeSrcDirPath } from "./shared/getThemeSrcDirPath";
19
19
  import type { CliCommandOptions } from "./main";
20
20
  import { readBuildOptions } from "./shared/buildOptions";
21
+ import chalk from "chalk";
21
22
 
22
23
  export async function command(params: { cliCommandOptions: CliCommandOptions }) {
23
24
  const { cliCommandOptions } = params;
@@ -26,17 +27,17 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
26
27
  cliCommandOptions
27
28
  });
28
29
 
29
- console.log("Theme type:");
30
+ console.log(chalk.cyan("Theme type:"));
30
31
 
31
32
  const { value: themeType } = await cliSelect<ThemeType>({
32
33
  "values": [...themeTypes]
33
34
  }).catch(() => {
34
- console.log("Aborting");
35
-
36
35
  process.exit(-1);
37
36
  });
38
37
 
39
- console.log("Select the page you want to customize:");
38
+ console.log(`→ ${themeType}`);
39
+
40
+ console.log(chalk.cyan("Select the page you want to customize:"));
40
41
 
41
42
  const { value: pageId } = await cliSelect<LoginThemePageId | AccountThemePageId>({
42
43
  "values": (() => {
@@ -49,11 +50,11 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
49
50
  assert<Equals<typeof themeType, never>>(false);
50
51
  })()
51
52
  }).catch(() => {
52
- console.log("Aborting");
53
-
54
53
  process.exit(-1);
55
54
  });
56
55
 
56
+ console.log(`→ ${pageId}`);
57
+
57
58
  const componentPageBasename = capitalize(kebabCaseToCamelCase(pageId)).replace(/ftl$/, "tsx");
58
59
 
59
60
  const { themeSrcDirPath } = getThemeSrcDirPath({ "reactAppRootDirPath": buildOptions.reactAppRootDirPath });
@@ -85,42 +86,54 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
85
86
  console.log(
86
87
  [
87
88
  ``,
88
- `\`${pathJoin(".", pathRelative(process.cwd(), targetFilePath))}\` copy pasted from the Keycloakify source code into your project.`,
89
+ `${chalk.green("")} ${chalk.bold(
90
+ pathJoin(".", pathRelative(process.cwd(), targetFilePath))
91
+ )} copy pasted from the Keycloakify source code into your project`,
89
92
  ``,
90
93
  `You now need to update your page router:`,
91
94
  ``,
92
- `\`${pathJoin(".", pathRelative(process.cwd(), themeSrcDirPath), themeType, "KcApp.tsx")}\`:`,
93
- "```",
95
+ `${chalk.bold(pathJoin(".", pathRelative(process.cwd(), themeSrcDirPath), themeType, "KcApp.tsx"))}:`,
96
+ chalk.grey("```"),
94
97
  `// ...`,
95
98
  ``,
96
- `+const ${componentPageBasename.replace(/.tsx$/, "")} = lazy(() => import("./pages/${componentPageBasename}"));`,
97
- ``,
98
- ` export default function KcApp(props: { kcContext: KcContext; }) {`,
99
- ``,
100
- ` // ...`,
101
- ``,
102
- ` return (`,
103
- ` <Suspense>`,
104
- ` {(() => {`,
105
- ` switch (kcContext.pageId) {`,
106
- ` // ...`,
107
- ` case "${pageId}": return (`,
108
- `+ <Login`,
109
- `+ {...{ kcContext, i18n, classes }}`,
110
- `+ Template={Template}`,
111
- ...(!componentPageContent.includes(userProfileFormFieldComponentName)
112
- ? []
113
- : [`+ ${userProfileFormFieldComponentName}={${userProfileFormFieldComponentName}}`]),
114
- `+ doUseDefaultCss={true}`,
115
- `+ />`,
116
- `+ );`,
117
- ` default: return <Fallback /* .. */ />;`,
118
- ` }`,
119
- ` })()}`,
120
- ` </Suspense>`,
121
- ` );`,
122
- ` }`,
123
- "```"
99
+ chalk.green(`+const ${componentPageBasename.replace(/.tsx$/, "")} = lazy(() => import("./pages/${componentPageBasename}"));`),
100
+ ...[
101
+ ``,
102
+ ` export default function KcApp(props: { kcContext: KcContext; }) {`,
103
+ ``,
104
+ ` // ...`,
105
+ ``,
106
+ ` return (`,
107
+ ` <Suspense>`,
108
+ ` {(() => {`,
109
+ ` switch (kcContext.pageId) {`,
110
+ ` // ...`,
111
+ `+ case "${pageId}": return (`,
112
+ `+ <Login`,
113
+ `+ {...{ kcContext, i18n, classes }}`,
114
+ `+ Template={Template}`,
115
+ ...(!componentPageContent.includes(userProfileFormFieldComponentName)
116
+ ? []
117
+ : [`+ ${userProfileFormFieldComponentName}={${userProfileFormFieldComponentName}}`]),
118
+ `+ doUseDefaultCss={true}`,
119
+ `+ />`,
120
+ `+ );`,
121
+ ` default: return <Fallback /* .. */ />;`,
122
+ ` }`,
123
+ ` })()}`,
124
+ ` </Suspense>`,
125
+ ` );`,
126
+ ` }`
127
+ ].map(line => {
128
+ if (line.startsWith("+")) {
129
+ return chalk.green(line);
130
+ }
131
+ if (line.startsWith("-")) {
132
+ return chalk.red(line);
133
+ }
134
+ return chalk.grey(line);
135
+ }),
136
+ chalk.grey("```")
124
137
  ].join("\n")
125
138
  );
126
139
  }
@@ -1,4 +1,4 @@
1
- import { downloadBuiltinKeycloakTheme } from "./shared/downloadBuiltinKeycloakTheme";
1
+ import { downloadKeycloakDefaultTheme } from "./shared/downloadKeycloakDefaultTheme";
2
2
  import { join as pathJoin, relative as pathRelative } from "path";
3
3
  import { transformCodebase } from "./tools/transformCodebase";
4
4
  import { promptKeycloakVersion } from "./shared/promptKeycloakVersion";
@@ -37,7 +37,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
37
37
 
38
38
  rmSync(builtinKeycloakThemeTmpDirPath, { "recursive": true, "force": true });
39
39
 
40
- await downloadBuiltinKeycloakTheme({
40
+ await downloadKeycloakDefaultTheme({
41
41
  keycloakVersion,
42
42
  "destDirPath": builtinKeycloakThemeTmpDirPath,
43
43
  buildOptions
@@ -3,7 +3,7 @@ import { join as pathJoin } from "path";
3
3
  import { assert } from "tsafe/assert";
4
4
  import type { BuildOptions } from "../../shared/buildOptions";
5
5
  import { resources_common, lastKeycloakVersionWithAccountV1, accountV1ThemeName } from "../../shared/constants";
6
- import { downloadBuiltinKeycloakTheme } from "../../shared/downloadBuiltinKeycloakTheme";
6
+ import { downloadKeycloakDefaultTheme } from "../../shared/downloadKeycloakDefaultTheme";
7
7
  import { transformCodebase } from "../../tools/transformCodebase";
8
8
  import { rmSync } from "../../tools/fs.rmSync";
9
9
 
@@ -20,7 +20,7 @@ export async function bringInAccountV1(params: { buildOptions: BuildOptionsLike
20
20
 
21
21
  const builtinKeycloakThemeTmpDirPath = pathJoin(buildOptions.cacheDirPath, "bringInAccountV1_tmp");
22
22
 
23
- await downloadBuiltinKeycloakTheme({
23
+ await downloadKeycloakDefaultTheme({
24
24
  "destDirPath": builtinKeycloakThemeTmpDirPath,
25
25
  "keycloakVersion": lastKeycloakVersionWithAccountV1,
26
26
  buildOptions
package/src/bin/main.ts CHANGED
@@ -107,13 +107,13 @@ program
107
107
 
108
108
  program
109
109
  .command({
110
- "name": "download-builtin-keycloak-theme",
110
+ "name": "download-keycloak-default-theme",
111
111
  "description": "Download the built-in Keycloak theme."
112
112
  })
113
113
  .task({
114
114
  skip,
115
115
  "handler": async cliCommandOptions => {
116
- const { command } = await import("./download-builtin-keycloak-theme");
116
+ const { command } = await import("./download-keycloak-default-theme");
117
117
 
118
118
  await command({ cliCommandOptions });
119
119
  }
@@ -121,13 +121,13 @@ program
121
121
 
122
122
  program
123
123
  .command({
124
- "name": "eject-keycloak-page",
124
+ "name": "eject-page",
125
125
  "description": "Eject a Keycloak page."
126
126
  })
127
127
  .task({
128
128
  skip,
129
129
  "handler": async cliCommandOptions => {
130
- const { command } = await import("./eject-keycloak-page");
130
+ const { command } = await import("./eject-page");
131
131
 
132
132
  await command({ cliCommandOptions });
133
133
  }
@@ -116,11 +116,11 @@ export async function downloadAndUnzip(params: {
116
116
 
117
117
  await rm(extractDirPath, { "recursive": true });
118
118
 
119
- upload_to_remot_cache_if_admin: {
119
+ upload_to_remote_cache_if_admin: {
120
120
  const githubToken = process.env["KEYCLOAKIFY_ADMIN_GITHUB_PERSONAL_ACCESS_TOKEN"];
121
121
 
122
- if (githubToken === undefined) {
123
- break upload_to_remot_cache_if_admin;
122
+ if (!githubToken) {
123
+ break upload_to_remote_cache_if_admin;
124
124
  }
125
125
 
126
126
  console.log("uploading to remote cache");
@@ -5,7 +5,7 @@ import { assert } from "tsafe/assert";
5
5
  import * as child_process from "child_process";
6
6
  import * as fs from "fs";
7
7
  import { rmSync } from "../tools/fs.rmSync";
8
- import { lastKeycloakVersionWithAccountV1 } from "../shared/constants";
8
+ import { lastKeycloakVersionWithAccountV1 } from "./constants";
9
9
  import { transformCodebase } from "../tools/transformCodebase";
10
10
 
11
11
  export type BuildOptionsLike = {
@@ -15,7 +15,7 @@ export type BuildOptionsLike = {
15
15
 
16
16
  assert<BuildOptions extends BuildOptionsLike ? true : false>();
17
17
 
18
- export async function downloadBuiltinKeycloakTheme(params: { keycloakVersion: string; destDirPath: string; buildOptions: BuildOptionsLike }) {
18
+ export async function downloadKeycloakDefaultTheme(params: { keycloakVersion: string; destDirPath: string; buildOptions: BuildOptionsLike }) {
19
19
  const { keycloakVersion, destDirPath, buildOptions } = params;
20
20
 
21
21
  await downloadAndUnzip({
@@ -1,6 +1,6 @@
1
1
  import { transformCodebase } from "../tools/transformCodebase";
2
2
  import { join as pathJoin } from "path";
3
- import { downloadBuiltinKeycloakTheme } from "./downloadBuiltinKeycloakTheme";
3
+ import { downloadKeycloakDefaultTheme } from "./downloadKeycloakDefaultTheme";
4
4
  import { resources_common, type ThemeType } from "./constants";
5
5
  import type { BuildOptions } from "./buildOptions";
6
6
  import { assert } from "tsafe/assert";
@@ -27,7 +27,7 @@ export async function downloadKeycloakStaticResources(params: {
27
27
  `downloadKeycloakStaticResources_tmp_${crypto.createHash("sha256").update(`${themeType}-${keycloakVersion}`).digest("hex").slice(0, 8)}`
28
28
  );
29
29
 
30
- await downloadBuiltinKeycloakTheme({
30
+ await downloadKeycloakDefaultTheme({
31
31
  keycloakVersion,
32
32
  "destDirPath": tmpDirPath,
33
33
  buildOptions
@@ -660,10 +660,10 @@ function downloadAndUnzip(params) {
660
660
  return [4 /*yield*/, (0, fs_rm_1.rm)(extractDirPath, { "recursive": true })];
661
661
  case 13:
662
662
  _d.sent();
663
- upload_to_remot_cache_if_admin: {
663
+ upload_to_remote_cache_if_admin: {
664
664
  githubToken = process.env["KEYCLOAKIFY_ADMIN_GITHUB_PERSONAL_ACCESS_TOKEN"];
665
- if (githubToken === undefined) {
666
- break upload_to_remot_cache_if_admin;
665
+ if (!githubToken) {
666
+ break upload_to_remote_cache_if_admin;
667
667
  }
668
668
  console.log("uploading to remote cache");
669
669
  try {
@@ -735,7 +735,7 @@ function generateFileNameFromURL(params) {
735
735
 
736
736
  /***/ }),
737
737
 
738
- /***/ 6800:
738
+ /***/ 597:
739
739
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
740
740
 
741
741
  "use strict";
@@ -825,7 +825,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
825
825
  return to.concat(ar || Array.prototype.slice.call(from));
826
826
  };
827
827
  Object.defineProperty(exports, "__esModule", ({ value: true }));
828
- exports.downloadBuiltinKeycloakTheme = void 0;
828
+ exports.downloadKeycloakDefaultTheme = void 0;
829
829
  var path_1 = __nccwpck_require__(1017);
830
830
  var downloadAndUnzip_1 = __nccwpck_require__(8469);
831
831
  var assert_1 = __nccwpck_require__(8078);
@@ -835,7 +835,7 @@ var fs_rmSync_1 = __nccwpck_require__(9693);
835
835
  var constants_1 = __nccwpck_require__(173);
836
836
  var transformCodebase_1 = __nccwpck_require__(332);
837
837
  (0, assert_1.assert)();
838
- function downloadBuiltinKeycloakTheme(params) {
838
+ function downloadKeycloakDefaultTheme(params) {
839
839
  return __awaiter(this, void 0, void 0, function () {
840
840
  var keycloakVersion, destDirPath, buildOptions;
841
841
  var _this = this;
@@ -1053,8 +1053,8 @@ function downloadBuiltinKeycloakTheme(params) {
1053
1053
  });
1054
1054
  });
1055
1055
  }
1056
- exports.downloadBuiltinKeycloakTheme = downloadBuiltinKeycloakTheme;
1057
- //# sourceMappingURL=downloadBuiltinKeycloakTheme.js.map
1056
+ exports.downloadKeycloakDefaultTheme = downloadKeycloakDefaultTheme;
1057
+ //# sourceMappingURL=downloadKeycloakDefaultTheme.js.map
1058
1058
 
1059
1059
  /***/ }),
1060
1060
 
@@ -1126,7 +1126,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
1126
1126
  exports.downloadKeycloakStaticResources = void 0;
1127
1127
  var transformCodebase_1 = __nccwpck_require__(332);
1128
1128
  var path_1 = __nccwpck_require__(1017);
1129
- var downloadBuiltinKeycloakTheme_1 = __nccwpck_require__(6800);
1129
+ var downloadKeycloakDefaultTheme_1 = __nccwpck_require__(597);
1130
1130
  var constants_1 = __nccwpck_require__(173);
1131
1131
  var assert_1 = __nccwpck_require__(8078);
1132
1132
  var crypto = __importStar(__nccwpck_require__(6113));
@@ -1140,7 +1140,7 @@ function downloadKeycloakStaticResources(params) {
1140
1140
  case 0:
1141
1141
  themeType = params.themeType, themeDirPath = params.themeDirPath, keycloakVersion = params.keycloakVersion, buildOptions = params.buildOptions;
1142
1142
  tmpDirPath = (0, path_1.join)(buildOptions.cacheDirPath, "downloadKeycloakStaticResources_tmp_".concat(crypto.createHash("sha256").update("".concat(themeType, "-").concat(keycloakVersion)).digest("hex").slice(0, 8)));
1143
- return [4 /*yield*/, (0, downloadBuiltinKeycloakTheme_1.downloadBuiltinKeycloakTheme)({
1143
+ return [4 /*yield*/, (0, downloadKeycloakDefaultTheme_1.downloadKeycloakDefaultTheme)({
1144
1144
  keycloakVersion: keycloakVersion,
1145
1145
  "destDirPath": tmpDirPath,
1146
1146
  buildOptions: buildOptions