keycloakify 11.8.31 → 11.8.33

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
@@ -15540,11 +15540,17 @@ function getBuildContext(params) {
15540
15540
  if (themeSrcDirPath !== undefined) {
15541
15541
  return { themeSrcDirPath };
15542
15542
  }
15543
- for (const themeType of [...constants/* THEME_TYPES */.Jh, "email"]) {
15544
- if (!external_fs_.existsSync((0,external_path_.join)(srcDirPath, themeType))) {
15545
- continue;
15543
+ {
15544
+ const basenames = external_fs_.readdirSync(srcDirPath);
15545
+ for (const basename of basenames) {
15546
+ const path = (0,external_path_.join)(srcDirPath, basename);
15547
+ if (!external_fs_.statSync(path).isFile()) {
15548
+ continue;
15549
+ }
15550
+ if (external_fs_.readFileSync(path).toString("utf8").includes("./kc.gen")) {
15551
+ return { themeSrcDirPath: srcDirPath };
15552
+ }
15546
15553
  }
15547
- return { themeSrcDirPath: srcDirPath };
15548
15554
  }
15549
15555
  console.log(source_default().red([
15550
15556
  `Can't locate your Keycloak theme source directory in .${external_path_.sep}${(0,external_path_.relative)(process.cwd(), srcDirPath)}`,
@@ -16235,7 +16241,7 @@ program
16235
16241
  .task({
16236
16242
  skip,
16237
16243
  handler: async ({ projectDirPath, keycloakVersion, port, realmJsonFilePath }) => {
16238
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(226), __nccwpck_require__.e(297), __nccwpck_require__.e(97)]).then(__nccwpck_require__.bind(__nccwpck_require__, 64097));
16244
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(69), __nccwpck_require__.e(910), __nccwpck_require__.e(375)]).then(__nccwpck_require__.bind(__nccwpck_require__, 64097));
16239
16245
  await command({
16240
16246
  buildContext: getBuildContext({ projectDirPath }),
16241
16247
  cliCommandOptions: {
@@ -16355,7 +16361,7 @@ program
16355
16361
  .task({
16356
16362
  skip,
16357
16363
  handler: async ({ projectDirPath }) => {
16358
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(226), __nccwpck_require__.e(363), __nccwpck_require__.e(946)]).then(__nccwpck_require__.bind(__nccwpck_require__, 74946));
16364
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(69), __nccwpck_require__.e(97), __nccwpck_require__.e(946)]).then(__nccwpck_require__.bind(__nccwpck_require__, 74946));
16359
16365
  await command({ buildContext: getBuildContext({ projectDirPath }) });
16360
16366
  }
16361
16367
  });
@@ -16409,7 +16415,7 @@ program
16409
16415
  .task({
16410
16416
  skip,
16411
16417
  handler: async ({ projectDirPath, path, revert }) => {
16412
- const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(226), __nccwpck_require__.e(363), __nccwpck_require__.e(930)]).then(__nccwpck_require__.bind(__nccwpck_require__, 71930));
16418
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(69), __nccwpck_require__.e(97), __nccwpck_require__.e(930)]).then(__nccwpck_require__.bind(__nccwpck_require__, 71930));
16413
16419
  await command({
16414
16420
  buildContext: getBuildContext({ projectDirPath }),
16415
16421
  cliCommandOptions: { path, isRevert: revert }
@@ -0,0 +1,6 @@
1
+ export declare const getIsKnownByGit: (params: {
2
+ filePath: string;
3
+ }) => Promise<boolean>;
4
+ export declare const untrackFromGit: (params: {
5
+ filePath: string;
6
+ }) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "11.8.31",
3
+ "version": "11.8.33",
4
4
  "description": "Framework to create custom Keycloak UIs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -745,8 +745,8 @@
745
745
  "src/bin/tools/getAbsoluteAndInOsFormatPath.ts",
746
746
  "src/bin/tools/getInstalledModuleDirPath.ts",
747
747
  "src/bin/tools/getThisCodebaseRootDirPath.ts",
748
+ "src/bin/tools/gitUtils.ts",
748
749
  "src/bin/tools/isInside.ts",
749
- "src/bin/tools/isKnownByGit.ts",
750
750
  "src/bin/tools/isRootPath.ts",
751
751
  "src/bin/tools/kebabCaseToSnakeCase.ts",
752
752
  "src/bin/tools/listInstalledModules.ts",
@@ -756,7 +756,6 @@
756
756
  "src/bin/tools/readThisNpmPackageVersion.ts",
757
757
  "src/bin/tools/runPrettier.ts",
758
758
  "src/bin/tools/transformCodebase.ts",
759
- "src/bin/tools/untrackFromGit.ts",
760
759
  "src/bin/tsconfig.json",
761
760
  "src/bin/update-kc-gen.ts",
762
761
  "src/lib/BASE_URL.ts",
@@ -1107,8 +1106,8 @@
1107
1106
  "bin/tools/getAbsoluteAndInOsFormatPath.d.ts",
1108
1107
  "bin/tools/getInstalledModuleDirPath.d.ts",
1109
1108
  "bin/tools/getThisCodebaseRootDirPath.d.ts",
1109
+ "bin/tools/gitUtils.d.ts",
1110
1110
  "bin/tools/isInside.d.ts",
1111
- "bin/tools/isKnownByGit.d.ts",
1112
1111
  "bin/tools/isRootPath.d.ts",
1113
1112
  "bin/tools/kebabCaseToSnakeCase.d.ts",
1114
1113
  "bin/tools/listInstalledModules.d.ts",
@@ -1121,27 +1120,26 @@
1121
1120
  "bin/tools/String.prototype.replaceAll.d.ts",
1122
1121
  "bin/tools/Stringifyable.d.ts",
1123
1122
  "bin/tools/transformCodebase.d.ts",
1124
- "bin/tools/untrackFromGit.d.ts",
1125
1123
  "bin/update-kc-gen.d.ts",
1126
1124
  "bin/main.js",
1127
- "bin/226.index.js",
1128
1125
  "bin/266.index.js",
1129
- "bin/297.index.js",
1130
1126
  "bin/304.index.js",
1131
1127
  "bin/355.index.js",
1132
- "bin/363.index.js",
1133
1128
  "bin/369.index.js",
1129
+ "bin/375.index.js",
1134
1130
  "bin/40.index.js",
1135
1131
  "bin/453.index.js",
1136
1132
  "bin/502.index.js",
1137
1133
  "bin/656.index.js",
1138
1134
  "bin/658.index.js",
1135
+ "bin/69.index.js",
1139
1136
  "bin/712.index.js",
1140
1137
  "bin/720.index.js",
1141
1138
  "bin/780.index.js",
1142
1139
  "bin/783.index.js",
1143
1140
  "bin/786.index.js",
1144
1141
  "bin/877.index.js",
1142
+ "bin/910.index.js",
1145
1143
  "bin/930.index.js",
1146
1144
  "bin/932.index.js",
1147
1145
  "bin/946.index.js",
@@ -18,7 +18,7 @@ import {
18
18
  import type { KeycloakVersionRange } from "./KeycloakVersionRange";
19
19
  import { exclude } from "tsafe";
20
20
  import { crawl } from "../tools/crawl";
21
- import { THEME_TYPES, KEYCLOAK_THEME, type ThemeType } from "./constants";
21
+ import { KEYCLOAK_THEME, type ThemeType } from "./constants";
22
22
  import { objectEntries } from "tsafe/objectEntries";
23
23
  import { id } from "tsafe/id";
24
24
  import chalk from "chalk";
@@ -166,11 +166,20 @@ export function getBuildContext(params: {
166
166
  return { themeSrcDirPath };
167
167
  }
168
168
 
169
- for (const themeType of [...THEME_TYPES, "email"]) {
170
- if (!fs.existsSync(pathJoin(srcDirPath, themeType))) {
171
- continue;
169
+ {
170
+ const basenames = fs.readdirSync(srcDirPath);
171
+
172
+ for (const basename of basenames) {
173
+ const path = pathJoin(srcDirPath, basename);
174
+
175
+ if (!fs.statSync(path).isFile()) {
176
+ continue;
177
+ }
178
+
179
+ if (fs.readFileSync(path).toString("utf8").includes("./kc.gen")) {
180
+ return { themeSrcDirPath: srcDirPath };
181
+ }
172
182
  }
173
- return { themeSrcDirPath: srcDirPath };
174
183
  }
175
184
 
176
185
  console.log(
@@ -9,8 +9,7 @@ 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 { getIsKnownByGit } from "../tools/isKnownByGit";
13
- import { untrackFromGit } from "../tools/untrackFromGit";
12
+ import { getIsKnownByGit, untrackFromGit } from "../tools/gitUtils";
14
13
 
15
14
  export async function command(params: { buildContext: BuildContext }) {
16
15
  const { buildContext } = params;
@@ -0,0 +1,86 @@
1
+ import * as child_process from "child_process";
2
+ import {
3
+ dirname as pathDirname,
4
+ basename as pathBasename,
5
+ join as pathJoin,
6
+ sep as pathSep
7
+ } from "path";
8
+ import { Deferred } from "evt/tools/Deferred";
9
+ import * as fs from "fs";
10
+ import * as runExclusive from "run-exclusive";
11
+ import { existsAsync } from "./fs.existsAsync";
12
+
13
+ const groupRef = runExclusive.createGroupRef();
14
+
15
+ export const getIsKnownByGit = runExclusive.build(
16
+ groupRef,
17
+ (params: { filePath: string }): Promise<boolean> => {
18
+ const { filePath } = params;
19
+
20
+ const dIsKnownByGit = new Deferred<boolean>();
21
+
22
+ let relativePath = pathBasename(filePath);
23
+
24
+ let dirPath = pathDirname(filePath);
25
+
26
+ while (!fs.existsSync(dirPath)) {
27
+ relativePath = pathJoin(pathBasename(dirPath), relativePath);
28
+
29
+ dirPath = pathDirname(dirPath);
30
+ }
31
+
32
+ child_process.exec(
33
+ `git ls-files --error-unmatch '${relativePath.split(pathSep).join("/")}'`,
34
+ { cwd: dirPath },
35
+ error => {
36
+ if (error === null) {
37
+ dIsKnownByGit.resolve(true);
38
+ return;
39
+ }
40
+
41
+ if (error.code === 1) {
42
+ dIsKnownByGit.resolve(false);
43
+ return;
44
+ }
45
+
46
+ dIsKnownByGit.reject(error);
47
+ }
48
+ );
49
+
50
+ return dIsKnownByGit.pr;
51
+ }
52
+ );
53
+
54
+ export const untrackFromGit = runExclusive.build(
55
+ groupRef,
56
+ async (params: { filePath: string }): Promise<void> => {
57
+ const { filePath } = params;
58
+
59
+ const dDone = new Deferred<void>();
60
+
61
+ let relativePath = pathBasename(filePath);
62
+
63
+ let dirPath = pathDirname(filePath);
64
+
65
+ while (!(await existsAsync(dirPath))) {
66
+ relativePath = pathJoin(pathBasename(dirPath), relativePath);
67
+
68
+ dirPath = pathDirname(dirPath);
69
+ }
70
+
71
+ child_process.exec(
72
+ `git rm --cached '${relativePath.split(pathSep).join("/")}'`,
73
+ { cwd: dirPath },
74
+ error => {
75
+ if (error !== null) {
76
+ dDone.reject(error);
77
+ return;
78
+ }
79
+
80
+ dDone.resolve();
81
+ }
82
+ );
83
+
84
+ await dDone.pr;
85
+ }
86
+ );
@@ -408,11 +408,17 @@ function getBuildContext(params) {
408
408
  if (themeSrcDirPath !== undefined) {
409
409
  return { themeSrcDirPath };
410
410
  }
411
- for (const themeType of [...constants.THEME_TYPES, "email"]) {
412
- if (!external_fs_.existsSync((0,external_path_.join)(srcDirPath, themeType))) {
413
- continue;
411
+ {
412
+ const basenames = external_fs_.readdirSync(srcDirPath);
413
+ for (const basename of basenames) {
414
+ const path = (0,external_path_.join)(srcDirPath, basename);
415
+ if (!external_fs_.statSync(path).isFile()) {
416
+ continue;
417
+ }
418
+ if (external_fs_.readFileSync(path).toString("utf8").includes("./kc.gen")) {
419
+ return { themeSrcDirPath: srcDirPath };
420
+ }
414
421
  }
415
- return { themeSrcDirPath: srcDirPath };
416
422
  }
417
423
  console.log(source_default().red([
418
424
  `Can't locate your Keycloak theme source directory in .${external_path_.sep}${(0,external_path_.relative)(process.cwd(), srcDirPath)}`,