keycloakify 11.0.0 → 11.0.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/README.md CHANGED
@@ -132,6 +132,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
132
132
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/oliviergoulet5"><img src="https://avatars.githubusercontent.com/u/17685861?v=4?s=100" width="100px;" alt="Olivier Goulet"/><br /><sub><b>Olivier Goulet</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=oliviergoulet5" title="Code">💻</a></td>
133
133
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/liamlows"><img src="https://avatars.githubusercontent.com/u/1365914?v=4?s=100" width="100px;" alt="Liam Lowsley-Williams"/><br /><sub><b>Liam Lowsley-Williams</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=liamlows" title="Code">💻</a> <a href="https://github.com/keycloakify/keycloakify/commits?author=liamlows" title="Documentation">📖</a></td>
134
134
  </tr>
135
+ <tr>
136
+ <td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/oes-rioniz/"><img src="https://avatars.githubusercontent.com/u/5172296?v=4?s=100" width="100px;" alt="Omid"/><br /><sub><b>Omid</b></sub></a><br /><a href="https://github.com/keycloakify/keycloakify/commits?author=uchar" title="Tests">⚠️</a> <a href="https://github.com/keycloakify/keycloakify/commits?author=uchar" title="Code">💻</a></td>
137
+ </tr>
135
138
  </tbody>
136
139
  </table>
137
140
 
