keycloakify 11.3.20 → 11.3.22

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/124.index.js CHANGED
@@ -34,6 +34,8 @@ var same = __webpack_require__(33805);
34
34
  var runPrettier = __webpack_require__(48433);
35
35
  // EXTERNAL MODULE: ./dist/bin/tools/npmInstall.js + 1 modules
36
36
  var npmInstall = __webpack_require__(63046);
37
+ // EXTERNAL MODULE: external "path"
38
+ var external_path_ = __webpack_require__(71017);
37
39
  ;// CONCATENATED MODULE: ./dist/bin/postinstall/installUiModulesPeerDependencies.js
38
40
 
39
41
 
@@ -44,6 +46,7 @@ var npmInstall = __webpack_require__(63046);
44
46
 
45
47
 
46
48
 
49
+
47
50
  (0,assert/* assert */.h)();
48
51
  (0,assert/* assert */.h)();
49
52
  async function installUiModulesPeerDependencies(params) {
@@ -126,15 +129,13 @@ async function installUiModulesPeerDependencies(params) {
126
129
  }
127
130
  await promises_.writeFile(buildContext.packageJsonFilePath, packageJsonContentStr);
128
131
  (0,npmInstall/* npmInstall */.c)({
129
- packageJsonDirPath: buildContext.packageJsonFilePath
132
+ packageJsonDirPath: (0,external_path_.dirname)(buildContext.packageJsonFilePath)
130
133
  });
131
134
  process.exit(0);
132
135
  }
133
136
  //# sourceMappingURL=installUiModulesPeerDependencies.js.map
134
137
  // EXTERNAL MODULE: ./dist/bin/postinstall/managedGitignoreFile.js
135
138
  var managedGitignoreFile = __webpack_require__(36843);
136
- // EXTERNAL MODULE: external "path"
137
- var external_path_ = __webpack_require__(71017);
138
139
  // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
139
140
  var fs_existsAsync = __webpack_require__(43765);
140
141
  ;// CONCATENATED MODULE: ./dist/bin/postinstall/postinstall.js
