keycloakify 11.3.21 → 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/356.index.js CHANGED
@@ -25,29 +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
- ` *`,
40
- ` * WARNING: Before modifying this file run the following command:`,
41
- ` * `,
42
- ` * $ npx keycloakify eject-file --file ${fileRelativePath.split(path__WEBPACK_IMPORTED_MODULE_2__.sep).join("/")}`,
43
- ` * `,
44
- ` * This file comes from ${uiModuleName} version ${uiModuleVersion}.`,
45
- ` *`,
46
- ` */`
47
- ].join("\n");
35
+ if (fileRelativePath.endsWith(".html")) {
36
+ return [`<!--`, ...lines.map(line => ` ${line}`), `-->`].join("\n");
48
37
  }
49
- })();
50
- 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
+ }
51
52
  const destFilePath = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(buildContext.themeSrcDirPath, fileRelativePath);
52
53
  format: {
53
54
  if (!(await (0,_tools_runPrettier__WEBPACK_IMPORTED_MODULE_0__/* .getIsPrettierAvailable */ .MT)())) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "11.3.21",
3
+ "version": "11.3.22",
4
4
  "description": "Framework to create custom Keycloak UIs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,29 +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
- ` *`,
46
- ` * WARNING: Before modifying this file run the following command:`,
47
- ` * `,
48
- ` * $ npx keycloakify eject-file --file ${fileRelativePath.split(pathSep).join("/")}`,
49
- ` * `,
50
- ` * This file comes from ${uiModuleName} version ${uiModuleVersion}.`,
51
- ` *`,
52
- ` */`
53
- ].join("\n");
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");
54
46
  }
55
- })();
56
47
 
57
- 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
+ }
58
66
 
59
67
  const destFilePath = pathJoin(buildContext.themeSrcDirPath, fileRelativePath);
60
68