keycloakify 11.4.5 → 11.5.0
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/375.index.js +4089 -0
- package/bin/{20.index.js → 490.index.js} +378 -56
- package/bin/{36.index.js → 503.index.js} +53 -2
- package/bin/{450.index.js → 525.index.js} +2 -4085
- package/bin/653.index.js +108 -110
- package/bin/682.index.js +1885 -0
- package/bin/735.index.js +107 -109
- package/bin/921.index.js +1 -1
- package/bin/main.js +8 -2
- package/bin/shared/constants.d.ts +3 -0
- package/bin/shared/constants.js +3 -0
- package/bin/shared/constants.js.map +1 -1
- package/bin/start-keycloak/getSupportedDockerImageTags.d.ts +8 -0
- package/bin/start-keycloak/realmConfig/ParsedRealmJson.d.ts +38 -0
- package/bin/start-keycloak/realmConfig/defaultConfig/defaultConfig.d.ts +8 -0
- package/bin/start-keycloak/realmConfig/defaultConfig/index.d.ts +1 -0
- package/bin/start-keycloak/realmConfig/dumpContainerConfig.d.ts +9 -0
- package/bin/start-keycloak/realmConfig/index.d.ts +1 -0
- package/bin/start-keycloak/realmConfig/prepareRealmConfig.d.ts +15 -0
- package/bin/start-keycloak/realmConfig/realmConfig.d.ts +16 -0
- package/package.json +31 -14
- package/src/bin/shared/constants.ts +6 -0
- package/src/bin/start-keycloak/getSupportedDockerImageTags.ts +230 -0
- package/src/bin/start-keycloak/keycloakify-logging-1.0.3.jar +0 -0
- package/src/bin/start-keycloak/realmConfig/ParsedRealmJson.ts +118 -0
- package/src/bin/start-keycloak/realmConfig/defaultConfig/defaultConfig.ts +75 -0
- package/src/bin/start-keycloak/realmConfig/defaultConfig/index.ts +1 -0
- package/src/bin/start-keycloak/{myrealm-realm-18.json → realmConfig/defaultConfig/realm-kc-18.json} +123 -60
- package/src/bin/start-keycloak/{myrealm-realm-19.json → realmConfig/defaultConfig/realm-kc-19.json} +81 -41
- package/src/bin/start-keycloak/{myrealm-realm-20.json → realmConfig/defaultConfig/realm-kc-20.json} +83 -42
- package/src/bin/start-keycloak/{myrealm-realm-21.json → realmConfig/defaultConfig/realm-kc-21.json} +58 -17
- package/src/bin/start-keycloak/{myrealm-realm-23.json → realmConfig/defaultConfig/realm-kc-23.json} +64 -20
- package/src/bin/start-keycloak/{myrealm-realm-24.json → realmConfig/defaultConfig/realm-kc-24.json} +63 -19
- package/src/bin/start-keycloak/{myrealm-realm-25.json → realmConfig/defaultConfig/realm-kc-25.json} +75 -20
- package/src/bin/start-keycloak/{myrealm-realm-26.json → realmConfig/defaultConfig/realm-kc-26.json} +86 -20
- package/src/bin/start-keycloak/realmConfig/dumpContainerConfig.ts +147 -0
- package/src/bin/start-keycloak/realmConfig/index.ts +1 -0
- package/src/bin/start-keycloak/realmConfig/prepareRealmConfig.ts +302 -0
- package/src/bin/start-keycloak/realmConfig/realmConfig.ts +151 -0
- package/src/bin/start-keycloak/start-keycloak.ts +160 -184
- package/src/bin/start-keycloak/startViteDevServer.ts +1 -0
- package/vite-plugin/index.js +6 -0
- package/bin/392.index.js +0 -740
- package/bin/932.index.js +0 -327
package/bin/392.index.js
DELETED
@@ -1,740 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
exports.id = 392;
|
3
|
-
exports.ids = [392];
|
4
|
-
exports.modules = {
|
5
|
-
|
6
|
-
/***/ 18392:
|
7
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
8
|
-
|
9
|
-
// ESM COMPAT FLAG
|
10
|
-
__webpack_require__.r(__webpack_exports__);
|
11
|
-
|
12
|
-
// EXPORTS
|
13
|
-
__webpack_require__.d(__webpack_exports__, {
|
14
|
-
"command": () => (/* reexport */ command)
|
15
|
-
});
|
16
|
-
|
17
|
-
// EXTERNAL MODULE: ./node_modules/tsafe/esm/exclude.mjs
|
18
|
-
var exclude = __webpack_require__(83101);
|
19
|
-
// EXTERNAL MODULE: ./dist/bin/shared/promptKeycloakVersion.js
|
20
|
-
var promptKeycloakVersion = __webpack_require__(82635);
|
21
|
-
// EXTERNAL MODULE: ./dist/bin/shared/constants.js
|
22
|
-
var constants = __webpack_require__(173);
|
23
|
-
// EXTERNAL MODULE: ./dist/bin/tools/SemVer.js
|
24
|
-
var SemVer = __webpack_require__(12171);
|
25
|
-
// EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
|
26
|
-
var assert = __webpack_require__(29041);
|
27
|
-
// EXTERNAL MODULE: external "fs"
|
28
|
-
var external_fs_ = __webpack_require__(57147);
|
29
|
-
// EXTERNAL MODULE: external "path"
|
30
|
-
var external_path_ = __webpack_require__(71017);
|
31
|
-
// EXTERNAL MODULE: external "child_process"
|
32
|
-
var external_child_process_ = __webpack_require__(32081);
|
33
|
-
// EXTERNAL MODULE: ./node_modules/chalk/source/index.js
|
34
|
-
var source = __webpack_require__(78818);
|
35
|
-
var source_default = /*#__PURE__*/__webpack_require__.n(source);
|
36
|
-
// EXTERNAL MODULE: ./node_modules/chokidar/index.js
|
37
|
-
var chokidar = __webpack_require__(42677);
|
38
|
-
// EXTERNAL MODULE: ./node_modules/powerhooks/tools/waitForDebounce.js
|
39
|
-
var tools_waitForDebounce = __webpack_require__(18721);
|
40
|
-
// EXTERNAL MODULE: ./dist/bin/tools/getThisCodebaseRootDirPath.js
|
41
|
-
var getThisCodebaseRootDirPath = __webpack_require__(58822);
|
42
|
-
// EXTERNAL MODULE: ./dist/bin/tools/getAbsoluteAndInOsFormatPath.js
|
43
|
-
var getAbsoluteAndInOsFormatPath = __webpack_require__(84794);
|
44
|
-
// EXTERNAL MODULE: ./node_modules/cli-select/dist/index.js
|
45
|
-
var dist = __webpack_require__(99398);
|
46
|
-
var dist_default = /*#__PURE__*/__webpack_require__.n(dist);
|
47
|
-
// EXTERNAL MODULE: ./node_modules/run-exclusive/lib/runExclusive.js
|
48
|
-
var runExclusive = __webpack_require__(81708);
|
49
|
-
// EXTERNAL MODULE: ./dist/bin/tools/extractArchive.js
|
50
|
-
var extractArchive = __webpack_require__(29121);
|
51
|
-
// EXTERNAL MODULE: ./node_modules/evt/tools/Deferred.js
|
52
|
-
var Deferred = __webpack_require__(50689);
|
53
|
-
// EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
|
54
|
-
var id = __webpack_require__(38469);
|
55
|
-
// EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
|
56
|
-
var lib = __webpack_require__(52300);
|
57
|
-
;// CONCATENATED MODULE: ./dist/bin/start-keycloak/appBuild.js
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
(0,assert/* assert */.h)();
|
69
|
-
async function appBuild(params) {
|
70
|
-
var _a;
|
71
|
-
const { buildContext } = params;
|
72
|
-
const { parsedPackageJson } = (() => {
|
73
|
-
const zParsedPackageJson = (() => {
|
74
|
-
const zTargetType = lib.z.object({
|
75
|
-
scripts: lib.z.record(lib.z.string()).optional()
|
76
|
-
});
|
77
|
-
(0,assert/* assert */.h)();
|
78
|
-
return (0,id.id)(zTargetType);
|
79
|
-
})();
|
80
|
-
const parsedPackageJson = JSON.parse(external_fs_.readFileSync(buildContext.packageJsonFilePath).toString("utf8"));
|
81
|
-
zParsedPackageJson.parse(parsedPackageJson);
|
82
|
-
(0,assert/* assert */.h)((0,assert.is)(parsedPackageJson));
|
83
|
-
return { parsedPackageJson };
|
84
|
-
})();
|
85
|
-
const entries = Object.entries((_a = parsedPackageJson.scripts) !== null && _a !== void 0 ? _a : {}).filter(([, scriptCommand]) => scriptCommand.includes("keycloakify build"));
|
86
|
-
if (entries.length === 0) {
|
87
|
-
console.log(source_default().red([
|
88
|
-
`You should have a script in your package.json at ${(0,external_path_.relative)(process.cwd(), (0,external_path_.dirname)(buildContext.packageJsonFilePath))}`,
|
89
|
-
`that includes the 'keycloakify build' command`
|
90
|
-
].join(" ")));
|
91
|
-
process.exit(-1);
|
92
|
-
}
|
93
|
-
const entry = entries.length === 1
|
94
|
-
? entries[0]
|
95
|
-
: entries.find(([scriptName]) => scriptName === "build-keycloak-theme");
|
96
|
-
if (entry === undefined) {
|
97
|
-
console.log(source_default().red("There's multiple candidate script for building your app, name one 'build-keycloak-theme'"));
|
98
|
-
process.exit(-1);
|
99
|
-
}
|
100
|
-
const [scriptName, scriptCommand] = entry;
|
101
|
-
const { appBuildSubCommands } = (() => {
|
102
|
-
const appBuildSubCommands = [];
|
103
|
-
for (const subCmd of scriptCommand.split("&&").map(s => s.trim())) {
|
104
|
-
if (subCmd.includes("keycloakify build")) {
|
105
|
-
break;
|
106
|
-
}
|
107
|
-
appBuildSubCommands.push(subCmd);
|
108
|
-
}
|
109
|
-
return { appBuildSubCommands };
|
110
|
-
})();
|
111
|
-
if (appBuildSubCommands.length === 0) {
|
112
|
-
console.log(source_default().red(`Your ${scriptName} script should look like "... && keycloakify build ..."`));
|
113
|
-
process.exit(-1);
|
114
|
-
}
|
115
|
-
common_case: {
|
116
|
-
if (appBuildSubCommands.length !== 1) {
|
117
|
-
break common_case;
|
118
|
-
}
|
119
|
-
const [appBuildSubCommand] = appBuildSubCommands;
|
120
|
-
const isNpmRunBuild = (() => {
|
121
|
-
for (const packageManager of ["npm", "yarn", "pnpm", "bun", "deno"]) {
|
122
|
-
for (const doUseRun of [true, false]) {
|
123
|
-
if (`${packageManager}${doUseRun ? " run " : " "}build` ===
|
124
|
-
appBuildSubCommand) {
|
125
|
-
return true;
|
126
|
-
}
|
127
|
-
}
|
128
|
-
}
|
129
|
-
return false;
|
130
|
-
})();
|
131
|
-
if (!isNpmRunBuild) {
|
132
|
-
break common_case;
|
133
|
-
}
|
134
|
-
const { scripts } = parsedPackageJson;
|
135
|
-
(0,assert/* assert */.h)(scripts !== undefined);
|
136
|
-
const buildCmd = scripts.build;
|
137
|
-
if (buildCmd !== "tsc && vite build") {
|
138
|
-
break common_case;
|
139
|
-
}
|
140
|
-
if (scripts.prebuild !== undefined) {
|
141
|
-
break common_case;
|
142
|
-
}
|
143
|
-
if (scripts.postbuild !== undefined) {
|
144
|
-
break common_case;
|
145
|
-
}
|
146
|
-
const dIsSuccess = new Deferred.Deferred();
|
147
|
-
console.log(source_default().blue("$ npx vite build"));
|
148
|
-
const child = external_child_process_.spawn("npx", ["vite", "build"], {
|
149
|
-
cwd: buildContext.projectDirPath,
|
150
|
-
shell: true
|
151
|
-
});
|
152
|
-
child.stdout.on("data", data => {
|
153
|
-
if (data.toString("utf8").includes("gzip:")) {
|
154
|
-
return;
|
155
|
-
}
|
156
|
-
process.stdout.write(data);
|
157
|
-
});
|
158
|
-
child.stderr.on("data", data => process.stderr.write(data));
|
159
|
-
child.on("exit", code => dIsSuccess.resolve(code === 0));
|
160
|
-
const isSuccess = await dIsSuccess.pr;
|
161
|
-
return { isAppBuildSuccess: isSuccess };
|
162
|
-
}
|
163
|
-
let commandCwd = (0,external_path_.dirname)(buildContext.packageJsonFilePath);
|
164
|
-
for (const subCommand of appBuildSubCommands) {
|
165
|
-
const dIsSuccess = new Deferred.Deferred();
|
166
|
-
const [command, ...args] = subCommand.split(" ");
|
167
|
-
if (command === "cd") {
|
168
|
-
const [pathIsh] = args;
|
169
|
-
commandCwd = (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
|
170
|
-
pathIsh,
|
171
|
-
cwd: commandCwd
|
172
|
-
});
|
173
|
-
continue;
|
174
|
-
}
|
175
|
-
console.log(source_default().blue(`$ ${subCommand}`));
|
176
|
-
const child = external_child_process_.spawn(command, args, {
|
177
|
-
cwd: commandCwd,
|
178
|
-
env: Object.assign(Object.assign({}, process.env), { PATH: (() => {
|
179
|
-
var _a;
|
180
|
-
const separator = external_path_.sep === "/" ? ":" : ";";
|
181
|
-
return [
|
182
|
-
(0,external_path_.join)((0,external_path_.dirname)(buildContext.packageJsonFilePath), "node_modules", ".bin"),
|
183
|
-
...((_a = process.env.PATH) !== null && _a !== void 0 ? _a : "").split(separator)
|
184
|
-
].join(separator);
|
185
|
-
})() }),
|
186
|
-
shell: true
|
187
|
-
});
|
188
|
-
child.stdout.on("data", data => process.stdout.write(data));
|
189
|
-
child.stderr.on("data", data => process.stderr.write(data));
|
190
|
-
child.on("exit", code => dIsSuccess.resolve(code === 0));
|
191
|
-
const isSuccess = await dIsSuccess.pr;
|
192
|
-
if (!isSuccess) {
|
193
|
-
return { isAppBuildSuccess: false };
|
194
|
-
}
|
195
|
-
}
|
196
|
-
return { isAppBuildSuccess: true };
|
197
|
-
}
|
198
|
-
//# sourceMappingURL=appBuild.js.map
|
199
|
-
;// CONCATENATED MODULE: ./dist/bin/start-keycloak/keycloakifyBuild.js
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
(0,assert/* assert */.h)();
|
206
|
-
async function keycloakifyBuild(params) {
|
207
|
-
const { buildForKeycloakMajorVersionNumber, buildContext } = params;
|
208
|
-
const dResult = new Deferred.Deferred();
|
209
|
-
console.log(source_default().blue("$ npx keycloakify build"));
|
210
|
-
const child = external_child_process_.spawn("npx", ["keycloakify", "build"], {
|
211
|
-
cwd: buildContext.projectDirPath,
|
212
|
-
env: Object.assign(Object.assign({}, process.env), { [constants/* BUILD_FOR_KEYCLOAK_MAJOR_VERSION_ENV_NAME */.ac]: `${buildForKeycloakMajorVersionNumber}` }),
|
213
|
-
shell: true
|
214
|
-
});
|
215
|
-
child.stdout.on("data", data => process.stdout.write(data));
|
216
|
-
child.stderr.on("data", data => process.stderr.write(data));
|
217
|
-
child.on("exit", code => dResult.resolve({ isSuccess: code === 0 }));
|
218
|
-
const { isSuccess } = await dResult.pr;
|
219
|
-
return { isKeycloakifyBuildSuccess: isSuccess };
|
220
|
-
}
|
221
|
-
//# sourceMappingURL=keycloakifyBuild.js.map
|
222
|
-
// EXTERNAL MODULE: ./dist/bin/tools/isInside.js
|
223
|
-
var isInside = __webpack_require__(90665);
|
224
|
-
// EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
|
225
|
-
var fs_existsAsync = __webpack_require__(43765);
|
226
|
-
// EXTERNAL MODULE: ./dist/bin/tools/fs.rm.js
|
227
|
-
var fs_rm = __webpack_require__(8699);
|
228
|
-
// EXTERNAL MODULE: ./dist/bin/tools/downloadAndExtractArchive.js
|
229
|
-
var downloadAndExtractArchive = __webpack_require__(38367);
|
230
|
-
;// CONCATENATED MODULE: ./dist/bin/start-keycloak/startViteDevServer.js
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
(0,assert/* assert */.h)();
|
237
|
-
function startViteDevServer(params) {
|
238
|
-
const { buildContext } = params;
|
239
|
-
console.log(source_default().blue(`$ npx vite dev`));
|
240
|
-
const child = external_child_process_.spawn("npx", ["vite", "dev"], {
|
241
|
-
cwd: buildContext.projectDirPath,
|
242
|
-
env: Object.assign(Object.assign({}, process.env), { [constants/* VITE_PLUGIN_SUB_SCRIPTS_ENV_NAMES.READ_KC_CONTEXT_FROM_URL */.TE.READ_KC_CONTEXT_FROM_URL]: "true" }),
|
243
|
-
shell: true
|
244
|
-
});
|
245
|
-
child.stdout.on("data", data => {
|
246
|
-
if (!data.toString("utf8").includes("[vite] hmr")) {
|
247
|
-
return;
|
248
|
-
}
|
249
|
-
process.stdout.write(data);
|
250
|
-
});
|
251
|
-
child.stderr.on("data", data => process.stderr.write(data));
|
252
|
-
const dPort = new Deferred.Deferred();
|
253
|
-
{
|
254
|
-
const onData = (data) => {
|
255
|
-
//Local: http://localhost:8083/
|
256
|
-
const match = data
|
257
|
-
.toString("utf8")
|
258
|
-
.match(/Local:\s*http:\/\/(?:localhost|127\.0\.0\.1):(\d+)\//);
|
259
|
-
if (match === null) {
|
260
|
-
return;
|
261
|
-
}
|
262
|
-
child.stdout.off("data", onData);
|
263
|
-
const port = parseInt(match[1]);
|
264
|
-
(0,assert/* assert */.h)(!isNaN(port));
|
265
|
-
dPort.resolve(port);
|
266
|
-
};
|
267
|
-
child.stdout.on("data", onData);
|
268
|
-
}
|
269
|
-
return dPort.pr.then(port => ({ port }));
|
270
|
-
}
|
271
|
-
//# sourceMappingURL=startViteDevServer.js.map
|
272
|
-
;// CONCATENATED MODULE: ./dist/bin/start-keycloak/start-keycloak.js
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
async function command(params) {
|
297
|
-
var _a, _b, _c, _d, _e;
|
298
|
-
exit_if_docker_not_installed: {
|
299
|
-
let commandOutput = undefined;
|
300
|
-
try {
|
301
|
-
commandOutput = (_a = external_child_process_.execSync("docker --version", {
|
302
|
-
stdio: ["ignore", "pipe", "ignore"]
|
303
|
-
})) === null || _a === void 0 ? void 0 : _a.toString("utf8");
|
304
|
-
}
|
305
|
-
catch (_f) { }
|
306
|
-
if ((commandOutput === null || commandOutput === void 0 ? void 0 : commandOutput.includes("Docker")) || (commandOutput === null || commandOutput === void 0 ? void 0 : commandOutput.includes("podman"))) {
|
307
|
-
break exit_if_docker_not_installed;
|
308
|
-
}
|
309
|
-
console.log([
|
310
|
-
`${source_default().red("Docker required.")}`,
|
311
|
-
`Install it with Docker Desktop: ${source_default().bold.underline("https://www.docker.com/products/docker-desktop/")}`,
|
312
|
-
`(or any other way)`
|
313
|
-
].join(" "));
|
314
|
-
process.exit(1);
|
315
|
-
}
|
316
|
-
exit_if_docker_not_running: {
|
317
|
-
let isDockerRunning;
|
318
|
-
try {
|
319
|
-
external_child_process_.execSync("docker info", { stdio: "ignore" });
|
320
|
-
isDockerRunning = true;
|
321
|
-
}
|
322
|
-
catch (_g) {
|
323
|
-
isDockerRunning = false;
|
324
|
-
}
|
325
|
-
if (isDockerRunning) {
|
326
|
-
break exit_if_docker_not_running;
|
327
|
-
}
|
328
|
-
console.log([
|
329
|
-
`${source_default().red("Docker daemon is not running.")}`,
|
330
|
-
`Please start Docker Desktop and try again.`
|
331
|
-
].join(" "));
|
332
|
-
process.exit(1);
|
333
|
-
}
|
334
|
-
const { cliCommandOptions, buildContext } = params;
|
335
|
-
const { dockerImageTag } = await (async () => {
|
336
|
-
if (cliCommandOptions.keycloakVersion !== undefined) {
|
337
|
-
return { dockerImageTag: cliCommandOptions.keycloakVersion };
|
338
|
-
}
|
339
|
-
if (buildContext.startKeycloakOptions.dockerImage !== undefined) {
|
340
|
-
return {
|
341
|
-
dockerImageTag: buildContext.startKeycloakOptions.dockerImage.tag
|
342
|
-
};
|
343
|
-
}
|
344
|
-
console.log([
|
345
|
-
source_default().cyan("On which version of Keycloak do you want to test your theme?"),
|
346
|
-
source_default().gray("You can also explicitly provide the version with `npx keycloakify start-keycloak --keycloak-version 25.0.2` (or any other version)")
|
347
|
-
].join("\n"));
|
348
|
-
const { keycloakVersion } = await (0,promptKeycloakVersion/* promptKeycloakVersion */.s)({
|
349
|
-
startingFromMajor: 18,
|
350
|
-
excludeMajorVersions: [22],
|
351
|
-
doOmitPatch: true,
|
352
|
-
buildContext
|
353
|
-
});
|
354
|
-
console.log(`→ ${keycloakVersion}`);
|
355
|
-
return { dockerImageTag: keycloakVersion };
|
356
|
-
})();
|
357
|
-
const keycloakMajorVersionNumber = (() => {
|
358
|
-
if (buildContext.startKeycloakOptions.dockerImage === undefined) {
|
359
|
-
return SemVer/* SemVer.parse */.h.parse(dockerImageTag).major;
|
360
|
-
}
|
361
|
-
const { tag } = buildContext.startKeycloakOptions.dockerImage;
|
362
|
-
const [wrap] = [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]
|
363
|
-
.map(majorVersionNumber => ({
|
364
|
-
majorVersionNumber,
|
365
|
-
index: tag.indexOf(`${majorVersionNumber}`)
|
366
|
-
}))
|
367
|
-
.filter(({ index }) => index !== -1)
|
368
|
-
.sort((a, b) => a.index - b.index);
|
369
|
-
if (wrap === undefined) {
|
370
|
-
console.warn(source_default().yellow(`Could not determine the major Keycloak version number from the docker image tag ${tag}. Assuming 25`));
|
371
|
-
return 25;
|
372
|
-
}
|
373
|
-
return wrap.majorVersionNumber;
|
374
|
-
})();
|
375
|
-
{
|
376
|
-
const { isAppBuildSuccess } = await appBuild({
|
377
|
-
buildContext
|
378
|
-
});
|
379
|
-
if (!isAppBuildSuccess) {
|
380
|
-
console.log(source_default().red(`App build failed, exiting. Try building your app (e.g 'npm run build') and see what's wrong.`));
|
381
|
-
process.exit(1);
|
382
|
-
}
|
383
|
-
const { isKeycloakifyBuildSuccess } = await keycloakifyBuild({
|
384
|
-
buildForKeycloakMajorVersionNumber: keycloakMajorVersionNumber,
|
385
|
-
buildContext
|
386
|
-
});
|
387
|
-
if (!isKeycloakifyBuildSuccess) {
|
388
|
-
console.log(source_default().red(`Keycloakify build failed, exiting. Try running 'npx keycloakify build' and see what's wrong.`));
|
389
|
-
process.exit(1);
|
390
|
-
}
|
391
|
-
}
|
392
|
-
const jarFilePath = external_fs_.readdirSync(buildContext.keycloakifyBuildDirPath)
|
393
|
-
.filter(fileBasename => fileBasename.endsWith(".jar"))
|
394
|
-
.map(fileBasename => (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, fileBasename))
|
395
|
-
.sort((a, b) => external_fs_.statSync(b).mtimeMs - external_fs_.statSync(a).mtimeMs)[0];
|
396
|
-
(0,assert/* assert */.h)(jarFilePath !== undefined);
|
397
|
-
const extensionJarFilePaths = await Promise.all(buildContext.startKeycloakOptions.extensionJars.map(async (extensionJar) => {
|
398
|
-
switch (extensionJar.type) {
|
399
|
-
case "path": {
|
400
|
-
(0,assert/* assert */.h)(await (0,fs_existsAsync/* existsAsync */.o)(extensionJar.path), `${extensionJar.path} does not exist`);
|
401
|
-
return extensionJar.path;
|
402
|
-
}
|
403
|
-
case "url": {
|
404
|
-
const { archiveFilePath } = await (0,downloadAndExtractArchive/* downloadAndExtractArchive */.I)({
|
405
|
-
cacheDirPath: buildContext.cacheDirPath,
|
406
|
-
fetchOptions: buildContext.fetchOptions,
|
407
|
-
url: extensionJar.url,
|
408
|
-
uniqueIdOfOnArchiveFile: "no extraction",
|
409
|
-
onArchiveFile: async () => { }
|
410
|
-
});
|
411
|
-
return archiveFilePath;
|
412
|
-
}
|
413
|
-
}
|
414
|
-
(0,assert/* assert */.h)(false);
|
415
|
-
}));
|
416
|
-
const getRealmJsonFilePath_defaultForKeycloakMajor = (keycloakMajorVersionNumber) => (0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.e)(), "src", "bin", "start-keycloak", `myrealm-realm-${keycloakMajorVersionNumber}.json`);
|
417
|
-
const realmJsonFilePath = await (async () => {
|
418
|
-
if (cliCommandOptions.realmJsonFilePath !== undefined) {
|
419
|
-
if (cliCommandOptions.realmJsonFilePath === "none") {
|
420
|
-
return undefined;
|
421
|
-
}
|
422
|
-
return (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
|
423
|
-
pathIsh: cliCommandOptions.realmJsonFilePath,
|
424
|
-
cwd: process.cwd()
|
425
|
-
});
|
426
|
-
}
|
427
|
-
if (buildContext.startKeycloakOptions.realmJsonFilePath !== undefined) {
|
428
|
-
(0,assert/* assert */.h)(await (0,fs_existsAsync/* existsAsync */.o)(buildContext.startKeycloakOptions.realmJsonFilePath), `${(0,external_path_.relative)(process.cwd(), buildContext.startKeycloakOptions.realmJsonFilePath)} does not exist`);
|
429
|
-
return buildContext.startKeycloakOptions.realmJsonFilePath;
|
430
|
-
}
|
431
|
-
const internalFilePath = await (async () => {
|
432
|
-
const defaultFilePath = getRealmJsonFilePath_defaultForKeycloakMajor(keycloakMajorVersionNumber);
|
433
|
-
if (external_fs_.existsSync(defaultFilePath)) {
|
434
|
-
return defaultFilePath;
|
435
|
-
}
|
436
|
-
console.log(`${source_default().yellow(`Keycloakify do not have a realm configuration for Keycloak ${keycloakMajorVersionNumber} yet.`)}`);
|
437
|
-
console.log(source_default().cyan("Select what configuration to use:"));
|
438
|
-
const dirPath = (0,external_path_.dirname)(defaultFilePath);
|
439
|
-
const { value } = await dist_default()({
|
440
|
-
values: [
|
441
|
-
...external_fs_.readdirSync(dirPath)
|
442
|
-
.filter(fileBasename => fileBasename.endsWith(".json")),
|
443
|
-
"none"
|
444
|
-
]
|
445
|
-
}).catch(() => {
|
446
|
-
process.exit(-1);
|
447
|
-
});
|
448
|
-
if (value === "none") {
|
449
|
-
return undefined;
|
450
|
-
}
|
451
|
-
return (0,external_path_.join)(dirPath, value);
|
452
|
-
})();
|
453
|
-
if (internalFilePath === undefined) {
|
454
|
-
return undefined;
|
455
|
-
}
|
456
|
-
const filePath = (0,external_path_.join)(buildContext.cacheDirPath, (0,external_path_.basename)(internalFilePath));
|
457
|
-
external_fs_.writeFileSync(filePath, Buffer.from(external_fs_.readFileSync(internalFilePath)
|
458
|
-
.toString("utf8")
|
459
|
-
.replace(/keycloakify\-starter/g, buildContext.themeNames[0])), "utf8");
|
460
|
-
return filePath;
|
461
|
-
})();
|
462
|
-
add_test_user_if_missing: {
|
463
|
-
if (realmJsonFilePath === undefined) {
|
464
|
-
break add_test_user_if_missing;
|
465
|
-
}
|
466
|
-
const realm = JSON.parse(external_fs_.readFileSync(realmJsonFilePath).toString("utf8"));
|
467
|
-
if (realm.users !== undefined) {
|
468
|
-
break add_test_user_if_missing;
|
469
|
-
}
|
470
|
-
const realmJsonFilePath_internal = (() => {
|
471
|
-
const filePath = getRealmJsonFilePath_defaultForKeycloakMajor(keycloakMajorVersionNumber);
|
472
|
-
if (!external_fs_.existsSync(filePath)) {
|
473
|
-
return getRealmJsonFilePath_defaultForKeycloakMajor(25);
|
474
|
-
}
|
475
|
-
return filePath;
|
476
|
-
})();
|
477
|
-
const users = JSON.parse(external_fs_.readFileSync(realmJsonFilePath_internal).toString("utf8")).users;
|
478
|
-
realm.users = users;
|
479
|
-
external_fs_.writeFileSync(realmJsonFilePath, JSON.stringify(realm, null, 2), "utf8");
|
480
|
-
}
|
481
|
-
async function extractThemeResourcesFromJar() {
|
482
|
-
await (0,extractArchive/* extractArchive */.N)({
|
483
|
-
archiveFilePath: jarFilePath,
|
484
|
-
onArchiveFile: async ({ relativeFilePathInArchive, writeFile }) => {
|
485
|
-
if ((0,isInside/* isInside */.V)({ dirPath: "theme", filePath: relativeFilePathInArchive })) {
|
486
|
-
await writeFile({
|
487
|
-
filePath: (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, relativeFilePathInArchive)
|
488
|
-
});
|
489
|
-
}
|
490
|
-
}
|
491
|
-
});
|
492
|
-
}
|
493
|
-
{
|
494
|
-
const destDirPath = (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, "theme");
|
495
|
-
if (await (0,fs_existsAsync/* existsAsync */.o)(destDirPath)) {
|
496
|
-
await (0,fs_rm.rm)(destDirPath, { recursive: true });
|
497
|
-
}
|
498
|
-
}
|
499
|
-
await extractThemeResourcesFromJar();
|
500
|
-
const jarFilePath_cacheDir = (0,external_path_.join)(buildContext.cacheDirPath, (0,external_path_.basename)(jarFilePath));
|
501
|
-
external_fs_.copyFileSync(jarFilePath, jarFilePath_cacheDir);
|
502
|
-
try {
|
503
|
-
external_child_process_.execSync(`docker rm --force ${constants/* CONTAINER_NAME */.sv}`, {
|
504
|
-
stdio: "ignore"
|
505
|
-
});
|
506
|
-
}
|
507
|
-
catch (_h) { }
|
508
|
-
const DEFAULT_PORT = 8080;
|
509
|
-
const port = (_c = (_b = cliCommandOptions.port) !== null && _b !== void 0 ? _b : buildContext.startKeycloakOptions.port) !== null && _c !== void 0 ? _c : DEFAULT_PORT;
|
510
|
-
const doStartDevServer = (() => {
|
511
|
-
const hasSpaUi = buildContext.implementedThemeTypes.admin.isImplemented ||
|
512
|
-
(buildContext.implementedThemeTypes.account.isImplemented &&
|
513
|
-
buildContext.implementedThemeTypes.account.type === "Single-Page");
|
514
|
-
if (!hasSpaUi) {
|
515
|
-
return false;
|
516
|
-
}
|
517
|
-
if (buildContext.bundler !== "vite") {
|
518
|
-
console.log(source_default().yellow([
|
519
|
-
`WARNING: Since you are using ${buildContext.bundler} instead of Vite,`,
|
520
|
-
`you'll have to wait serval seconds for the changes you made on your account or admin theme to be reflected in the browser.\n`,
|
521
|
-
`For a better development experience, consider migrating to Vite.`
|
522
|
-
].join(" ")));
|
523
|
-
return false;
|
524
|
-
}
|
525
|
-
if (keycloakMajorVersionNumber < 25) {
|
526
|
-
console.log(source_default().yellow([
|
527
|
-
`WARNING: Your account or admin theme can't be tested with hot module replacement on Keycloak ${keycloakMajorVersionNumber}.`,
|
528
|
-
`This mean that you'll have to wait serval seconds for the changes to be reflected in the browser.`,
|
529
|
-
`For a better development experience, select a more recent version of Keycloak.`
|
530
|
-
].join("\n")));
|
531
|
-
return false;
|
532
|
-
}
|
533
|
-
return true;
|
534
|
-
})();
|
535
|
-
let devServerPort = undefined;
|
536
|
-
if (doStartDevServer) {
|
537
|
-
const { port } = await startViteDevServer({ buildContext });
|
538
|
-
devServerPort = port;
|
539
|
-
}
|
540
|
-
const SPACE_PLACEHOLDER = "SPACE_PLACEHOLDER_xKLmdPd";
|
541
|
-
const dockerRunArgs = [
|
542
|
-
`-p${SPACE_PLACEHOLDER}${port}:8080`,
|
543
|
-
`--name${SPACE_PLACEHOLDER}${constants/* CONTAINER_NAME */.sv}`,
|
544
|
-
`-e${SPACE_PLACEHOLDER}KEYCLOAK_ADMIN=admin`,
|
545
|
-
`-e${SPACE_PLACEHOLDER}KEYCLOAK_ADMIN_PASSWORD=admin`,
|
546
|
-
...(devServerPort === undefined
|
547
|
-
? []
|
548
|
-
: [
|
549
|
-
`-e${SPACE_PLACEHOLDER}${constants/* KEYCLOAKIFY_SPA_DEV_SERVER_PORT */.Sz}=${devServerPort}`
|
550
|
-
]),
|
551
|
-
...(buildContext.startKeycloakOptions.dockerExtraArgs.length === 0
|
552
|
-
? []
|
553
|
-
: [
|
554
|
-
buildContext.startKeycloakOptions.dockerExtraArgs.join(SPACE_PLACEHOLDER)
|
555
|
-
]),
|
556
|
-
...(realmJsonFilePath === undefined
|
557
|
-
? []
|
558
|
-
: [
|
559
|
-
`-v${SPACE_PLACEHOLDER}"${realmJsonFilePath}":/opt/keycloak/data/import/myrealm-realm.json`
|
560
|
-
]),
|
561
|
-
`-v${SPACE_PLACEHOLDER}"${jarFilePath_cacheDir}":/opt/keycloak/providers/keycloak-theme.jar`,
|
562
|
-
...extensionJarFilePaths.map(jarFilePath => `-v${SPACE_PLACEHOLDER}"${jarFilePath}":/opt/keycloak/providers/${(0,external_path_.basename)(jarFilePath)}`),
|
563
|
-
...(keycloakMajorVersionNumber <= 20
|
564
|
-
? [`-e${SPACE_PLACEHOLDER}JAVA_OPTS=-Dkeycloak.profile=preview`]
|
565
|
-
: []),
|
566
|
-
...[
|
567
|
-
...buildContext.themeNames,
|
568
|
-
...(external_fs_.existsSync((0,external_path_.join)(buildContext.keycloakifyBuildDirPath, "theme", "account-v1"))
|
569
|
-
? ["account-v1"]
|
570
|
-
: [])
|
571
|
-
]
|
572
|
-
.map(themeName => ({
|
573
|
-
localDirPath: (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, "theme", themeName),
|
574
|
-
containerDirPath: `/opt/keycloak/themes/${themeName}`
|
575
|
-
}))
|
576
|
-
.map(({ localDirPath, containerDirPath }) => `-v${SPACE_PLACEHOLDER}"${localDirPath}":${containerDirPath}:rw`),
|
577
|
-
...buildContext.environmentVariables
|
578
|
-
.map(({ name }) => ({ name, envValue: process.env[name] }))
|
579
|
-
.map(({ name, envValue }) => envValue === undefined ? undefined : { name, envValue })
|
580
|
-
.filter((0,exclude/* exclude */.D)(undefined))
|
581
|
-
.map(({ name, envValue }) => `--env${SPACE_PLACEHOLDER}${name}='${envValue.replace(/'/g, "'\\''")}'`),
|
582
|
-
`${(_e = (_d = buildContext.startKeycloakOptions.dockerImage) === null || _d === void 0 ? void 0 : _d.reference) !== null && _e !== void 0 ? _e : "quay.io/keycloak/keycloak"}:${dockerImageTag}`,
|
583
|
-
"start-dev",
|
584
|
-
...(21 <= keycloakMajorVersionNumber && keycloakMajorVersionNumber < 24
|
585
|
-
? ["--features=declarative-user-profile"]
|
586
|
-
: []),
|
587
|
-
...(realmJsonFilePath === undefined ? [] : ["--import-realm"]),
|
588
|
-
...(buildContext.startKeycloakOptions.keycloakExtraArgs.length === 0
|
589
|
-
? []
|
590
|
-
: [
|
591
|
-
buildContext.startKeycloakOptions.keycloakExtraArgs.join(SPACE_PLACEHOLDER)
|
592
|
-
])
|
593
|
-
];
|
594
|
-
console.log(source_default().blue([
|
595
|
-
`$ docker run \\`,
|
596
|
-
...dockerRunArgs
|
597
|
-
.map(arg => arg.replace(new RegExp(SPACE_PLACEHOLDER, "g"), " "))
|
598
|
-
.map((line, i, arr) => ` ${line}${arr.length - 1 === i ? "" : " \\"}`)
|
599
|
-
].join("\n")));
|
600
|
-
const child = external_child_process_.spawn("docker", ["run", ...dockerRunArgs.map(line => line.split(SPACE_PLACEHOLDER)).flat()], { shell: true });
|
601
|
-
child.stdout.on("data", data => process.stdout.write(data));
|
602
|
-
child.stderr.on("data", data => process.stderr.write(data));
|
603
|
-
child.on("exit", process.exit);
|
604
|
-
const srcDirPath = (0,external_path_.join)(buildContext.projectDirPath, "src");
|
605
|
-
{
|
606
|
-
const kcHttpRelativePath = (() => {
|
607
|
-
const match = buildContext.startKeycloakOptions.dockerExtraArgs
|
608
|
-
.join(" ")
|
609
|
-
.match(/KC_HTTP_RELATIVE_PATH=([^ ]+)/);
|
610
|
-
if (match === null) {
|
611
|
-
return undefined;
|
612
|
-
}
|
613
|
-
return match[1];
|
614
|
-
})();
|
615
|
-
const handler = async (data) => {
|
616
|
-
if (!data.toString("utf8").includes("Listening on: http://0.0.0.0:8080")) {
|
617
|
-
return;
|
618
|
-
}
|
619
|
-
child.stdout.off("data", handler);
|
620
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
621
|
-
console.log([
|
622
|
-
"",
|
623
|
-
`The ftl files from ${source_default().bold(`.${external_path_.sep}${(0,external_path_.relative)(process.cwd(), (0,external_path_.join)(buildContext.keycloakifyBuildDirPath, "theme"))}`)} are mounted in the Keycloak container.`,
|
624
|
-
"",
|
625
|
-
`Keycloak Admin console: ${source_default().cyan.bold(`http://localhost:${port}${kcHttpRelativePath !== null && kcHttpRelativePath !== void 0 ? kcHttpRelativePath : ""}`)}`,
|
626
|
-
`- user: ${source_default().cyan.bold("admin")}`,
|
627
|
-
`- password: ${source_default().cyan.bold("admin")}`,
|
628
|
-
"",
|
629
|
-
"",
|
630
|
-
`${source_default().green("Your theme is accessible at:")}`,
|
631
|
-
`${source_default().green("➜")} ${source_default().cyan.bold((() => {
|
632
|
-
const url = new URL("https://my-theme.keycloakify.dev");
|
633
|
-
if (port !== DEFAULT_PORT) {
|
634
|
-
url.searchParams.set("port", `${port}`);
|
635
|
-
}
|
636
|
-
if (kcHttpRelativePath !== undefined) {
|
637
|
-
url.searchParams.set("kcHttpRelativePath", kcHttpRelativePath);
|
638
|
-
}
|
639
|
-
return url.href;
|
640
|
-
})())}`,
|
641
|
-
"",
|
642
|
-
"You can login with the following credentials:",
|
643
|
-
`- username: ${source_default().cyan.bold("testuser")}`,
|
644
|
-
`- password: ${source_default().cyan.bold("password123")}`,
|
645
|
-
"",
|
646
|
-
`Watching for changes in ${source_default().bold(`.${external_path_.sep}${(0,external_path_.relative)(process.cwd(), buildContext.projectDirPath)}`)}`
|
647
|
-
].join("\n"));
|
648
|
-
};
|
649
|
-
child.stdout.on("data", handler);
|
650
|
-
}
|
651
|
-
{
|
652
|
-
const runFullBuild = runExclusive.build(async () => {
|
653
|
-
console.log(source_default().cyan("Detected changes in the theme. Rebuilding ..."));
|
654
|
-
const { isAppBuildSuccess } = await appBuild({
|
655
|
-
buildContext
|
656
|
-
});
|
657
|
-
if (!isAppBuildSuccess) {
|
658
|
-
return;
|
659
|
-
}
|
660
|
-
const { isKeycloakifyBuildSuccess } = await keycloakifyBuild({
|
661
|
-
buildForKeycloakMajorVersionNumber: keycloakMajorVersionNumber,
|
662
|
-
buildContext
|
663
|
-
});
|
664
|
-
if (!isKeycloakifyBuildSuccess) {
|
665
|
-
return;
|
666
|
-
}
|
667
|
-
await extractThemeResourcesFromJar();
|
668
|
-
console.log(source_default().green("Theme rebuilt and updated in Keycloak."));
|
669
|
-
});
|
670
|
-
const { waitForDebounce } = (0,tools_waitForDebounce/* waitForDebounceFactory */.z)({ delay: 400 });
|
671
|
-
chokidar.watch([
|
672
|
-
srcDirPath,
|
673
|
-
buildContext.publicDirPath,
|
674
|
-
(0,external_path_.join)(buildContext.projectDirPath, "package.json"),
|
675
|
-
(0,external_path_.join)(buildContext.projectDirPath, "vite.config.ts"),
|
676
|
-
(0,external_path_.join)(buildContext.projectDirPath, "vite.config.js"),
|
677
|
-
(0,external_path_.join)(buildContext.projectDirPath, "index.html"),
|
678
|
-
(0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.e)(), "src")
|
679
|
-
], {
|
680
|
-
ignoreInitial: true
|
681
|
-
})
|
682
|
-
.on("all", async (...[, filePath]) => {
|
683
|
-
ignore_account_spa: {
|
684
|
-
const doImplementAccountSpa = buildContext.implementedThemeTypes.account.isImplemented &&
|
685
|
-
buildContext.implementedThemeTypes.account.type === "Single-Page";
|
686
|
-
if (!doImplementAccountSpa) {
|
687
|
-
break ignore_account_spa;
|
688
|
-
}
|
689
|
-
if (!(0,isInside/* isInside */.V)({
|
690
|
-
dirPath: (0,external_path_.join)(buildContext.themeSrcDirPath, "account"),
|
691
|
-
filePath
|
692
|
-
})) {
|
693
|
-
break ignore_account_spa;
|
694
|
-
}
|
695
|
-
return;
|
696
|
-
}
|
697
|
-
ignore_admin: {
|
698
|
-
if (!buildContext.implementedThemeTypes.admin.isImplemented) {
|
699
|
-
break ignore_admin;
|
700
|
-
}
|
701
|
-
if (!(0,isInside/* isInside */.V)({
|
702
|
-
dirPath: (0,external_path_.join)(buildContext.themeSrcDirPath, "admin"),
|
703
|
-
filePath
|
704
|
-
})) {
|
705
|
-
break ignore_admin;
|
706
|
-
}
|
707
|
-
return;
|
708
|
-
}
|
709
|
-
console.log(`Detected changes in ${filePath}`);
|
710
|
-
await waitForDebounce();
|
711
|
-
runFullBuild();
|
712
|
-
});
|
713
|
-
}
|
714
|
-
}
|
715
|
-
//# sourceMappingURL=start-keycloak.js.map
|
716
|
-
;// CONCATENATED MODULE: ./dist/bin/start-keycloak/index.js
|
717
|
-
|
718
|
-
//# sourceMappingURL=index.js.map
|
719
|
-
|
720
|
-
/***/ }),
|
721
|
-
|
722
|
-
/***/ 90665:
|
723
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
724
|
-
|
725
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
726
|
-
/* harmony export */ "V": () => (/* binding */ isInside)
|
727
|
-
/* harmony export */ });
|
728
|
-
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
|
729
|
-
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
|
730
|
-
|
731
|
-
function isInside(params) {
|
732
|
-
const { dirPath, filePath } = params;
|
733
|
-
return !(0,path__WEBPACK_IMPORTED_MODULE_0__.relative)(dirPath, filePath).startsWith("..");
|
734
|
-
}
|
735
|
-
//# sourceMappingURL=isInside.js.map
|
736
|
-
|
737
|
-
/***/ })
|
738
|
-
|
739
|
-
};
|
740
|
-
;
|