@capgo/cli 4.12.12 → 4.12.14
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/.github/workflows/autofix.yml +25 -0
- package/CHANGELOG.md +9 -0
- package/bun.lockb +0 -0
- package/bunfig.toml +2 -0
- package/dist/index.js +1670 -298
- package/package.json +2 -2
- package/src/bundle/upload.ts +30 -24
- package/src/index.ts +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/cli",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.14",
|
|
4
4
|
"description": "A CLI to upload to capgo servers",
|
|
5
5
|
"author": "github.com/riderx",
|
|
6
6
|
"license": "Apache 2.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"check-posix-paths": "node test/check-posix-paths.js"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@
|
|
47
|
+
"@bradenmacdonald/s3-lite-client": "npm:@jsr/bradenmacdonald__s3-lite-client",
|
|
48
48
|
"@capacitor/cli": "6.1.0",
|
|
49
49
|
"@capgo/find-package-manager": "^0.0.17",
|
|
50
50
|
"@clack/prompts": "^0.7.0",
|
package/src/bundle/upload.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { program } from 'commander'
|
|
|
7
7
|
import { checksum as getChecksum } from '@tomasklaen/checksum'
|
|
8
8
|
import ciDetect from 'ci-info'
|
|
9
9
|
import type LogSnag from 'logsnag'
|
|
10
|
+
import { S3Client } from '@bradenmacdonald/s3-lite-client'
|
|
10
11
|
import ky, { HTTPError } from 'ky'
|
|
11
12
|
import { encryptSource } from '../api/crypto'
|
|
12
13
|
import { type OptionsBase, OrganizationPerm, baseKeyPub, checkChecksum, checkCompatibility, checkPlanValid, convertAppName, createSupabaseClient, deletedFailedVersion, findSavedKey, formatError, getConfig, getLocalConfig, getLocalDepenencies, getOrganizationId, getPMAndCommand, hasOrganizationPerm, regexSemver, updateOrCreateChannel, updateOrCreateVersion, uploadMultipart, uploadUrl, useLogSnag, verifyUser, zipFile } from '../utils'
|
|
@@ -27,6 +28,9 @@ interface Options extends OptionsBase {
|
|
|
27
28
|
s3Apikey?: string
|
|
28
29
|
s3Apisecret?: string
|
|
29
30
|
s3BucketName?: string
|
|
31
|
+
s3Port?: number
|
|
32
|
+
s3SSL?: boolean
|
|
33
|
+
s3Endpoint?: string
|
|
30
34
|
bundleUrl?: boolean
|
|
31
35
|
codeCheck?: boolean
|
|
32
36
|
minUpdateVersion?: string
|
|
@@ -395,29 +399,7 @@ export async function uploadBundle(preAppid: string, options: Options, shouldExi
|
|
|
395
399
|
const pm = getPMAndCommand()
|
|
396
400
|
await checkLatest()
|
|
397
401
|
|
|
398
|
-
const { s3Region, s3Apikey, s3Apisecret, s3BucketName } = options
|
|
399
|
-
|
|
400
|
-
if (s3BucketName || s3Region || s3Apikey || s3Apisecret) {
|
|
401
|
-
if (!s3BucketName || !s3Region || !s3Apikey || !s3Apisecret) {
|
|
402
|
-
p.log.error('Missing argument, for S3 upload you need to provide a bucket name, region, API key, and API secret')
|
|
403
|
-
program.error('')
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
if (s3Region && s3Apikey && s3Apisecret && s3BucketName) {
|
|
408
|
-
p.log.info('Uploading to S3')
|
|
409
|
-
// const s3Client = new S3Client({
|
|
410
|
-
// region: s3Region,
|
|
411
|
-
// credentials: {
|
|
412
|
-
// accessKeyId: s3Apikey,
|
|
413
|
-
// secretAccessKey: s3Apisecret,
|
|
414
|
-
// },
|
|
415
|
-
// })
|
|
416
|
-
p.log.error('S3 upload is not available we have currenly an issue with it')
|
|
417
|
-
program.error('')
|
|
418
|
-
// todo: figure out s3 upload
|
|
419
|
-
return
|
|
420
|
-
}
|
|
402
|
+
const { s3Region, s3Apikey, s3Apisecret, s3BucketName, s3Endpoint, s3Port, s3SSL } = options
|
|
421
403
|
|
|
422
404
|
const apikey = getApikey(options)
|
|
423
405
|
const config = await getConfig()
|
|
@@ -492,7 +474,31 @@ export async function uploadBundle(preAppid: string, options: Options, shouldExi
|
|
|
492
474
|
program.error('')
|
|
493
475
|
}
|
|
494
476
|
|
|
495
|
-
if (zipped) {
|
|
477
|
+
if (zipped && (s3BucketName || s3Endpoint || s3Region || s3Apikey || s3Apisecret || s3Port || s3SSL)) {
|
|
478
|
+
if (!s3BucketName || !s3Endpoint || !s3Region || !s3Apikey || !s3Apisecret || !s3Port) {
|
|
479
|
+
p.log.error('Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret')
|
|
480
|
+
program.error('')
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
p.log.info('Uploading to S3')
|
|
484
|
+
const s3Client = new S3Client({
|
|
485
|
+
endPoint: s3Endpoint,
|
|
486
|
+
region: s3Region,
|
|
487
|
+
port: s3Port,
|
|
488
|
+
useSSL: s3SSL,
|
|
489
|
+
bucket: s3BucketName,
|
|
490
|
+
credentials: {
|
|
491
|
+
accessKeyId: s3Apikey,
|
|
492
|
+
secretAccessKey: s3Apisecret,
|
|
493
|
+
},
|
|
494
|
+
})
|
|
495
|
+
const fileName = `${appid}-${bundle}`
|
|
496
|
+
const encodeFileName = encodeURIComponent(fileName)
|
|
497
|
+
await s3Client.putObject(fileName, zipped)
|
|
498
|
+
versionData.external_url = `https://${s3Endpoint}/${encodeFileName}`
|
|
499
|
+
versionData.storage_provider = 'external'
|
|
500
|
+
}
|
|
501
|
+
else if (zipped) {
|
|
496
502
|
await uploadBundleToCapgoCloud(supabase, appid, bundle, orgId, zipped, options)
|
|
497
503
|
|
|
498
504
|
versionData.storage_provider = 'r2'
|
package/src/index.ts
CHANGED
|
@@ -114,10 +114,13 @@ bundle
|
|
|
114
114
|
.option('-c, --channel <channel>', 'channel to link to')
|
|
115
115
|
.option('-e, --external <url>', 'link to external url intead of upload to Capgo Cloud')
|
|
116
116
|
.option('--iv-session-key <key>', 'Set the iv and session key for bundle url external')
|
|
117
|
-
.option('--s3-region <region>', 'Region for your
|
|
118
|
-
.option('--s3-apikey <apikey>', '
|
|
119
|
-
.option('--s3-apisecret <apisecret>', '
|
|
117
|
+
.option('--s3-region <region>', 'Region for your S3 bucket')
|
|
118
|
+
.option('--s3-apikey <apikey>', 'Apikey for your S3 endpoint')
|
|
119
|
+
.option('--s3-apisecret <apisecret>', 'Api secret for your S3 endpoint')
|
|
120
|
+
.option('--s3-endoint <s3Endpoint>', 'Url of S3 endpoint')
|
|
120
121
|
.option('--s3-bucket-name <bucketName>', 'Name for your AWS S3 bucket')
|
|
122
|
+
.option('--s3-port <port>', 'Port for your S3 endpoint')
|
|
123
|
+
.option('--no-s3-ssl', 'Disable SSL for S3 upload')
|
|
121
124
|
.option('--key <key>', 'custom path for public signing key')
|
|
122
125
|
.option('--key-data <keyData>', 'base64 public signing key')
|
|
123
126
|
.option('--bundle-url', 'prints bundle url into stdout')
|