keycloakify 11.3.0 → 11.3.2

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.
@@ -16,11 +16,11 @@ assert<Equals<ApiVersion, "v1">>();
16
16
  export function maybeDelegateCommandToCustomHandler(params: {
17
17
  commandName: CommandName;
18
18
  buildContext: BuildContext;
19
- }) {
19
+ }): { hasBeenHandled: boolean } {
20
20
  const { commandName, buildContext } = params;
21
21
 
22
22
  if (!fs.readdirSync(pathDirname(process.argv[1])).includes(BIN_NAME)) {
23
- return;
23
+ return { hasBeenHandled: false };
24
24
  }
25
25
 
26
26
  try {
@@ -36,11 +36,11 @@ export function maybeDelegateCommandToCustomHandler(params: {
36
36
  const status = error.status;
37
37
 
38
38
  if (status === NOT_IMPLEMENTED_EXIT_CODE) {
39
- return;
39
+ return { hasBeenHandled: false };
40
40
  }
41
41
 
42
42
  process.exit(status);
43
43
  }
44
44
 
45
- process.exit(0);
45
+ return { hasBeenHandled: true };
46
46
  }
@@ -7,11 +7,15 @@ import { maybeDelegateCommandToCustomHandler } from "./shared/customHandler_dele
7
7
  export async function command(params: { buildContext: BuildContext }) {
8
8
  const { buildContext } = params;
9
9
 
10
- maybeDelegateCommandToCustomHandler({
10
+ const { hasBeenHandled } = maybeDelegateCommandToCustomHandler({
11
11
  commandName: "update-kc-gen",
12
12
  buildContext
13
13
  });
14
14
 
15
+ if (hasBeenHandled) {
16
+ return;
17
+ }
18
+
15
19
  const filePath = pathJoin(buildContext.themeSrcDirPath, `kc.gen.tsx`);
16
20
 
17
21
  const currentContent = (await existsAsync(filePath))
@@ -6,7 +6,7 @@ import {
6
6
  } from "../bin/shared/constants";
7
7
  import { id } from "tsafe/id";
8
8
  import { rm } from "../bin/tools/fs.rm";
9
- import { copyKeycloakResourcesToPublic } from "../bin/shared/copyKeycloakResourcesToPublic";
9
+ import { command as copyKeycloakResourcesToPublicCommand } from "../bin/copy-keycloak-resources-to-public";
10
10
  import { assert } from "tsafe/assert";
11
11
  import {
12
12
  getBuildContext,
@@ -125,7 +125,7 @@ export function keycloakify(params: keycloakify.Params) {
125
125
  projectDirPath
126
126
  });
127
127
 
128
- copyKeycloakResourcesToPublic({ buildContext });
128
+ await copyKeycloakResourcesToPublicCommand({ buildContext });
129
129
 
130
130
  await updateKcGenCommand({ buildContext });
131
131
  },
@@ -1,6 +1,208 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
+ /***/ 721:
5
+ /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
6
+
7
+ "use strict";
8
+ // ESM COMPAT FLAG
9
+ __nccwpck_require__.r(__webpack_exports__);
10
+
11
+ // EXPORTS
12
+ __nccwpck_require__.d(__webpack_exports__, {
13
+ "command": () => (/* binding */ command)
14
+ });
15
+
16
+ // EXTERNAL MODULE: ./dist/bin/shared/customHandler_delegate.js + 1 modules
17
+ var customHandler_delegate = __nccwpck_require__(138);
18
+ // EXTERNAL MODULE: external "path"
19
+ var external_path_ = __nccwpck_require__(17);
20
+ // EXTERNAL MODULE: ./dist/bin/shared/constants.js
21
+ var constants = __nccwpck_require__(173);
22
+ // EXTERNAL MODULE: external "fs"
23
+ var external_fs_ = __nccwpck_require__(147);
24
+ ;// CONCATENATED MODULE: ./dist/bin/tools/getThisCodebaseRootDirPath.js
25
+
26
+
27
+ function getThisCodebaseRootDirPath_rec(dirPath) {
28
+ if (external_fs_.existsSync(external_path_.join(dirPath, "package.json"))) {
29
+ return dirPath;
30
+ }
31
+ return getThisCodebaseRootDirPath_rec(external_path_.join(dirPath, ".."));
32
+ }
33
+ let result = undefined;
34
+ function getThisCodebaseRootDirPath() {
35
+ if (result !== undefined) {
36
+ return result;
37
+ }
38
+ return (result = getThisCodebaseRootDirPath_rec(__dirname));
39
+ }
40
+ //# sourceMappingURL=getThisCodebaseRootDirPath.js.map
41
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
42
+ var assert = __nccwpck_require__(41);
43
+ ;// CONCATENATED MODULE: ./dist/bin/tools/readThisNpmPackageVersion.js
44
+
45
+
46
+
47
+
48
+ function readThisNpmPackageVersion() {
49
+ const version = JSON.parse(external_fs_.readFileSync((0,external_path_.join)(getThisCodebaseRootDirPath(), "package.json"))
50
+ .toString("utf8"))["version"];
51
+ (0,assert/* assert */.h)(typeof version === "string");
52
+ return version;
53
+ }
54
+ //# sourceMappingURL=readThisNpmPackageVersion.js.map
55
+ // EXTERNAL MODULE: ./dist/bin/tools/SemVer.js
56
+ var SemVer = __nccwpck_require__(171);
57
+ ;// CONCATENATED MODULE: ./dist/bin/tools/fs.rmSync.js
58
+
59
+
60
+
61
+ /**
62
+ * Polyfill of fs.rmSync(dirPath, { "recursive": true })
63
+ * For older version of Node
64
+ */
65
+ function rmSync(dirPath, options) {
66
+ if (SemVer/* SemVer.compare */.h.compare(SemVer/* SemVer.parse */.h.parse(process.version), SemVer/* SemVer.parse */.h.parse("14.14.0")) > 0) {
67
+ external_fs_.rmSync(dirPath, options);
68
+ return;
69
+ }
70
+ const { force = true } = options;
71
+ if (force && !external_fs_.existsSync(dirPath)) {
72
+ return;
73
+ }
74
+ const removeDir_rec = (dirPath) => external_fs_.readdirSync(dirPath).forEach(basename => {
75
+ const fileOrDirPath = (0,external_path_.join)(dirPath, basename);
76
+ if (external_fs_.lstatSync(fileOrDirPath).isDirectory()) {
77
+ removeDir_rec(fileOrDirPath);
78
+ return;
79
+ }
80
+ else {
81
+ external_fs_.unlinkSync(fileOrDirPath);
82
+ }
83
+ });
84
+ removeDir_rec(dirPath);
85
+ }
86
+ //# sourceMappingURL=fs.rmSync.js.map
87
+ // EXTERNAL MODULE: ./dist/bin/tools/crawl.js
88
+ var crawl = __nccwpck_require__(36);
89
+ ;// CONCATENATED MODULE: ./dist/bin/tools/transformCodebase.js
90
+
91
+
92
+
93
+
94
+ /**
95
+ * Apply a transformation function to every file of directory
96
+ * If source and destination are the same this function can be used to apply the transformation in place
97
+ * like filtering out some files or modifying them.
98
+ * */
99
+ function transformCodebase(params) {
100
+ const { srcDirPath, transformSourceCode } = params;
101
+ const isTargetSameAsSource = external_path_.relative(srcDirPath, params.destDirPath) === "";
102
+ const destDirPath = isTargetSameAsSource
103
+ ? external_path_.join(srcDirPath, "..", "tmp_xOsPdkPsTdzPs34sOkHs")
104
+ : params.destDirPath;
105
+ external_fs_.mkdirSync(destDirPath, {
106
+ recursive: true
107
+ });
108
+ for (const fileRelativePath of (0,crawl/* crawl */.J)({
109
+ dirPath: srcDirPath,
110
+ returnedPathsType: "relative to dirPath"
111
+ })) {
112
+ const filePath = external_path_.join(srcDirPath, fileRelativePath);
113
+ const destFilePath = external_path_.join(destDirPath, fileRelativePath);
114
+ // NOTE: Optimization, if we don't need to transform the file, just copy
115
+ // it using the lower level implementation.
116
+ if (transformSourceCode === undefined) {
117
+ external_fs_.mkdirSync(external_path_.dirname(destFilePath), {
118
+ recursive: true
119
+ });
120
+ external_fs_.copyFileSync(filePath, destFilePath);
121
+ continue;
122
+ }
123
+ const transformSourceCodeResult = transformSourceCode({
124
+ sourceCode: external_fs_.readFileSync(filePath),
125
+ filePath,
126
+ fileRelativePath
127
+ });
128
+ if (transformSourceCodeResult === undefined) {
129
+ continue;
130
+ }
131
+ external_fs_.mkdirSync(external_path_.dirname(destFilePath), {
132
+ recursive: true
133
+ });
134
+ const { newFileName, modifiedSourceCode } = transformSourceCodeResult;
135
+ external_fs_.writeFileSync(external_path_.join(external_path_.dirname(destFilePath), newFileName !== null && newFileName !== void 0 ? newFileName : external_path_.basename(destFilePath)), modifiedSourceCode);
136
+ }
137
+ if (isTargetSameAsSource) {
138
+ rmSync(srcDirPath, { recursive: true });
139
+ external_fs_.renameSync(destDirPath, srcDirPath);
140
+ }
141
+ }
142
+ //# sourceMappingURL=transformCodebase.js.map
143
+ ;// CONCATENATED MODULE: ./dist/bin/copy-keycloak-resources-to-public.js
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+ async function command(params) {
153
+ const { buildContext } = params;
154
+ const { hasBeenHandled } = (0,customHandler_delegate/* maybeDelegateCommandToCustomHandler */.q)({
155
+ commandName: "copy-keycloak-resources-to-public",
156
+ buildContext
157
+ });
158
+ if (hasBeenHandled) {
159
+ return;
160
+ }
161
+ const destDirPath = (0,external_path_.join)(buildContext.publicDirPath, constants.WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES);
162
+ const keycloakifyBuildinfoFilePath = (0,external_path_.join)(destDirPath, "keycloakify.buildinfo");
163
+ const keycloakifyBuildinfoRaw = JSON.stringify({
164
+ keycloakifyVersion: readThisNpmPackageVersion()
165
+ }, null, 2);
166
+ skip_if_already_done: {
167
+ if (!external_fs_.existsSync(keycloakifyBuildinfoFilePath)) {
168
+ break skip_if_already_done;
169
+ }
170
+ const keycloakifyBuildinfoRaw_previousRun = external_fs_.readFileSync(keycloakifyBuildinfoFilePath)
171
+ .toString("utf8");
172
+ if (keycloakifyBuildinfoRaw_previousRun !== keycloakifyBuildinfoRaw) {
173
+ break skip_if_already_done;
174
+ }
175
+ return;
176
+ }
177
+ rmSync(destDirPath, { force: true, recursive: true });
178
+ // NOTE: To remove in a while, remove the legacy keycloak-resources directory
179
+ rmSync((0,external_path_.join)((0,external_path_.dirname)(destDirPath), "keycloak-resources"), {
180
+ force: true,
181
+ recursive: true
182
+ });
183
+ rmSync((0,external_path_.join)((0,external_path_.dirname)(destDirPath), ".keycloakify"), {
184
+ force: true,
185
+ recursive: true
186
+ });
187
+ external_fs_.mkdirSync(destDirPath, { recursive: true });
188
+ external_fs_.writeFileSync((0,external_path_.join)(destDirPath, ".gitignore"), Buffer.from("*", "utf8"));
189
+ transformCodebase({
190
+ srcDirPath: (0,external_path_.join)(getThisCodebaseRootDirPath(), "res", "public", constants.WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES),
191
+ destDirPath
192
+ });
193
+ external_fs_.writeFileSync((0,external_path_.join)(destDirPath, "README.txt"), Buffer.from(
194
+ // prettier-ignore
195
+ [
196
+ "This directory is only used in dev mode by Keycloakify",
197
+ "It won't be included in your final build.",
198
+ "Do not modify anything in this directory.",
199
+ ].join("\n")));
200
+ external_fs_.writeFileSync(keycloakifyBuildinfoFilePath, Buffer.from(keycloakifyBuildinfoRaw, "utf8"));
201
+ }
202
+ //# sourceMappingURL=copy-keycloak-resources-to-public.js.map
203
+
204
+ /***/ }),
205
+
4
206
  /***/ 2:
5
207
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
6
208
 
@@ -4857,197 +5059,76 @@ const CUSTOM_HANDLER_ENV_NAMES = {
4857
5059
 
4858
5060
  /***/ }),
4859
5061
 
4860
- /***/ 601:
5062
+ /***/ 138:
4861
5063
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
4862
5064
 
4863
5065
  "use strict";
4864
- // ESM COMPAT FLAG
4865
- __nccwpck_require__.r(__webpack_exports__);
4866
5066
 
4867
5067
  // EXPORTS
4868
5068
  __nccwpck_require__.d(__webpack_exports__, {
4869
- "copyKeycloakResourcesToPublic": () => (/* binding */ copyKeycloakResourcesToPublic)
5069
+ "q": () => (/* binding */ maybeDelegateCommandToCustomHandler)
4870
5070
  });
4871
5071
 
4872
- // EXTERNAL MODULE: external "path"
4873
- var external_path_ = __nccwpck_require__(17);
5072
+ // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
5073
+ var esm_assert = __nccwpck_require__(41);
4874
5074
  // EXTERNAL MODULE: ./dist/bin/shared/constants.js
4875
5075
  var constants = __nccwpck_require__(173);
4876
- // EXTERNAL MODULE: external "fs"
4877
- var external_fs_ = __nccwpck_require__(147);
4878
- ;// CONCATENATED MODULE: ./dist/bin/tools/getThisCodebaseRootDirPath.js
5076
+ ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler.js
4879
5077
 
4880
5078
 
4881
- function getThisCodebaseRootDirPath_rec(dirPath) {
4882
- if (external_fs_.existsSync(external_path_.join(dirPath, "package.json"))) {
4883
- return dirPath;
4884
- }
4885
- return getThisCodebaseRootDirPath_rec(external_path_.join(dirPath, ".."));
4886
- }
4887
- let result = undefined;
4888
- function getThisCodebaseRootDirPath() {
4889
- if (result !== undefined) {
4890
- return result;
4891
- }
4892
- return (result = getThisCodebaseRootDirPath_rec(__dirname));
5079
+ const BIN_NAME = "_keycloakify-custom-handler";
5080
+ const NOT_IMPLEMENTED_EXIT_CODE = 78;
5081
+ function readParams(params) {
5082
+ const { apiVersion } = params;
5083
+ assert(apiVersion === "v1");
5084
+ const commandName = (() => {
5085
+ const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME];
5086
+ assert(envValue !== undefined);
5087
+ return envValue;
5088
+ })();
5089
+ const buildContext = (() => {
5090
+ const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT];
5091
+ assert(envValue !== undefined);
5092
+ return JSON.parse(envValue);
5093
+ })();
5094
+ return { commandName, buildContext };
4893
5095
  }
