keycloakify 11.8.36 → 11.8.37-rc.1
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 +26 -3
- package/bin/930.index.js +45 -29
- package/bin/97.index.js +145 -108
- package/bin/keycloakify/generateResources/generateResources.d.ts +1 -0
- package/bin/main.js +16 -2
- package/bin/own.d.ts +1 -0
- package/bin/sync-extensions/extensionModuleMeta.d.ts +1 -0
- package/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.d.ts +2 -0
- package/bin/sync-extensions/managedGitignoreFiles.d.ts +29 -0
- package/package.json +3 -3
- package/src/bin/keycloakify/generateResources/generateResources.ts +43 -3
- package/src/bin/main.ts +19 -2
- package/src/bin/own.ts +60 -27
- package/src/bin/sync-extensions/extensionModuleMeta.ts +52 -41
- package/src/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts +11 -3
- package/src/bin/sync-extensions/managedGitignoreFiles.ts +189 -0
- package/src/bin/sync-extensions/sync-extension.ts +21 -8
- package/src/vite-plugin/vite-plugin.ts +8 -1
- package/vite-plugin/index.js +5 -0
- package/bin/sync-extensions/managedGitignoreFile.d.ts +0 -14
- package/src/bin/sync-extensions/managedGitignoreFile.ts +0 -136
package/bin/712.index.js
CHANGED
@@ -846,6 +846,7 @@ var isInside = __webpack_require__(90665);
|
|
846
846
|
|
847
847
|
|
848
848
|
|
849
|
+
|
849
850
|
|
850
851
|
(0,assert/* assert */.h)();
|
851
852
|
async function generateResources(params) {
|
@@ -907,12 +908,16 @@ async function generateResources(params) {
|
|
907
908
|
});
|
908
909
|
break apply_replacers_and_move_to_theme_resources;
|
909
910
|
}
|
910
|
-
|
911
|
-
|
911
|
+
for (const directoryBasename of [
|
912
|
+
constants/* KEYCLOAK_THEME */.PC,
|
913
|
+
// NOTE: This is legacy and should eventually be removed
|
914
|
+
constants/* WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES */.Ju.KEYCLOAKIFY_DEV_RESOURCES
|
915
|
+
]) {
|
916
|
+
const dirPath = (0,external_path_.join)(buildContext.projectBuildDirPath, directoryBasename);
|
912
917
|
if (external_fs_default().existsSync(dirPath)) {
|
913
918
|
(0,assert/* assert */.h)(buildContext.bundler === "webpack");
|
914
919
|
throw new Error([
|
915
|
-
`Keycloakify build error: The ${
|
920
|
+
`Keycloakify build error: The ${directoryBasename} directory shouldn't exist in your build directory.`,
|
916
921
|
`(${(0,external_path_.relative)(process.cwd(), dirPath)}).\n`,
|
917
922
|
`Theses assets are only required for local development with Storybook.",
|
918
923
|
"Please remove this directory as an additional step of your command.\n`,
|
@@ -1173,6 +1178,7 @@ async function generateResources(params) {
|
|
1173
1178
|
});
|
1174
1179
|
};
|
1175
1180
|
}
|
1181
|
+
// NOTE: Legacy
|
1176
1182
|
keycloak_static_resources: {
|
1177
1183
|
if (isNative) {
|
1178
1184
|
break keycloak_static_resources;
|
@@ -1180,11 +1186,28 @@ async function generateResources(params) {
|
|
1180
1186
|
if (isSpa) {
|
1181
1187
|
break keycloak_static_resources;
|
1182
1188
|
}
|
1189
|
+
// TODO: Implement a check to skip that.
|
1183
1190
|
(0,transformCodebase/* transformCodebase */.N)({
|
1184
1191
|
srcDirPath: (0,external_path_.join)((0,getThisCodebaseRootDirPath/* getThisCodebaseRootDirPath */.e)(), "res", "public", constants/* WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES */.Ju.KEYCLOAKIFY_DEV_RESOURCES, themeType),
|
1185
1192
|
destDirPath: (0,external_path_.join)(themeTypeDirPath, "resources")
|
1186
1193
|
});
|
1187
1194
|
}
|
1195
|
+
extensions_static_resources: {
|
1196
|
+
if (isNative) {
|
1197
|
+
break extensions_static_resources;
|
1198
|
+
}
|
1199
|
+
if (isSpa) {
|
1200
|
+
break extensions_static_resources;
|
1201
|
+
}
|
1202
|
+
const dirPath = (0,external_path_.join)(buildContext.publicDirPath, constants/* KEYCLOAK_THEME */.PC, themeType);
|
1203
|
+
if (!external_fs_default().existsSync(dirPath)) {
|
1204
|
+
break extensions_static_resources;
|
1205
|
+
}
|
1206
|
+
(0,transformCodebase/* transformCodebase */.N)({
|
1207
|
+
srcDirPath: dirPath,
|
1208
|
+
destDirPath: (0,external_path_.join)(themeTypeDirPath, "resources", constants/* WELL_KNOWN_DIRECTORY_BASE_NAME.DIST */.Ju.DIST, constants/* KEYCLOAK_THEME */.PC, themeType)
|
1209
|
+
});
|
1210
|
+
}
|
1188
1211
|
bring_in_account_v1: {
|
1189
1212
|
if (isNative) {
|
1190
1213
|
break bring_in_account_v1;
|
package/bin/930.index.js
CHANGED
@@ -12,7 +12,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
12
12
|
/* harmony export */ });
|
13
13
|
/* harmony import */ var _sync_extensions_getExtensionModuleFileSourceCodeReadyToBeCopied__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2237);
|
14
14
|
/* harmony import */ var _sync_extensions_sync_extension__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(91097);
|
15
|
-
/* harmony import */ var
|
15
|
+
/* harmony import */ var _sync_extensions_managedGitignoreFiles__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(86087);
|
16
16
|
/* harmony import */ var _sync_extensions_extensionModuleMeta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(77372);
|
17
17
|
/* harmony import */ var _tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84794);
|
18
18
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(71017);
|
@@ -21,8 +21,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
21
21
|
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(73292);
|
22
22
|
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_7__);
|
23
23
|
/* harmony import */ var _tools_isInside__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(90665);
|
24
|
-
/* harmony import */ var
|
25
|
-
/* harmony import */ var
|
24
|
+
/* harmony import */ var _shared_constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(173);
|
25
|
+
/* harmony import */ var evt_tools_inDepth_same__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(33805);
|
26
|
+
/* harmony import */ var evt_tools_inDepth_same__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(evt_tools_inDepth_same__WEBPACK_IMPORTED_MODULE_10__);
|
27
|
+
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(78818);
|
28
|
+
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_11__);
|
29
|
+
|
30
|
+
|
26
31
|
|
27
32
|
|
28
33
|
|
@@ -37,20 +42,26 @@ async function command(params) {
|
|
37
42
|
const { buildContext, cliCommandOptions } = params;
|
38
43
|
const extensionModuleMetas = await (0,_sync_extensions_extensionModuleMeta__WEBPACK_IMPORTED_MODULE_3__/* .getExtensionModuleMetas */ .f)({ buildContext });
|
39
44
|
const { targetFileRelativePathsByExtensionModuleMeta } = await (async () => {
|
40
|
-
const fileOrDirectoryRelativePath = (
|
41
|
-
|
42
|
-
|
43
|
-
|
45
|
+
const fileOrDirectoryRelativePath = (() => {
|
46
|
+
const dirPath_ctx = cliCommandOptions.isPublic
|
47
|
+
? (0,path__WEBPACK_IMPORTED_MODULE_5__.join)(buildContext.publicDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_9__/* .KEYCLOAK_THEME */ .PC)
|
48
|
+
: buildContext.themeSrcDirPath;
|
49
|
+
return (0,path__WEBPACK_IMPORTED_MODULE_5__.relative)(dirPath_ctx, (0,_tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_4__/* .getAbsoluteAndInOsFormatPath */ .c)({
|
50
|
+
cwd: dirPath_ctx,
|
51
|
+
pathIsh: cliCommandOptions.path
|
52
|
+
}));
|
53
|
+
})();
|
44
54
|
const arr = extensionModuleMetas
|
45
55
|
.map(extensionModuleMeta => ({
|
46
56
|
extensionModuleMeta,
|
47
57
|
fileRelativePaths: extensionModuleMeta.files
|
58
|
+
.filter(({ fileRelativePath, isPublic }) => cliCommandOptions.isPublic === isPublic &&
|
59
|
+
(fileRelativePath === fileOrDirectoryRelativePath ||
|
60
|
+
(0,_tools_isInside__WEBPACK_IMPORTED_MODULE_8__/* .isInside */ .V)({
|
61
|
+
dirPath: fileOrDirectoryRelativePath,
|
62
|
+
filePath: fileRelativePath
|
63
|
+
})))
|
48
64
|
.map(({ fileRelativePath }) => fileRelativePath)
|
49
|
-
.filter(fileRelativePath => fileRelativePath === fileOrDirectoryRelativePath ||
|
50
|
-
(0,_tools_isInside__WEBPACK_IMPORTED_MODULE_8__/* .isInside */ .V)({
|
51
|
-
dirPath: fileOrDirectoryRelativePath,
|
52
|
-
filePath: fileRelativePath
|
53
|
-
}))
|
54
65
|
}))
|
55
66
|
.filter(({ fileRelativePaths }) => fileRelativePaths.length !== 0);
|
56
67
|
const targetFileRelativePathsByExtensionModuleMeta = new Map();
|
@@ -60,29 +71,31 @@ async function command(params) {
|
|
60
71
|
return { targetFileRelativePathsByExtensionModuleMeta };
|
61
72
|
})();
|
62
73
|
if (targetFileRelativePathsByExtensionModuleMeta.size === 0) {
|
63
|
-
console.log(
|
74
|
+
console.log(chalk__WEBPACK_IMPORTED_MODULE_11___default().yellow("There is no Keycloakify extension modules files matching the provided path."));
|
64
75
|
process.exit(1);
|
65
76
|
}
|
66
|
-
const { ownedFilesRelativePaths: ownedFilesRelativePaths_current } = await (0,
|
77
|
+
const { ownedFilesRelativePaths: ownedFilesRelativePaths_current } = await (0,_sync_extensions_managedGitignoreFiles__WEBPACK_IMPORTED_MODULE_2__/* .readManagedGitignoresFile */ .P)({
|
67
78
|
buildContext
|
68
79
|
});
|
69
80
|
await (cliCommandOptions.isRevert ? command_revert : command_own)({
|
70
81
|
extensionModuleMetas,
|
82
|
+
isPublic: cliCommandOptions.isPublic,
|
71
83
|
targetFileRelativePathsByExtensionModuleMeta,
|
72
84
|
ownedFilesRelativePaths_current,
|
73
85
|
buildContext
|
74
86
|
});
|
75
87
|
}
|
76
88
|
async function command_own(params) {
|
77
|
-
const { extensionModuleMetas, targetFileRelativePathsByExtensionModuleMeta, ownedFilesRelativePaths_current, buildContext } = params;
|
78
|
-
await (0,
|
89
|
+
const { extensionModuleMetas, isPublic, targetFileRelativePathsByExtensionModuleMeta, ownedFilesRelativePaths_current, buildContext } = params;
|
90
|
+
await (0,_sync_extensions_managedGitignoreFiles__WEBPACK_IMPORTED_MODULE_2__/* .writeManagedGitignoreFiles */ .F)({
|
79
91
|
buildContext,
|
80
92
|
extensionModuleMetas,
|
81
93
|
ownedFilesRelativePaths: [
|
82
94
|
...ownedFilesRelativePaths_current,
|
83
95
|
...Array.from(targetFileRelativePathsByExtensionModuleMeta.values())
|
84
96
|
.flat()
|
85
|
-
.filter(fileRelativePath => !ownedFilesRelativePaths_current.
|
97
|
+
.filter(fileRelativePath => !ownedFilesRelativePaths_current.some(entry => (0,evt_tools_inDepth_same__WEBPACK_IMPORTED_MODULE_10__.same)(entry, { isPublic, fileRelativePath })))
|
98
|
+
.map(fileRelativePath => ({ isPublic, fileRelativePath }))
|
86
99
|
]
|
87
100
|
});
|
88
101
|
const writeActions = [];
|
@@ -92,50 +105,53 @@ async function command_own(params) {
|
|
92
105
|
packageJsonDirPath: (0,path__WEBPACK_IMPORTED_MODULE_5__.dirname)(buildContext.packageJsonFilePath)
|
93
106
|
});
|
94
107
|
for (const fileRelativePath of fileRelativePaths) {
|
95
|
-
if (ownedFilesRelativePaths_current.
|
96
|
-
console.log(
|
108
|
+
if (ownedFilesRelativePaths_current.some(entry => (0,evt_tools_inDepth_same__WEBPACK_IMPORTED_MODULE_10__.same)(entry, { isPublic, fileRelativePath }))) {
|
109
|
+
console.log(chalk__WEBPACK_IMPORTED_MODULE_11___default().grey(`You already have ownership over '${fileRelativePath}'.`));
|
97
110
|
continue;
|
98
111
|
}
|
99
112
|
writeActions.push(async () => {
|
100
113
|
const sourceCode = await (0,_sync_extensions_getExtensionModuleFileSourceCodeReadyToBeCopied__WEBPACK_IMPORTED_MODULE_0__/* .getExtensionModuleFileSourceCodeReadyToBeCopied */ .p)({
|
101
114
|
buildContext,
|
115
|
+
isPublic,
|
102
116
|
fileRelativePath,
|
103
117
|
isOwnershipAction: true,
|
104
118
|
extensionModuleName: extensionModuleMeta.moduleName,
|
105
119
|
extensionModuleDirPath,
|
106
120
|
extensionModuleVersion: extensionModuleMeta.version
|
107
121
|
});
|
108
|
-
await fs_promises__WEBPACK_IMPORTED_MODULE_7__.writeFile((0,path__WEBPACK_IMPORTED_MODULE_5__.join)(
|
109
|
-
|
122
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_7__.writeFile((0,path__WEBPACK_IMPORTED_MODULE_5__.join)(isPublic
|
123
|
+
? (0,path__WEBPACK_IMPORTED_MODULE_5__.join)(buildContext.publicDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_9__/* .KEYCLOAK_THEME */ .PC)
|
124
|
+
: buildContext.themeSrcDirPath, fileRelativePath), sourceCode);
|
125
|
+
console.log(chalk__WEBPACK_IMPORTED_MODULE_11___default().green(`Ownership over '${fileRelativePath}' claimed.`));
|
110
126
|
});
|
111
127
|
}
|
112
128
|
}
|
113
129
|
if (writeActions.length === 0) {
|
114
|
-
console.log(
|
130
|
+
console.log(chalk__WEBPACK_IMPORTED_MODULE_11___default().yellow("No new file claimed."));
|
115
131
|
return;
|
116
132
|
}
|
117
133
|
await Promise.all(writeActions.map(action => action()));
|
118
134
|
}
|
119
135
|
async function command_revert(params) {
|
120
|
-
const { extensionModuleMetas, targetFileRelativePathsByExtensionModuleMeta, ownedFilesRelativePaths_current, buildContext } = params;
|
136
|
+
const { extensionModuleMetas, isPublic, targetFileRelativePathsByExtensionModuleMeta, ownedFilesRelativePaths_current, buildContext } = params;
|
121
137
|
const ownedFilesRelativePaths_toRemove = Array.from(targetFileRelativePathsByExtensionModuleMeta.values())
|
122
138
|
.flat()
|
123
139
|
.filter(fileRelativePath => {
|
124
|
-
if (!ownedFilesRelativePaths_current.
|
125
|
-
console.log(
|
140
|
+
if (!ownedFilesRelativePaths_current.some(entry => (0,evt_tools_inDepth_same__WEBPACK_IMPORTED_MODULE_10__.same)(entry, { isPublic, fileRelativePath }))) {
|
141
|
+
console.log(chalk__WEBPACK_IMPORTED_MODULE_11___default().grey(`Ownership over '${fileRelativePath}' wasn't claimed.`));
|
126
142
|
return false;
|
127
143
|
}
|
128
|
-
console.log(
|
144
|
+
console.log(chalk__WEBPACK_IMPORTED_MODULE_11___default().green(`Ownership over '${fileRelativePath}' relinquished.`));
|
129
145
|
return true;
|
130
146
|
});
|
131
147
|
if (ownedFilesRelativePaths_toRemove.length === 0) {
|
132
|
-
console.log(
|
148
|
+
console.log(chalk__WEBPACK_IMPORTED_MODULE_11___default().yellow("No file relinquished."));
|
133
149
|
return;
|
134
150
|
}
|
135
|
-
await (0,
|
151
|
+
await (0,_sync_extensions_managedGitignoreFiles__WEBPACK_IMPORTED_MODULE_2__/* .writeManagedGitignoreFiles */ .F)({
|
136
152
|
buildContext,
|
137
153
|
extensionModuleMetas,
|
138
|
-
ownedFilesRelativePaths: ownedFilesRelativePaths_current.filter(
|
154
|
+
ownedFilesRelativePaths: ownedFilesRelativePaths_current.filter(entry => !ownedFilesRelativePaths_toRemove.some(fileRelativePath => (0,evt_tools_inDepth_same__WEBPACK_IMPORTED_MODULE_10__.same)(entry, { isPublic, fileRelativePath })))
|
139
155
|
});
|
140
156
|
await (0,_sync_extensions_sync_extension__WEBPACK_IMPORTED_MODULE_1__/* .command */ .W)({ buildContext });
|
141
157
|
}
|
package/bin/97.index.js
CHANGED
@@ -185,6 +185,7 @@ const zExtensionModuleMeta = (() => {
|
|
185
185
|
moduleName: lib.z.string(),
|
186
186
|
version: lib.z.string(),
|
187
187
|
files: lib.z.array(lib.z.object({
|
188
|
+
isPublic: lib.z.boolean(),
|
188
189
|
fileRelativePath: lib.z.string(),
|
189
190
|
hash: lib.z.string(),
|
190
191
|
copyableFilePath: lib.z.string()
|
@@ -289,37 +290,40 @@ async function getExtensionModuleMetas(params) {
|
|
289
290
|
return extensionModuleMeta_cache;
|
290
291
|
}
|
291
292
|
const files = [];
|
292
|
-
{
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
293
|
+
await crawlAsync({
|
294
|
+
dirPath: (0,external_path_.join)(dirPath, constants/* KEYCLOAK_THEME */.PC),
|
295
|
+
returnedPathsType: "relative to dirPath",
|
296
|
+
onFileFound: async (fileRelativePath) => {
|
297
|
+
const isPublic = fileRelativePath.startsWith(`public${external_path_.sep}`);
|
298
|
+
const fileRelativePath_contextual = isPublic
|
299
|
+
? (0,external_path_.relative)("public", fileRelativePath)
|
300
|
+
: fileRelativePath;
|
301
|
+
const sourceCode = await (0,getExtensionModuleFileSourceCodeReadyToBeCopied/* getExtensionModuleFileSourceCodeReadyToBeCopied */.p)({
|
302
|
+
buildContext,
|
303
|
+
isPublic,
|
304
|
+
fileRelativePath: fileRelativePath_contextual,
|
305
|
+
isOwnershipAction: false,
|
306
|
+
extensionModuleDirPath: dirPath,
|
307
|
+
extensionModuleName: moduleName,
|
308
|
+
extensionModuleVersion: version
|
309
|
+
});
|
310
|
+
const hash = computeHash(sourceCode);
|
311
|
+
const copyableFilePath = (0,external_path_.join)((0,external_path_.dirname)(cacheFilePath), constants/* KEYCLOAK_THEME */.PC, fileRelativePath);
|
312
|
+
{
|
313
|
+
const dirPath = (0,external_path_.dirname)(copyableFilePath);
|
314
|
+
if (!(await (0,fs_existsAsync/* existsAsync */.o)(dirPath))) {
|
315
|
+
await promises_.mkdir(dirPath, { recursive: true });
|
313
316
|
}
|
314
|
-
promises_.writeFile(copyableFilePath, sourceCode);
|
315
|
-
files.push({
|
316
|
-
fileRelativePath,
|
317
|
-
hash,
|
318
|
-
copyableFilePath
|
319
|
-
});
|
320
317
|
}
|
321
|
-
|
322
|
-
|
318
|
+
promises_.writeFile(copyableFilePath, sourceCode);
|
319
|
+
files.push({
|
320
|
+
isPublic,
|
321
|
+
fileRelativePath: fileRelativePath_contextual,
|
322
|
+
hash,
|
323
|
+
copyableFilePath
|
324
|
+
});
|
325
|
+
}
|
326
|
+
});
|
323
327
|
return (0,id.id)({
|
324
328
|
moduleName,
|
325
329
|
version,
|
@@ -376,7 +380,7 @@ function computeHash(data) {
|
|
376
380
|
|
377
381
|
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .h)();
|
378
382
|
async function getExtensionModuleFileSourceCodeReadyToBeCopied(params) {
|
379
|
-
const { buildContext, extensionModuleDirPath, fileRelativePath, isOwnershipAction, extensionModuleName, extensionModuleVersion } = params;
|
383
|
+
const { buildContext, extensionModuleDirPath, isPublic, fileRelativePath, isOwnershipAction, extensionModuleName, extensionModuleVersion } = params;
|
380
384
|
let sourceCode = (await fs_promises__WEBPACK_IMPORTED_MODULE_1__.readFile((0,path__WEBPACK_IMPORTED_MODULE_2__.join)(extensionModuleDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_4__/* .KEYCLOAK_THEME */ .PC, fileRelativePath))).toString("utf8");
|
381
385
|
add_eslint_disable: {
|
382
386
|
if (isOwnershipAction) {
|
@@ -400,19 +404,21 @@ async function getExtensionModuleFileSourceCodeReadyToBeCopied(params) {
|
|
400
404
|
`This file has been claimed for ownership from ${extensionModuleName} version ${extensionModuleVersion}.`,
|
401
405
|
`To relinquish ownership and restore this file to its original content, run the following command:`,
|
402
406
|
``,
|
403
|
-
`$ npx keycloakify own --path "${path}" --revert`
|
407
|
+
`$ npx keycloakify own --path "${path}"${isPublic ? " --public " : ""}--revert`
|
404
408
|
]
|
405
409
|
: [
|
406
410
|
`WARNING: Before modifying this file, run the following command:`,
|
407
411
|
``,
|
408
|
-
`$ npx keycloakify own --path "${path}"`,
|
412
|
+
`$ npx keycloakify own --path "${path}"${isPublic ? " --public" : ""}`,
|
409
413
|
``,
|
410
414
|
`This file is provided by ${extensionModuleName} version ${extensionModuleVersion}.`,
|
411
415
|
`It was copied into your repository by the postinstall script: \`keycloakify sync-extensions\`.`
|
412
416
|
];
|
413
417
|
})()
|
414
418
|
});
|
415
|
-
const destFilePath = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(
|
419
|
+
const destFilePath = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(isPublic
|
420
|
+
? (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(buildContext.publicDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_4__/* .KEYCLOAK_THEME */ .PC)
|
421
|
+
: buildContext.themeSrcDirPath, fileRelativePath);
|
416
422
|
format: {
|
417
423
|
if (!(await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_0__/* .getIsPrettierAvailable */ .MT)())) {
|
418
424
|
break format;
|
@@ -474,12 +480,12 @@ function addCommentToSourceCode(params) {
|
|
474
480
|
|
475
481
|
/***/ }),
|
476
482
|
|
477
|
-
/***/
|
483
|
+
/***/ 86087:
|
478
484
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
479
485
|
|
480
486
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
481
|
-
/* harmony export */ "
|
482
|
-
/* harmony export */ "
|
487
|
+
/* harmony export */ "F": () => (/* binding */ writeManagedGitignoreFiles),
|
488
|
+
/* harmony export */ "P": () => (/* binding */ readManagedGitignoresFile)
|
483
489
|
/* harmony export */ });
|
484
490
|
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
|
485
491
|
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
|
@@ -488,89 +494,114 @@ function addCommentToSourceCode(params) {
|
|
488
494
|
/* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(29041);
|
489
495
|
/* harmony import */ var _tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(43765);
|
490
496
|
/* harmony import */ var _tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84794);
|
497
|
+
/* harmony import */ var _shared_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(173);
|
498
|
+
|
491
499
|
|
492
500
|
|
493
501
|
|
494
502
|
|
495
503
|
|
504
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .h)();
|
496
505
|
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .h)();
|
497
506
|
const DELIMITER_START = `# === Owned files start ===`;
|
498
507
|
const DELIMITER_END = `# === Owned files end =====`;
|
499
|
-
async function
|
500
|
-
const { buildContext
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
.
|
511
|
-
.
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
...extensionModuleMeta.files
|
508
|
+
async function writeManagedGitignoreFiles(params) {
|
509
|
+
const { buildContext } = params;
|
510
|
+
for (const isPublicIteration of [false, true]) {
|
511
|
+
const extensionModuleMetas_ctx = params.extensionModuleMetas
|
512
|
+
.map(extensionModuleMeta => (Object.assign(Object.assign({}, extensionModuleMeta), { files: extensionModuleMeta.files.filter(({ isPublic }) => isPublic === isPublicIteration) })))
|
513
|
+
.filter(extensionModuleMeta => extensionModuleMeta.files.length !== 0);
|
514
|
+
if (extensionModuleMetas_ctx.length === 0) {
|
515
|
+
continue;
|
516
|
+
}
|
517
|
+
const ownedFilesRelativePaths_ctx = params.ownedFilesRelativePaths.filter(({ isPublic }) => isPublic === isPublicIteration);
|
518
|
+
const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(isPublicIteration
|
519
|
+
? (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.publicDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_5__/* .KEYCLOAK_THEME */ .PC)
|
520
|
+
: buildContext.themeSrcDirPath, ".gitignore");
|
521
|
+
const content_new = Buffer.from([
|
522
|
+
`# This file is managed by Keycloakify, do not edit it manually.`,
|
523
|
+
``,
|
524
|
+
DELIMITER_START,
|
525
|
+
...ownedFilesRelativePaths_ctx
|
518
526
|
.map(({ fileRelativePath }) => fileRelativePath)
|
519
|
-
.
|
520
|
-
.map(
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
527
|
+
.map(fileRelativePath => fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_1__.sep).join("/"))
|
528
|
+
.map(line => `# ${line}`),
|
529
|
+
DELIMITER_END,
|
530
|
+
``,
|
531
|
+
...extensionModuleMetas_ctx
|
532
|
+
.map(extensionModuleMeta => [
|
533
|
+
`# === ${extensionModuleMeta.moduleName} v${extensionModuleMeta.version} ===`,
|
534
|
+
...extensionModuleMeta.files
|
535
|
+
.map(({ fileRelativePath }) => fileRelativePath)
|
536
|
+
.filter(fileRelativePath => !ownedFilesRelativePaths_ctx
|
537
|
+
.map(({ fileRelativePath }) => fileRelativePath)
|
538
|
+
.includes(fileRelativePath))
|
539
|
+
.map(fileRelativePath => `/${fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_1__.sep).join("/").replace(/^\.\//, "")}`),
|
540
|
+
``
|
541
|
+
])
|
542
|
+
.flat()
|
543
|
+
].join("\n"), "utf8");
|
544
|
+
const content_current = await (async () => {
|
545
|
+
if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(filePath))) {
|
546
|
+
return undefined;
|
547
|
+
}
|
548
|
+
return await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(filePath);
|
549
|
+
})();
|
550
|
+
if (content_current !== undefined && content_current.equals(content_new)) {
|
551
|
+
continue;
|
528
552
|
}
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
const dirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(filePath);
|
536
|
-
if (await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(dirPath)) {
|
537
|
-
break create_dir;
|
553
|
+
create_dir: {
|
554
|
+
const dirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(filePath);
|
555
|
+
if (await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(dirPath)) {
|
556
|
+
break create_dir;
|
557
|
+
}
|
558
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_0__.mkdir(dirPath, { recursive: true });
|
538
559
|
}
|
539
|
-
await fs_promises__WEBPACK_IMPORTED_MODULE_0__.
|
560
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_0__.writeFile(filePath, content_new);
|
540
561
|
}
|
541
|
-
await fs_promises__WEBPACK_IMPORTED_MODULE_0__.writeFile(filePath, content_new);
|
542
562
|
}
|
543
|
-
async function
|
563
|
+
async function readManagedGitignoresFile(params) {
|
544
564
|
const { buildContext } = params;
|
545
|
-
const
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
const index_end = contentStr.indexOf(DELIMITER_END);
|
553
|
-
if (index_start === -1 || index_end === -1) {
|
554
|
-
return undefined;
|
565
|
+
const ownedFilesRelativePaths = [];
|
566
|
+
for (const isPublicIteration of [false, true]) {
|
567
|
+
const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(isPublicIteration
|
568
|
+
? (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.publicDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_5__/* .KEYCLOAK_THEME */ .PC)
|
569
|
+
: buildContext.themeSrcDirPath, ".gitignore");
|
570
|
+
if (!(await (0,_tools_fs_existsAsync__WEBPACK_IMPORTED_MODULE_3__/* .existsAsync */ .o)(filePath))) {
|
571
|
+
continue;
|
555
572
|
}
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
573
|
+
const contentStr = (await fs_promises__WEBPACK_IMPORTED_MODULE_0__.readFile(filePath)).toString("utf8");
|
574
|
+
const payload = (() => {
|
575
|
+
const index_start = contentStr.indexOf(DELIMITER_START);
|
576
|
+
const index_end = contentStr.indexOf(DELIMITER_END);
|
577
|
+
if (index_start === -1 || index_end === -1) {
|
578
|
+
return undefined;
|
579
|
+
}
|
580
|
+
return contentStr
|
581
|
+
.slice(index_start + DELIMITER_START.length, index_end)
|
582
|
+
.trim();
|
583
|
+
})();
|
584
|
+
if (payload === undefined) {
|
585
|
+
continue;
|
586
|
+
}
|
587
|
+
payload
|
588
|
+
.split("\n")
|
589
|
+
.map(line => line.trim())
|
590
|
+
.map(line => line.replace(/^# /, ""))
|
591
|
+
.filter(line => line !== "")
|
592
|
+
.map(line => (0,_tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_4__/* .getAbsoluteAndInOsFormatPath */ .c)({
|
593
|
+
cwd: buildContext.themeSrcDirPath,
|
594
|
+
pathIsh: line
|
595
|
+
}))
|
596
|
+
.map(filePath => (0,path__WEBPACK_IMPORTED_MODULE_1__.relative)(buildContext.themeSrcDirPath, filePath))
|
597
|
+
.forEach(fileRelativePath => ownedFilesRelativePaths.push({
|
598
|
+
isPublic: isPublicIteration,
|
599
|
+
fileRelativePath
|
600
|
+
}));
|
560
601
|
}
|
561
|
-
const ownedFilesRelativePaths = payload
|
562
|
-
.split("\n")
|
563
|
-
.map(line => line.trim())
|
564
|
-
.map(line => line.replace(/^# /, ""))
|
565
|
-
.filter(line => line !== "")
|
566
|
-
.map(line => (0,_tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_4__/* .getAbsoluteAndInOsFormatPath */ .c)({
|
567
|
-
cwd: buildContext.themeSrcDirPath,
|
568
|
-
pathIsh: line
|
569
|
-
}))
|
570
|
-
.map(filePath => (0,path__WEBPACK_IMPORTED_MODULE_1__.relative)(buildContext.themeSrcDirPath, filePath));
|
571
602
|
return { ownedFilesRelativePaths };
|
572
603
|
}
|
573
|
-
//# sourceMappingURL=
|
604
|
+
//# sourceMappingURL=managedGitignoreFiles.js.map
|
574
605
|
|
575
606
|
/***/ }),
|
576
607
|
|
@@ -700,8 +731,8 @@ async function installExtensionModulesPeerDependencies(params) {
|
|
700
731
|
process.exit(0);
|
701
732
|
}
|
702
733
|
//# sourceMappingURL=installExtensionModulesPeerDependencies.js.map
|
703
|
-
// EXTERNAL MODULE: ./dist/bin/sync-extensions/
|
704
|
-
var
|
734
|
+
// EXTERNAL MODULE: ./dist/bin/sync-extensions/managedGitignoreFiles.js
|
735
|
+
var managedGitignoreFiles = __webpack_require__(86087);
|
705
736
|
// EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
|
706
737
|
var fs_existsAsync = __webpack_require__(43765);
|
707
738
|
// EXTERNAL MODULE: external "child_process"
|
@@ -765,6 +796,8 @@ const untrackFromGit = runExclusive.build(groupRef, async (params) => {
|
|
765
796
|
var update_kc_gen = __webpack_require__(10786);
|
766
797
|
// EXTERNAL MODULE: ./dist/bin/shared/buildContext.js + 3 modules
|
767
798
|
var shared_buildContext = __webpack_require__(85400);
|
799
|
+
// EXTERNAL MODULE: ./dist/bin/shared/constants.js
|
800
|
+
var constants = __webpack_require__(173);
|
768
801
|
;// CONCATENATED MODULE: ./dist/bin/sync-extensions/sync-extension.js
|
769
802
|
|
770
803
|
|
@@ -776,6 +809,8 @@ var shared_buildContext = __webpack_require__(85400);
|
|
776
809
|
|
777
810
|
|
778
811
|
|
812
|
+
|
813
|
+
|
779
814
|
async function command(params) {
|
780
815
|
const { buildContext } = params;
|
781
816
|
const extensionModuleMetas = await (0,sync_extensions_extensionModuleMeta/* getExtensionModuleMetas */.f)({ buildContext });
|
@@ -783,20 +818,22 @@ async function command(params) {
|
|
783
818
|
buildContext,
|
784
819
|
extensionModuleMetas
|
785
820
|
});
|
786
|
-
const { ownedFilesRelativePaths } = await (0,
|
821
|
+
const { ownedFilesRelativePaths } = await (0,managedGitignoreFiles/* readManagedGitignoresFile */.P)({
|
787
822
|
buildContext
|
788
823
|
});
|
789
|
-
await (0,
|
824
|
+
await (0,managedGitignoreFiles/* writeManagedGitignoreFiles */.F)({
|
790
825
|
buildContext,
|
791
826
|
ownedFilesRelativePaths,
|
792
827
|
extensionModuleMetas
|
793
828
|
});
|
794
829
|
await Promise.all(extensionModuleMetas
|
795
|
-
.map(extensionModuleMeta => Promise.all(extensionModuleMeta.files.map(async ({ fileRelativePath, copyableFilePath, hash }) => {
|
796
|
-
if (ownedFilesRelativePaths.
|
830
|
+
.map(extensionModuleMeta => Promise.all(extensionModuleMeta.files.map(async ({ isPublic, fileRelativePath, copyableFilePath, hash }) => {
|
831
|
+
if (ownedFilesRelativePaths.some(entry => (0,same.same)(entry, { isPublic, fileRelativePath }))) {
|
797
832
|
return;
|
798
833
|
}
|
799
|
-
const destFilePath = (0,external_path_.join)(
|
834
|
+
const destFilePath = (0,external_path_.join)(isPublic
|
835
|
+
? (0,external_path_.join)(buildContext.publicDirPath, constants/* KEYCLOAK_THEME */.PC)
|
836
|
+
: buildContext.themeSrcDirPath, fileRelativePath);
|
800
837
|
const doesFileExist = await (0,fs_existsAsync/* existsAsync */.o)(destFilePath);
|
801
838
|
skip_condition: {
|
802
839
|
if (!doesFileExist) {
|
@@ -6,6 +6,7 @@ export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode & Bui
|
|
6
6
|
extraThemeProperties: string[] | undefined;
|
7
7
|
projectDirPath: string;
|
8
8
|
projectBuildDirPath: string;
|
9
|
+
publicDirPath: string;
|
9
10
|
environmentVariables: {
|
10
11
|
name: string;
|
11
12
|
default: string;
|
package/bin/main.js
CHANGED
@@ -16435,14 +16435,28 @@ program
|
|
16435
16435
|
"removing your ownership claim and reverting any modifications."
|
16436
16436
|
].join(" "),
|
16437
16437
|
defaultValue: false
|
16438
|
+
})
|
16439
|
+
.option({
|
16440
|
+
key: "public",
|
16441
|
+
name: (() => {
|
16442
|
+
const long = "public";
|
16443
|
+
const short = "p";
|
16444
|
+
optionsKeys.push(long, short);
|
16445
|
+
return { long, short };
|
16446
|
+
})(),
|
16447
|
+
description: [
|
16448
|
+
"Flag to use when targeting a file or directory in the public directory",
|
16449
|
+
"instead of the src"
|
16450
|
+
].join(" "),
|
16451
|
+
defaultValue: false
|
16438
16452
|
})
|
16439
16453
|
.task({
|
16440
16454
|
skip,
|
16441
|
-
handler: async ({ projectDirPath, path, revert }) => {
|
16455
|
+
handler: async ({ projectDirPath, path, revert, public: public_params }) => {
|
16442
16456
|
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(69), __nccwpck_require__.e(84), __nccwpck_require__.e(97), __nccwpck_require__.e(930)]).then(__nccwpck_require__.bind(__nccwpck_require__, 71930));
|
16443
16457
|
await command({
|
16444
16458
|
buildContext: (0,buildContext/* getBuildContext */.s)({ projectDirPath }),
|
16445
|
-
cliCommandOptions: { path, isRevert: revert }
|
16459
|
+
cliCommandOptions: { path, isRevert: revert, isPublic: public_params }
|
16446
16460
|
});
|
16447
16461
|
}
|
16448
16462
|
});
|