@capgo/cli 5.0.0-alpha.3 → 5.0.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/README.md +197 -37
- package/dist/index.js +327 -65172
- package/dist/package.json +83 -0
- package/package.json +48 -61
- package/.eslintignore +0 -4
- package/.github/FUNDING.yml +0 -1
- package/.github/workflows/build.yml +0 -46
- package/.github/workflows/bump_version.yml +0 -56
- package/.github/workflows/test.yml +0 -30
- package/.prettierignore +0 -6
- package/.vscode/launch.json +0 -23
- package/.vscode/settings.json +0 -5
- package/.vscode/tasks.json +0 -42
- package/CHANGELOG.md +0 -2727
- package/build.mjs +0 -23
- package/bun.lockb +0 -0
- package/capacitor.config.ts +0 -33
- package/crypto_explained.png +0 -0
- package/eslint.config.js +0 -3
- package/renovate.json +0 -23
- package/src/api/app.ts +0 -75
- package/src/api/channels.ts +0 -142
- package/src/api/crypto.ts +0 -121
- package/src/api/devices_override.ts +0 -41
- package/src/api/update.ts +0 -12
- package/src/api/versions.ts +0 -98
- package/src/app/add.ts +0 -154
- package/src/app/debug.ts +0 -214
- package/src/app/delete.ts +0 -68
- package/src/app/info.ts +0 -87
- package/src/app/list.ts +0 -63
- package/src/app/set.ts +0 -94
- package/src/bundle/check.ts +0 -42
- package/src/bundle/cleanup.ts +0 -128
- package/src/bundle/compatibility.ts +0 -70
- package/src/bundle/decrypt.ts +0 -65
- package/src/bundle/delete.ts +0 -53
- package/src/bundle/encrypt.ts +0 -69
- package/src/bundle/list.ts +0 -43
- package/src/bundle/unlink.ts +0 -80
- package/src/bundle/upload.ts +0 -434
- package/src/bundle/zip.ts +0 -137
- package/src/channel/add.ts +0 -73
- package/src/channel/currentBundle.ts +0 -73
- package/src/channel/delete.ts +0 -51
- package/src/channel/list.ts +0 -49
- package/src/channel/set.ts +0 -171
- package/src/index.ts +0 -285
- package/src/init.ts +0 -301
- package/src/key.ts +0 -158
- package/src/login.ts +0 -66
- package/src/types/capacitor__cli.d.ts +0 -6
- package/src/types/supabase.types.ts +0 -2065
- package/src/utils.ts +0 -719
- package/test/chunk_convert.ts +0 -28
- package/test/data.ts +0 -18769
- package/test/test_headers_rls.ts +0 -24
- package/test/test_semver.ts +0 -13
- package/tsconfig.json +0 -39
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import process from 'node:process'
|
|
2
|
-
import { program } from 'commander'
|
|
3
|
-
import * as p from '@clack/prompts'
|
|
4
|
-
import { checkAppExistsAndHasPermissionErr } from '../api/app'
|
|
5
|
-
import type { OptionsBase } from '../utils'
|
|
6
|
-
import { createSupabaseClient, findSavedKey, getConfig, verifyUser } from '../utils'
|
|
7
|
-
|
|
8
|
-
interface Options extends OptionsBase {
|
|
9
|
-
channel?: string
|
|
10
|
-
quiet?: boolean
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface Channel {
|
|
14
|
-
version: {
|
|
15
|
-
name: string
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function currentBundle(channel: string, appId: string, options: Options) {
|
|
20
|
-
const { quiet } = options
|
|
21
|
-
|
|
22
|
-
if (!quiet)
|
|
23
|
-
p.intro(`List current bundle`)
|
|
24
|
-
|
|
25
|
-
options.apikey = options.apikey || findSavedKey(quiet)
|
|
26
|
-
const config = await getConfig()
|
|
27
|
-
appId = appId || config?.app?.appId
|
|
28
|
-
|
|
29
|
-
if (!options.apikey) {
|
|
30
|
-
p.log.error('Missing API key, you need to provide a API key to upload your bundle')
|
|
31
|
-
program.error('')
|
|
32
|
-
}
|
|
33
|
-
if (!appId) {
|
|
34
|
-
p.log.error('Missing argument, you need to provide a appId, or be in a capacitor project')
|
|
35
|
-
program.error('')
|
|
36
|
-
}
|
|
37
|
-
const supabase = await createSupabaseClient(options.apikey)
|
|
38
|
-
|
|
39
|
-
const userId = await verifyUser(supabase, options.apikey, ['write', 'all', 'read'])
|
|
40
|
-
// Check we have app access to this appId
|
|
41
|
-
await checkAppExistsAndHasPermissionErr(supabase, options.apikey, appId)
|
|
42
|
-
|
|
43
|
-
if (!channel) {
|
|
44
|
-
p.log.error(`Please provide a channel to get the bundle from.`)
|
|
45
|
-
program.error('')
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const { data: supabaseChannel, error } = await supabase
|
|
49
|
-
.from('channels')
|
|
50
|
-
.select('version ( name )')
|
|
51
|
-
.eq('name', channel)
|
|
52
|
-
.eq('app_id', appId)
|
|
53
|
-
.eq('created_by', userId)
|
|
54
|
-
.limit(1)
|
|
55
|
-
|
|
56
|
-
if (error || supabaseChannel.length === 0) {
|
|
57
|
-
p.log.error(`Error retrieving channel ${channel} for app ${appId}. Perhaps the channel does not exists?`)
|
|
58
|
-
program.error('')
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const { version } = supabaseChannel[0] as any as Channel
|
|
62
|
-
if (!version) {
|
|
63
|
-
p.log.error(`Error retrieving channel ${channel} for app ${appId}. Perhaps the channel does not exists?`)
|
|
64
|
-
program.error('')
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (!quiet)
|
|
68
|
-
p.log.info(`Current bundle for channel ${channel} is ${version.name}`)
|
|
69
|
-
else
|
|
70
|
-
p.log.info(version.name)
|
|
71
|
-
|
|
72
|
-
process.exit()
|
|
73
|
-
}
|
package/src/channel/delete.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import process from 'node:process'
|
|
2
|
-
import { program } from 'commander'
|
|
3
|
-
import * as p from '@clack/prompts'
|
|
4
|
-
import { checkAppExistsAndHasPermissionErr } from '../api/app'
|
|
5
|
-
import { delChannel } from '../api/channels'
|
|
6
|
-
import type { OptionsBase } from '../utils'
|
|
7
|
-
import { createSupabaseClient, findSavedKey, getConfig, useLogSnag, verifyUser } from '../utils'
|
|
8
|
-
|
|
9
|
-
export async function deleteChannel(channelId: string, appId: string, options: OptionsBase) {
|
|
10
|
-
p.intro(`Delete channel`)
|
|
11
|
-
options.apikey = options.apikey || findSavedKey()
|
|
12
|
-
const config = await getConfig()
|
|
13
|
-
appId = appId || config?.app?.appId
|
|
14
|
-
const snag = useLogSnag()
|
|
15
|
-
|
|
16
|
-
if (!options.apikey) {
|
|
17
|
-
p.log.error('Missing API key, you need to provide a API key to upload your bundle')
|
|
18
|
-
program.error('')
|
|
19
|
-
}
|
|
20
|
-
if (!appId) {
|
|
21
|
-
p.log.error('Missing argument, you need to provide a appId, or be in a capacitor project')
|
|
22
|
-
program.error('')
|
|
23
|
-
}
|
|
24
|
-
const supabase = await createSupabaseClient(options.apikey)
|
|
25
|
-
|
|
26
|
-
const userId = await verifyUser(supabase, options.apikey, ['write', 'all'])
|
|
27
|
-
// Check we have app access to this appId
|
|
28
|
-
await checkAppExistsAndHasPermissionErr(supabase, options.apikey, appId)
|
|
29
|
-
|
|
30
|
-
p.log.info(`Deleting channel ${appId}#${channelId} from Capgo`)
|
|
31
|
-
try {
|
|
32
|
-
await delChannel(supabase, channelId, appId, userId)
|
|
33
|
-
p.log.success(`Channel deleted`)
|
|
34
|
-
await snag.track({
|
|
35
|
-
channel: 'channel',
|
|
36
|
-
event: 'Delete channel',
|
|
37
|
-
icon: '✅',
|
|
38
|
-
tags: {
|
|
39
|
-
'user-id': userId,
|
|
40
|
-
'app-id': appId,
|
|
41
|
-
'channel': channelId,
|
|
42
|
-
},
|
|
43
|
-
notify: false,
|
|
44
|
-
}).catch()
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
p.log.error(`Cannot delete Channel 🙀`)
|
|
48
|
-
}
|
|
49
|
-
p.outro(`Done ✅`)
|
|
50
|
-
process.exit()
|
|
51
|
-
}
|
package/src/channel/list.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import process from 'node:process'
|
|
2
|
-
import { program } from 'commander'
|
|
3
|
-
import * as p from '@clack/prompts'
|
|
4
|
-
import { checkAppExistsAndHasPermissionErr } from '../api/app'
|
|
5
|
-
import { displayChannels, getActiveChannels } from '../api/channels'
|
|
6
|
-
import type { OptionsBase } from '../utils'
|
|
7
|
-
import { createSupabaseClient, findSavedKey, getConfig, useLogSnag, verifyUser } from '../utils'
|
|
8
|
-
|
|
9
|
-
export async function listChannels(appId: string, options: OptionsBase) {
|
|
10
|
-
p.intro(`List channels`)
|
|
11
|
-
options.apikey = options.apikey || findSavedKey()
|
|
12
|
-
const config = await getConfig()
|
|
13
|
-
appId = appId || config?.app?.appId
|
|
14
|
-
const snag = useLogSnag()
|
|
15
|
-
|
|
16
|
-
if (!options.apikey)
|
|
17
|
-
p.log.error('Missing API key, you need to provide a API key to upload your bundle')
|
|
18
|
-
|
|
19
|
-
if (!appId) {
|
|
20
|
-
p.log.error('Missing argument, you need to provide a appId, or be in a capacitor project')
|
|
21
|
-
program.error('')
|
|
22
|
-
}
|
|
23
|
-
const supabase = await createSupabaseClient(options.apikey)
|
|
24
|
-
|
|
25
|
-
const userId = await verifyUser(supabase, options.apikey, ['write', 'all', 'read', 'upload'])
|
|
26
|
-
// Check we have app access to this appId
|
|
27
|
-
await checkAppExistsAndHasPermissionErr(supabase, options.apikey, appId)
|
|
28
|
-
|
|
29
|
-
p.log.info(`Querying available channels in Capgo`)
|
|
30
|
-
|
|
31
|
-
// Get all active app versions we might possibly be able to cleanup
|
|
32
|
-
const allVersions = await getActiveChannels(supabase, appId)
|
|
33
|
-
|
|
34
|
-
p.log.info(`Active channels in Capgo: ${allVersions?.length}`)
|
|
35
|
-
|
|
36
|
-
displayChannels(allVersions)
|
|
37
|
-
await snag.track({
|
|
38
|
-
channel: 'channel',
|
|
39
|
-
event: 'List channel',
|
|
40
|
-
icon: '✅',
|
|
41
|
-
user_id: userId,
|
|
42
|
-
tags: {
|
|
43
|
-
'app-id': appId,
|
|
44
|
-
},
|
|
45
|
-
notify: false,
|
|
46
|
-
}).catch()
|
|
47
|
-
p.outro(`Done ✅`)
|
|
48
|
-
process.exit()
|
|
49
|
-
}
|
package/src/channel/set.ts
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import process from 'node:process'
|
|
2
|
-
import { program } from 'commander'
|
|
3
|
-
import * as p from '@clack/prompts'
|
|
4
|
-
import type { Database } from '../types/supabase.types'
|
|
5
|
-
import { checkAppExistsAndHasPermissionErr } from '../api/app'
|
|
6
|
-
import type {
|
|
7
|
-
OptionsBase,
|
|
8
|
-
} from '../utils'
|
|
9
|
-
import {
|
|
10
|
-
checkPlanValid,
|
|
11
|
-
createSupabaseClient,
|
|
12
|
-
findSavedKey,
|
|
13
|
-
formatError,
|
|
14
|
-
getConfig,
|
|
15
|
-
updateOrCreateChannel,
|
|
16
|
-
useLogSnag,
|
|
17
|
-
verifyUser,
|
|
18
|
-
} from '../utils'
|
|
19
|
-
|
|
20
|
-
interface Options extends OptionsBase {
|
|
21
|
-
bundle: string
|
|
22
|
-
state?: string
|
|
23
|
-
downgrade?: boolean
|
|
24
|
-
latest?: boolean
|
|
25
|
-
upgrade?: boolean
|
|
26
|
-
ios?: boolean
|
|
27
|
-
android?: boolean
|
|
28
|
-
selfAssign?: boolean
|
|
29
|
-
disableAutoUpdate: string
|
|
30
|
-
channel?: string
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const disableAutoUpdatesPossibleOptions = ['major', 'minor', 'metadata', 'none']
|
|
34
|
-
|
|
35
|
-
export async function setChannel(channel: string, appId: string, options: Options) {
|
|
36
|
-
p.intro(`Set channel`)
|
|
37
|
-
options.apikey = options.apikey || findSavedKey()
|
|
38
|
-
const config = await getConfig()
|
|
39
|
-
appId = appId || config?.app?.appId
|
|
40
|
-
const snag = useLogSnag()
|
|
41
|
-
|
|
42
|
-
if (!options.apikey) {
|
|
43
|
-
p.log.error('Missing API key, you need to provide a API key to upload your bundle')
|
|
44
|
-
program.error('')
|
|
45
|
-
}
|
|
46
|
-
if (!appId) {
|
|
47
|
-
p.log.error('Missing argument, you need to provide a appId, or be in a capacitor project')
|
|
48
|
-
program.error('')
|
|
49
|
-
}
|
|
50
|
-
const supabase = await createSupabaseClient(options.apikey)
|
|
51
|
-
|
|
52
|
-
const userId = await verifyUser(supabase, options.apikey, ['write', 'all'])
|
|
53
|
-
// Check we have app access to this appId
|
|
54
|
-
await checkAppExistsAndHasPermissionErr(supabase, options.apikey, appId)
|
|
55
|
-
|
|
56
|
-
const { bundle, latest, downgrade, upgrade, ios, android, selfAssign, state, disableAutoUpdate } = options
|
|
57
|
-
if (!channel) {
|
|
58
|
-
p.log.error('Missing argument, you need to provide a channel')
|
|
59
|
-
program.error('')
|
|
60
|
-
}
|
|
61
|
-
if (latest && bundle) {
|
|
62
|
-
p.log.error('Cannot set latest and bundle at the same time')
|
|
63
|
-
program.error('')
|
|
64
|
-
}
|
|
65
|
-
if (bundle == null
|
|
66
|
-
&& state == null
|
|
67
|
-
&& latest == null
|
|
68
|
-
&& downgrade == null
|
|
69
|
-
&& upgrade == null
|
|
70
|
-
&& ios == null
|
|
71
|
-
&& android == null
|
|
72
|
-
&& selfAssign == null
|
|
73
|
-
&& disableAutoUpdate == null) {
|
|
74
|
-
p.log.error('Missing argument, you need to provide a option to set')
|
|
75
|
-
program.error('')
|
|
76
|
-
}
|
|
77
|
-
try {
|
|
78
|
-
await checkPlanValid(supabase, userId, options.apikey, appId)
|
|
79
|
-
const channelPayload: Database['public']['Tables']['channels']['Insert'] = {
|
|
80
|
-
created_by: userId,
|
|
81
|
-
app_id: appId,
|
|
82
|
-
name: channel,
|
|
83
|
-
version: undefined as any,
|
|
84
|
-
}
|
|
85
|
-
const bundleVersion = latest ? config?.app?.package?.version : bundle
|
|
86
|
-
if (bundleVersion != null) {
|
|
87
|
-
const { data, error: vError } = await supabase
|
|
88
|
-
.from('app_versions')
|
|
89
|
-
.select()
|
|
90
|
-
.eq('app_id', appId)
|
|
91
|
-
.eq('name', bundleVersion)
|
|
92
|
-
.eq('user_id', userId)
|
|
93
|
-
.eq('deleted', false)
|
|
94
|
-
.single()
|
|
95
|
-
if (vError || !data) {
|
|
96
|
-
p.log.error(`Cannot find version ${bundleVersion}`)
|
|
97
|
-
program.error('')
|
|
98
|
-
}
|
|
99
|
-
p.log.info(`Set ${appId} channel: ${channel} to @${bundleVersion}`)
|
|
100
|
-
channelPayload.version = data.id
|
|
101
|
-
}
|
|
102
|
-
if (state != null) {
|
|
103
|
-
if (state === 'public' || state === 'private')
|
|
104
|
-
p.log.info(`Set ${appId} channel: ${channel} to public or private is deprecated, use default or normal instead`)
|
|
105
|
-
|
|
106
|
-
p.log.info(`Set ${appId} channel: ${channel} to ${state === 'public' || state === 'default' ? 'default' : 'normal'}`)
|
|
107
|
-
channelPayload.public = state === 'public' || state === 'default'
|
|
108
|
-
}
|
|
109
|
-
if (downgrade != null) {
|
|
110
|
-
p.log.info(`Set ${appId} channel: ${channel} to ${downgrade ? 'allow' : 'disallow'} downgrade`)
|
|
111
|
-
channelPayload.disableAutoUpdateUnderNative = !downgrade
|
|
112
|
-
}
|
|
113
|
-
if (ios != null) {
|
|
114
|
-
p.log.info(`Set ${appId} channel: ${channel} to ${ios ? 'allow' : 'disallow'} ios update`)
|
|
115
|
-
channelPayload.ios = !!ios
|
|
116
|
-
}
|
|
117
|
-
if (android != null) {
|
|
118
|
-
p.log.info(`Set ${appId} channel: ${channel} to ${android ? 'allow' : 'disallow'} android update`)
|
|
119
|
-
channelPayload.android = !!android
|
|
120
|
-
}
|
|
121
|
-
if (selfAssign != null) {
|
|
122
|
-
p.log.info(`Set ${appId} channel: ${channel} to ${selfAssign ? 'allow' : 'disallow'} self assign to this channel`)
|
|
123
|
-
channelPayload.allow_device_self_set = !!selfAssign
|
|
124
|
-
}
|
|
125
|
-
if (disableAutoUpdate != null) {
|
|
126
|
-
let finalDisableAutoUpdate = disableAutoUpdate.toLocaleLowerCase()
|
|
127
|
-
|
|
128
|
-
// The user passed an unimplemented strategy
|
|
129
|
-
if (!disableAutoUpdatesPossibleOptions.includes(finalDisableAutoUpdate)) {
|
|
130
|
-
p.log.error(`Channel strategy ${finalDisableAutoUpdate} is not known. The possible values are: ${disableAutoUpdatesPossibleOptions.join(', ')}.`)
|
|
131
|
-
program.error('')
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// This metadata is called differently in the database
|
|
135
|
-
if (finalDisableAutoUpdate === 'metadata')
|
|
136
|
-
finalDisableAutoUpdate = 'version_number'
|
|
137
|
-
|
|
138
|
-
// This cast is safe, look above
|
|
139
|
-
channelPayload.disableAutoUpdate = finalDisableAutoUpdate as any
|
|
140
|
-
p.log.info(`Set ${appId} channel: ${channel} to ${finalDisableAutoUpdate} disable update strategy to this channel`)
|
|
141
|
-
}
|
|
142
|
-
try {
|
|
143
|
-
const { error: dbError } = await updateOrCreateChannel(supabase, channelPayload)
|
|
144
|
-
if (dbError) {
|
|
145
|
-
p.log.error(`Cannot set channel the upload key is not allowed to do that, use the "all" for this.`)
|
|
146
|
-
program.error('')
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
catch (e) {
|
|
150
|
-
p.log.error(`Cannot set channel the upload key is not allowed to do that, use the "all" for this.`)
|
|
151
|
-
program.error('')
|
|
152
|
-
}
|
|
153
|
-
await snag.track({
|
|
154
|
-
channel: 'channel',
|
|
155
|
-
event: 'Set channel',
|
|
156
|
-
icon: '✅',
|
|
157
|
-
user_id: userId,
|
|
158
|
-
tags: {
|
|
159
|
-
'user-id': userId,
|
|
160
|
-
'app-id': appId,
|
|
161
|
-
},
|
|
162
|
-
notify: false,
|
|
163
|
-
}).catch()
|
|
164
|
-
}
|
|
165
|
-
catch (err) {
|
|
166
|
-
p.log.error(`Unknow error ${formatError(err)}`)
|
|
167
|
-
program.error('')
|
|
168
|
-
}
|
|
169
|
-
p.outro(`Done ✅`)
|
|
170
|
-
process.exit()
|
|
171
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import { program } from 'commander'
|
|
2
|
-
import pack from '../package.json'
|
|
3
|
-
import { zipBundle } from './bundle/zip'
|
|
4
|
-
import { initApp } from './init'
|
|
5
|
-
import { listBundle } from './bundle/list'
|
|
6
|
-
import { decryptZip } from './bundle/decrypt'
|
|
7
|
-
import { encryptZip } from './bundle/encrypt'
|
|
8
|
-
import { addCommand } from './app/add'
|
|
9
|
-
import { getInfo } from './app/info'
|
|
10
|
-
import { createKeyCommand, saveKeyCommand } from './key'
|
|
11
|
-
import { deleteBundle } from './bundle/delete'
|
|
12
|
-
import { setChannel } from './channel/set'
|
|
13
|
-
import { currentBundle } from './channel/currentBundle'
|
|
14
|
-
import { uploadCommand, uploadDeprecatedCommand } from './bundle/upload'
|
|
15
|
-
import { loginCommand } from './login'
|
|
16
|
-
import { listApp } from './app/list'
|
|
17
|
-
import { cleanupBundle } from './bundle/cleanup'
|
|
18
|
-
import { addChannelCommand } from './channel/add'
|
|
19
|
-
import { deleteChannel } from './channel/delete'
|
|
20
|
-
import { listChannels } from './channel/list'
|
|
21
|
-
import { setApp } from './app/set'
|
|
22
|
-
import { deleteApp } from './app/delete'
|
|
23
|
-
|
|
24
|
-
// import { watchApp } from './app/watch';
|
|
25
|
-
import { debugApp } from './app/debug'
|
|
26
|
-
import { checkCompatibilityCommand } from './bundle/compatibility'
|
|
27
|
-
|
|
28
|
-
program
|
|
29
|
-
.name(pack.name)
|
|
30
|
-
.description('Manage packages and bundle versions in Capgo Cloud')
|
|
31
|
-
.version(pack.version)
|
|
32
|
-
|
|
33
|
-
program
|
|
34
|
-
.command('login [apikey]')
|
|
35
|
-
.alias('l')
|
|
36
|
-
.description('Save apikey to your machine or folder')
|
|
37
|
-
.action(loginCommand)
|
|
38
|
-
.option('--local', 'Only save in local folder')
|
|
39
|
-
|
|
40
|
-
program
|
|
41
|
-
.command('doctor')
|
|
42
|
-
.description('Get info about your Capgo app install')
|
|
43
|
-
.action(getInfo)
|
|
44
|
-
|
|
45
|
-
program
|
|
46
|
-
.command('init [apikey] [appId]')
|
|
47
|
-
.description('Init a new app')
|
|
48
|
-
.action(initApp)
|
|
49
|
-
.option('-n, --name <name>', 'app name')
|
|
50
|
-
.option('-i, --icon <icon>', 'app icon path')
|
|
51
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
52
|
-
|
|
53
|
-
const app = program
|
|
54
|
-
.command('app')
|
|
55
|
-
.description('Manage app')
|
|
56
|
-
|
|
57
|
-
app
|
|
58
|
-
.command('add [appId]')
|
|
59
|
-
.alias('a')
|
|
60
|
-
.description('Add a new app in Capgo Cloud')
|
|
61
|
-
.action(addCommand)
|
|
62
|
-
.option('-n, --name <name>', 'app name')
|
|
63
|
-
.option('-i, --icon <icon>', 'app icon path')
|
|
64
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
65
|
-
|
|
66
|
-
app
|
|
67
|
-
.command('delete [appId]')
|
|
68
|
-
.description('Delete an app in Capgo Cloud')
|
|
69
|
-
.action(deleteApp)
|
|
70
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
71
|
-
|
|
72
|
-
app
|
|
73
|
-
.command('list')
|
|
74
|
-
.alias('l')
|
|
75
|
-
.description('list apps in Capgo Cloud')
|
|
76
|
-
.action(listApp)
|
|
77
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
78
|
-
|
|
79
|
-
app
|
|
80
|
-
.command('debug [appId]')
|
|
81
|
-
.description('Listen for live updates event in Capgo Cloud to debug your app')
|
|
82
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
83
|
-
.option('-d, --device <device>', 'the specific device to debug')
|
|
84
|
-
.action(debugApp)
|
|
85
|
-
|
|
86
|
-
// app
|
|
87
|
-
// .command('watch [port]')
|
|
88
|
-
// .alias('w')
|
|
89
|
-
// .description('watch for changes in your app and allow capgo app or your app to see changes in live')
|
|
90
|
-
// .action(watchApp);
|
|
91
|
-
|
|
92
|
-
app
|
|
93
|
-
.command('set [appId]')
|
|
94
|
-
.alias('s')
|
|
95
|
-
.description('Set an app in Capgo Cloud')
|
|
96
|
-
.action(setApp)
|
|
97
|
-
.option('-n, --name <name>', 'app name')
|
|
98
|
-
.option('-i, --icon <icon>', 'app icon path')
|
|
99
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
100
|
-
.option('-r, --retention <retention>', 'retention period of app bundle in days')
|
|
101
|
-
|
|
102
|
-
const bundle = program
|
|
103
|
-
.command('bundle')
|
|
104
|
-
.description('Manage bundle')
|
|
105
|
-
|
|
106
|
-
bundle
|
|
107
|
-
.command('upload [appId]')
|
|
108
|
-
.alias('u')
|
|
109
|
-
.description('Upload a new bundle in Capgo Cloud')
|
|
110
|
-
.action(uploadCommand)
|
|
111
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
112
|
-
.option('-p, --path <path>', 'path of the folder to upload')
|
|
113
|
-
.option('-c, --channel <channel>', 'channel to link to')
|
|
114
|
-
.option('-e, --external <url>', 'link to external url intead of upload to Capgo Cloud')
|
|
115
|
-
.option('--iv-session-key <key>', 'Set the iv and session key for bundle url external')
|
|
116
|
-
.option('--key <key>', 'custom path for public signing key')
|
|
117
|
-
.option('--key-data <keyData>', 'base64 public signing key')
|
|
118
|
-
.option('--bundle-url', 'prints bundle url into stdout')
|
|
119
|
-
.option('--no-key', 'ignore signing key and send clear update')
|
|
120
|
-
.option('--no-code-check', 'Ignore checking if notifyAppReady() is called in soure code and index present in root folder')
|
|
121
|
-
.option('--display-iv-session', 'Show in the console the iv and session key used to encrypt the update')
|
|
122
|
-
.option('-b, --bundle <bundle>', 'bundle version number of the bundle to upload')
|
|
123
|
-
.option(
|
|
124
|
-
'--min-update-version <minUpdateVersion>',
|
|
125
|
-
'Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel',
|
|
126
|
-
)
|
|
127
|
-
.option('--auto-min-update-version', 'Set the min update version based on native packages')
|
|
128
|
-
.option('--ignore-metadata-check', 'Ignores the metadata (node_modules) check when uploading')
|
|
129
|
-
|
|
130
|
-
bundle
|
|
131
|
-
.command('compatibility [appId]')
|
|
132
|
-
.action(checkCompatibilityCommand)
|
|
133
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
134
|
-
.option('-c, --channel <channel>', 'channel to check the compatibility with')
|
|
135
|
-
.option('--text', 'output text instead of emojis')
|
|
136
|
-
|
|
137
|
-
bundle
|
|
138
|
-
.command('delete [bundleId] [appId]')
|
|
139
|
-
.alias('d')
|
|
140
|
-
.description('Delete a bundle in Capgo Cloud')
|
|
141
|
-
.action(deleteBundle)
|
|
142
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
143
|
-
|
|
144
|
-
bundle
|
|
145
|
-
.command('list [appId]')
|
|
146
|
-
.alias('l')
|
|
147
|
-
.description('List bundle in Capgo Cloud')
|
|
148
|
-
.action(listBundle)
|
|
149
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
150
|
-
|
|
151
|
-
bundle
|
|
152
|
-
.command('unlink [appId]')
|
|
153
|
-
.description('Unlink a bundle in Capgo Cloud')
|
|
154
|
-
.action(listBundle)
|
|
155
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
156
|
-
.option('-b, --bundle <bundle>', 'bundle version number of the bundle to unlink')
|
|
157
|
-
|
|
158
|
-
bundle
|
|
159
|
-
.command('cleanup [appId]')
|
|
160
|
-
.alias('c')
|
|
161
|
-
.action(cleanupBundle)
|
|
162
|
-
.description('Cleanup bundle in Capgo Cloud')
|
|
163
|
-
.option('-b, --bundle <bundle>', 'bundle version number of the app to delete')
|
|
164
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
165
|
-
.option('-k, --keep <keep>', 'number of version to keep')
|
|
166
|
-
.option('-f, --force', 'force removal')
|
|
167
|
-
|
|
168
|
-
bundle
|
|
169
|
-
.command('decrypt [zipPath] [sessionKey]')
|
|
170
|
-
.description('Decrypt a signed zip bundle')
|
|
171
|
-
.action(decryptZip)
|
|
172
|
-
.option('--key <key>', 'custom path for public signing key')
|
|
173
|
-
.option('--key-data <keyData>', 'base64 public signing key')
|
|
174
|
-
|
|
175
|
-
bundle
|
|
176
|
-
.command('encrypt [zipPath]')
|
|
177
|
-
.description('Encrypt a zip bundle')
|
|
178
|
-
.action(encryptZip)
|
|
179
|
-
.option('--key <key>', 'custom path for private signing key')
|
|
180
|
-
.option('--key-data <keyData>', 'base64 private signing key')
|
|
181
|
-
|
|
182
|
-
bundle
|
|
183
|
-
.command('zip [appId]')
|
|
184
|
-
.description('Zip a bundle')
|
|
185
|
-
.action(zipBundle)
|
|
186
|
-
.option('-p, --path <path>', 'path of the folder to upload')
|
|
187
|
-
.option('-b, --bundle <bundle>', 'bundle version number to name the zip file')
|
|
188
|
-
.option('-n, --name <name>', 'name of the zip file')
|
|
189
|
-
.option('-j, --json', 'output in JSON')
|
|
190
|
-
.option('--no-code-check', 'Ignore checking if notifyAppReady() is called in soure code and index present in root folder')
|
|
191
|
-
|
|
192
|
-
const channel = program
|
|
193
|
-
.command('channel')
|
|
194
|
-
.description('Manage channel')
|
|
195
|
-
|
|
196
|
-
channel
|
|
197
|
-
.command('add [channelId] [appId]')
|
|
198
|
-
.alias('a')
|
|
199
|
-
.description('Create channel')
|
|
200
|
-
.action(addChannelCommand)
|
|
201
|
-
.option('-d, --default', 'set the channel as default')
|
|
202
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
203
|
-
|
|
204
|
-
channel
|
|
205
|
-
.command('delete [channelId] [appId]')
|
|
206
|
-
.alias('d')
|
|
207
|
-
.description('Delete channel')
|
|
208
|
-
.action(deleteChannel)
|
|
209
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
210
|
-
|
|
211
|
-
channel
|
|
212
|
-
.command('list [appId]')
|
|
213
|
-
.alias('l')
|
|
214
|
-
.description('List channel')
|
|
215
|
-
.action(listChannels)
|
|
216
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
217
|
-
|
|
218
|
-
channel
|
|
219
|
-
.command('currentBundle [channel] [appId]')
|
|
220
|
-
.description('Get current bundle for specific channel in Capgo Cloud')
|
|
221
|
-
.action(currentBundle)
|
|
222
|
-
.option('-c, --channel <channel>', 'channel to get the current bundle from')
|
|
223
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
224
|
-
.option('--quiet', 'only print the bundle version')
|
|
225
|
-
|
|
226
|
-
channel
|
|
227
|
-
.command('set [channelId] [appId]')
|
|
228
|
-
.alias('s')
|
|
229
|
-
.description('Set channel')
|
|
230
|
-
.action(setChannel)
|
|
231
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
232
|
-
.option('-b, --bundle <bundle>', 'bundle version number of the file to set')
|
|
233
|
-
.option('-s, --state <state>', 'set the state of the channel, default or normal')
|
|
234
|
-
.option('--latest', 'get the latest version key in the package.json to set it to the channel')
|
|
235
|
-
.option('--downgrade', 'Allow to downgrade to version under native one')
|
|
236
|
-
.option('--no-downgrade', 'Disable downgrade to version under native one')
|
|
237
|
-
.option('--upgrade', 'Allow to upgrade to version above native one')
|
|
238
|
-
.option('--no-upgrade', 'Disable upgrade to version above native one')
|
|
239
|
-
.option('--ios', 'Allow sending update to ios devices')
|
|
240
|
-
.option('--no-ios', 'Disable sending update to ios devices')
|
|
241
|
-
.option('--android', 'Allow sending update to android devices')
|
|
242
|
-
.option('--no-android', 'Disable sending update to android devices')
|
|
243
|
-
.option('--self-assign', 'Allow to device to self assign to this channel')
|
|
244
|
-
.option('--no-self-assign', 'Disable devices to self assign to this channel')
|
|
245
|
-
.option('--disable-auto-update <disableAutoUpdate>', 'Disable auto update strategy for this channel.The possible options are: major, minor, metadata, none')
|
|
246
|
-
|
|
247
|
-
const key = program
|
|
248
|
-
.command('key')
|
|
249
|
-
.description('Manage key')
|
|
250
|
-
|
|
251
|
-
key
|
|
252
|
-
.command('save')
|
|
253
|
-
.description('Save base64 signing key in capacitor config, useful for CI')
|
|
254
|
-
.action(saveKeyCommand)
|
|
255
|
-
.option('-f, --force', 'force generate a new one')
|
|
256
|
-
.option('--key', 'key path to save in capacitor config')
|
|
257
|
-
.option('--key-data <keyData>', 'key data to save in capacitor config')
|
|
258
|
-
|
|
259
|
-
key
|
|
260
|
-
.command('create')
|
|
261
|
-
.description('Create a new signing key')
|
|
262
|
-
.action(createKeyCommand)
|
|
263
|
-
.option('-f, --force', 'force generate a new one')
|
|
264
|
-
|
|
265
|
-
program
|
|
266
|
-
.command('upload [appId]')
|
|
267
|
-
.alias('u')
|
|
268
|
-
.description('(Deprecated) Upload a new bundle to Capgo Cloud')
|
|
269
|
-
.action(uploadDeprecatedCommand)
|
|
270
|
-
.option('-a, --apikey <apikey>', 'apikey to link to your account')
|
|
271
|
-
.option('-p, --path <path>', 'path of the folder to upload')
|
|
272
|
-
.option('-c, --channel <channel>', 'channel to link to')
|
|
273
|
-
.option('-e, --external <url>', 'link to external url intead of upload to Capgo Cloud')
|
|
274
|
-
.option('--key <key>', 'custom path for public signing key')
|
|
275
|
-
.option('--key-data <keyData>', 'base64 public signing key')
|
|
276
|
-
.option('--bundle-url', 'prints bundle url into stdout')
|
|
277
|
-
.option('--no-key', 'ignore signing key and send clear update')
|
|
278
|
-
.option('--display-iv-session', 'Show in the console the iv and session key used to encrypt the update')
|
|
279
|
-
.option('-b, --bundle <bundle>', 'bundle version number of the file to upload')
|
|
280
|
-
.option(
|
|
281
|
-
'--min-update-version <minUpdateVersion>',
|
|
282
|
-
'Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel',
|
|
283
|
-
)
|
|
284
|
-
|
|
285
|
-
program.parseAsync()
|