4894
- //# sourceMappingURL=getThisCodebaseRootDirPath.js.map
4895
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
4896
- var assert = __nccwpck_require__(41);
4897
- ;// CONCATENATED MODULE: ./dist/bin/tools/readThisNpmPackageVersion.js
4898
-
5096
+ //# sourceMappingURL=customHandler.js.map
5097
+ // EXTERNAL MODULE: external "child_process"
5098
+ var external_child_process_ = __nccwpck_require__(81);
5099
+ // EXTERNAL MODULE: external "path"
5100
+ var external_path_ = __nccwpck_require__(17);
5101
+ // EXTERNAL MODULE: external "fs"
5102
+ var external_fs_ = __nccwpck_require__(147);
5103
+ ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler_delegate.js
4899
5104
 
4900
5105
 
4901
5106
 
4902
- function readThisNpmPackageVersion() {
4903
- const version = JSON.parse(external_fs_.readFileSync((0,external_path_.join)(getThisCodebaseRootDirPath(), "package.json"))
4904
- .toString("utf8"))["version"];
4905
- (0,assert/* assert */.h)(typeof version === "string");
4906
- return version;
4907
- }
4908
- //# sourceMappingURL=readThisNpmPackageVersion.js.map
4909
- // EXTERNAL MODULE: ./dist/bin/tools/SemVer.js
4910
- var SemVer = __nccwpck_require__(171);
4911
- ;// CONCATENATED MODULE: ./dist/bin/tools/fs.rmSync.js
4912
5107
 
