keycloakify 11.8.37-rc.1 → 11.8.37
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/712.index.js +12 -32
- package/bin/{783.index.js → 864.index.js} +1460 -2
- package/bin/930.index.js +29 -45
- package/bin/97.index.js +108 -145
- package/bin/keycloakify/generateResources/generateResources.d.ts +0 -1
- package/bin/main.js +3 -17
- package/bin/own.d.ts +0 -1
- package/bin/sync-extensions/extensionModuleMeta.d.ts +0 -1
- package/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.d.ts +0 -2
- package/bin/sync-extensions/managedGitignoreFile.d.ts +14 -0
- package/package.json +6 -5
- package/src/bin/keycloakify/generateResources/generateMessageProperties.ts +2 -1
- package/src/bin/keycloakify/generateResources/generateResources.ts +3 -43
- package/src/bin/main.ts +2 -19
- package/src/bin/own.ts +27 -60
- package/src/bin/sync-extensions/extensionModuleMeta.ts +41 -52
- package/src/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts +3 -11
- package/src/bin/sync-extensions/managedGitignoreFile.ts +136 -0
- package/src/bin/sync-extensions/sync-extension.ts +8 -21
- package/src/vite-plugin/vite-plugin.ts +1 -8
- package/vite-plugin/index.js +0 -5
- package/bin/sync-extensions/managedGitignoreFiles.d.ts +0 -29
- package/src/bin/sync-extensions/managedGitignoreFiles.ts +0 -189
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "keycloakify",
|
3
|
-
"version": "11.8.37
|
3
|
+
"version": "11.8.37",
|
4
4
|
"description": "Framework to create custom Keycloak UIs",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -717,7 +717,7 @@
|
|
717
717
|
"src/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts",
|
718
718
|
"src/bin/sync-extensions/index.ts",
|
719
719
|
"src/bin/sync-extensions/installExtensionModulesPeerDependencies.ts",
|
720
|
-
"src/bin/sync-extensions/
|
720
|
+
"src/bin/sync-extensions/managedGitignoreFile.ts",
|
721
721
|
"src/bin/sync-extensions/sync-extension.ts",
|
722
722
|
"src/bin/tools/SemVer.ts",
|
723
723
|
"src/bin/tools/String.prototype.replaceAll.ts",
|
@@ -1081,7 +1081,7 @@
|
|
1081
1081
|
"bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.d.ts",
|
1082
1082
|
"bin/sync-extensions/index.d.ts",
|
1083
1083
|
"bin/sync-extensions/installExtensionModulesPeerDependencies.d.ts",
|
1084
|
-
"bin/sync-extensions/
|
1084
|
+
"bin/sync-extensions/managedGitignoreFile.d.ts",
|
1085
1085
|
"bin/sync-extensions/sync-extension.d.ts",
|
1086
1086
|
"bin/tools/assertNoPnpmDlx.d.ts",
|
1087
1087
|
"bin/tools/canonicalStringify.d.ts",
|
@@ -1128,9 +1128,9 @@
|
|
1128
1128
|
"bin/712.index.js",
|
1129
1129
|
"bin/720.index.js",
|
1130
1130
|
"bin/780.index.js",
|
1131
|
-
"bin/783.index.js",
|
1132
1131
|
"bin/786.index.js",
|
1133
1132
|
"bin/84.index.js",
|
1133
|
+
"bin/864.index.js",
|
1134
1134
|
"bin/877.index.js",
|
1135
1135
|
"bin/910.index.js",
|
1136
1136
|
"bin/930.index.js",
|
@@ -1214,6 +1214,7 @@
|
|
1214
1214
|
"webpack": "5.93.0",
|
1215
1215
|
"webpack-cli": "5.1.4",
|
1216
1216
|
"yauzl": "^2.10.0",
|
1217
|
-
"zod": "^3.17.10"
|
1217
|
+
"zod": "^3.17.10",
|
1218
|
+
"json5": "^2.2.3"
|
1218
1219
|
}
|
1219
1220
|
}
|
@@ -12,6 +12,7 @@ import * as fs from "fs";
|
|
12
12
|
import { assert } from "tsafe/assert";
|
13
13
|
import type { BuildContext } from "../../shared/buildContext";
|
14
14
|
import { getAbsoluteAndInOsFormatPath } from "../../tools/getAbsoluteAndInOsFormatPath";
|
15
|
+
import JSON5 from "json5";
|
15
16
|
|
16
17
|
export type BuildContextLike = {
|
17
18
|
themeNames: string[];
|
@@ -74,7 +75,7 @@ export function generateMessageProperties(params: {
|
|
74
75
|
messagesJson += line;
|
75
76
|
}
|
76
77
|
|
77
|
-
const messages =
|
78
|
+
const messages = JSON5.parse(messagesJson) as Record<string, string>;
|
78
79
|
|
79
80
|
return [languageTag, messages];
|
80
81
|
})
|
@@ -37,7 +37,6 @@ import { createObjectThatThrowsIfAccessed } from "../../tools/createObjectThatTh
|
|
37
37
|
import { listInstalledModules } from "../../tools/listInstalledModules";
|
38
38
|
import { isInside } from "../../tools/isInside";
|
39
39
|
import { id } from "tsafe/id";
|
40
|
-
import { KEYCLOAK_THEME } from "../../shared/constants";
|
41
40
|
|
42
41
|
export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode &
|
43
42
|
BuildContextLike_generateMessageProperties & {
|
@@ -45,7 +44,6 @@ export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode &
|
|
45
44
|
extraThemeProperties: string[] | undefined;
|
46
45
|
projectDirPath: string;
|
47
46
|
projectBuildDirPath: string;
|
48
|
-
publicDirPath: string;
|
49
47
|
environmentVariables: { name: string; default: string }[];
|
50
48
|
implementedThemeTypes: BuildContext["implementedThemeTypes"];
|
51
49
|
themeSrcDirPath: string;
|
@@ -155,14 +153,10 @@ export async function generateResources(params: {
|
|
155
153
|
break apply_replacers_and_move_to_theme_resources;
|
156
154
|
}
|
157
155
|
|
158
|
-
|
159
|
-
KEYCLOAK_THEME,
|
160
|
-
// NOTE: This is legacy and should eventually be removed
|
161
|
-
WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES
|
162
|
-
]) {
|
156
|
+
{
|
163
157
|
const dirPath = pathJoin(
|
164
158
|
buildContext.projectBuildDirPath,
|
165
|
-
|
159
|
+
WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES
|
166
160
|
);
|
167
161
|
|
168
162
|
if (fs.existsSync(dirPath)) {
|
@@ -170,7 +164,7 @@ export async function generateResources(params: {
|
|
170
164
|
|
171
165
|
throw new Error(
|
172
166
|
[
|
173
|
-
`Keycloakify build error: The ${
|
167
|
+
`Keycloakify build error: The ${WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES} directory shouldn't exist in your build directory.`,
|
174
168
|
`(${pathRelative(process.cwd(), dirPath)}).\n`,
|
175
169
|
`Theses assets are only required for local development with Storybook.",
|
176
170
|
"Please remove this directory as an additional step of your command.\n`,
|
@@ -575,7 +569,6 @@ export async function generateResources(params: {
|
|
575
569
|
};
|
576
570
|
}
|
577
571
|
|
578
|
-
// NOTE: Legacy
|
579
572
|
keycloak_static_resources: {
|
580
573
|
if (isNative) {
|
581
574
|
break keycloak_static_resources;
|
@@ -585,8 +578,6 @@ export async function generateResources(params: {
|
|
585
578
|
break keycloak_static_resources;
|
586
579
|
}
|
587
580
|
|
588
|
-
// TODO: Implement a check to skip that.
|
589
|
-
|
590
581
|
transformCodebase({
|
591
582
|
srcDirPath: pathJoin(
|
592
583
|
getThisCodebaseRootDirPath(),
|
@@ -599,37 +590,6 @@ export async function generateResources(params: {
|
|
599
590
|
});
|
600
591
|
}
|
601
592
|
|
602
|
-
extensions_static_resources: {
|
603
|
-
if (isNative) {
|
604
|
-
break extensions_static_resources;
|
605
|
-
}
|
606
|
-
|
607
|
-
if (isSpa) {
|
608
|
-
break extensions_static_resources;
|
609
|
-
}
|
610
|
-
|
611
|
-
const dirPath = pathJoin(
|
612
|
-
buildContext.publicDirPath,
|
613
|
-
KEYCLOAK_THEME,
|
614
|
-
themeType
|
615
|
-
);
|
616
|
-
|
617
|
-
if (!fs.existsSync(dirPath)) {
|
618
|
-
break extensions_static_resources;
|
619
|
-
}
|
620
|
-
|
621
|
-
transformCodebase({
|
622
|
-
srcDirPath: dirPath,
|
623
|
-
destDirPath: pathJoin(
|
624
|
-
themeTypeDirPath,
|
625
|
-
"resources",
|
626
|
-
WELL_KNOWN_DIRECTORY_BASE_NAME.DIST,
|
627
|
-
KEYCLOAK_THEME,
|
628
|
-
themeType
|
629
|
-
)
|
630
|
-
});
|
631
|
-
}
|
632
|
-
|
633
593
|
bring_in_account_v1: {
|
634
594
|
if (isNative) {
|
635
595
|
break bring_in_account_v1;
|
package/src/bin/main.ts
CHANGED
@@ -281,7 +281,6 @@ program
|
|
281
281
|
.command<{
|
282
282
|
path: string;
|
283
283
|
revert: boolean;
|
284
|
-
public: boolean;
|
285
284
|
}>({
|
286
285
|
name: "own",
|
287
286
|
description: [
|
@@ -332,30 +331,14 @@ program
|
|
332
331
|
].join(" "),
|
333
332
|
defaultValue: false
|
334
333
|
})
|
335
|
-
.option({
|
336
|
-
key: "public",
|
337
|
-
name: (() => {
|
338
|
-
const long = "public";
|
339
|
-
const short = "p";
|
340
|
-
|
341
|
-
optionsKeys.push(long, short);
|
342
|
-
|
343
|
-
return { long, short };
|
344
|
-
})(),
|
345
|
-
description: [
|
346
|
-
"Flag to use when targeting a file or directory in the public directory",
|
347
|
-
"instead of the src"
|
348
|
-
].join(" "),
|
349
|
-
defaultValue: false
|
350
|
-
})
|
351
334
|
.task({
|
352
335
|
skip,
|
353
|
-
handler: async ({ projectDirPath, path, revert
|
336
|
+
handler: async ({ projectDirPath, path, revert }) => {
|
354
337
|
const { command } = await import("./own");
|
355
338
|
|
356
339
|
await command({
|
357
340
|
buildContext: getBuildContext({ projectDirPath }),
|
358
|
-
cliCommandOptions: { path, isRevert: revert
|
341
|
+
cliCommandOptions: { path, isRevert: revert }
|
359
342
|
});
|
360
343
|
}
|
361
344
|
});
|
package/src/bin/own.ts
CHANGED
@@ -3,17 +3,15 @@ import { getExtensionModuleFileSourceCodeReadyToBeCopied } from "./sync-extensio
|
|
3
3
|
import type { ExtensionModuleMeta } from "./sync-extensions/extensionModuleMeta";
|
4
4
|
import { command as command_syncExtensions } from "./sync-extensions/sync-extension";
|
5
5
|
import {
|
6
|
-
|
7
|
-
|
8
|
-
} from "./sync-extensions/
|
6
|
+
readManagedGitignoreFile,
|
7
|
+
writeManagedGitignoreFile
|
8
|
+
} from "./sync-extensions/managedGitignoreFile";
|
9
9
|
import { getExtensionModuleMetas } from "./sync-extensions/extensionModuleMeta";
|
10
10
|
import { getAbsoluteAndInOsFormatPath } from "./tools/getAbsoluteAndInOsFormatPath";
|
11
11
|
import { relative as pathRelative, dirname as pathDirname, join as pathJoin } from "path";
|
12
12
|
import { getInstalledModuleDirPath } from "./tools/getInstalledModuleDirPath";
|
13
13
|
import * as fsPr from "fs/promises";
|
14
14
|
import { isInside } from "./tools/isInside";
|
15
|
-
import { KEYCLOAK_THEME } from "./shared/constants";
|
16
|
-
import { same } from "evt/tools/inDepth/same";
|
17
15
|
import chalk from "chalk";
|
18
16
|
|
19
17
|
export async function command(params: {
|
@@ -21,7 +19,6 @@ export async function command(params: {
|
|
21
19
|
cliCommandOptions: {
|
22
20
|
path: string;
|
23
21
|
isRevert: boolean;
|
24
|
-
isPublic: boolean;
|
25
22
|
};
|
26
23
|
}) {
|
27
24
|
const { buildContext, cliCommandOptions } = params;
|
@@ -29,34 +26,27 @@ export async function command(params: {
|
|
29
26
|
const extensionModuleMetas = await getExtensionModuleMetas({ buildContext });
|
30
27
|
|
31
28
|
const { targetFileRelativePathsByExtensionModuleMeta } = await (async () => {
|
32
|
-
const fileOrDirectoryRelativePath = (
|
33
|
-
|
34
|
-
|
35
|
-
: buildContext.themeSrcDirPath
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
getAbsoluteAndInOsFormatPath({
|
40
|
-
cwd: dirPath_ctx,
|
41
|
-
pathIsh: cliCommandOptions.path
|
42
|
-
})
|
43
|
-
);
|
44
|
-
})();
|
29
|
+
const fileOrDirectoryRelativePath = pathRelative(
|
30
|
+
buildContext.themeSrcDirPath,
|
31
|
+
getAbsoluteAndInOsFormatPath({
|
32
|
+
cwd: buildContext.themeSrcDirPath,
|
33
|
+
pathIsh: cliCommandOptions.path
|
34
|
+
})
|
35
|
+
);
|
45
36
|
|
46
37
|
const arr = extensionModuleMetas
|
47
38
|
.map(extensionModuleMeta => ({
|
48
39
|
extensionModuleMeta,
|
49
40
|
fileRelativePaths: extensionModuleMeta.files
|
41
|
+
.map(({ fileRelativePath }) => fileRelativePath)
|
50
42
|
.filter(
|
51
|
-
|
52
|
-
|
53
|
-
(
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}))
|
43
|
+
fileRelativePath =>
|
44
|
+
fileRelativePath === fileOrDirectoryRelativePath ||
|
45
|
+
isInside({
|
46
|
+
dirPath: fileOrDirectoryRelativePath,
|
47
|
+
filePath: fileRelativePath
|
48
|
+
})
|
58
49
|
)
|
59
|
-
.map(({ fileRelativePath }) => fileRelativePath)
|
60
50
|
}))
|
61
51
|
.filter(({ fileRelativePaths }) => fileRelativePaths.length !== 0);
|
62
52
|
|
@@ -85,13 +75,12 @@ export async function command(params: {
|
|
85
75
|
}
|
86
76
|
|
87
77
|
const { ownedFilesRelativePaths: ownedFilesRelativePaths_current } =
|
88
|
-
await
|
78
|
+
await readManagedGitignoreFile({
|
89
79
|
buildContext
|
90
80
|
});
|
91
81
|
|
92
82
|
await (cliCommandOptions.isRevert ? command_revert : command_own)({
|
93
83
|
extensionModuleMetas,
|
94
|
-
isPublic: cliCommandOptions.isPublic,
|
95
84
|
targetFileRelativePathsByExtensionModuleMeta,
|
96
85
|
ownedFilesRelativePaths_current,
|
97
86
|
buildContext
|
@@ -100,22 +89,20 @@ export async function command(params: {
|
|
100
89
|
|
101
90
|
type Params_subcommands = {
|
102
91
|
extensionModuleMetas: ExtensionModuleMeta[];
|
103
|
-
isPublic: boolean;
|
104
92
|
targetFileRelativePathsByExtensionModuleMeta: Map<ExtensionModuleMeta, string[]>;
|
105
|
-
ownedFilesRelativePaths_current:
|
93
|
+
ownedFilesRelativePaths_current: string[];
|
106
94
|
buildContext: BuildContext;
|
107
95
|
};
|
108
96
|
|
109
97
|
async function command_own(params: Params_subcommands) {
|
110
98
|
const {
|
111
99
|
extensionModuleMetas,
|
112
|
-
isPublic,
|
113
100
|
targetFileRelativePathsByExtensionModuleMeta,
|
114
101
|
ownedFilesRelativePaths_current,
|
115
102
|
buildContext
|
116
103
|
} = params;
|
117
104
|
|
118
|
-
await
|
105
|
+
await writeManagedGitignoreFile({
|
119
106
|
buildContext,
|
120
107
|
extensionModuleMetas,
|
121
108
|
ownedFilesRelativePaths: [
|
@@ -124,11 +111,8 @@ async function command_own(params: Params_subcommands) {
|
|
124
111
|
.flat()
|
125
112
|
.filter(
|
126
113
|
fileRelativePath =>
|
127
|
-
!ownedFilesRelativePaths_current.
|
128
|
-
same(entry, { isPublic, fileRelativePath })
|
129
|
-
)
|
114
|
+
!ownedFilesRelativePaths_current.includes(fileRelativePath)
|
130
115
|
)
|
131
|
-
.map(fileRelativePath => ({ isPublic, fileRelativePath }))
|
132
116
|
]
|
133
117
|
});
|
134
118
|
|
@@ -144,11 +128,7 @@ async function command_own(params: Params_subcommands) {
|
|
144
128
|
});
|
145
129
|
|
146
130
|
for (const fileRelativePath of fileRelativePaths) {
|
147
|
-
if (
|
148
|
-
ownedFilesRelativePaths_current.some(entry =>
|
149
|
-
same(entry, { isPublic, fileRelativePath })
|
150
|
-
)
|
151
|
-
) {
|
131
|
+
if (ownedFilesRelativePaths_current.includes(fileRelativePath)) {
|
152
132
|
console.log(
|
153
133
|
chalk.grey(`You already have ownership over '${fileRelativePath}'.`)
|
154
134
|
);
|
@@ -158,7 +138,6 @@ async function command_own(params: Params_subcommands) {
|
|
158
138
|
writeActions.push(async () => {
|
159
139
|
const sourceCode = await getExtensionModuleFileSourceCodeReadyToBeCopied({
|
160
140
|
buildContext,
|
161
|
-
isPublic,
|
162
141
|
fileRelativePath,
|
163
142
|
isOwnershipAction: true,
|
164
143
|
extensionModuleName: extensionModuleMeta.moduleName,
|
@@ -167,12 +146,7 @@ async function command_own(params: Params_subcommands) {
|
|
167
146
|
});
|
168
147
|
|
169
148
|
await fsPr.writeFile(
|
170
|
-
pathJoin(
|
171
|
-
isPublic
|
172
|
-
? pathJoin(buildContext.publicDirPath, KEYCLOAK_THEME)
|
173
|
-
: buildContext.themeSrcDirPath,
|
174
|
-
fileRelativePath
|
175
|
-
),
|
149
|
+
pathJoin(buildContext.themeSrcDirPath, fileRelativePath),
|
176
150
|
sourceCode
|
177
151
|
);
|
178
152
|
|
@@ -192,7 +166,6 @@ async function command_own(params: Params_subcommands) {
|
|
192
166
|
async function command_revert(params: Params_subcommands) {
|
193
167
|
const {
|
194
168
|
extensionModuleMetas,
|
195
|
-
isPublic,
|
196
169
|
targetFileRelativePathsByExtensionModuleMeta,
|
197
170
|
ownedFilesRelativePaths_current,
|
198
171
|
buildContext
|
@@ -203,11 +176,7 @@ async function command_revert(params: Params_subcommands) {
|
|
203
176
|
)
|
204
177
|
.flat()
|
205
178
|
.filter(fileRelativePath => {
|
206
|
-
if (
|
207
|
-
!ownedFilesRelativePaths_current.some(entry =>
|
208
|
-
same(entry, { isPublic, fileRelativePath })
|
209
|
-
)
|
210
|
-
) {
|
179
|
+
if (!ownedFilesRelativePaths_current.includes(fileRelativePath)) {
|
211
180
|
console.log(
|
212
181
|
chalk.grey(`Ownership over '${fileRelativePath}' wasn't claimed.`)
|
213
182
|
);
|
@@ -226,14 +195,12 @@ async function command_revert(params: Params_subcommands) {
|
|
226
195
|
return;
|
227
196
|
}
|
228
197
|
|
229
|
-
await
|
198
|
+
await writeManagedGitignoreFile({
|
230
199
|
buildContext,
|
231
200
|
extensionModuleMetas,
|
232
201
|
ownedFilesRelativePaths: ownedFilesRelativePaths_current.filter(
|
233
|
-
|
234
|
-
!ownedFilesRelativePaths_toRemove.
|
235
|
-
same(entry, { isPublic, fileRelativePath })
|
236
|
-
)
|
202
|
+
fileRelativePath =>
|
203
|
+
!ownedFilesRelativePaths_toRemove.includes(fileRelativePath)
|
237
204
|
)
|
238
205
|
});
|
239
206
|
|
@@ -1,12 +1,7 @@
|
|
1
1
|
import { assert, type Equals, is } from "tsafe/assert";
|
2
2
|
import { id } from "tsafe/id";
|
3
3
|
import { z } from "zod";
|
4
|
-
import {
|
5
|
-
join as pathJoin,
|
6
|
-
dirname as pathDirname,
|
7
|
-
relative as pathRelative,
|
8
|
-
sep as pathSep
|
9
|
-
} from "path";
|
4
|
+
import { join as pathJoin, dirname as pathDirname } from "path";
|
10
5
|
import * as fsPr from "fs/promises";
|
11
6
|
import type { BuildContext } from "../shared/buildContext";
|
12
7
|
import { existsAsync } from "../tools/fs.existsAsync";
|
@@ -27,7 +22,6 @@ export type ExtensionModuleMeta = {
|
|
27
22
|
moduleName: string;
|
28
23
|
version: string;
|
29
24
|
files: {
|
30
|
-
isPublic: boolean;
|
31
25
|
fileRelativePath: string;
|
32
26
|
hash: string;
|
33
27
|
copyableFilePath: string;
|
@@ -43,7 +37,6 @@ const zExtensionModuleMeta = (() => {
|
|
43
37
|
version: z.string(),
|
44
38
|
files: z.array(
|
45
39
|
z.object({
|
46
|
-
isPublic: z.boolean(),
|
47
40
|
fileRelativePath: z.string(),
|
48
41
|
hash: z.string(),
|
49
42
|
copyableFilePath: z.string()
|
@@ -229,53 +222,49 @@ export async function getExtensionModuleMetas(params: {
|
|
229
222
|
|
230
223
|
const files: ExtensionModuleMeta["files"] = [];
|
231
224
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
if (!(await existsAsync(dirPath))) {
|
265
|
-
await fsPr.mkdir(dirPath, { recursive: true });
|
225
|
+
{
|
226
|
+
const srcDirPath = pathJoin(dirPath, KEYCLOAK_THEME);
|
227
|
+
|
228
|
+
await crawlAsync({
|
229
|
+
dirPath: srcDirPath,
|
230
|
+
returnedPathsType: "relative to dirPath",
|
231
|
+
onFileFound: async fileRelativePath => {
|
232
|
+
const sourceCode =
|
233
|
+
await getExtensionModuleFileSourceCodeReadyToBeCopied({
|
234
|
+
buildContext,
|
235
|
+
fileRelativePath,
|
236
|
+
isOwnershipAction: false,
|
237
|
+
extensionModuleDirPath: dirPath,
|
238
|
+
extensionModuleName: moduleName,
|
239
|
+
extensionModuleVersion: version
|
240
|
+
});
|
241
|
+
|
242
|
+
const hash = computeHash(sourceCode);
|
243
|
+
|
244
|
+
const copyableFilePath = pathJoin(
|
245
|
+
pathDirname(cacheFilePath),
|
246
|
+
KEYCLOAK_THEME,
|
247
|
+
fileRelativePath
|
248
|
+
);
|
249
|
+
|
250
|
+
{
|
251
|
+
const dirPath = pathDirname(copyableFilePath);
|
252
|
+
|
253
|
+
if (!(await existsAsync(dirPath))) {
|
254
|
+
await fsPr.mkdir(dirPath, { recursive: true });
|
255
|
+
}
|
266
256
|
}
|
267
|
-
}
|
268
257
|
|
269
|
-
|
258
|
+
fsPr.writeFile(copyableFilePath, sourceCode);
|
270
259
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
}
|
277
|
-
}
|
278
|
-
}
|
260
|
+
files.push({
|
261
|
+
fileRelativePath,
|
262
|
+
hash,
|
263
|
+
copyableFilePath
|
264
|
+
});
|
265
|
+
}
|
266
|
+
});
|
267
|
+
}
|
279
268
|
|
280
269
|
return id<ExtensionModuleMeta>({
|
281
270
|
moduleName,
|
@@ -7,14 +7,12 @@ import { KEYCLOAK_THEME } from "../shared/constants";
|
|
7
7
|
|
8
8
|
export type BuildContextLike = {
|
9
9
|
themeSrcDirPath: string;
|
10
|
-
publicDirPath: string;
|
11
10
|
};
|
12
11
|
|
13
12
|
assert<BuildContext extends BuildContextLike ? true : false>();
|
14
13
|
|
15
14
|
export async function getExtensionModuleFileSourceCodeReadyToBeCopied(params: {
|
16
15
|
buildContext: BuildContextLike;
|
17
|
-
isPublic: boolean;
|
18
16
|
fileRelativePath: string;
|
19
17
|
isOwnershipAction: boolean;
|
20
18
|
extensionModuleDirPath: string;
|
@@ -24,7 +22,6 @@ export async function getExtensionModuleFileSourceCodeReadyToBeCopied(params: {
|
|
24
22
|
const {
|
25
23
|
buildContext,
|
26
24
|
extensionModuleDirPath,
|
27
|
-
isPublic,
|
28
25
|
fileRelativePath,
|
29
26
|
isOwnershipAction,
|
30
27
|
extensionModuleName,
|
@@ -64,12 +61,12 @@ export async function getExtensionModuleFileSourceCodeReadyToBeCopied(params: {
|
|
64
61
|
`This file has been claimed for ownership from ${extensionModuleName} version ${extensionModuleVersion}.`,
|
65
62
|
`To relinquish ownership and restore this file to its original content, run the following command:`,
|
66
63
|
``,
|
67
|
-
`$ npx keycloakify own --path "${path}"
|
64
|
+
`$ npx keycloakify own --path "${path}" --revert`
|
68
65
|
]
|
69
66
|
: [
|
70
67
|
`WARNING: Before modifying this file, run the following command:`,
|
71
68
|
``,
|
72
|
-
`$ npx keycloakify own --path "${path}"
|
69
|
+
`$ npx keycloakify own --path "${path}"`,
|
73
70
|
``,
|
74
71
|
`This file is provided by ${extensionModuleName} version ${extensionModuleVersion}.`,
|
75
72
|
`It was copied into your repository by the postinstall script: \`keycloakify sync-extensions\`.`
|
@@ -77,12 +74,7 @@ export async function getExtensionModuleFileSourceCodeReadyToBeCopied(params: {
|
|
77
74
|
})()
|
78
75
|
});
|
79
76
|
|
80
|
-
const destFilePath = pathJoin(
|
81
|
-
isPublic
|
82
|
-
? pathJoin(buildContext.publicDirPath, KEYCLOAK_THEME)
|
83
|
-
: buildContext.themeSrcDirPath,
|
84
|
-
fileRelativePath
|
85
|
-
);
|
77
|
+
const destFilePath = pathJoin(buildContext.themeSrcDirPath, fileRelativePath);
|
86
78
|
|
87
79
|
format: {
|
88
80
|
if (!(await getIsPrettierAvailable())) {
|