keycloakify 11.15.4 → 11.15.6

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/97.index.js CHANGED
@@ -1146,7 +1146,8 @@ async function npmInstall(params) {
1146
1146
  async function runPackageManagerInstall(params) {
1147
1147
  const { packageManagerBinName, cwd } = params;
1148
1148
  const dCompleted = new Deferred.Deferred();
1149
- const child = external_child_process_.spawn(packageManagerBinName, ["install", ...(packageManagerBinName !== "npm" ? [] : ["--force"])], {
1149
+ const packageManagerArguments = ["install", ...(packageManagerBinName !== "npm" ? [] : ["--force"])];
1150
+ const child = external_child_process_.spawn(packageManagerBinName + " " + packageManagerArguments.join(" "), {
1150
1151
  cwd,
1151
1152
  env: process.env,
1152
1153
  shell: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "11.15.4",
3
+ "version": "11.15.6",
4
4
  "description": "Framework to create custom Keycloak UIs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1230,7 +1230,7 @@
1230
1230
  "@types/properties-parser": "^0.3.3",
1231
1231
  "@types/react": "^18.0.35",
1232
1232
  "@types/react-dom": "^18.0.11",
1233
- "@types/yauzl": "^2.10.3",
1233
+ "@types/yauzl": "^3.3.0",
1234
1234
  "@vercel/ncc": "^0.38.1",
1235
1235
  "babel-loader": "9.1.3",
1236
1236
  "chalk": "^4.1.2",
@@ -1243,6 +1243,7 @@
1243
1243
  "html-entities": "^2.5.2",
1244
1244
  "husky": "^4.3.8",
1245
1245
  "isomorphic-dompurify": "^2.15.0",
1246
+ "json5": "^2.2.3",
1246
1247
  "lint-staged": "^11.0.0",
1247
1248
  "magic-string": "^0.30.7",
1248
1249
  "make-fetch-happen": "^11.0.3",
@@ -1263,8 +1264,7 @@
1263
1264
  "vitest": "^1.6.0",
1264
1265
  "webpack": "5.93.0",
1265
1266
  "webpack-cli": "5.1.4",
1266
- "yauzl": "^2.10.0",
1267
- "zod": "^3.17.10",
1268
- "json5": "^2.2.3"
1267
+ "yauzl": "^3.4.0",
1268
+ "zod": "^3.17.10"
1269
1269
  }
1270
1270
  }
@@ -152,7 +152,7 @@ export async function appBuild(params: {
152
152
 
153
153
  console.log(chalk.blue("$ npx vite build"));
154
154
 
155
- const child = child_process.spawn("npx", ["vite", "build"], {
155
+ const child = child_process.spawn("npx vite build", {
156
156
  cwd: buildContext.projectDirPath,
157
157
  shell: true
158
158
  });
@@ -22,7 +22,7 @@ export async function keycloakifyBuild(params: {
22
22
 
23
23
  console.log(chalk.blue("$ npx keycloakify build"));
24
24
 
25
- const child = child_process.spawn("npx", ["keycloakify", "build"], {
25
+ const child = child_process.spawn("npx keycloakify build", {
26
26
  cwd: buildContext.projectDirPath,
27
27
  env: {
28
28
  ...process.env,
@@ -52,27 +52,24 @@ export async function dumpContainerConfig(params: {
52
52
 
53
53
  {
54
54
  const dCompleted = new Deferred<void>();
55
-
56
- const child = child_process.spawn(
57
- "docker",
58
- [
59
- ...["exec", CONTAINER_NAME],
60
- ...["/opt/keycloak/bin/kc.sh", "export"],
61
- ...["--dir", "/tmp"],
62
- ...["--realm", realmName],
63
- ...["--users", "realm_file"],
64
- ...(!doesUseLockedH2Database
65
- ? []
66
- : [
67
- ...["--db", "dev-file"],
68
- ...[
69
- "--db-url",
70
- '"jdbc:h2:file:/tmp/h2/keycloakdb;NON_KEYWORDS=VALUE"'
71
- ]
72
- ])
73
- ],
74
- { shell: true }
75
- );
55
+ const dockerArguments = [
56
+ ...["exec", CONTAINER_NAME],
57
+ ...["/opt/keycloak/bin/kc.sh", "export"],
58
+ ...["--dir", "/tmp"],
59
+ ...["--realm", realmName],
60
+ ...["--users", "realm_file"],
61
+ ...(!doesUseLockedH2Database
62
+ ? []
63
+ : [
64
+ ...["--db", "dev-file"],
65
+ ...[
66
+ "--db-url",
67
+ '"jdbc:h2:file:/tmp/h2/keycloakdb;NON_KEYWORDS=VALUE"'
68
+ ]
69
+ ])
70
+ ];
71
+
72
+ const child = child_process.spawn("docker " + dockerArguments.join(" "), { shell: true });
76
73
 
77
74
  let output = "";
78
75
 
@@ -621,8 +621,8 @@ export async function command(params: {
621
621
  );
622
622
 
623
623
  const child = child_process.spawn(
624
- "docker",
625
- ["run", ...dockerRunArgs.map(line => line.split(SPACE_PLACEHOLDER)).flat()],
624
+ "docker run " +
625
+ dockerRunArgs.map(line => line.split(SPACE_PLACEHOLDER)).flat().join(" "),
626
626
  { shell: true }
627
627
  );
628
628
 
@@ -18,7 +18,7 @@ export function startViteDevServer(params: {
18
18
 
19
19
  console.log(chalk.blue(`$ npx vite dev`));
20
20
 
21
- const child = child_process.spawn("npx", ["vite", "dev"], {
21
+ const child = child_process.spawn("npx vite dev", {
22
22
  cwd: buildContext.projectDirPath,
23
23
  env: {
24
24
  ...process.env,
@@ -2,10 +2,21 @@ import fs from "fs/promises";
2
2
  import fsSync from "fs";
3
3
  import yauzl from "yauzl";
4
4
  import stream from "stream";
5
- import { Deferred } from "evt/tools/Deferred";
6
5
  import { dirname as pathDirname, sep as pathSep } from "path";
7
6
  import { existsAsync } from "./fs.existsAsync";
8
7
 
8
+ type ZipFileWithPromises = yauzl.ZipFile & {
9
+ eachEntry: () => AsyncIterable<yauzl.Entry>;
10
+ openReadStreamPromise: (
11
+ entry: yauzl.Entry,
12
+ options?: yauzl.ZipFileOptions
13
+ ) => Promise<stream.Readable>;
14
+ };
15
+
16
+ type YauzlWithPromises = typeof yauzl & {
17
+ openPromise: (path: string, options?: yauzl.Options) => Promise<ZipFileWithPromises>;
18
+ };
19
+
9
20
  export async function extractArchive(params: {
10
21
  archiveFilePath: string;
11
22
  onArchiveFile: (params: {
@@ -18,22 +29,7 @@ export async function extractArchive(params: {
18
29
  }) {
19
30
  const { archiveFilePath, onArchiveFile } = params;
20
31
 
21
- const zipFile = await new Promise<yauzl.ZipFile>((resolve, reject) => {
22
- yauzl.open(archiveFilePath, { lazyEntries: true }, async (error, zipFile) => {
23
- if (error) {
24
- reject(error);
25
- return;
26
- }
27
- resolve(zipFile);
28
- });
29
- });
30
-
31
- const dDone = new Deferred<void>();
32
-
33
- zipFile.once("end", () => {
34
- zipFile.close();
35
- dDone.resolve();
36
- });
32
+ const zipFile = await (yauzl as YauzlWithPromises).openPromise(archiveFilePath);
37
33
 
38
34
  const writeFile = async (
39
35
  entry: yauzl.Entry,
@@ -57,56 +53,39 @@ export async function extractArchive(params: {
57
53
  return;
58
54
  }
59
55
 
60
- const readStream = await new Promise<stream.Readable>(resolve =>
61
- zipFile.openReadStream(entry, async (error, readStream) => {
56
+ const readStream = await zipFile.openReadStreamPromise(entry);
57
+
58
+ await new Promise<void>((resolve, reject) => {
59
+ stream.pipeline(readStream, fsSync.createWriteStream(filePath), error => {
62
60
  if (error) {
63
- dDone.reject(error);
61
+ reject(error);
64
62
  return;
65
63
  }
66
64
 
67
- resolve(readStream);
68
- })
69
- );
70
-
71
- const dDoneWithFile = new Deferred<void>();
72
-
73
- stream.pipeline(readStream, fsSync.createWriteStream(filePath), error => {
74
- if (error) {
75
- dDone.reject(error);
76
- return;
77
- }
78
-
79
- dDoneWithFile.resolve();
65
+ resolve();
66
+ });
80
67
  });
81
-
82
- await dDoneWithFile.pr;
83
68
  };
84
69
 
85
- const readFile = (entry: yauzl.Entry) =>
86
- new Promise<Buffer>(resolve =>
87
- zipFile.openReadStream(entry, async (error, readStream) => {
88
- if (error) {
89
- dDone.reject(error);
90
- return;
91
- }
70
+ const readFile = async (entry: yauzl.Entry) => {
71
+ const readStream = await zipFile.openReadStreamPromise(entry);
92
72
 
93
- const chunks: Buffer[] = [];
73
+ return new Promise<Buffer>((resolve, reject) => {
74
+ const chunks: Buffer[] = [];
94
75
 
95
- readStream.on("data", chunk => {
96
- chunks.push(chunk);
97
- });
76
+ readStream.on("data", chunk => {
77
+ chunks.push(chunk);
78
+ });
98
79
 
99
- readStream.on("end", () => {
100
- resolve(Buffer.concat(chunks));
101
- });
80
+ readStream.on("end", () => {
81
+ resolve(Buffer.concat(chunks));
82
+ });
102
83
 
103
- readStream.on("error", error => {
104
- dDone.reject(error);
105
- });
106
- })
107
- );
84
+ readStream.on("error", reject);
85
+ });
86
+ };
108
87
 
109
- zipFile.on("entry", async (entry: yauzl.Entry) => {
88
+ for await (const entry of zipFile.eachEntry()) {
110
89
  handle_file: {
111
90
  // NOTE: Skip directories
112
91
  if (entry.fileName.endsWith("/")) {
@@ -126,15 +105,8 @@ export async function extractArchive(params: {
126
105
 
127
106
  if (hasEarlyExitBeenCalled) {
128
107
  zipFile.close();
129
- dDone.resolve();
130
108
  return;
131
109
  }
132
110
  }
133
-
134
- zipFile.readEntry();
135
- });
136
-
137
- zipFile.readEntry();
138
-
139
- await dDone.pr;
111
+ }
140
112
  }
@@ -98,10 +98,10 @@ async function runPackageManagerInstall(params: {
98
98
  const { packageManagerBinName, cwd } = params;
99
99
 
100
100
  const dCompleted = new Deferred<void>();
101
+ const packageManagerArguments = ["install", ...(packageManagerBinName !== "npm" ? [] : ["--force"])];
101
102
 
102
103
  const child = child_process.spawn(
103
- packageManagerBinName,
104
- ["install", ...(packageManagerBinName !== "npm" ? [] : ["--force"])],
104
+ packageManagerBinName + " " + packageManagerArguments.join(" "),
105
105
  {
106
106
  cwd,
107
107
  env: process.env,