4913
5108
 
4914
5109
 
4915
- /**
4916
- * Polyfill of fs.rmSync(dirPath, { "recursive": true })
4917
- * For older version of Node
4918
- */
4919
- function rmSync(dirPath, options) {
4920
- if (SemVer/* SemVer.compare */.h.compare(SemVer/* SemVer.parse */.h.parse(process.version), SemVer/* SemVer.parse */.h.parse("14.14.0")) > 0) {
4921
- external_fs_.rmSync(dirPath, options);
4922
- return;
4923
- }
4924
- const { force = true } = options;
4925
- if (force && !external_fs_.existsSync(dirPath)) {
4926
- return;
5110
+ (0,esm_assert/* assert */.h)();
5111
+ function maybeDelegateCommandToCustomHandler(params) {
5112
+ const { commandName, buildContext } = params;
5113
+ if (!external_fs_.readdirSync((0,external_path_.dirname)(process.argv[1])).includes(BIN_NAME)) {
5114
+ return { hasBeenHandled: false };
4927
5115
  }
4928
- const removeDir_rec = (dirPath) => external_fs_.readdirSync(dirPath).forEach(basename => {
4929
- const fileOrDirPath = (0,external_path_.join)(dirPath, basename);
4930
- if (external_fs_.lstatSync(fileOrDirPath).isDirectory()) {
4931
- removeDir_rec(fileOrDirPath);
4932
- return;
4933
- }
4934
- else {
4935
- external_fs_.unlinkSync(fileOrDirPath);
4936
- }
4937
- });
4938
- removeDir_rec(dirPath);
4939
- }
4940
- //# sourceMappingURL=fs.rmSync.js.map
4941
- // EXTERNAL MODULE: ./dist/bin/tools/crawl.js
4942
- var crawl = __nccwpck_require__(36);
4943
- ;// CONCATENATED MODULE: ./dist/bin/tools/transformCodebase.js
4944
-
4945
-
4946
-
4947
-
4948
- /**
4949
- * Apply a transformation function to every file of directory
4950
- * If source and destination are the same this function can be used to apply the transformation in place
4951
- * like filtering out some files or modifying them.
4952
- * */
4953
- function transformCodebase(params) {
4954
- const { srcDirPath, transformSourceCode } = params;
4955
- const isTargetSameAsSource = external_path_.relative(srcDirPath, params.destDirPath) === "";
4956
- const destDirPath = isTargetSameAsSource
4957
- ? external_path_.join(srcDirPath, "..", "tmp_xOsPdkPsTdzPs34sOkHs")
4958
- : params.destDirPath;
4959
- external_fs_.mkdirSync(destDirPath, {
4960
- recursive: true
4961
- });
4962
- for (const fileRelativePath of (0,crawl/* crawl */.J)({
4963
- dirPath: srcDirPath,
4964
- returnedPathsType: "relative to dirPath"
4965
- })) {
4966
- const filePath = external_path_.join(srcDirPath, fileRelativePath);
4967
- const destFilePath = external_path_.join(destDirPath, fileRelativePath);
4968
- // NOTE: Optimization, if we don't need to transform the file, just copy
4969
- // it using the lower level implementation.
4970
- if (transformSourceCode === undefined) {
4971
- external_fs_.mkdirSync(external_path_.dirname(destFilePath), {
4972
- recursive: true
4973
- });
4974
- external_fs_.copyFileSync(filePath, destFilePath);
4975
- continue;
4976
- }
4977
- const transformSourceCodeResult = transformSourceCode({
4978
- sourceCode: external_fs_.readFileSync(filePath),
4979
- filePath,
4980
- fileRelativePath
4981
- });
4982
- if (transformSourceCodeResult === undefined) {
4983
- continue;
4984
- }
4985
- external_fs_.mkdirSync(external_path_.dirname(destFilePath), {
4986
- recursive: true
5116
+ try {
5117
+ external_child_process_.execSync(`npx ${BIN_NAME}`, {
5118
+ stdio: "inherit",
5119
+ env: Object.assign(Object.assign({}, process.env), { [constants.CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME]: commandName, [constants.CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT]: JSON.stringify(buildContext) })
4987
5120
  });
4988
- const { newFileName, modifiedSourceCode } = transformSourceCodeResult;
4989
- external_fs_.writeFileSync(external_path_.join(external_path_.dirname(destFilePath), newFileName !== null && newFileName !== void 0 ? newFileName : external_path_.basename(destFilePath)), modifiedSourceCode);
4990
5121
  }
4991
- if (isTargetSameAsSource) {
4992
- rmSync(srcDirPath, { recursive: true });
4993
- external_fs_.renameSync(destDirPath, srcDirPath);
4994
- }
4995
- }
4996
- //# sourceMappingURL=transformCodebase.js.map
4997
- ;// CONCATENATED MODULE: ./dist/bin/shared/copyKeycloakResourcesToPublic.js
4998
-
4999
-
5000
-
5001
-
5002
-
5003
-
5004
-
5005
-
5006
- (0,assert/* assert */.h)();
5007
- function copyKeycloakResourcesToPublic(params) {
5008
- const { buildContext } = params;
5009
- const destDirPath = (0,external_path_.join)(buildContext.publicDirPath, constants.WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES);
5010
- const keycloakifyBuildinfoFilePath = (0,external_path_.join)(destDirPath, "keycloakify.buildinfo");
5011
- const keycloakifyBuildinfoRaw = JSON.stringify({
5012
- keycloakifyVersion: readThisNpmPackageVersion()
5013
- }, null, 2);
5014
- skip_if_already_done: {
5015
- if (!external_fs_.existsSync(keycloakifyBuildinfoFilePath)) {
5016
- break skip_if_already_done;
5017
- }
5018
- const keycloakifyBuildinfoRaw_previousRun = external_fs_.readFileSync(keycloakifyBuildinfoFilePath)
5019
- .toString("utf8");
5020
- if (keycloakifyBuildinfoRaw_previousRun !== keycloakifyBuildinfoRaw) {
5021
- break skip_if_already_done;
5122
+ catch (error) {
5123
+ const status = error.status;
5124
+ if (status === NOT_IMPLEMENTED_EXIT_CODE) {
5125
+ return { hasBeenHandled: false };
5022
5126
  }
5023
- return;
5127
+ process.exit(status);
5024
5128
  }
5025
- rmSync(destDirPath, { force: true, recursive: true });
5026
- // NOTE: To remove in a while, remove the legacy keycloak-resources directory
5027
- rmSync((0,external_path_.join)((0,external_path_.dirname)(destDirPath), "keycloak-resources"), {
5028
- force: true,
5029
- recursive: true
5030
- });
5031
- rmSync((0,external_path_.join)((0,external_path_.dirname)(destDirPath), ".keycloakify"), {
5032
- force: true,
5033
- recursive: true
5034
- });
5035
- external_fs_.mkdirSync(destDirPath, { recursive: true });
5036
- external_fs_.writeFileSync((0,external_path_.join)(destDirPath, ".gitignore"), Buffer.from("*", "utf8"));
5037
- transformCodebase({
5038
- srcDirPath: (0,external_path_.join)(getThisCodebaseRootDirPath(), "res", "public", constants.WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES),
5039
- destDirPath
5040
- });
5041
- external_fs_.writeFileSync((0,external_path_.join)(destDirPath, "README.txt"), Buffer.from(
5042
- // prettier-ignore
5043
- [
5044
- "This directory is only used in dev mode by Keycloakify",
5045
- "It won't be included in your final build.",
5046
- "Do not modify anything in this directory.",
5047
- ].join("\n")));
5048
- external_fs_.writeFileSync(keycloakifyBuildinfoFilePath, Buffer.from(keycloakifyBuildinfoRaw, "utf8"));
5129
+ return { hasBeenHandled: true };
5049
5130
  }
5050
- //# sourceMappingURL=copyKeycloakResourcesToPublic.js.map
5131
+ //# sourceMappingURL=customHandler_delegate.js.map
5051
5132
 
5052
5133
  /***/ }),
5053
5134
 
@@ -5228,7 +5309,7 @@ async function checkDirExists(dirPath) {
5228
5309
 
5229
5310
  /***/ }),
5230
5311
 
5231
- /***/ 358:
5312
+ /***/ 810:
5232
5313
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
5233
5314
 
5234
5315
  "use strict";
@@ -5258,64 +5339,8 @@ async function existsAsync(path) {
5258
5339
  }
5259
5340
  }
5260
5341
  //# sourceMappingURL=fs.existsAsync.js.map
5261
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
5262
- var esm_assert = __nccwpck_require__(41);
5263
- // EXTERNAL MODULE: ./dist/bin/shared/constants.js
5264
- var constants = __nccwpck_require__(173);
5265
- ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler.js
5266
-
5267
-
5268
- const BIN_NAME = "_keycloakify-custom-handler";
5269
- const NOT_IMPLEMENTED_EXIT_CODE = 78;
5270
- function readParams(params) {
5271
- const { apiVersion } = params;
5272
- assert(apiVersion === "v1");
5273
- const commandName = (() => {
5274
- const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME];
5275
- assert(envValue !== undefined);
5276
- return envValue;
5277
- })();
5278
- const buildContext = (() => {
5279
- const envValue = process.env[CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT];
5280
- assert(envValue !== undefined);
5281
- return JSON.parse(envValue);
5282
- })();
5283
- return { commandName, buildContext };
5284
- }
5285
- //# sourceMappingURL=customHandler.js.map
5286
- // EXTERNAL MODULE: external "child_process"
5287
- var external_child_process_ = __nccwpck_require__(81);
5288
- // EXTERNAL MODULE: external "fs"
5289
- var external_fs_ = __nccwpck_require__(147);
5290
- ;// CONCATENATED MODULE: ./dist/bin/shared/customHandler_delegate.js
5291
-
5292
-
5293
-
5294
-
5295
-
5296
-
5297
- (0,esm_assert/* assert */.h)();
5298
- function maybeDelegateCommandToCustomHandler(params) {
5299
- const { commandName, buildContext } = params;
5300
- if (!external_fs_.readdirSync((0,external_path_.dirname)(process.argv[1])).includes(BIN_NAME)) {
5301
- return;
5302
- }
5303
- try {
5304
- external_child_process_.execSync(`npx ${BIN_NAME}`, {
5305
- stdio: "inherit",
5306
- env: Object.assign(Object.assign({}, process.env), { [constants.CUSTOM_HANDLER_ENV_NAMES.COMMAND_NAME]: commandName, [constants.CUSTOM_HANDLER_ENV_NAMES.BUILD_CONTEXT]: JSON.stringify(buildContext) })
5307
- });
5308
- }
5309
- catch (error) {
5310
- const status = error.status;
5311
- if (status === NOT_IMPLEMENTED_EXIT_CODE) {
5312
- return;
5313
- }
5314
- process.exit(status);
5315
- }
5316
- process.exit(0);
5317
- }
5318
- //# sourceMappingURL=customHandler_delegate.js.map
5342
+ // EXTERNAL MODULE: ./dist/bin/shared/customHandler_delegate.js + 1 modules
5343
+ var customHandler_delegate = __nccwpck_require__(138);
5319
5344
  ;// CONCATENATED MODULE: ./dist/bin/update-kc-gen.js
5320
5345
 
5321
5346
 
@@ -5323,10 +5348,13 @@ function maybeDelegateCommandToCustomHandler(params) {
5323
5348
 
5324
5349
  async function command(params) {
5325
5350
  const { buildContext } = params;
5326
- maybeDelegateCommandToCustomHandler({
5351
+ const { hasBeenHandled } = (0,customHandler_delegate/* maybeDelegateCommandToCustomHandler */.q)({
5327
5352
  commandName: "update-kc-gen",
5328
5353
  buildContext
5329
5354
  });
5355
+ if (hasBeenHandled) {
5356
+ return;
5357
+ }
5330
5358
  const filePath = (0,external_path_.join)(buildContext.themeSrcDirPath, `kc.gen.tsx`);
5331
5359
  const currentContent = (await existsAsync(filePath))
5332
5360
  ? await promises_.readFile(filePath)
@@ -5453,11 +5481,11 @@ const path_1 = __nccwpck_require__(17);
5453
5481
  const constants_1 = __nccwpck_require__(173);
5454
5482
  const id_1 = __nccwpck_require__(47);
5455
5483
  const fs_rm_1 = __nccwpck_require__(699);
5456
- const copyKeycloakResourcesToPublic_1 = __nccwpck_require__(601);
5484
+ const copy_keycloak_resources_to_public_1 = __nccwpck_require__(721);
5457
5485
  const assert_1 = __nccwpck_require__(78);
5458
5486
  const buildContext_1 = __nccwpck_require__(2);
5459
5487
  const magic_string_1 = __importDefault(__nccwpck_require__(734));
5460
- const update_kc_gen_1 = __nccwpck_require__(358);
5488
+ const update_kc_gen_1 = __nccwpck_require__(810);
5461
5489
  function keycloakify(params) {
5462
5490
  const { postBuild, ...buildOptions } = params;
5463
5491
  let projectDirPath = undefined;
@@ -5522,7 +5550,7 @@ function keycloakify(params) {
5522
5550
  const buildContext = (0, buildContext_1.getBuildContext)({
5523
5551
  projectDirPath
5524
5552
  });
5525
- (0, copyKeycloakResourcesToPublic_1.copyKeycloakResourcesToPublic)({ buildContext });
5553
+ await (0, copy_keycloak_resources_to_public_1.command)({ buildContext });
5526
5554
  await (0, update_kc_gen_1.command)({ buildContext });
5527
5555
  },
5528
5556
  transform: (code, id) => {
@@ -1,6 +0,0 @@
1
- export type BuildContextLike = {
2
- publicDirPath: string;
3
- };
4
- export declare function copyKeycloakResourcesToPublic(params: {
5
- buildContext: BuildContextLike;
6
- }): void;