@capgo/cli 4.12.12 → 4.12.14-beta.0
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 +40559 -50832
- package/package.json +22 -24
- package/src/api/app.ts +5 -5
- package/src/api/channels.ts +12 -12
- package/src/api/devices_override.ts +8 -8
- package/src/api/update.ts +2 -2
- package/src/api/versions.ts +10 -9
- package/src/app/add.ts +21 -22
- package/src/app/debug.ts +53 -54
- package/src/app/delete.ts +20 -20
- package/src/app/info.ts +34 -24
- package/src/app/list.ts +11 -11
- package/src/app/set.ts +16 -16
- package/src/bundle/check.ts +10 -10
- package/src/bundle/cleanup.ts +27 -27
- package/src/bundle/compatibility.ts +8 -8
- package/src/bundle/decrypt.ts +8 -8
- package/src/bundle/delete.ts +14 -15
- package/src/bundle/encrypt.ts +13 -13
- package/src/bundle/list.ts +11 -12
- package/src/bundle/unlink.ts +15 -13
- package/src/bundle/upload.ts +93 -86
- package/src/bundle/zip.ts +23 -21
- package/src/channel/add.ts +14 -14
- package/src/channel/currentBundle.ts +13 -13
- package/src/channel/delete.ts +13 -13
- package/src/channel/list.ts +11 -11
- package/src/channel/set.ts +28 -26
- package/src/config/index.ts +156 -0
- package/src/index.ts +6 -3
- package/src/init.ts +22 -22
- package/src/key.ts +45 -46
- package/src/login.ts +10 -10
- package/src/user/account.ts +3 -3
- package/src/utils.ts +119 -150
- package/tsconfig.json +1 -1
- package/vercel-ncc.js +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/cli",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.14-beta.0",
|
|
4
4
|
"description": "A CLI to upload to capgo servers",
|
|
5
5
|
"author": "github.com/riderx",
|
|
6
6
|
"license": "Apache 2.0",
|
|
@@ -32,42 +32,25 @@
|
|
|
32
32
|
"node": ">=18.0.0"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "
|
|
36
|
-
"dev": "NODE_ENV=development
|
|
35
|
+
"build": "ncc build",
|
|
36
|
+
"dev": "NODE_ENV=development ncc build",
|
|
37
37
|
"no-debug": "node dist/index.js",
|
|
38
38
|
"test": "npx --yes ts-node -T src/index.ts",
|
|
39
|
-
"dev-build": "SUPA_DB=development
|
|
39
|
+
"dev-build": "SUPA_DB=development ncc build",
|
|
40
40
|
"pack": "pkg",
|
|
41
41
|
"types": "npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",
|
|
42
42
|
"test_rls": "ts-node ./test/test_headers_rls.ts",
|
|
43
43
|
"lint": "eslint \"src/**/*.ts\" --fix",
|
|
44
44
|
"check-posix-paths": "node test/check-posix-paths.js"
|
|
45
45
|
},
|
|
46
|
-
"
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@antfu/eslint-config": "^2.21.1",
|
|
48
|
+
"@bradenmacdonald/s3-lite-client": "npm:@jsr/bradenmacdonald__s3-lite-client",
|
|
49
49
|
"@capgo/find-package-manager": "^0.0.17",
|
|
50
50
|
"@clack/prompts": "^0.7.0",
|
|
51
51
|
"@manypkg/find-root": "^2.2.1",
|
|
52
52
|
"@supabase/supabase-js": "^2.43.5",
|
|
53
53
|
"@tomasklaen/checksum": "^1.1.0",
|
|
54
|
-
"adm-zip": "^0.5.14",
|
|
55
|
-
"ci-info": "^4.0.0",
|
|
56
|
-
"commander": "12.1.0",
|
|
57
|
-
"console-table-printer": "^2.12.1",
|
|
58
|
-
"get-latest-version": "^5.1.0",
|
|
59
|
-
"is-wsl": "^3.1.0",
|
|
60
|
-
"jszip": "^3.10.1",
|
|
61
|
-
"ky": "^1.3.0",
|
|
62
|
-
"logsnag": "1.0.0",
|
|
63
|
-
"mime": "^4.0.3",
|
|
64
|
-
"open": "^10.1.0",
|
|
65
|
-
"prettyjson": "^1.2.5",
|
|
66
|
-
"semver": "^7.6.2",
|
|
67
|
-
"tmp": "^0.2.3"
|
|
68
|
-
},
|
|
69
|
-
"devDependencies": {
|
|
70
|
-
"@antfu/eslint-config": "^2.21.1",
|
|
71
54
|
"@types/adm-zip": "0.5.5",
|
|
72
55
|
"@types/mime": "^4.0.0",
|
|
73
56
|
"@types/node": "^20.14.7",
|
|
@@ -78,11 +61,26 @@
|
|
|
78
61
|
"@types/tmp": "^0.2.6",
|
|
79
62
|
"@typescript-eslint/eslint-plugin": "^7.13.0",
|
|
80
63
|
"@typescript-eslint/parser": "^7.13.1",
|
|
64
|
+
"@vercel/ncc": "^0.38.1",
|
|
65
|
+
"adm-zip": "^0.5.14",
|
|
66
|
+
"ci-info": "^4.0.0",
|
|
67
|
+
"commander": "12.1.0",
|
|
68
|
+
"console-table-printer": "^2.12.1",
|
|
81
69
|
"esbuild": "^0.21.5",
|
|
82
70
|
"eslint": "9.7.0",
|
|
71
|
+
"get-latest-version": "^5.1.0",
|
|
83
72
|
"git-format-staged": "3.1.1",
|
|
84
73
|
"husky": "^9.0.11",
|
|
74
|
+
"is-wsl": "^3.1.0",
|
|
75
|
+
"jszip": "^3.10.1",
|
|
76
|
+
"ky": "^1.3.0",
|
|
77
|
+
"logsnag": "1.0.0",
|
|
78
|
+
"mime": "^4.0.3",
|
|
79
|
+
"open": "^10.1.0",
|
|
85
80
|
"pkg": "5.8.1",
|
|
81
|
+
"prettyjson": "^1.2.5",
|
|
82
|
+
"semver": "^7.6.2",
|
|
83
|
+
"tmp": "^0.2.3",
|
|
86
84
|
"ts-loader": "^9.5.1",
|
|
87
85
|
"ts-node": "^10.9.2",
|
|
88
86
|
"tsconfig-paths": "4.2.0",
|
package/src/api/app.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SupabaseClient } from '@supabase/supabase-js'
|
|
2
|
-
import * as p from '@clack/prompts'
|
|
3
2
|
import { program } from 'commander'
|
|
3
|
+
import { log } from '@clack/prompts'
|
|
4
4
|
import type { Database } from '../types/supabase.types'
|
|
5
5
|
import type { OptionsBase } from '../utils'
|
|
6
6
|
import { OrganizationPerm, getPMAndCommand, isAllowedAppOrg } from '../utils'
|
|
@@ -18,17 +18,17 @@ export async function checkAppExistsAndHasPermissionOrgErr(supabase: SupabaseCli
|
|
|
18
18
|
if (!permissions.okay) {
|
|
19
19
|
switch (permissions.error) {
|
|
20
20
|
case 'INVALID_APIKEY': {
|
|
21
|
-
|
|
21
|
+
log.error('Invalid apikey, such apikey does not exists!')
|
|
22
22
|
program.error('')
|
|
23
23
|
break
|
|
24
24
|
}
|
|
25
25
|
case 'NO_APP': {
|
|
26
|
-
|
|
26
|
+
log.error(`App ${appid} does not exist, run first \`${pm.runner} @capgo/cli app add ${appid}\` to create it`)
|
|
27
27
|
program.error('')
|
|
28
28
|
break
|
|
29
29
|
}
|
|
30
30
|
case 'NO_ORG': {
|
|
31
|
-
|
|
31
|
+
log.error('Could not find organization, please contact support to resolve this!')
|
|
32
32
|
program.error('')
|
|
33
33
|
break
|
|
34
34
|
}
|
|
@@ -39,7 +39,7 @@ export async function checkAppExistsAndHasPermissionOrgErr(supabase: SupabaseCli
|
|
|
39
39
|
const requiredPermNumber = requiredPermission as number
|
|
40
40
|
|
|
41
41
|
if (requiredPermNumber > remotePermNumber) {
|
|
42
|
-
|
|
42
|
+
log.error(`Insuficcent permissions for app ${appid}. Current permission: ${OrganizationPerm[permissions.data]}, required for this action: ${OrganizationPerm[requiredPermission]}.`)
|
|
43
43
|
program.error('')
|
|
44
44
|
}
|
|
45
45
|
|
package/src/api/channels.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { exit } from 'node:process'
|
|
2
2
|
import type { SupabaseClient } from '@supabase/supabase-js'
|
|
3
3
|
import { program } from 'commander'
|
|
4
4
|
import { Table } from 'console-table-printer'
|
|
5
|
-
import
|
|
5
|
+
import { confirm as confirmC, intro, log, outro, spinner } from '@clack/prompts'
|
|
6
6
|
import type { Database } from '../types/supabase.types'
|
|
7
7
|
import { formatError } from '../utils'
|
|
8
8
|
|
|
@@ -13,15 +13,15 @@ export async function checkVersionNotUsedInChannel(supabase: SupabaseClient<Data
|
|
|
13
13
|
.eq('app_id', appid)
|
|
14
14
|
.eq('version', versionData.id)
|
|
15
15
|
if (errorChannel) {
|
|
16
|
-
|
|
16
|
+
log.error(`Cannot check Version ${appid}@${versionData.name}`)
|
|
17
17
|
program.error('')
|
|
18
18
|
}
|
|
19
19
|
if (channelFound && channelFound.length > 0) {
|
|
20
|
-
|
|
21
|
-
if (await
|
|
20
|
+
intro(`❌ Version ${appid}@${versionData.name} is used in ${channelFound.length} channel`)
|
|
21
|
+
if (await confirmC({ message: 'unlink it?' })) {
|
|
22
22
|
// loop on all channels and set version to unknown
|
|
23
23
|
for (const channel of channelFound) {
|
|
24
|
-
const s =
|
|
24
|
+
const s = spinner()
|
|
25
25
|
s.start(`Unlinking channel ${channel.name}`)
|
|
26
26
|
const { error: errorChannelUpdate } = await supabase
|
|
27
27
|
.from('channels')
|
|
@@ -31,16 +31,16 @@ export async function checkVersionNotUsedInChannel(supabase: SupabaseClient<Data
|
|
|
31
31
|
.eq('id', channel.id)
|
|
32
32
|
if (errorChannelUpdate) {
|
|
33
33
|
s.stop(`Cannot update channel ${channel.name} ${formatError(errorChannelUpdate)}`)
|
|
34
|
-
|
|
34
|
+
exit(1)
|
|
35
35
|
}
|
|
36
36
|
s.stop(`✅ Channel ${channel.name} unlinked`)
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
|
|
40
|
+
log.error(`Unlink it first`)
|
|
41
41
|
program.error('')
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
outro(`Version unlinked from ${channelFound.length} channel`)
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -53,7 +53,7 @@ export function findUnknownVersion(supabase: SupabaseClient<Database>, appId: st
|
|
|
53
53
|
.throwOnError()
|
|
54
54
|
.single().then(({ data, error }) => {
|
|
55
55
|
if (error) {
|
|
56
|
-
|
|
56
|
+
log.error(`Cannot call findUnknownVersion as it returned an error.\n${formatError(error)}`)
|
|
57
57
|
program.error('')
|
|
58
58
|
}
|
|
59
59
|
return data
|
|
@@ -125,7 +125,7 @@ export function displayChannels(data: Channel[]) {
|
|
|
125
125
|
})
|
|
126
126
|
})
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
log.success(t.render())
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
export async function getActiveChannels(supabase: SupabaseClient<Database>, appid: string) {
|
|
@@ -156,7 +156,7 @@ export async function getActiveChannels(supabase: SupabaseClient<Database>, appi
|
|
|
156
156
|
.order('created_at', { ascending: false })
|
|
157
157
|
|
|
158
158
|
if (vError) {
|
|
159
|
-
|
|
159
|
+
log.error(`App ${appid} not found in database`)
|
|
160
160
|
program.error('')
|
|
161
161
|
}
|
|
162
162
|
return data as any as Channel[]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { exit } from 'node:process'
|
|
2
2
|
import type { SupabaseClient } from '@supabase/supabase-js'
|
|
3
3
|
import { program } from 'commander'
|
|
4
|
-
import
|
|
4
|
+
import { confirm as confirmC, intro, log, spinner } from '@clack/prompts'
|
|
5
5
|
import type { Database } from '../types/supabase.types'
|
|
6
6
|
import { formatError } from '../utils'
|
|
7
7
|
|
|
@@ -12,15 +12,15 @@ export async function checkVersionNotUsedInDeviceOverride(supabase: SupabaseClie
|
|
|
12
12
|
.eq('app_id', appid)
|
|
13
13
|
.eq('version', versionData.id)
|
|
14
14
|
if (errorDevice) {
|
|
15
|
-
|
|
15
|
+
log.error(`Cannot check Device override ${appid}@${versionData.name}`)
|
|
16
16
|
program.error('')
|
|
17
17
|
}
|
|
18
18
|
if (deviceFound && deviceFound.length > 0) {
|
|
19
|
-
|
|
20
|
-
if (await
|
|
19
|
+
intro(`❌ Version ${appid}@${versionData.name} is used in ${deviceFound.length} device override`)
|
|
20
|
+
if (await confirmC({ message: 'unlink it?' })) {
|
|
21
21
|
// loop on all devices and set version to unknown
|
|
22
22
|
for (const device of deviceFound) {
|
|
23
|
-
const s =
|
|
23
|
+
const s = spinner()
|
|
24
24
|
s.start(`Unlinking device ${device.device_id}`)
|
|
25
25
|
const { error: errorDeviceDel } = await supabase
|
|
26
26
|
.from('devices_override')
|
|
@@ -28,13 +28,13 @@ export async function checkVersionNotUsedInDeviceOverride(supabase: SupabaseClie
|
|
|
28
28
|
.eq('device_id', device.device_id)
|
|
29
29
|
if (errorDeviceDel) {
|
|
30
30
|
s.stop(`Cannot unlink device ${device.device_id} ${formatError(errorDeviceDel)}`)
|
|
31
|
-
|
|
31
|
+
exit(1)
|
|
32
32
|
}
|
|
33
33
|
s.stop(`✅ Device ${device.device_id} unlinked`)
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
|
|
37
|
+
log.error(`Unlink it first`)
|
|
38
38
|
program.error('')
|
|
39
39
|
}
|
|
40
40
|
}
|
package/src/api/update.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import getLatest from 'get-latest-version'
|
|
2
|
-
import
|
|
2
|
+
import { log } from '@clack/prompts'
|
|
3
3
|
import pack from '../../package.json'
|
|
4
4
|
|
|
5
5
|
export async function checkLatest() {
|
|
6
6
|
const latest = await getLatest('@capgo/cli')
|
|
7
7
|
const major = latest?.split('.')[0]
|
|
8
8
|
if (latest !== pack.version) {
|
|
9
|
-
|
|
9
|
+
log.warning(`🚨 You are using @capgo/cli@${pack.version} it's not the latest version.
|
|
10
10
|
Please use @capgo/cli@${latest}" or @capgo/cli@${major} to keep up to date with the latest features and bug fixes.`,
|
|
11
11
|
)
|
|
12
12
|
}
|
package/src/api/versions.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { exit } from 'node:process'
|
|
1
2
|
import type { SupabaseClient } from '@supabase/supabase-js'
|
|
2
3
|
import { program } from 'commander'
|
|
3
4
|
import { Table } from 'console-table-printer'
|
|
4
|
-
import
|
|
5
|
+
import { log } from '@clack/prompts'
|
|
5
6
|
import type { Database } from '../types/supabase.types'
|
|
6
7
|
|
|
7
8
|
// import { definitions } from '../types/types_supabase';
|
|
@@ -19,7 +20,7 @@ export async function deleteAppVersion(supabase: SupabaseClient<Database>, appid
|
|
|
19
20
|
.eq('deleted', false)
|
|
20
21
|
.eq('name', bundle)
|
|
21
22
|
if (delAppSpecVersionError) {
|
|
22
|
-
|
|
23
|
+
log.error(`App Version ${appid}@${bundle} not found in database`)
|
|
23
24
|
program.error('')
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -34,9 +35,9 @@ export async function deleteSpecificVersion(supabase: SupabaseClient<Database>,
|
|
|
34
35
|
|
|
35
36
|
export function displayBundles(data: (Database['public']['Tables']['app_versions']['Row'] & { keep?: string })[]) {
|
|
36
37
|
if (!data.length) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
log.error('No bundle found')
|
|
39
|
+
|
|
40
|
+
exit(1)
|
|
40
41
|
}
|
|
41
42
|
const t = new Table({
|
|
42
43
|
title: 'Bundles',
|
|
@@ -52,7 +53,7 @@ export function displayBundles(data: (Database['public']['Tables']['app_versions
|
|
|
52
53
|
})
|
|
53
54
|
})
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
log.success(t.render())
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export async function getActiveAppVersions(supabase: SupabaseClient<Database>, appid: string) {
|
|
@@ -64,7 +65,7 @@ export async function getActiveAppVersions(supabase: SupabaseClient<Database>, a
|
|
|
64
65
|
.order('created_at', { ascending: false })
|
|
65
66
|
|
|
66
67
|
if (vError) {
|
|
67
|
-
|
|
68
|
+
log.error(`App ${appid} not found in database`)
|
|
68
69
|
program.error('')
|
|
69
70
|
}
|
|
70
71
|
return data
|
|
@@ -78,7 +79,7 @@ export async function getChannelsVersion(supabase: SupabaseClient<Database>, app
|
|
|
78
79
|
.eq('app_id', appid)
|
|
79
80
|
|
|
80
81
|
if (channelsError) {
|
|
81
|
-
|
|
82
|
+
log.error(`App ${appid} not found in database`)
|
|
82
83
|
program.error('')
|
|
83
84
|
}
|
|
84
85
|
return channels.map(c => c.version)
|
|
@@ -93,7 +94,7 @@ export async function getVersionData(supabase: SupabaseClient<Database>, appid:
|
|
|
93
94
|
.eq('deleted', false)
|
|
94
95
|
.single()
|
|
95
96
|
if (!versionData || versionIdError) {
|
|
96
|
-
|
|
97
|
+
log.error(`App Version ${appid}@${bundle} doesn't exist`)
|
|
97
98
|
program.error('')
|
|
98
99
|
}
|
|
99
100
|
return versionData
|
package/src/app/add.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs'
|
|
2
|
-
import
|
|
2
|
+
import { config, exit } from 'node:process'
|
|
3
3
|
import mime from 'mime'
|
|
4
4
|
import { program } from 'commander'
|
|
5
|
-
import
|
|
5
|
+
import { intro, log, outro } from '@clack/prompts'
|
|
6
6
|
import { checkLatest } from '../api/update'
|
|
7
7
|
import type { Options } from '../api/app'
|
|
8
8
|
import { checkAppExists, newIconPath } from '../api/app'
|
|
@@ -25,24 +25,24 @@ export async function addApp(appId: string, options: Options, throwErr = true) {
|
|
|
25
25
|
|
|
26
26
|
export async function addAppInternal(appId: string, options: Options, organization?: Organization, throwErr = true) {
|
|
27
27
|
if (throwErr)
|
|
28
|
-
|
|
28
|
+
intro(`Adding`)
|
|
29
29
|
|
|
30
30
|
await checkLatest()
|
|
31
31
|
options.apikey = options.apikey || findSavedKey()
|
|
32
|
-
const
|
|
33
|
-
appId = appId || config?.
|
|
32
|
+
const extConfig = await getConfig()
|
|
33
|
+
appId = appId || extConfig?.config?.appId
|
|
34
34
|
|
|
35
35
|
if (!options.apikey) {
|
|
36
|
-
|
|
36
|
+
log.error(`Missing API key, you need to provide a API key to upload your bundle`)
|
|
37
37
|
program.error('')
|
|
38
38
|
}
|
|
39
39
|
if (!appId) {
|
|
40
|
-
|
|
40
|
+
log.error('Missing argument, you need to provide a appId, or be in a capacitor project')
|
|
41
41
|
program.error('')
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if (appId.includes('--')) {
|
|
45
|
-
|
|
45
|
+
log.error('The app id includes illegal symbols. You cannot use "--" in the app id')
|
|
46
46
|
program.error('')
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -53,7 +53,7 @@ export async function addAppInternal(appId: string, options: Options, organizati
|
|
|
53
53
|
// Check we have app access to this appId
|
|
54
54
|
const appExist = await checkAppExists(supabase, appId)
|
|
55
55
|
if (appExist) {
|
|
56
|
-
|
|
56
|
+
log.error(`App ${appId} already exist`)
|
|
57
57
|
program.error('')
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -65,15 +65,14 @@ export async function addAppInternal(appId: string, options: Options, organizati
|
|
|
65
65
|
await checkPlanValid(supabase, organizationUid, options.apikey, undefined, false)
|
|
66
66
|
|
|
67
67
|
let { name, icon } = options
|
|
68
|
-
|
|
69
|
-
name = name || config?.app?.appName || 'Unknown'
|
|
68
|
+
name = name || extConfig.config?.appName || 'Unknown'
|
|
70
69
|
icon = icon || 'resources/icon.png' // default path for capacitor app
|
|
71
70
|
if (!icon || !name) {
|
|
72
|
-
|
|
71
|
+
log.error('Missing argument, you need to provide a appId and a name, or be in a capacitor project')
|
|
73
72
|
program.error('')
|
|
74
73
|
}
|
|
75
74
|
if (throwErr)
|
|
76
|
-
|
|
75
|
+
log.info(`Adding ${appId} to Capgo`)
|
|
77
76
|
|
|
78
77
|
let iconBuff
|
|
79
78
|
let iconType
|
|
@@ -82,16 +81,16 @@ export async function addAppInternal(appId: string, options: Options, organizati
|
|
|
82
81
|
iconBuff = readFileSync(icon)
|
|
83
82
|
const contentType = mime.getType(icon)
|
|
84
83
|
iconType = contentType || 'image/png'
|
|
85
|
-
|
|
84
|
+
log.warn(`Found app icon ${icon}`)
|
|
86
85
|
}
|
|
87
86
|
else if (existsSync(newIconPath)) {
|
|
88
87
|
iconBuff = readFileSync(newIconPath)
|
|
89
88
|
const contentType = mime.getType(newIconPath)
|
|
90
89
|
iconType = contentType || 'image/png'
|
|
91
|
-
|
|
90
|
+
log.warn(`Found app icon ${newIconPath}`)
|
|
92
91
|
}
|
|
93
92
|
else {
|
|
94
|
-
|
|
93
|
+
log.warn(`Cannot find app icon in any of the following locations: ${icon}, ${newIconPath}`)
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
const fileName = `icon`
|
|
@@ -106,7 +105,7 @@ export async function addAppInternal(appId: string, options: Options, organizati
|
|
|
106
105
|
})
|
|
107
106
|
if (error) {
|
|
108
107
|
console.error(error)
|
|
109
|
-
|
|
108
|
+
log.error(`Could not add app ${formatError(error)}`)
|
|
110
109
|
program.error('')
|
|
111
110
|
}
|
|
112
111
|
const { data: signedURLData } = await supabase
|
|
@@ -125,7 +124,7 @@ export async function addAppInternal(appId: string, options: Options, organizati
|
|
|
125
124
|
app_id: appId,
|
|
126
125
|
})
|
|
127
126
|
if (dbError) {
|
|
128
|
-
|
|
127
|
+
log.error(`Could not add app ${formatError(dbError)}`)
|
|
129
128
|
program.error('')
|
|
130
129
|
}
|
|
131
130
|
const { error: dbVersionError } = await supabase
|
|
@@ -142,13 +141,13 @@ export async function addAppInternal(appId: string, options: Options, organizati
|
|
|
142
141
|
app_id: appId,
|
|
143
142
|
}])
|
|
144
143
|
if (dbVersionError) {
|
|
145
|
-
|
|
144
|
+
log.error(`Could not add app ${formatError(dbVersionError)}`)
|
|
146
145
|
program.error('')
|
|
147
146
|
}
|
|
148
|
-
|
|
147
|
+
log.success(`App ${appId} added to Capgo. ${throwErr ? 'You can upload a bundle now' : ''}`)
|
|
149
148
|
if (throwErr) {
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
outro(`Done ✅`)
|
|
150
|
+
exit()
|
|
152
151
|
}
|
|
153
152
|
return true
|
|
154
153
|
}
|