package/bin/499.index.js CHANGED
@@ -1249,6 +1249,8 @@ function generatePom(params) {
1249
1249
  //# sourceMappingURL=generatePom.js.map
1250
1250
  // EXTERNAL MODULE: ./dist/bin/tools/isInside.js
1251
1251
  var isInside = __webpack_require__(90665);
1252
+ // EXTERNAL MODULE: ./dist/bin/tools/fs.existsAsync.js
1253
+ var fs_existsAsync = __webpack_require__(43765);
1252
1254
  ;// CONCATENATED MODULE: ./dist/bin/keycloakify/buildJars/buildJar.js
1253
1255
 
1254
1256
 
@@ -1260,6 +1262,7 @@ var isInside = __webpack_require__(90665);
1260
1262
 
1261
1263
 
1262
1264
 
1265
+
1263
1266
  (0,assert.assert)();
1264
1267
  async function buildJar(params) {
1265
1268
  const { jarFileBasename, keycloakAccountV1Version, keycloakThemeAdditionalInfoExtensionVersion, resourcesDirPath, doesImplementAccountV1Theme, buildContext } = params;
@@ -1314,8 +1317,13 @@ async function buildJar(params) {
1314
1317
  if (!buildContext.implementedThemeTypes.login.isImplemented) {
1315
1318
  break route_legacy_pages;
1316
1319
  }
1317
- ["register.ftl", "login-update-profile.ftl"].forEach(pageId => buildContext.themeNames.map(themeName => {
1320
+ await Promise.all(["register.ftl", "login-update-profile.ftl"]
1321
+ .map(pageId => buildContext.themeNames.map(async (themeName) => {
1318
1322
  const ftlFilePath = (0,external_path_.join)(tmpResourcesDirPath, "theme", themeName, "login", pageId);
1323
+ // NOTE: https://github.com/keycloakify/keycloakify/issues/665
1324
+ if (!(await (0,fs_existsAsync/* existsAsync */.o)(ftlFilePath))) {
1325
+ return;
1326
+ }
1319
1327
  const ftlFileContent = (0,external_fs_.readFileSync)(ftlFilePath).toString("utf8");
1320
1328
  const ftlFileBasename = (() => {
1321
1329
  switch (pageId) {
@@ -1328,8 +1336,9 @@ async function buildJar(params) {
1328
1336
  })();
1329
1337
  const modifiedFtlFileContent = ftlFileContent.replace(`"ftlTemplateFileName": "${pageId}"`, `"ftlTemplateFileName": "${ftlFileBasename}"`);
1330
1338
  (0,assert.assert)(modifiedFtlFileContent !== ftlFileContent);
1331
- promises_.writeFile((0,external_path_.join)((0,external_path_.dirname)(ftlFilePath), ftlFileBasename), Buffer.from(modifiedFtlFileContent, "utf8"));
1332
- }));
1339
+ await promises_.writeFile((0,external_path_.join)((0,external_path_.dirname)(ftlFilePath), ftlFileBasename), Buffer.from(modifiedFtlFileContent, "utf8"));
1340
+ }))
1341
+ .flat());
1333
1342
  }
1334
1343
  {
1335
1344
  const { pomFileCode } = generatePom({
@@ -1651,6 +1660,30 @@ function escapeStringForPropertiesFile(str) {
1651
1660
 
1652
1661
  /***/ }),
1653
1662
 
1663
+ /***/ 43765:
1664
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1665
+
1666
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1667
+ /* harmony export */ "o": () => (/* binding */ existsAsync)
1668
+ /* harmony export */ });
1669
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73292);
1670
+ /* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_0__);
1671
+
1672
+ async function existsAsync(path) {
1673
+ try {
1674
+ await fs_promises__WEBPACK_IMPORTED_MODULE_0__.stat(path);
1675
+ return true;
1676
+ }
1677
+ catch (error) {
1678
+ if (error.code === "ENOENT")
1679
+ return false;
1680
+ throw error;
1681
+ }
1682
+ }
1683
+ //# sourceMappingURL=fs.existsAsync.js.map
1684
+
1685
+ /***/ }),
1686
+
1654
1687
  /***/ 89693:
1655
1688
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1656
1689
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "11.0.0",
3
+ "version": "11.0.1",
4
4
  "description": "Framework to create custom Keycloak UIs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,6 +16,7 @@ import { isInside } from "../../tools/isInside";
16
16
  import child_process from "child_process";
17
17
  import { rmSync } from "../../tools/fs.rmSync";
18
18
  import { writeMetaInfKeycloakThemes } from "../../shared/metaInfKeycloakThemes";
19
+ import { existsAsync } from "../../tools/fs.existsAsync";
19
20
 
20
21
  export type BuildContextLike = BuildContextLike_generatePom & {
21
22
  keycloakifyBuildDirPath: string;
@@ -135,40 +136,49 @@ export async function buildJar(params: {
135
136
  break route_legacy_pages;
136
137
  }
137
138
 
138
- (["register.ftl", "login-update-profile.ftl"] as const).forEach(pageId =>
139
- buildContext.themeNames.map(themeName => {
140
- const ftlFilePath = pathJoin(
141
- tmpResourcesDirPath,
142
- "theme",
143
- themeName,
144
- "login",
145
- pageId
146
- );
147
-
148
- const ftlFileContent = readFileSync(ftlFilePath).toString("utf8");
149
-
150
- const ftlFileBasename = (() => {
151
- switch (pageId) {
152
- case "register.ftl":
153
- return "register-user-profile.ftl";
154
- case "login-update-profile.ftl":
155
- return "update-user-profile.ftl";
156
- }
157
- assert<Equals<typeof pageId, never>>(false);
158
- })();
159
-
160
- const modifiedFtlFileContent = ftlFileContent.replace(
161
- `"ftlTemplateFileName": "${pageId}"`,
162
- `"ftlTemplateFileName": "${ftlFileBasename}"`
163
- );
164
-
165
- assert(modifiedFtlFileContent !== ftlFileContent);
166
-
167
- fs.writeFile(
168
- pathJoin(pathDirname(ftlFilePath), ftlFileBasename),
169
- Buffer.from(modifiedFtlFileContent, "utf8")
170
- );
171
- })
139
+ await Promise.all(
140
+ (["register.ftl", "login-update-profile.ftl"] as const)
141
+ .map(pageId =>
142
+ buildContext.themeNames.map(async themeName => {
143
+ const ftlFilePath = pathJoin(
144
+ tmpResourcesDirPath,
145
+ "theme",
146
+ themeName,
147
+ "login",
148
+ pageId
149
+ );
150
+
151
+ // NOTE: https://github.com/keycloakify/keycloakify/issues/665
152
+ if (!(await existsAsync(ftlFilePath))) {
153
+ return;
154
+ }
155
+
156
+ const ftlFileContent = readFileSync(ftlFilePath).toString("utf8");
157
+
158
+ const ftlFileBasename = (() => {
159
+ switch (pageId) {
160
+ case "register.ftl":
161
+ return "register-user-profile.ftl";
162
+ case "login-update-profile.ftl":
163
+ return "update-user-profile.ftl";
164
+ }
165
+ assert<Equals<typeof pageId, never>>(false);
166
+ })();
167
+
168
+ const modifiedFtlFileContent = ftlFileContent.replace(
169
+ `"ftlTemplateFileName": "${pageId}"`,
170
+ `"ftlTemplateFileName": "${ftlFileBasename}"`
171
+ );
172
+
173
+ assert(modifiedFtlFileContent !== ftlFileContent);
174
+
175
+ await fs.writeFile(
176
+ pathJoin(pathDirname(ftlFilePath), ftlFileBasename),
177
+ Buffer.from(modifiedFtlFileContent, "utf8")
178
+ );
179
+ })
180
+ )
181
+ .flat()
172
182
  );
173
183
  }
174
184