package/bin/356.index.js CHANGED
@@ -25,27 +25,30 @@ exports.modules = {
25
25
  async function getUiModuleFileSourceCodeReadyToBeCopied(params) {
26
26
  const { buildContext, uiModuleDirPath, fileRelativePath, isForEjection, uiModuleName, uiModuleVersion } = params;
27
27
  let sourceCode = (await fs_promises__WEBPACK_IMPORTED_MODULE_1__.readFile((0,path__WEBPACK_IMPORTED_MODULE_2__.join)(uiModuleDirPath, _shared_constants__WEBPACK_IMPORTED_MODULE_4__/* .KEYCLOAK_THEME */ .PC, fileRelativePath))).toString("utf8");
28
- const comment = (() => {
29
- if (isForEjection) {
30
- return [
31
- `/*`,
32
- `This file was ejected from ${uiModuleName} version ${uiModuleVersion}.`,
33
- `*/`
34
- ].join("\n");
28
+ const toComment = (lines) => {
29
+ for (const ext of [".ts", ".tsx", ".css", ".less", ".sass", ".js", ".jsx"]) {
30
+ if (!fileRelativePath.endsWith(ext)) {
31
+ continue;
32
+ }
33
+ return [`/**`, ...lines.map(line => ` * ${line}`), ` */`].join("\n");
35
34
  }
36
- else {
37
- return [
38
- `/*`,
39
- `WARNING: Before modifying this file run the following command:`,
40
- ``,
41
- `npx keycloakify eject-file --file ${fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_2__.sep).join("/")}\``,
42
- ``,
43
- `This file comes from ${uiModuleName} version ${uiModuleVersion}.`,
44
- `*/`
45
- ];
35
+ if (fileRelativePath.endsWith(".html")) {
36
+ return [`<!--`, ...lines.map(line => ` ${line}`), `-->`].join("\n");
46
37
  }
47
- })();
48
- sourceCode = [comment, ``, sourceCode].join("\n");
38
+ return undefined;
39
+ };
40
+ const comment = toComment(isForEjection
41
+ ? [`This file was ejected from ${uiModuleName} version ${uiModuleVersion}.`]
42
+ : [
43
+ `WARNING: Before modifying this file run the following command:`,
44
+ ``,
45
+ `$ npx keycloakify eject-file --file ${fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_2__.sep).join("/")}`,
46
+ ``,
47
+ `This file comes from ${uiModuleName} version ${uiModuleVersion}.`
48
+ ]);
49
+ if (comment !== undefined) {
50
+ sourceCode = [comment, ``, sourceCode].join("\n");
51
+ }
49
52
  const destFilePath = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(buildContext.themeSrcDirPath, fileRelativePath);
50
53
  format: {
51
54
  if (!(await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_0__/* .getIsPrettierAvailable */ .MT)())) {
@@ -94,7 +97,9 @@ async function writeManagedGitignoreFile(params) {
94
97
  `# This file is managed by Keycloakify, do not edit it manually.`,
95
98
  ``,
96
99
  DELIMITER_START,
97
- ...ejectedFilesRelativePaths.map(fileRelativePath => fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_1__.sep).join("/")),
100
+ ...ejectedFilesRelativePaths
101
+ .map(fileRelativePath => fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_1__.sep).join("/"))
102
+ .map(line => `# ${line}`),
98
103
  DELIMITER_END,
99
104
  ``,
100
105
  ...uiModuleMetas
@@ -147,6 +152,7 @@ async function readManagedGitignoreFile(params) {
147
152
  const ejectedFilesRelativePaths = payload
148
153
  .split("\n")
149
154
  .map(line => line.trim())
155
+ .map(line => line.replace(/^# /, ""))
150
156
  .filter(line => line !== "")
151
157
  .map(line => (0,_tools_getAbsoluteAndInOsFormatPath__WEBPACK_IMPORTED_MODULE_4__/* .getAbsoluteAndInOsFormatPath */ .c)({
152
158
  cwd: buildContext.themeSrcDirPath,
@@ -269,13 +275,13 @@ async function crawlAsync(params) {
269
275
  const { dirPath, returnedPathsType, onFileFound } = params;
270
276
  await crawlAsyncRec({
271
277
  dirPath,
272
- onFileFound: ({ filePath }) => {
278
+ onFileFound: async ({ filePath }) => {
273
279
  switch (returnedPathsType) {
274
280
  case "absolute":
275
- onFileFound(filePath);
281
+ await onFileFound(filePath);
276
282
  return;
277
283
  case "relative to dirPath":
278
- onFileFound((0,external_path_.relative)(dirPath, filePath));
284
+ await onFileFound((0,external_path_.relative)(dirPath, filePath));
279
285
  return;
280
286
  }
281
287
  (0,assert/* assert */.h)();
@@ -292,7 +298,7 @@ async function crawlAsyncRec(params) {
292
298
  await crawlAsyncRec({ dirPath: fileOrDirPath, onFileFound });
293
299
  return;
294
300
  }
295
- onFileFound({ filePath: fileOrDirPath });
301
+ await onFileFound({ filePath: fileOrDirPath });
296
302
  }));
297
303
  }
298
304
  //# sourceMappingURL=crawlAsync.js.map
@@ -321,6 +327,7 @@ var constants = __webpack_require__(173);
321
327
 
322
328
 
323
329
 
330
+
324
331
  const zUiModuleMeta = (() => {
325
332
  const zTargetType = lib.z.object({
326
333
  moduleName: lib.z.string(),
@@ -364,7 +371,12 @@ async function getUiModuleMetas(params) {
364
371
  projectDirPath: buildContext.packageJsonFilePath,
365
372
  filter: ({ moduleName }) => moduleName.includes("keycloakify") && moduleName !== "keycloakify"
366
373
  });
367
- return Promise.all(installedModulesWithKeycloakifyInTheName.filter(async ({ dirPath }) => (0,fs_existsAsync/* existsAsync */.o)((0,external_path_.join)(dirPath, constants/* KEYCLOAK_THEME */.PC))));
374
+ return (await Promise.all(installedModulesWithKeycloakifyInTheName.map(async (entry) => {
375
+ if (!(await (0,fs_existsAsync/* existsAsync */.o)((0,external_path_.join)(entry.dirPath, constants/* KEYCLOAK_THEME */.PC)))) {
376
+ return undefined;
377
+ }
378
+ return entry;
379
+ }))).filter((0,exclude/* exclude */.D)(undefined));
368
380
  })();
369
381
  const cacheContent = await (async () => {
370
382
  if (!(await (0,fs_existsAsync/* existsAsync */.o)(cacheFilePath))) {
@@ -2,5 +2,5 @@
2
2
  export declare function crawlAsync(params: {
3
3
  dirPath: string;
4
4
  returnedPathsType: "absolute" | "relative to dirPath";
5
- onFileFound: (filePath: string) => void;
5
+ onFileFound: (filePath: string) => Promise<void>;
6
6
  }): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "11.3.20",
3
+ "version": "11.3.22",
4
4
  "description": "Framework to create custom Keycloak UIs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,27 +32,37 @@ export async function getUiModuleFileSourceCodeReadyToBeCopied(params: {
32
32
  await fsPr.readFile(pathJoin(uiModuleDirPath, KEYCLOAK_THEME, fileRelativePath))
33
33
  ).toString("utf8");
34
34
 
35
- const comment = (() => {
36
- if (isForEjection) {
37
- return [
38
- `/*`,
39
- `This file was ejected from ${uiModuleName} version ${uiModuleVersion}.`,
40
- `*/`
41
- ].join("\n");
42
- } else {
43
- return [
44
- `/*`,
45
- `WARNING: Before modifying this file run the following command:`,
46
- ``,
47
- `npx keycloakify eject-file --file ${fileRelativePath.split(pathSep).join("/")}\``,
48
- ``,
49
- `This file comes from ${uiModuleName} version ${uiModuleVersion}.`,
50
- `*/`
51
- ];
35
+ const toComment = (lines: string[]) => {
36
+ for (const ext of [".ts", ".tsx", ".css", ".less", ".sass", ".js", ".jsx"]) {
37
+ if (!fileRelativePath.endsWith(ext)) {
38
+ continue;
39
+ }
40
+
41
+ return [`/**`, ...lines.map(line => ` * ${line}`), ` */`].join("\n");
42
+ }
43
+
44
+ if (fileRelativePath.endsWith(".html")) {
45
+ return [`<!--`, ...lines.map(line => ` ${line}`), `-->`].join("\n");
52
46
  }
53
- })();
54
47
 
55
- sourceCode = [comment, ``, sourceCode].join("\n");
48
+ return undefined;
49
+ };
50
+
51
+ const comment = toComment(
52
+ isForEjection
53
+ ? [`This file was ejected from ${uiModuleName} version ${uiModuleVersion}.`]
54
+ : [
55
+ `WARNING: Before modifying this file run the following command:`,
56
+ ``,
57
+ `$ npx keycloakify eject-file --file ${fileRelativePath.split(pathSep).join("/")}`,
58
+ ``,
59
+ `This file comes from ${uiModuleName} version ${uiModuleVersion}.`
60
+ ]
61
+ );
62
+
63
+ if (comment !== undefined) {
64
+ sourceCode = [comment, ``, sourceCode].join("\n");
65
+ }
56
66
 
57
67
  const destFilePath = pathJoin(buildContext.themeSrcDirPath, fileRelativePath);
58
68
 
@@ -9,6 +9,7 @@ import { SemVer } from "../tools/SemVer";
9
9
  import { same } from "evt/tools/inDepth/same";
10
10
  import { runPrettier, getIsPrettierAvailable } from "../tools/runPrettier";
11
11
  import { npmInstall } from "../tools/npmInstall";
12
+ import { dirname as pathDirname } from "path";
12
13
 
13
14
  export type BuildContextLike = {
14
15
  packageJsonFilePath: string;
@@ -150,7 +151,7 @@ export async function installUiModulesPeerDependencies(params: {
150
151
  await fsPr.writeFile(buildContext.packageJsonFilePath, packageJsonContentStr);
151
152
 
152
153
  npmInstall({
153
- packageJsonDirPath: buildContext.packageJsonFilePath
154
+ packageJsonDirPath: pathDirname(buildContext.packageJsonFilePath)
154
155
  });
155
156
 
156
157
  process.exit(0);
@@ -38,9 +38,9 @@ export async function writeManagedGitignoreFile(params: {
38
38
  `# This file is managed by Keycloakify, do not edit it manually.`,
39
39
  ``,
40
40
  DELIMITER_START,
41
- ...ejectedFilesRelativePaths.map(fileRelativePath =>
42
- fileRelativePath.split(pathSep).join("/")
43
- ),
41
+ ...ejectedFilesRelativePaths
42
+ .map(fileRelativePath => fileRelativePath.split(pathSep).join("/"))
43
+ .map(line => `# ${line}`),
44
44
  DELIMITER_END,
45
45
  ``,
46
46
  ...uiModuleMetas
@@ -122,6 +122,7 @@ export async function readManagedGitignoreFile(params: {
122
122
  const ejectedFilesRelativePaths = payload
123
123
  .split("\n")
124
124
  .map(line => line.trim())
125
+ .map(line => line.replace(/^# /, ""))
125
126
  .filter(line => line !== "")
126
127
  .map(line =>
127
128
  getAbsoluteAndInOsFormatPath({
@@ -16,6 +16,7 @@ import {
16
16
  } from "./getUiModuleFileSourceCodeReadyToBeCopied";
17
17
  import * as crypto from "crypto";
18
18
  import { KEYCLOAK_THEME } from "../shared/constants";
19
+ import { exclude } from "tsafe/exclude";
19
20
 
20
21
  export type UiModuleMeta = {
21
22
  moduleName: string;
@@ -113,11 +114,16 @@ export async function getUiModuleMetas(params: {
113
114
  moduleName.includes("keycloakify") && moduleName !== "keycloakify"
114
115
  });
115
116
 
116
- return Promise.all(
117
- installedModulesWithKeycloakifyInTheName.filter(async ({ dirPath }) =>
118
- existsAsync(pathJoin(dirPath, KEYCLOAK_THEME))
117
+ return (
118
+ await Promise.all(
119
+ installedModulesWithKeycloakifyInTheName.map(async entry => {
120
+ if (!(await existsAsync(pathJoin(entry.dirPath, KEYCLOAK_THEME)))) {
121
+ return undefined;
122
+ }
123
+ return entry;
124
+ })
119
125
  )
120
- );
126
+ ).filter(exclude(undefined));
121
127
  })();
122
128
 
123
129
  const cacheContent = await (async () => {
@@ -6,19 +6,19 @@ import { assert, type Equals } from "tsafe/assert";
6
6
  export async function crawlAsync(params: {
7
7
  dirPath: string;
8
8
  returnedPathsType: "absolute" | "relative to dirPath";
9
- onFileFound: (filePath: string) => void;
9
+ onFileFound: (filePath: string) => Promise<void>;
10
10
  }) {
11
11
  const { dirPath, returnedPathsType, onFileFound } = params;
12
12
 
13
13
  await crawlAsyncRec({
14
14
  dirPath,
15
- onFileFound: ({ filePath }) => {
15
+ onFileFound: async ({ filePath }) => {
16
16
  switch (returnedPathsType) {
17
17
  case "absolute":
18
- onFileFound(filePath);
18
+ await onFileFound(filePath);
19
19
  return;
20
20
  case "relative to dirPath":
21
- onFileFound(pathRelative(dirPath, filePath));
21
+ await onFileFound(pathRelative(dirPath, filePath));
22
22
  return;
23
23
  }
24
24
  assert<Equals<typeof returnedPathsType, never>>();
@@ -28,7 +28,7 @@ export async function crawlAsync(params: {
28
28
 
29
29
  async function crawlAsyncRec(params: {
30
30
  dirPath: string;
31
- onFileFound: (params: { filePath: string }) => void;
31
+ onFileFound: (params: { filePath: string }) => Promise<void>;
32
32
  }) {
33
33
  const { dirPath, onFileFound } = params;
34
34
 
@@ -45,7 +45,7 @@ async function crawlAsyncRec(params: {
45
45
  return;
46
46
  }
47
47
 
48
- onFileFound({ filePath: fileOrDirPath });
48
+ await onFileFound({ filePath: fileOrDirPath });
49
49
  })
50
50
  );
51
51
  }