keycloakify 8.1.1 → 8.1.2

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.
@@ -66,6 +66,7 @@ var path_1 = require("path");
66
66
  var download_builtin_keycloak_theme_1 = require("../../download-builtin-keycloak-theme");
67
67
  var mockTestingResourcesPath_1 = require("../../mockTestingResourcesPath");
68
68
  var crypto = __importStar(require("crypto"));
69
+ var assert_1 = require("tsafe/assert");
69
70
  function downloadKeycloakStaticResources(
70
71
  // prettier-ignore
71
72
  params) {
@@ -74,7 +75,25 @@ params) {
74
75
  return __generator(this, function (_a) {
75
76
  switch (_a.label) {
76
77
  case 0:
77
- projectDirPath = params.projectDirPath, themeType = params.themeType, themeDirPath = params.themeDirPath, keycloakVersion = params.keycloakVersion, usedResources = params.usedResources;
78
+ projectDirPath = params.projectDirPath, themeType = params.themeType, themeDirPath = params.themeDirPath, keycloakVersion = params.keycloakVersion;
79
+ usedResources = (function () {
80
+ var usedResources = params.usedResources;
81
+ if (usedResources === undefined) {
82
+ return undefined;
83
+ }
84
+ (0, assert_1.assert)(usedResources !== undefined);
85
+ return {
86
+ "resourcesCommonDirPaths": usedResources.resourcesCommonFilePaths.map(function (filePath) {
87
+ {
88
+ var splitArg = "/dist/";
89
+ if (filePath.includes(splitArg)) {
90
+ return filePath.split(splitArg)[0] + splitArg;
91
+ }
92
+ }
93
+ return (0, path_1.dirname)(filePath);
94
+ })
95
+ };
96
+ })();
78
97
  tmpDirPath = (0, path_1.join)(themeDirPath, "..", "tmp_suLeKsxId_".concat(crypto.createHash("sha256").update("".concat(themeType, "-").concat(keycloakVersion)).digest("hex").slice(0, 8)));
79
98
  return [4 /*yield*/, (0, download_builtin_keycloak_theme_1.downloadBuiltinKeycloakTheme)({
80
99
  projectDirPath: projectDirPath,
@@ -85,16 +104,7 @@ params) {
85
104
  _a.sent();
86
105
  (0, transformCodebase_1.transformCodebase)({
87
106
  "srcDirPath": (0, path_1.join)(tmpDirPath, "keycloak", themeType, "resources"),
88
- "destDirPath": (0, path_1.join)(themeDirPath, (0, path_1.relative)(mockTestingResourcesPath_1.basenameOfKeycloakDirInPublicDir, mockTestingResourcesPath_1.resourcesDirPathRelativeToPublicDir)),
89
- "transformSourceCode": usedResources === undefined
90
- ? undefined
91
- : function (_a) {
92
- var fileRelativePath = _a.fileRelativePath, sourceCode = _a.sourceCode;
93
- if (!usedResources.resourcesFilePaths.includes(fileRelativePath)) {
94
- return undefined;
95
- }
96
- return { "modifiedSourceCode": sourceCode };
97
- }
107
+ "destDirPath": (0, path_1.join)(themeDirPath, (0, path_1.relative)(mockTestingResourcesPath_1.basenameOfKeycloakDirInPublicDir, mockTestingResourcesPath_1.resourcesDirPathRelativeToPublicDir))
98
108
  });
99
109
  (0, transformCodebase_1.transformCodebase)({
100
110
  "srcDirPath": (0, path_1.join)(tmpDirPath, "keycloak", "common", "resources"),
@@ -103,7 +113,7 @@ params) {
103
113
  ? undefined
104
114
  : function (_a) {
105
115
  var fileRelativePath = _a.fileRelativePath, sourceCode = _a.sourceCode;
106
- if (!usedResources.resourcesCommonFilePaths.includes(fileRelativePath)) {
116
+ if (usedResources.resourcesCommonDirPaths.find(function (dirPath) { return fileRelativePath.startsWith(dirPath); }) === undefined) {
107
117
  return undefined;
108
118
  }
109
119
  return { "modifiedSourceCode": sourceCode };
@@ -1 +1 @@
1
- {"version":3,"file":"downloadKeycloakStaticResources.js","sourceRoot":"","sources":["../../../src/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAkE;AAClE,qCAAyB;AACzB,6BAAkE;AAElE,yFAAqF;AACrF,2EAIwC;AACxC,6CAAiC;AAEjC,SAAsB,+BAA+B;AACjD,kBAAkB;AAClB,MASC;;;;;;oBAEO,cAAc,GAA8D,MAAM,eAApE,EAAE,SAAS,GAAmD,MAAM,UAA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AC,2DAAgC,EAAE,oEAAyC,CAAC,CAAC;wBAChI,qBAAqB,EACjB,aAAa,KAAK,SAAS;4BACvB,CAAC,CAAC,SAAS;4BACX,CAAC,CAAC,UAAC,EAAgC;oCAA9B,gBAAgB,sBAAA,EAAE,UAAU,gBAAA;gCAC3B,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;oCACpE,OAAO,SAAS,CAAC;iCACpB;gCAED,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,CAAC;4BAChD,CAAC;qBACd,CAAC,CAAC;oBAEH,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;;;;;CAC/D;AA1DD,0EA0DC"}
1
+ {"version":3,"file":"downloadKeycloakStaticResources.js","sourceRoot":"","sources":["../../../src/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAkE;AAClE,qCAAyB;AACzB,6BAA0F;AAE1F,yFAAqF;AACrF,2EAIwC;AACxC,6CAAiC;AACjC,uCAAsC;AAEtC,SAAsB,+BAA+B;AACjD,kBAAkB;AAClB,MASC;;;;;;oBAEO,cAAc,GAA+C,MAAM,eAArD,EAAE,SAAS,GAAoC,MAAM,UAA1C,EAAE,YAAY,GAAsB,MAAM,aAA5B,EAAE,eAAe,GAAK,MAAM,gBAAX,CAAY;oBAGtE,aAAa,GAAG,CAAC;wBACX,IAAA,aAAa,GAAK,MAAM,cAAX,CAAY;wBAEjC,IAAI,aAAa,KAAK,SAAS,EAAE;4BAC7B,OAAO,SAAS,CAAC;yBACpB;wBAED,IAAA,eAAM,EAAC,aAAa,KAAK,SAAS,CAAC,CAAC;wBAEpC,OAAO;4BACH,yBAAyB,EAAE,aAAa,CAAC,wB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Aa,KAAK,SAAS;4BACvB,CAAC,CAAC,SAAS;4BACX,CAAC,CAAC,UAAC,EAAgC;oCAA9B,gBAAgB,sBAAA,EAAE,UAAU,gBAAA;gCAC3B,IAAI,aAAa,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAA,OAAO,IAAI,OAAA,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,EAApC,CAAoC,CAAC,KAAK,SAAS,EAAE;oCAC3G,OAAO,SAAS,CAAC;iCACpB;gCAED,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,CAAC;4BAChD,CAAC;qBACd,CAAC,CAAC;oBAEH,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;;;;;CAC/D;AAzED,0EAyEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "8.1.1",
3
+ "version": "8.1.2",
4
4
  "description": "Create Keycloak themes using React",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  import { transformCodebase } from "../../tools/transformCodebase";
2
2
  import * as fs from "fs";
3
- import { join as pathJoin, relative as pathRelative } from "path";
3
+ import { join as pathJoin, relative as pathRelative, dirname as pathDirname } from "path";
4
4
  import type { ThemeType } from "../generateFtl";
5
5
  import { downloadBuiltinKeycloakTheme } from "../../download-builtin-keycloak-theme";
6
6
  import {
@@ -9,6 +9,7 @@ import {
9
9
  basenameOfKeycloakDirInPublicDir
10
10
  } from "../../mockTestingResourcesPath";
11
11
  import * as crypto from "crypto";
12
+ import { assert } from "tsafe/assert";
12
13
 
13
14
  export async function downloadKeycloakStaticResources(
14
15
  // prettier-ignore
@@ -23,7 +24,32 @@ export async function downloadKeycloakStaticResources(
23
24
  } | undefined
24
25
  }
25
26
  ) {
26
- const { projectDirPath, themeType, themeDirPath, keycloakVersion, usedResources } = params;
27
+ const { projectDirPath, themeType, themeDirPath, keycloakVersion } = params;
28
+
29
+ // NOTE: Hack for 427
30
+ const usedResources = (() => {
31
+ const { usedResources } = params;
32
+
33
+ if (usedResources === undefined) {
34
+ return undefined;
35
+ }
36
+
37
+ assert(usedResources !== undefined);
38
+
39
+ return {
40
+ "resourcesCommonDirPaths": usedResources.resourcesCommonFilePaths.map(filePath => {
41
+ {
42
+ const splitArg = "/dist/";
43
+
44
+ if (filePath.includes(splitArg)) {
45
+ return filePath.split(splitArg)[0] + splitArg;
46
+ }
47
+ }
48
+
49
+ return pathDirname(filePath);
50
+ })
51
+ };
52
+ })();
27
53
 
28
54
  const tmpDirPath = pathJoin(
29
55
  themeDirPath,
@@ -39,17 +65,7 @@ export async function downloadKeycloakStaticResources(
39
65
 
40
66
  transformCodebase({
41
67
  "srcDirPath": pathJoin(tmpDirPath, "keycloak", themeType, "resources"),
42
- "destDirPath": pathJoin(themeDirPath, pathRelative(basenameOfKeycloakDirInPublicDir, resourcesDirPathRelativeToPublicDir)),
43
- "transformSourceCode":
44
- usedResources === undefined
45
- ? undefined
46
- : ({ fileRelativePath, sourceCode }) => {
47
- if (!usedResources.resourcesFilePaths.includes(fileRelativePath)) {
48
- return undefined;
49
- }
50
-
51
- return { "modifiedSourceCode": sourceCode };
52
- }
68
+ "destDirPath": pathJoin(themeDirPath, pathRelative(basenameOfKeycloakDirInPublicDir, resourcesDirPathRelativeToPublicDir))
53
69
  });
54
70
 
55
71
  transformCodebase({
@@ -59,7 +75,7 @@ export async function downloadKeycloakStaticResources(
59
75
  usedResources === undefined
60
76
  ? undefined
61
77
  : ({ fileRelativePath, sourceCode }) => {
62
- if (!usedResources.resourcesCommonFilePaths.includes(fileRelativePath)) {
78
+ if (usedResources.resourcesCommonDirPaths.find(dirPath => fileRelativePath.startsWith(dirPath)) === undefined) {
63
79
  return undefined;
64
80
  }
65
81