keycloakify 11.3.23 → 11.3.24

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/921.index.js CHANGED
@@ -334,12 +334,15 @@ function getNodeModulesBinDirPath() {
334
334
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
335
335
  /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
336
336
  /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
337
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(38469);
337
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(38469);
338
338
  /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
339
339
  /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
340
340
  /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
341
341
  /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
342
342
  /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
343
+ /* harmony import */ var tsafe_is__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(16453);
344
+ /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(76030);
345
+ /* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(64795);
343
346
 
344
347
 
345
348
 
@@ -347,7 +350,10 @@ function getNodeModulesBinDirPath() {
347
350
 
348
351
 
349
352
 
350
- getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(undefined);
353
+
354
+
355
+
356
+ getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_8__.id)(undefined);
351
357
  async function getIsPrettierAvailable() {
352
358
  var _a;
353
359
  if (getIsPrettierAvailable.cache !== undefined) {
@@ -360,13 +366,25 @@ async function getIsPrettierAvailable() {
360
366
  getIsPrettierAvailable.cache = isPrettierAvailable;
361
367
  return isPrettierAvailable;
362
368
  }
363
- getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(undefined);
369
+ getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_8__.id)(undefined);
364
370
  async function getPrettier() {
365
371
  (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
366
372
  if (getPrettier.cache !== undefined) {
367
373
  return getPrettier.cache;
368
374
  }
369
- const prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
375
+ let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_8__.id)(undefined);
376
+ import_prettier: {
377
+ // NOTE: When module is linked we want to make sure we import the correct version
378
+ // of prettier, that is the one of the project, not the one of this repo.
379
+ // So we do a sketchy eval to bypass ncc.
380
+ // We make sure to only do that when linking, otherwise we import properly.
381
+ if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_7__/* .readThisNpmPackageVersion */ .K)() === "0.0.0") {
382
+ eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_9__/* .symToStr */ .r)({ prettier })} = require("${(0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), "..", "prettier"))}")`);
383
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(!(0,tsafe_is__WEBPACK_IMPORTED_MODULE_6__.is)(prettier));
384
+ break import_prettier;
385
+ }
386
+ prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
387
+ }
370
388
  const configHash = await (async () => {
371
389
  const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), ".."));
372
390
  if (configFilePath === null) {
@@ -1112,6 +1130,24 @@ const withObjectValues = options => {
1112
1130
 
1113
1131
  exports.withObjectValues = withObjectValues;
1114
1132
 
1133
+ /***/ }),
1134
+
1135
+ /***/ 76030:
1136
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
1137
+
1138
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1139
+ /* harmony export */ "r": () => (/* binding */ symToStr)
1140
+ /* harmony export */ });
1141
+ /** @see <https://docs.tsafe.dev/main/symtostr> */
1142
+ function symToStr(wrap) {
1143
+ // @ts-expect-error: We know better
1144
+ return Object.keys(wrap)[0];
1145
+ }
1146
+
1147
+
1148
+ //# sourceMappingURL=symToStr.mjs.map
1149
+
1150
+
1115
1151
  /***/ })
1116
1152
 
1117
1153
  };
package/bin/97.index.js CHANGED
@@ -272,12 +272,15 @@ function getNodeModulesBinDirPath() {
272
272
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
273
273
  /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73292);
274
274
  /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_2__);
275
- /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(38469);
275
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(38469);
276
276
  /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29041);
277
277
  /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78818);
278
278
  /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
279
279
  /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6113);
280
280
  /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_5__);
281
+ /* harmony import */ var tsafe_is__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(16453);
282
+ /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(76030);
283
+ /* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(64795);
281
284
 
282
285
 
283
286
 
@@ -285,7 +288,10 @@ function getNodeModulesBinDirPath() {
285
288
 
286
289
 
287
290
 
288
- getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(undefined);
291
+
292
+
293
+
294
+ getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_8__.id)(undefined);
289
295
  async function getIsPrettierAvailable() {
290
296
  var _a;
291
297
  if (getIsPrettierAvailable.cache !== undefined) {
@@ -298,13 +304,25 @@ async function getIsPrettierAvailable() {
298
304
  getIsPrettierAvailable.cache = isPrettierAvailable;
299
305
  return isPrettierAvailable;
300
306
  }
301
- getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(undefined);
307
+ getPrettier.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_8__.id)(undefined);
302
308
  async function getPrettier() {
303
309
  (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(getIsPrettierAvailable());
304
310
  if (getPrettier.cache !== undefined) {
305
311
  return getPrettier.cache;
306
312
  }
307
- const prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
313
+ let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_8__.id)(undefined);
314
+ import_prettier: {
315
+ // NOTE: When module is linked we want to make sure we import the correct version
316
+ // of prettier, that is the one of the project, not the one of this repo.
317
+ // So we do a sketchy eval to bypass ncc.
318
+ // We make sure to only do that when linking, otherwise we import properly.
319
+ if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_7__/* .readThisNpmPackageVersion */ .K)() === "0.0.0") {
320
+ eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_9__/* .symToStr */ .r)({ prettier })} = require("${(0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), "..", "prettier"))}")`);
321
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)(!(0,tsafe_is__WEBPACK_IMPORTED_MODULE_6__.is)(prettier));
322
+ break import_prettier;
323
+ }
324
+ prettier = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 79421, 23));
325
+ }
308
326
  const configHash = await (async () => {
309
327
  const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_0__/* .getNodeModulesBinDirPath */ .K)(), ".."));
