@promte/app-upload 0.1.5 → 0.1.7
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/promte-app-upload.js +6 -6
- package/package.json +1 -1
package/bin/promte-app-upload.js
CHANGED
|
@@ -6,7 +6,8 @@ import AdmZip from "adm-zip";
|
|
|
6
6
|
import undici from "undici";
|
|
7
7
|
import readline from "node:readline/promises";
|
|
8
8
|
|
|
9
|
-
const { FormData,
|
|
9
|
+
const { FormData, Blob, fetch: undiciFetch } = undici;
|
|
10
|
+
const BlobCtor = globalThis.Blob || Blob;
|
|
10
11
|
|
|
11
12
|
const DEFAULT_HOST = "https://app.promte.dk";
|
|
12
13
|
const DEFAULT_DIST = "./dist";
|
|
@@ -199,17 +200,16 @@ async function runPush(args) {
|
|
|
199
200
|
zipBuffer = zip.toBuffer();
|
|
200
201
|
}
|
|
201
202
|
|
|
203
|
+
assert(BlobCtor, "Blob is not available in this Node runtime.");
|
|
202
204
|
const form = new FormData();
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
});
|
|
206
|
-
form.append("app", file);
|
|
205
|
+
const blob = new BlobCtor([zipBuffer], { type: "application/zip" });
|
|
206
|
+
form.append("app", blob, zipName);
|
|
207
207
|
|
|
208
208
|
const url = new URL("/api/upload-app-version", host);
|
|
209
209
|
url.searchParams.set("workspaceId", workspaceId);
|
|
210
210
|
if (args.version) url.searchParams.set("version", args.version);
|
|
211
211
|
|
|
212
|
-
const res = await
|
|
212
|
+
const res = await undiciFetch(url.toString(), {
|
|
213
213
|
method: "POST",
|
|
214
214
|
headers: {
|
|
215
215
|
"service-key": serviceKey,
|