keycloakify 10.0.0-rc.43 → 10.0.0-rc.45

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.
Files changed (33) hide show
  1. package/bin/{322.index.js → 190.index.js} +58 -61
  2. package/bin/193.index.js +0 -51
  3. package/bin/3.index.js +83 -94
  4. package/bin/526.index.js +76 -48
  5. package/bin/538.index.js +7 -4
  6. package/bin/932.index.js +535 -1
  7. package/bin/98.index.js +5 -3
  8. package/bin/{944.index.js → 991.index.js} +74 -5
  9. package/bin/main.js +4 -16
  10. package/bin/shared/buildContext.d.ts +1 -1
  11. package/bin/shared/constants.d.ts +1 -1
  12. package/bin/shared/constants.js +1 -1
  13. package/bin/shared/constants.js.map +1 -1
  14. package/package.json +3 -6
  15. package/src/bin/keycloakify/buildJars/buildJar.ts +9 -21
  16. package/src/bin/keycloakify/buildJars/buildJars.ts +15 -4
  17. package/src/bin/keycloakify/generateSrcMainResources/bringInAccountV1.ts +6 -7
  18. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +11 -3
  19. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts +6 -18
  20. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +9 -15
  21. package/src/bin/keycloakify/keycloakify.ts +20 -9
  22. package/src/bin/main.ts +0 -14
  23. package/src/bin/shared/buildContext.ts +7 -3
  24. package/src/bin/shared/constants.ts +1 -1
  25. package/src/bin/shared/generateKcGenTs.ts +2 -1
  26. package/src/bin/shared/metaInfKeycloakThemes.ts +37 -14
  27. package/src/bin/start-keycloak/keycloakifyBuild.ts +4 -4
  28. package/src/bin/start-keycloak/start-keycloak.ts +57 -66
  29. package/src/vite-plugin/vite-plugin.ts +5 -1
  30. package/vite-plugin/index.js +8 -4
  31. package/bin/961.index.js +0 -263
  32. package/src/bin/download-keycloak-default-theme.ts +0 -63
  33. package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +0 -74