310
328
  if (configFilePath === null) {
@@ -929,6 +947,24 @@ function capitalize(str) {
929
947
  //# sourceMappingURL=capitalize.mjs.map
930
948
 
931
949
 
950
+ /***/ }),
951
+
952
+ /***/ 76030:
953
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
954
+
955
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
956
+ /* harmony export */ "r": () => (/* binding */ symToStr)
957
+ /* harmony export */ });
958
+ /** @see <https://docs.tsafe.dev/main/symtostr> */
959
+ function symToStr(wrap) {
960
+ // @ts-expect-error: We know better
961
+ return Object.keys(wrap)[0];
962
+ }
963
+
964
+
965
+ //# sourceMappingURL=symToStr.mjs.map
966
+
967
+
932
968
  /***/ })
933
969
 
934
970
  };
package/bin/main.js CHANGED
@@ -16327,7 +16327,7 @@ program
16327
16327
  .task({
16328
16328
  skip,
16329
16329
  handler: async ({ projectDirPath }) => {
16330
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(805), __nccwpck_require__.e(356), __nccwpck_require__.e(124)]).then(__nccwpck_require__.bind(__nccwpck_require__, 67124));
16330
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(805), __nccwpck_require__.e(356), __nccwpck_require__.e(653)]).then(__nccwpck_require__.bind(__nccwpck_require__, 2653));
16331
16331
  await command({ buildContext: getBuildContext({ projectDirPath }) });
16332
16332
  }
16333
16333
  });
@@ -0,0 +1,3 @@
1
+ export declare function getIsTrackedByGit(params: {
2
+ filePath: string;
3
+ }): Promise<boolean>;
@@ -0,0 +1,3 @@
1
+ export declare function untrackFromGit(params: {
2
+ filePath: string;
3
+ }): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "11.3.23",
3
+ "version": "11.3.24",
4
4
  "description": "Framework to create custom Keycloak UIs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -730,6 +730,7 @@
730
730
  "src/bin/tools/getInstalledModuleDirPath.ts",
731
731
  "src/bin/tools/getThisCodebaseRootDirPath.ts",
732
732
  "src/bin/tools/isInside.ts",
733
+ "src/bin/tools/isTrackedByGit.ts",
733
734
  "src/bin/tools/kebabCaseToSnakeCase.ts",
734
735
  "src/bin/tools/listInstalledModules.ts",
735
736
  "src/bin/tools/nodeModulesBinDirPath.ts",
