keycloakify 10.0.0-rc.14 → 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