package/bin/961.index.js DELETED
@@ -1,263 +0,0 @@
1
- "use strict";
2
- exports.id = 961;
3
- exports.ids = [961];
4
- exports.modules = {
5
-
6
- /***/ 27961:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- __webpack_require__.r(__webpack_exports__);
10
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11
- /* harmony export */ "command": () => (/* binding */ command)
12
- /* harmony export */ });
13
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
14
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
15
- /* harmony import */ var _shared_promptKeycloakVersion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(95781);
16
- /* harmony import */ var _shared_buildContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(87751);
17
- /* harmony import */ var _shared_downloadKeycloakDefaultTheme__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(61804);
18
- /* harmony import */ var _tools_transformCodebase__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(60332);
19
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(78818);
20
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_5__);
21
-
22
-
23
-
24
-
25
-
26
-
27
- async function command(params) {
28
- const { cliCommandOptions } = params;
29
- const buildContext = (0,_shared_buildContext__WEBPACK_IMPORTED_MODULE_2__/* .getBuildContext */ .s)({
30
- cliCommandOptions
31
- });
32
- console.log(chalk__WEBPACK_IMPORTED_MODULE_5___default().cyan("Select the Keycloak version from which you want to download the builtins theme:"));
33
- const { keycloakVersion } = await (0,_shared_promptKeycloakVersion__WEBPACK_IMPORTED_MODULE_1__/* .promptKeycloakVersion */ .s)({
34
- startingFromMajor: undefined,
35
- cacheDirPath: buildContext.cacheDirPath
36
- });
37
- console.log(`→ ${keycloakVersion}`);
38
- const destDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(buildContext.keycloakifyBuildDirPath, "src", "main", "resources", "theme");
39
- console.log([
40
- `Downloading builtins theme of Keycloak ${keycloakVersion} here:`,
41
- `- ${chalk__WEBPACK_IMPORTED_MODULE_5___default().bold(`.${path__WEBPACK_IMPORTED_MODULE_0__.sep}${(0,path__WEBPACK_IMPORTED_MODULE_0__.join)((0,path__WEBPACK_IMPORTED_MODULE_0__.relative)(process.cwd(), destDirPath), "base")}`)}`,
42
- `- ${chalk__WEBPACK_IMPORTED_MODULE_5___default().bold(`.${path__WEBPACK_IMPORTED_MODULE_0__.sep}${(0,path__WEBPACK_IMPORTED_MODULE_0__.join)((0,path__WEBPACK_IMPORTED_MODULE_0__.relative)(process.cwd(), destDirPath), "keycloak")}`)}`
43
- ].join("\n"));
44
- const { defaultThemeDirPath } = await (0,_shared_downloadKeycloakDefaultTheme__WEBPACK_IMPORTED_MODULE_3__/* .downloadKeycloakDefaultTheme */ .x)({
45
- keycloakVersion,
46
- buildContext
47
- });
48
- (0,_tools_transformCodebase__WEBPACK_IMPORTED_MODULE_4__/* .transformCodebase */ .N)({
49
- srcDirPath: defaultThemeDirPath,
50
- destDirPath
51
- });
52
- console.log(chalk__WEBPACK_IMPORTED_MODULE_5___default().green(`✓ done`));
53
- }
54
- //# sourceMappingURL=download-keycloak-default-theme.js.map
55
-
56
- /***/ }),
57
-
58
- /***/ 95781:
59
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
60
-
61
-
62
- // EXPORTS
63
- __webpack_require__.d(__webpack_exports__, {
64
- "s": () => (/* binding */ promptKeycloakVersion)
65
- });
66
-
67
- ;// CONCATENATED MODULE: ./dist/bin/tools/octokit-addons/listTags.js
68
- var __await = (undefined && undefined.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
69
- var __asyncGenerator = (undefined && undefined.__asyncGenerator) || function (thisArg, _arguments, generator) {
70
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
71
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
72
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
73
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
74
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
75
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
76
- function fulfill(value) { resume("next", value); }
77
- function reject(value) { resume("throw", value); }
78
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
79
- };
80
- const per_page = 99;
81
- function listTagsFactory(params) {
82
- const { octokit } = params;
83
- const octokit_repo_listTags = async (params) => {
84
- return octokit.repos.listTags(params);
85
- };
86
- function listTags(params) {
87
- return __asyncGenerator(this, arguments, function* listTags_1() {
88
- const { owner, repo } = params;
89
- let page = 1;
90
- while (true) {
91
- const resp = yield __await(octokit_repo_listTags({
92
- owner,
93
- repo,
94
- per_page,
95
- page: page++
96
- }));
97
- for (const branch of resp.data.map(({ name }) => name)) {
98
- yield yield __await(branch);
99
- }
100
- if (resp.data.length < 99) {
101
- break;
102
- }
103
- }
104
- });
105
- }
106
- /** Returns the same "latest" tag as deno.land/x, not actually the latest though */
107
- async function getLatestTag(params) {
108
- const { owner, repo } = params;
109
- const itRes = await listTags({ owner, repo }).next();
110
- if (itRes.done) {
111
- return undefined;
112
- }
113
- return itRes.value;
114
- }
115
- return { listTags, getLatestTag };
116
- }
117
- //# sourceMappingURL=listTags.js.map
118
- // EXTERNAL MODULE: ./dist/bin/tools/SemVer.js
119
- var SemVer = __webpack_require__(12171);
120
- ;// CONCATENATED MODULE: ./dist/bin/tools/octokit-addons/getLatestsSemVersionedTag.js
121
- var __asyncValues = (undefined && undefined.__asyncValues) || function (o) {
122
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
123
- var m = o[Symbol.asyncIterator], i;
124
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
125
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
126
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
127
- };
128
-
129
-
130
- function getLatestsSemVersionedTagFactory(params) {
131
- const { octokit } = params;
132
- async function getLatestsSemVersionedTag(params) {
133
- var _a, e_1, _b, _c;
134
- const { owner, repo, count } = params;
135
- const semVersionedTags = [];
136
- const { listTags } = listTagsFactory({ octokit });
137
- try {
138
- for (var _d = true, _e = __asyncValues(listTags({ owner, repo })), _f; _f = await _e.next(), _a = _f.done, !_a;) {
139
- _c = _f.value;
140
- _d = false;
141
- try {
142
- const tag = _c;
143
- let version;
144
- try {
145
- version = SemVer/* SemVer.parse */.h.parse(tag.replace(/^[vV]?/, ""));
146
- }
147
- catch (_g) {
148
- continue;
149
- }
150
- if (version.rc !== undefined) {
151
- continue;
152
- }
153
- semVersionedTags.push({ tag, version });
154
- }
155
- finally {
156
- _d = true;
157
- }
158
- }
159
- }
160
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
161
- finally {
162
- try {
163
- if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
164
- }
165
- finally { if (e_1) throw e_1.error; }
166
- }
167
- return semVersionedTags
168
- .sort(({ version: vX }, { version: vY }) => SemVer/* SemVer.compare */.h.compare(vY, vX))
169
- .slice(0, count);
170
- }
171
- return { getLatestsSemVersionedTag };
172
- }
173
- //# sourceMappingURL=getLatestsSemVersionedTag.js.map
174
- // EXTERNAL MODULE: ./node_modules/@octokit/rest/dist-node/index.js
175
- var dist_node = __webpack_require__(55375);
176
- // EXTERNAL MODULE: ./node_modules/cli-select/dist/index.js
177
- var dist = __webpack_require__(99398);
178
- var dist_default = /*#__PURE__*/__webpack_require__.n(dist);
179
- // EXTERNAL MODULE: external "path"
180
- var external_path_ = __webpack_require__(71017);
181
- // EXTERNAL MODULE: external "fs"
182
- var external_fs_ = __webpack_require__(57147);
183
- // EXTERNAL MODULE: ./node_modules/tsafe/id.js
184
- var id = __webpack_require__(43047);
185
- ;// CONCATENATED MODULE: ./dist/bin/shared/promptKeycloakVersion.js
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
- async function promptKeycloakVersion(params) {
194
- const { startingFromMajor, cacheDirPath } = params;
195
- const { getLatestsSemVersionedTag } = (() => {
196
- const { octokit } = (() => {
197
- const githubToken = process.env.GITHUB_TOKEN;
198
- const octokit = new dist_node.Octokit(githubToken === undefined ? undefined : { auth: githubToken });
199
- return { octokit };
200
- })();
201
- const { getLatestsSemVersionedTag } = getLatestsSemVersionedTagFactory({
202
- octokit
203
- });
204
- return { getLatestsSemVersionedTag };
205
- })();
206
- const semVersionedTagByMajor = new Map();
207
- const semVersionedTags = await (async () => {
208
- const cacheFilePath = (0,external_path_.join)(cacheDirPath, "keycloak-versions.json");
209
- use_cache: {
210
- if (!external_fs_.existsSync(cacheFilePath)) {
211
- break use_cache;
212
- }
213
- const cache = JSON.parse(external_fs_.readFileSync(cacheFilePath).toString("utf8"));
214
- if (Date.now() - cache.time > 3600000) {
215
- external_fs_.unlinkSync(cacheFilePath);
216
- break use_cache;
217
- }
218
- return cache.semVersionedTags;
219
- }
220
- const semVersionedTags = await getLatestsSemVersionedTag({
221
- count: 50,
222
- owner: "keycloak",
223
- repo: "keycloak"
224
- });
225
- {
226
- const dirPath = (0,external_path_.dirname)(cacheFilePath);
227
- if (!external_fs_.existsSync(dirPath)) {
228
- external_fs_.mkdirSync(dirPath, { recursive: true });
229
- }
230
- }
231
- external_fs_.writeFileSync(cacheFilePath, JSON.stringify((0,id.id)({
232
- time: Date.now(),
233
- semVersionedTags
234
- }), null, 2));
235
- return semVersionedTags;
236
- })();
237
- semVersionedTags.forEach(semVersionedTag => {
238
- if (startingFromMajor !== undefined &&
239
- semVersionedTag.version.major < startingFromMajor) {
240
- return;
241
- }
242
- const currentSemVersionedTag = semVersionedTagByMajor.get(semVersionedTag.version.major);
243
- if (currentSemVersionedTag !== undefined &&
244
- SemVer/* SemVer.compare */.h.compare(semVersionedTag.version, currentSemVersionedTag.version) === -1) {
245
- return;
246
- }
247
- semVersionedTagByMajor.set(semVersionedTag.version.major, semVersionedTag);
248
- });
249
- const lastMajorVersions = Array.from(semVersionedTagByMajor.values()).map(({ tag }) => tag);
250
- const { value } = await dist_default()({
251
- values: lastMajorVersions
252
- }).catch(() => {
253
- process.exit(-1);
254
- });
255
- const keycloakVersion = value.split(" ")[0];
256
- return { keycloakVersion };
257
- }
258
- //# sourceMappingURL=promptKeycloakVersion.js.map
259
-
260
- /***/ })
261
-
262
- };
263
- ;
@@ -1,63 +0,0 @@
1
- import { join as pathJoin, relative as pathRelative, sep as pathSep } from "path";
2
- import { promptKeycloakVersion } from "./shared/promptKeycloakVersion";
3
- import { getBuildContext } from "./shared/buildContext";
4
- import { downloadKeycloakDefaultTheme } from "./shared/downloadKeycloakDefaultTheme";
5
- import { transformCodebase } from "./tools/transformCodebase";
6
- import type { CliCommandOptions } from "./main";
7
- import chalk from "chalk";
8
-
9
- export async function command(params: { cliCommandOptions: CliCommandOptions }) {
10
- const { cliCommandOptions } = params;
11
-
12
- const buildContext = getBuildContext({
13
- cliCommandOptions
14
- });
15
-
16
- console.log(
17
- chalk.cyan(
18
- "Select the Keycloak version from which you want to download the builtins theme:"
19
- )
20
- );
21
-
22
- const { keycloakVersion } = await promptKeycloakVersion({
23
- startingFromMajor: undefined,
24
- cacheDirPath: buildContext.cacheDirPath
25
- });
26
-
27
- console.log(`→ ${keycloakVersion}`);
28
-
29
- const destDirPath = pathJoin(
30
- buildContext.keycloakifyBuildDirPath,
31
- "src",
32
- "main",
33
- "resources",
34
- "theme"
35
- );
36
-
37
- console.log(
38
- [
39
- `Downloading builtins theme of Keycloak ${keycloakVersion} here:`,
40
- `- ${chalk.bold(
41
- `.${pathSep}${pathJoin(pathRelative(process.cwd(), destDirPath), "base")}`
42
- )}`,
43
- `- ${chalk.bold(
44
- `.${pathSep}${pathJoin(
45
- pathRelative(process.cwd(), destDirPath),
46
- "keycloak"
47
- )}`
48
- )}`
49
- ].join("\n")
50
- );
51
-
52
- const { defaultThemeDirPath } = await downloadKeycloakDefaultTheme({
53
- keycloakVersion,
54
- buildContext
55
- });
56
-
57
- transformCodebase({
58
- srcDirPath: defaultThemeDirPath,
59
- destDirPath
60
- });
61
-
62
- console.log(chalk.green(`✓ done`));
63
- }
@@ -1,74 +0,0 @@
1
- import * as fs from "fs";
2
- import {
3
- join as pathJoin,
4
- relative as pathRelative,
5
- basename as pathBasename
6
- } from "path";
7
- import { assert } from "tsafe/assert";
8
- import type { BuildContext } from "../shared/buildContext";
9
- import { accountV1ThemeName } from "../shared/constants";
10
-
11
- export type BuildContextLike = {
12
- keycloakifyBuildDirPath: string;
13
- themeNames: string[];
14
- };
15
-
16
- assert<BuildContext extends BuildContextLike ? true : false>();
17
-
18
- generateStartKeycloakTestingContainer.basename = "start_keycloak_testing_container.sh";
19
-
20
- const containerName = "keycloak-testing-container";
21
- const keycloakVersion = "24.0.4";
22
-
23
- /** Files for being able to run a hot reload keycloak container */
24
- export function generateStartKeycloakTestingContainer(params: {
25
- jarFilePath: string;
26
- doesImplementAccountTheme: boolean;
27
- buildContext: BuildContextLike;
28
- }) {
29
- const { jarFilePath, doesImplementAccountTheme, buildContext } = params;
30
-
31
- const themeRelativeDirPath = pathJoin("src", "main", "resources", "theme");
32
-
33
- fs.writeFileSync(
34
- pathJoin(
35
- buildContext.keycloakifyBuildDirPath,
36
- generateStartKeycloakTestingContainer.basename
37
- ),
38
- Buffer.from(
39
- [
40
- "#!/usr/bin/env bash",
41
- "",
42
- `docker rm ${containerName} || true`,
43
- "",
44
- `cd "${buildContext.keycloakifyBuildDirPath}"`,
45
- "",
46
- "docker run \\",
47
- " -p 8080:8080 \\",
48
- ` --name ${containerName} \\`,
49
- " -e KEYCLOAK_ADMIN=admin \\",
50
- " -e KEYCLOAK_ADMIN_PASSWORD=admin \\",
51
- ` -v "${pathJoin(
52
- "$(pwd)",
53
- pathRelative(buildContext.keycloakifyBuildDirPath, jarFilePath)
54
- )}":"/opt/keycloak/providers/${pathBasename(jarFilePath)}" \\`,
55
- [
56
- ...(doesImplementAccountTheme ? [accountV1ThemeName] : []),
57
- ...buildContext.themeNames
58
- ].map(
59
- themeName =>
60
- ` -v "${pathJoin(
61
- "$(pwd)",
62
- themeRelativeDirPath,
63
- themeName
64
- ).replace(/\\/g, "/")}":"/opt/keycloak/themes/${themeName}":rw \\`
65
- ),
66
- ` -it quay.io/keycloak/keycloak:${keycloakVersion} \\`,
67
- ` start-dev`,
68
- ""
69
- ].join("\n"),
70
- "utf8"
71
- ),
72
- { mode: 0o755 }
73
- );
74
- }