@@ -742,6 +743,7 @@
742
743
  "src/bin/tools/tee.ts",
743
744
  "src/bin/tools/transformCodebase.ts",
744
745
  "src/bin/tools/trimIndent.ts",
746
+ "src/bin/tools/untrackFromGit.ts",
745
747
  "src/bin/tsconfig.json",
746
748
  "src/bin/update-kc-gen.ts",
747
749
  "src/lib/BASE_URL.ts",
@@ -1073,6 +1075,7 @@
1073
1075
  "bin/tools/getInstalledModuleDirPath.d.ts",
1074
1076
  "bin/tools/getThisCodebaseRootDirPath.d.ts",
1075
1077
  "bin/tools/isInside.d.ts",
1078
+ "bin/tools/isTrackedByGit.d.ts",
1076
1079
  "bin/tools/kebabCaseToSnakeCase.d.ts",
1077
1080
  "bin/tools/listInstalledModules.d.ts",
1078
1081
  "bin/tools/nodeModulesBinDirPath.d.ts",
@@ -1088,9 +1091,9 @@
1088
1091
  "bin/tools/tee.d.ts",
1089
1092
  "bin/tools/transformCodebase.d.ts",
1090
1093
  "bin/tools/trimIndent.d.ts",
1094
+ "bin/tools/untrackFromGit.d.ts",
1091
1095
  "bin/update-kc-gen.d.ts",
1092
1096
  "bin/main.js",
1093
- "bin/124.index.js",
1094
1097
  "bin/20.index.js",
1095
1098
  "bin/266.index.js",
1096
1099
  "bin/304.index.js",
@@ -1102,6 +1105,7 @@
1102
1105
  "bin/453.index.js",
1103
1106
  "bin/526.index.js",
1104
1107
  "bin/573.index.js",
1108
+ "bin/653.index.js",
1105
1109
  "bin/720.index.js",
1106
1110
  "bin/735.index.js",
1107
1111
  "bin/743.index.js",
@@ -56,7 +56,8 @@ export async function getUiModuleFileSourceCodeReadyToBeCopied(params: {
56
56
  ``,
57
57
  `$ npx keycloakify eject-file --file ${fileRelativePath.split(pathSep).join("/")}`,
58
58
  ``,
59
- `This file comes from ${uiModuleName} version ${uiModuleVersion}.`
59
+ `This file comes from ${uiModuleName} version ${uiModuleVersion}.`,
60
+ `This file has been copied over to your repo by your postinstall script: \`npx keycloakify postinstall\``
60
61
  ]
61
62
  );
62
63
 
@@ -9,6 +9,8 @@ import { dirname as pathDirname } from "path";
9
9
  import { join as pathJoin } from "path";
10
10
  import { existsAsync } from "../tools/fs.existsAsync";
11
11
  import * as fsPr from "fs/promises";
12
+ import { getIsTrackedByGit } from "../tools/isTrackedByGit";
13
+ import { untrackFromGit } from "../tools/untrackFromGit";
12
14
 
