@capgo/cli 4.3.6 → 4.4.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/CHANGELOG.md +14 -0
- package/dist/index.js +17 -2
- package/package.json +1 -1
- package/src/bundle/upload.ts +4 -1
- package/src/utils.ts +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [4.4.1](https://github.com/Cap-go/CLI/compare/v4.4.0...v4.4.1) (2024-04-21)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* lint issue auto delete ([3d343e2](https://github.com/Cap-go/CLI/commit/3d343e29522b4de725836965c9ec2aabcf469171))
|
|
11
|
+
|
|
12
|
+
## [4.4.0](https://github.com/Cap-go/CLI/compare/v4.3.6...v4.4.0) (2024-04-21)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add auto delete Failed Versions upload ([8ba691c](https://github.com/Cap-go/CLI/commit/8ba691c116b92ababa2870fd5ed9479b9286242d))
|
|
18
|
+
|
|
5
19
|
### [4.3.6](https://github.com/Cap-go/CLI/compare/v4.3.5...v4.3.6) (2024-04-21)
|
|
6
20
|
|
|
7
21
|
|
package/dist/index.js
CHANGED
|
@@ -91634,7 +91634,7 @@ var {
|
|
|
91634
91634
|
// package.json
|
|
91635
91635
|
var package_default = {
|
|
91636
91636
|
name: "@capgo/cli",
|
|
91637
|
-
version: "4.
|
|
91637
|
+
version: "4.4.1",
|
|
91638
91638
|
description: "A CLI to upload to capgo servers",
|
|
91639
91639
|
main: "dist/index.js",
|
|
91640
91640
|
bin: {
|
|
@@ -93079,6 +93079,20 @@ async function uploadUrl(supabase, appId, name) {
|
|
|
93079
93079
|
}
|
|
93080
93080
|
return "";
|
|
93081
93081
|
}
|
|
93082
|
+
async function deletedFailedVersion(supabase, appId, name) {
|
|
93083
|
+
const data = {
|
|
93084
|
+
app_id: appId,
|
|
93085
|
+
name
|
|
93086
|
+
};
|
|
93087
|
+
try {
|
|
93088
|
+
const pathFailed = "private/delete_failed_version";
|
|
93089
|
+
const res = await supabase.functions.invoke(pathFailed, { body: JSON.stringify(data), method: "DELETE" });
|
|
93090
|
+
return res.data.url;
|
|
93091
|
+
} catch (error) {
|
|
93092
|
+
f2.error(`Cannot delete failed version ${formatError(error)}`);
|
|
93093
|
+
return Promise.reject(new Error("Cannot delete failed version"));
|
|
93094
|
+
}
|
|
93095
|
+
}
|
|
93082
93096
|
async function updateOrCreateChannel(supabase, update) {
|
|
93083
93097
|
if (!update.app_id || !update.name || !update.created_by) {
|
|
93084
93098
|
f2.error("missing app_id, name, or created_by");
|
|
@@ -94214,7 +94228,7 @@ The app size is ${mbSize} Mb, this may take a while to download for users
|
|
|
94214
94228
|
}
|
|
94215
94229
|
try {
|
|
94216
94230
|
await distribution_default.put(url, {
|
|
94217
|
-
timeout:
|
|
94231
|
+
timeout: 2e4,
|
|
94218
94232
|
retry: 5,
|
|
94219
94233
|
body: zipped,
|
|
94220
94234
|
headers: !localS3 ? {
|
|
@@ -94225,6 +94239,7 @@ The app size is ${mbSize} Mb, this may take a while to download for users
|
|
|
94225
94239
|
});
|
|
94226
94240
|
} catch (errorUpload) {
|
|
94227
94241
|
f2.error(`Cannot upload bundle ${formatError(errorUpload)}`);
|
|
94242
|
+
await deletedFailedVersion(supabase, appid, bundle2);
|
|
94228
94243
|
program.error("");
|
|
94229
94244
|
}
|
|
94230
94245
|
versionData.storage_provider = "r2";
|
package/package.json
CHANGED
package/src/bundle/upload.ts
CHANGED
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
checkPlanValid,
|
|
27
27
|
convertAppName,
|
|
28
28
|
createSupabaseClient,
|
|
29
|
+
deletedFailedVersion,
|
|
29
30
|
findSavedKey,
|
|
30
31
|
formatError,
|
|
31
32
|
getAppOwner,
|
|
@@ -388,7 +389,7 @@ It will be also visible in your dashboard\n`)
|
|
|
388
389
|
}
|
|
389
390
|
try {
|
|
390
391
|
await ky.put(url, {
|
|
391
|
-
timeout:
|
|
392
|
+
timeout: 20000,
|
|
392
393
|
retry: 5,
|
|
393
394
|
body: zipped,
|
|
394
395
|
headers: (!localS3
|
|
@@ -402,6 +403,8 @@ It will be also visible in your dashboard\n`)
|
|
|
402
403
|
}
|
|
403
404
|
catch (errorUpload) {
|
|
404
405
|
p.log.error(`Cannot upload bundle ${formatError(errorUpload)}`)
|
|
406
|
+
// call delete version on path /delete_failed_version to delete the version
|
|
407
|
+
await deletedFailedVersion(supabase, appid, bundle)
|
|
405
408
|
program.error('')
|
|
406
409
|
}
|
|
407
410
|
versionData.storage_provider = 'r2'
|
package/src/utils.ts
CHANGED
|
@@ -426,6 +426,22 @@ export async function uploadUrl(supabase: SupabaseClient<Database>, appId: strin
|
|
|
426
426
|
return ''
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
+
export async function deletedFailedVersion(supabase: SupabaseClient<Database>, appId: string, name: string): Promise<void> {
|
|
430
|
+
const data = {
|
|
431
|
+
app_id: appId,
|
|
432
|
+
name,
|
|
433
|
+
}
|
|
434
|
+
try {
|
|
435
|
+
const pathFailed = 'private/delete_failed_version'
|
|
436
|
+
const res = await supabase.functions.invoke(pathFailed, { body: JSON.stringify(data), method: 'DELETE' })
|
|
437
|
+
return res.data.url
|
|
438
|
+
}
|
|
439
|
+
catch (error) {
|
|
440
|
+
p.log.error(`Cannot delete failed version ${formatError(error)}`)
|
|
441
|
+
return Promise.reject(new Error('Cannot delete failed version'))
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
429
445
|
export async function updateOrCreateChannel(supabase: SupabaseClient<Database>, update: Database['public']['Tables']['channels']['Insert']) {
|
|
430
446
|
// console.log('updateOrCreateChannel', update)
|
|
431
447
|
if (!update.app_id || !update.name || !update.created_by) {
|