@easybits.cloud/cli 0.15.2 → 0.15.3
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 +1 -0
- package/dist/index.js +15 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,6 +105,7 @@ easybits agents create --from helper.json --name helper-3
|
|
|
105
105
|
# Files, websites, account
|
|
106
106
|
easybits files ls
|
|
107
107
|
easybits files upload ./report.pdf
|
|
108
|
+
easybits files upload ./logo.png --public # open CDN URL; private by default
|
|
108
109
|
easybits files rm FILE_ID --yes
|
|
109
110
|
easybits websites ls
|
|
110
111
|
easybits websites create "My shop" --slug my-shop # slug optional
|
package/dist/index.js
CHANGED
|
@@ -866,22 +866,30 @@ var files = {
|
|
|
866
866
|
},
|
|
867
867
|
upload: {
|
|
868
868
|
summary: "Upload a local file",
|
|
869
|
-
usage: "easybits files upload <path>",
|
|
870
|
-
|
|
869
|
+
usage: "easybits files upload <path> [--public]",
|
|
870
|
+
options: {
|
|
871
|
+
public: { type: "boolean", description: "Public file with an open CDN URL (default: private)" }
|
|
872
|
+
},
|
|
873
|
+
examples: ["easybits files upload ./report.pdf", "easybits files upload ./logo.png --public --json"],
|
|
871
874
|
async run(ctx) {
|
|
872
875
|
const path = need(ctx, 0, "path", this.usage);
|
|
873
876
|
if (!existsSync2(path)) throw usageError(t(`File not found: ${path}`, `No existe el archivo: ${path}`), this.usage);
|
|
874
877
|
const size = statSync(path).size;
|
|
875
878
|
const contentType = MIME[extname(path).slice(1).toLowerCase()] || "application/octet-stream";
|
|
876
879
|
const eb = await getClient(ctx);
|
|
877
|
-
const
|
|
880
|
+
const access = bool(ctx, "public") ? "public" : void 0;
|
|
881
|
+
const data = await eb.uploadFile({ fileName: basename(path), contentType, size, access });
|
|
878
882
|
const res = await fetch(data.putUrl, {
|
|
879
883
|
method: "PUT",
|
|
880
884
|
body: readFileSync3(path),
|
|
881
885
|
headers: { "Content-Type": contentType }
|
|
882
886
|
});
|
|
883
887
|
if (!res.ok) throw new CliError(t(`Upload failed: storage answered ${res.status}`, `Fall\xF3 la subida: el almacenamiento contest\xF3 ${res.status}`), 1, void 0, "upload_failed", res.status);
|
|
884
|
-
|
|
888
|
+
const url = data.file.url;
|
|
889
|
+
emit(ctx, data.file, () => {
|
|
890
|
+
console.log(`${t("Uploaded", "Subido")}: ${data.file.id}`);
|
|
891
|
+
if (url) console.log(`URL: ${url}`);
|
|
892
|
+
});
|
|
885
893
|
}
|
|
886
894
|
},
|
|
887
895
|
rm: {
|
|
@@ -3715,7 +3723,7 @@ async function updateNotice(current2) {
|
|
|
3715
3723
|
}
|
|
3716
3724
|
|
|
3717
3725
|
// src/commands/doctor.ts
|
|
3718
|
-
var VERSION = true ? "0.15.
|
|
3726
|
+
var VERSION = true ? "0.15.3" : "dev";
|
|
3719
3727
|
var doctor2 = {
|
|
3720
3728
|
name: "doctor",
|
|
3721
3729
|
group: "Account",
|
|
@@ -4000,6 +4008,7 @@ var HELP_ES = {
|
|
|
4000
4008
|
"Your files in EasyBits storage": "Tus archivos en el almacenamiento de EasyBits",
|
|
4001
4009
|
"List your files": "Enlista tus archivos",
|
|
4002
4010
|
"Upload a local file": "Sube un archivo local",
|
|
4011
|
+
"Public file with an open CDN URL (default: private)": "Archivo p\xFAblico con URL abierta en el CDN (por defecto: privado)",
|
|
4003
4012
|
"Delete a file (soft delete, 7-day trash)": "Borra un archivo (a la papelera 7 d\xEDas)",
|
|
4004
4013
|
"List your static websites": "Enlista tus sitios est\xE1ticos",
|
|
4005
4014
|
"Static websites: list, create, change slug": "Sitios est\xE1ticos: enlistar, crear, cambiar slug",
|
|
@@ -4223,7 +4232,7 @@ function normalizeArgs(input) {
|
|
|
4223
4232
|
}
|
|
4224
4233
|
|
|
4225
4234
|
// src/index.ts
|
|
4226
|
-
var VERSION2 = true ? "0.15.
|
|
4235
|
+
var VERSION2 = true ? "0.15.3" : "dev";
|
|
4227
4236
|
var GLOBAL_OPTIONS = {
|
|
4228
4237
|
json: { type: "boolean" },
|
|
4229
4238
|
token: { type: "string" },
|
package/package.json
CHANGED