13
15
  export async function command(params: { buildContext: BuildContext }) {
14
16
  const { buildContext } = params;
@@ -45,8 +47,10 @@ export async function command(params: { buildContext: BuildContext }) {
45
47
  fileRelativePath
46
48
  );
47
49
 
50
+ const doesFileExist = await existsAsync(destFilePath);
51
+
48
52
  skip_condition: {
49
- if (!(await existsAsync(destFilePath))) {
53
+ if (!doesFileExist) {
50
54
  break skip_condition;
51
55
  }
52
56
 
@@ -61,6 +65,24 @@ export async function command(params: { buildContext: BuildContext }) {
61
65
  return;
62
66
  }
63
67
 
68
+ git_untrack: {
69
+ if (!doesFileExist) {
70
+ break git_untrack;
71
+ }
72
+
73
+ const isTracked = await getIsTrackedByGit({
74
+ filePath: destFilePath
75
+ });
76
+
77
+ if (!isTracked) {
78
+ break git_untrack;
79
+ }
80
+
81
+ await untrackFromGit({
82
+ filePath: destFilePath
83
+ });
84
+ }
85
+
64
86
  {
65
87
  const dirName = pathDirname(destFilePath);
66
88
 
@@ -0,0 +1,29 @@
1
+ import * as child_process from "child_process";
2
+ import { dirname as pathDirname, basename as pathBasename } from "path";
3
+ import { Deferred } from "evt/tools/Deferred";
4
+
5
+ export function getIsTrackedByGit(params: { filePath: string }): Promise<boolean> {
6
+ const { filePath } = params;
7
+
8
+ const dIsTracked = new Deferred<boolean>();
9
+
10
+ child_process.exec(
11
+ `git ls-files --error-unmatch ${pathBasename(filePath)}`,
12
+ { cwd: pathDirname(filePath) },
13
+ error => {
14
+ if (error === null) {
15
+ dIsTracked.resolve(true);
16
+ return;
17
+ }
18
+
19
+ if (error.code === 1) {
20
+ dIsTracked.resolve(false);
21
+ return;
22
+ }
23
+
24
+ dIsTracked.reject(error);
25
+ }
26
+ );
27
+
28
+ return dIsTracked.pr;
29
+ }
@@ -1,10 +1,13 @@
1
1
  import { getNodeModulesBinDirPath } from "./nodeModulesBinDirPath";
2
- import { join as pathJoin } from "path";
2
+ import { join as pathJoin, resolve as pathResolve } from "path";
3
3
  import * as fsPr from "fs/promises";
4
4
  import { id } from "tsafe/id";
5
5
  import { assert } from "tsafe/assert";
6
6
  import chalk from "chalk";
7
7
  import * as crypto from "crypto";
8
+ import { is } from "tsafe/is";
9
+ import { symToStr } from "tsafe/symToStr";
10
+ import { readThisNpmPackageVersion } from "./readThisNpmPackageVersion";
8
11
 
9
12
  getIsPrettierAvailable.cache = id<boolean | undefined>(undefined);
10
13
 
@@ -40,7 +43,25 @@ export async function getPrettier(): Promise<PrettierAndConfigHash> {
40
43
  return getPrettier.cache;
41
44
  }
42
45
 
43
- const prettier = await import("prettier");
46
+ let prettier = id<typeof import("prettier") | undefined>(undefined);
47
+
48
+ import_prettier: {
49
+ // NOTE: When module is linked we want to make sure we import the correct version
50
+ // of prettier, that is the one of the project, not the one of this repo.
51
+ // So we do a sketchy eval to bypass ncc.
52
+ // We make sure to only do that when linking, otherwise we import properly.
53
+ if (readThisNpmPackageVersion() === "0.0.0") {
54
+ eval(
55
+ `${symToStr({ prettier })} = require("${pathResolve(pathJoin(getNodeModulesBinDirPath(), "..", "prettier"))}")`
56
+ );
57
+
58
+ assert(!is<undefined>(prettier));
59
+
60
+ break import_prettier;
61
+ }
62
+
63
+ prettier = await import("prettier");
64
+ }
44
65
 
45
66
  const configHash = await (async () => {
46
67
  const configFilePath = await prettier.resolveConfigFile(
@@ -0,0 +1,24 @@
1
+ import * as child_process from "child_process";
2
+ import { dirname as pathDirname, basename as pathBasename } from "path";
3
+ import { Deferred } from "evt/tools/Deferred";
4
+
5
+ export async function untrackFromGit(params: { filePath: string }): Promise<void> {
6
+ const { filePath } = params;
7
+
8
+ const dDone = new Deferred<void>();
9
+
10
+ child_process.exec(
11
+ `git rm --cached ${pathBasename(filePath)}`,
12
+ { cwd: pathDirname(filePath) },
13
+ error => {
14
+ if (error !== null) {
15
+ dDone.reject(error);
16
+ return;
17
+ }
18
+
19
+ dDone.resolve();
20
+ }
21
+ );
22
+
23
+ await dDone.pr;
24
+ }