@promte/app-upload 0.1.3 → 0.1.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/README.md CHANGED
@@ -11,9 +11,9 @@ npx promte-app-upload push
11
11
  ## Commands
12
12
  ```
13
13
  promte-app-upload config
14
- - interactive setup for host/workspaceId/dist (stored in ~/.promte-app-upload.json)
14
+ - interactive setup for host/workspaceId/dist (stored in ./promte-app-upload.config.json)
15
15
 
16
- promte-app-upload push [--host ...] [--workspaceId ...] [--dist ...] [--serviceKey ...]
16
+ promte-app-upload push [--host ...] [--workspaceId ...] [--dist ...] [--zip ...] [--serviceKey ...]
17
17
  - uploads ./dist by default
18
18
  - host defaults to https://app.promte.dk
19
19
  - use --zip <file> to upload an existing zip
@@ -6,11 +6,12 @@ import AdmZip from "adm-zip";
6
6
  import undici from "undici";
7
7
  import readline from "node:readline/promises";
8
8
 
9
- const { FormData, File } = undici;
9
+ const { FormData, Blob } = undici;
10
+ const BlobCtor = globalThis.Blob || Blob;
10
11
 
11
12
  const DEFAULT_HOST = "https://app.promte.dk";
12
13
  const DEFAULT_DIST = "./dist";
13
- const CONFIG_PATH = path.join(os.homedir(), ".promte-app-upload.json");
14
+ const CONFIG_PATH = path.resolve(process.cwd(), "promte-app-upload.config.json");
14
15
 
15
16
  function usage() {
16
17
  console.log(
@@ -199,11 +200,10 @@ 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 file = new File([zipBuffer], zipName, {
204
- type: "application/zip",
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promte/app-upload",
3
- "version": "0.1.3",
3
+ "version": "0.1.6",
4
4
  "description": "CLI to upload Promte app bundles",
5
5
  "type": "module",
6
6
  "bin": {