@capgo/cli 4.4.5 โ 4.6.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/.vscode/settings.json +43 -2
- package/CHANGELOG.md +15 -0
- package/bun.lockb +0 -0
- package/dist/index.js +30789 -30061
- package/eslint.config.js +8 -1
- package/package.json +29 -37
- package/src/api/update.ts +1 -1
- package/src/bundle/upload.ts +4 -8
- package/src/channel/add.ts +3 -2
- package/src/channel/set.ts +6 -2
- package/src/index.ts +4 -0
- package/src/init.ts +7 -1
- package/src/types/supabase.types.ts +697 -324
- package/src/utils.ts +0 -18
- package/.eslintignore +0 -4
package/eslint.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"description": "A CLI to upload to capgo servers",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
},
|
|
5
|
+
"author": "github.com/riderx",
|
|
6
|
+
"license": "Apache 2.0",
|
|
7
|
+
"homepage": "https://github.com/Cap-go/CLIl#readme",
|
|
9
8
|
"repository": {
|
|
10
9
|
"type": "git",
|
|
11
10
|
"url": "git+https://github.com/Cap-go/CLI.git"
|
|
@@ -13,11 +12,6 @@
|
|
|
13
12
|
"bugs": {
|
|
14
13
|
"url": "https://github.com/Cap-go/CLI/issues"
|
|
15
14
|
},
|
|
16
|
-
"homepage": "https://github.com/Cap-go/CLIl#readme",
|
|
17
|
-
"engines": {
|
|
18
|
-
"npm": ">=8.0.0",
|
|
19
|
-
"node": ">=18.0.0"
|
|
20
|
-
},
|
|
21
15
|
"keywords": [
|
|
22
16
|
"appflow alternative",
|
|
23
17
|
"ionic",
|
|
@@ -29,6 +23,14 @@
|
|
|
29
23
|
"upload",
|
|
30
24
|
"capgo-cli"
|
|
31
25
|
],
|
|
26
|
+
"main": "dist/index.js",
|
|
27
|
+
"bin": {
|
|
28
|
+
"capgo": "dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"npm": ">=8.0.0",
|
|
32
|
+
"node": ">=18.0.0"
|
|
33
|
+
},
|
|
32
34
|
"scripts": {
|
|
33
35
|
"build": "node build.mjs",
|
|
34
36
|
"dev": "NODE_ENV=development node build.mjs",
|
|
@@ -40,58 +42,48 @@
|
|
|
40
42
|
"test_rls": "ts-node ./test/test_headers_rls.ts",
|
|
41
43
|
"lint": "eslint \"src/**/*.ts\" --fix"
|
|
42
44
|
},
|
|
43
|
-
"author": "github.com/riderx",
|
|
44
|
-
"license": "Apache 2.0",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@aws-sdk/client-s3": "^3.
|
|
47
|
-
"@capacitor/cli": "
|
|
46
|
+
"@aws-sdk/client-s3": "^3.563.0",
|
|
47
|
+
"@capacitor/cli": "6.0.0",
|
|
48
48
|
"@capgo/find-package-manager": "0.0.11",
|
|
49
49
|
"@clack/prompts": "^0.7.0",
|
|
50
|
-
"@supabase/supabase-js": "^2.
|
|
50
|
+
"@supabase/supabase-js": "^2.42.7",
|
|
51
51
|
"@tomasklaen/checksum": "^1.1.0",
|
|
52
52
|
"@trufflesuite/spinnies": "^0.1.1",
|
|
53
|
-
"adm-zip": "^0.5.
|
|
53
|
+
"adm-zip": "^0.5.12",
|
|
54
54
|
"ci-info": "^4.0.0",
|
|
55
55
|
"commander": "12.0.0",
|
|
56
56
|
"console-table-printer": "^2.12.0",
|
|
57
57
|
"get-latest-version": "^5.1.0",
|
|
58
|
-
"ky": "^1.2.
|
|
58
|
+
"ky": "^1.2.4",
|
|
59
59
|
"logsnag": "1.0.0",
|
|
60
|
-
"mime": "^4.0.
|
|
60
|
+
"mime": "^4.0.3",
|
|
61
61
|
"node-dir": "^0.1.17",
|
|
62
|
-
"open": "^10.0
|
|
62
|
+
"open": "^10.1.0",
|
|
63
63
|
"prettyjson": "^1.2.5",
|
|
64
64
|
"prompt-sync": "^4.2.0",
|
|
65
|
-
"qrcode": "^1.5.3",
|
|
66
65
|
"semver": "^7.6.0"
|
|
67
66
|
},
|
|
68
67
|
"devDependencies": {
|
|
69
|
-
"@antfu/eslint-config": "^2.
|
|
68
|
+
"@antfu/eslint-config": "^2.16.1",
|
|
70
69
|
"@types/adm-zip": "0.5.5",
|
|
71
70
|
"@types/mime": "^3.0.4",
|
|
72
|
-
"@types/node": "^20.
|
|
71
|
+
"@types/node": "^20.12.7",
|
|
73
72
|
"@types/node-dir": "^0.0.37",
|
|
74
73
|
"@types/npmcli__ci-detect": "^2.0.3",
|
|
75
74
|
"@types/prettyjson": "^0.0.33",
|
|
76
75
|
"@types/prompt-sync": "^4.2.3",
|
|
77
|
-
"@types/
|
|
78
|
-
"@
|
|
79
|
-
"@typescript-eslint/
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"eslint-config-prettier": "^9.1.0",
|
|
85
|
-
"eslint-import-resolver-typescript": "3.6.1",
|
|
86
|
-
"eslint-plugin-import": "2.29.1",
|
|
87
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
88
|
-
"git-format-staged": "3.0.0",
|
|
89
|
-
"husky": "^9.0.10",
|
|
76
|
+
"@types/semver": "^7.5.8",
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "7.7.1",
|
|
78
|
+
"@typescript-eslint/parser": "7.7.1",
|
|
79
|
+
"esbuild": "^0.20.2",
|
|
80
|
+
"eslint": "9.1.1",
|
|
81
|
+
"git-format-staged": "3.1.1",
|
|
82
|
+
"husky": "^9.0.11",
|
|
90
83
|
"pkg": "5.8.1",
|
|
91
|
-
"prettier": "3.2.5",
|
|
92
84
|
"ts-loader": "^9.5.1",
|
|
93
85
|
"ts-node": "^10.9.2",
|
|
94
86
|
"tsconfig-paths": "4.2.0",
|
|
95
|
-
"typescript": "5.
|
|
87
|
+
"typescript": "5.4.5"
|
|
96
88
|
}
|
|
97
89
|
}
|
package/src/api/update.ts
CHANGED
|
@@ -4,7 +4,7 @@ import pack from '../../package.json'
|
|
|
4
4
|
|
|
5
5
|
export async function checkLatest() {
|
|
6
6
|
const latest = await getLatest('@capgo/cli')
|
|
7
|
-
const major = latest
|
|
7
|
+
const major = latest?.split('.')[0]
|
|
8
8
|
if (latest !== pack.version) {
|
|
9
9
|
p.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.`,
|
package/src/bundle/upload.ts
CHANGED
|
@@ -19,7 +19,6 @@ import type {
|
|
|
19
19
|
OptionsBase,
|
|
20
20
|
} from '../utils'
|
|
21
21
|
import {
|
|
22
|
-
EMPTY_UUID,
|
|
23
22
|
OrganizationPerm,
|
|
24
23
|
baseKeyPub,
|
|
25
24
|
checkCompatibility,
|
|
@@ -29,7 +28,6 @@ import {
|
|
|
29
28
|
deletedFailedVersion,
|
|
30
29
|
findSavedKey,
|
|
31
30
|
formatError,
|
|
32
|
-
getAppOwner,
|
|
33
31
|
getConfig,
|
|
34
32
|
getLocalConfig,
|
|
35
33
|
getLocalDepenencies,
|
|
@@ -358,8 +356,6 @@ It will be also visible in your dashboard\n`)
|
|
|
358
356
|
|
|
359
357
|
const nativePackages = (hashedLocalDependencies.size > 0 || !options.ignoreMetadataCheck) ? Array.from(hashedLocalDependencies, ([name, value]) => ({ name, version: value.version })) : undefined
|
|
360
358
|
|
|
361
|
-
const appOwner = await getAppOwner(supabase, appid)
|
|
362
|
-
|
|
363
359
|
const versionData = {
|
|
364
360
|
// bucket_id: external ? undefined : fileName,
|
|
365
361
|
name: bundle,
|
|
@@ -369,7 +365,7 @@ It will be also visible in your dashboard\n`)
|
|
|
369
365
|
storage_provider: external ? 'external' : 'r2-direct',
|
|
370
366
|
minUpdateVersion,
|
|
371
367
|
native_packages: nativePackages,
|
|
372
|
-
owner_org:
|
|
368
|
+
owner_org: orgId,
|
|
373
369
|
user_id: userId,
|
|
374
370
|
checksum,
|
|
375
371
|
}
|
|
@@ -415,7 +411,7 @@ It will be also visible in your dashboard\n`)
|
|
|
415
411
|
}
|
|
416
412
|
spinner.stop('Bundle Uploaded ๐ช')
|
|
417
413
|
}
|
|
418
|
-
else if (useS3 && zipped) {
|
|
414
|
+
else if (useS3 && zipped && s3Client) {
|
|
419
415
|
const spinner = p.spinner()
|
|
420
416
|
spinner.start(`Uploading Bundle`)
|
|
421
417
|
|
|
@@ -450,9 +446,9 @@ It will be also visible in your dashboard\n`)
|
|
|
450
446
|
const { error: dbError3, data } = await updateOrCreateChannel(supabase, {
|
|
451
447
|
name: channel,
|
|
452
448
|
app_id: appid,
|
|
453
|
-
created_by:
|
|
449
|
+
created_by: userId,
|
|
454
450
|
version: versionId,
|
|
455
|
-
owner_org:
|
|
451
|
+
owner_org: orgId,
|
|
456
452
|
})
|
|
457
453
|
if (dbError3) {
|
|
458
454
|
p.log.error(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${formatError(dbError3)}`)
|
package/src/channel/add.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as p from '@clack/prompts'
|
|
|
4
4
|
import { checkAppExistsAndHasPermissionOrgErr } from '../api/app'
|
|
5
5
|
import { createChannel, findUnknownVersion } from '../api/channels'
|
|
6
6
|
import type { OptionsBase } from '../utils'
|
|
7
|
-
import {
|
|
7
|
+
import { OrganizationPerm, createSupabaseClient, findSavedKey, getConfig, getOrganizationId, useLogSnag, verifyUser } from '../utils'
|
|
8
8
|
|
|
9
9
|
interface Options extends OptionsBase {
|
|
10
10
|
default?: boolean
|
|
@@ -34,6 +34,7 @@ export async function addChannel(channelId: string, appId: string, options: Opti
|
|
|
34
34
|
p.log.info(`Creating channel ${appId}#${channelId} to Capgo`)
|
|
35
35
|
try {
|
|
36
36
|
const data = await findUnknownVersion(supabase, appId)
|
|
37
|
+
const orgId = await getOrganizationId(supabase, appId)
|
|
37
38
|
if (!data) {
|
|
38
39
|
p.log.error(`Cannot find default version for channel creation, please contact Capgo support ๐คจ`)
|
|
39
40
|
program.error('')
|
|
@@ -42,7 +43,7 @@ export async function addChannel(channelId: string, appId: string, options: Opti
|
|
|
42
43
|
name: channelId,
|
|
43
44
|
app_id: appId,
|
|
44
45
|
version: data.id,
|
|
45
|
-
owner_org:
|
|
46
|
+
owner_org: orgId,
|
|
46
47
|
})
|
|
47
48
|
p.log.success(`Channel created โ
`)
|
|
48
49
|
await snag.track({
|
package/src/channel/set.ts
CHANGED
|
@@ -29,7 +29,8 @@ interface Options extends OptionsBase {
|
|
|
29
29
|
android?: boolean
|
|
30
30
|
selfAssign?: boolean
|
|
31
31
|
disableAutoUpdate: string
|
|
32
|
-
|
|
32
|
+
dev?: boolean
|
|
33
|
+
emulator?: boolean
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
const disableAutoUpdatesPossibleOptions = ['major', 'minor', 'metadata', 'patch', 'none']
|
|
@@ -56,7 +57,7 @@ export async function setChannel(channel: string, appId: string, options: Option
|
|
|
56
57
|
await checkAppExistsAndHasPermissionOrgErr(supabase, options.apikey, appId, OrganizationPerm.admin)
|
|
57
58
|
const orgId = await getOrganizationId(supabase, appId)
|
|
58
59
|
|
|
59
|
-
const { bundle,
|
|
60
|
+
const { bundle, state, downgrade, latest, upgrade, ios, android, selfAssign, disableAutoUpdate, dev, emulator } = options
|
|
60
61
|
if (!channel) {
|
|
61
62
|
p.log.error('Missing argument, you need to provide a channel')
|
|
62
63
|
program.error('')
|
|
@@ -73,6 +74,8 @@ export async function setChannel(channel: string, appId: string, options: Option
|
|
|
73
74
|
&& ios == null
|
|
74
75
|
&& android == null
|
|
75
76
|
&& selfAssign == null
|
|
77
|
+
&& dev == null
|
|
78
|
+
&& emulator == null
|
|
76
79
|
&& disableAutoUpdate == null) {
|
|
77
80
|
p.log.error('Missing argument, you need to provide a option to set')
|
|
78
81
|
program.error('')
|
|
@@ -83,6 +86,7 @@ export async function setChannel(channel: string, appId: string, options: Option
|
|
|
83
86
|
created_by: userId,
|
|
84
87
|
app_id: appId,
|
|
85
88
|
name: channel,
|
|
89
|
+
owner_org: orgId,
|
|
86
90
|
version: undefined as any,
|
|
87
91
|
}
|
|
88
92
|
const bundleVersion = latest ? config?.app?.package?.version : bundle
|
package/src/index.ts
CHANGED
|
@@ -248,6 +248,10 @@ channel
|
|
|
248
248
|
.option('--self-assign', 'Allow to device to self assign to this channel')
|
|
249
249
|
.option('--no-self-assign', 'Disable devices to self assign to this channel')
|
|
250
250
|
.option('--disable-auto-update <disableAutoUpdate>', 'Disable auto update strategy for this channel.The possible options are: major, minor, metadata, patch, none')
|
|
251
|
+
.option('--dev', 'Allow sending update to development devices')
|
|
252
|
+
.option('--no-dev', 'Disable sending update to development devices')
|
|
253
|
+
.option('--emulator', 'Allow sending update to emulator devices')
|
|
254
|
+
.option('--no-emulator', 'Disable sending update to emulator devices')
|
|
251
255
|
|
|
252
256
|
const key = program
|
|
253
257
|
.command('key')
|
package/src/init.ts
CHANGED
|
@@ -79,6 +79,7 @@ async function step3(userId: string, snag: LogSnag, apikey: string, appId: strin
|
|
|
79
79
|
await markStep(userId, snag, 3)
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
const urlMigrateV6 = 'https://capacitorjs.com/docs/updating/6-0'
|
|
82
83
|
const urlMigrateV5 = 'https://capacitorjs.com/docs/updating/5-0'
|
|
83
84
|
async function step4(userId: string, snag: LogSnag, apikey: string, appId: string) {
|
|
84
85
|
const doInstall = await p.confirm({ message: `Automatic Install "@capgo/capacitor-updater" dependency in ${appId}?` })
|
|
@@ -86,6 +87,7 @@ async function step4(userId: string, snag: LogSnag, apikey: string, appId: strin
|
|
|
86
87
|
if (doInstall) {
|
|
87
88
|
const s = p.spinner()
|
|
88
89
|
s.start(`Checking if @capgo/capacitor-updater is installed`)
|
|
90
|
+
let versionToInstall = 'latest'
|
|
89
91
|
const pack = JSON.parse(readFileSync('package.json').toString())
|
|
90
92
|
let coreVersion = pack.dependencies['@capacitor/core'] || pack.devDependencies['@capacitor/core']
|
|
91
93
|
coreVersion = coreVersion?.replace('^', '').replace('~', '')
|
|
@@ -97,6 +99,10 @@ async function step4(userId: string, snag: LogSnag, apikey: string, appId: strin
|
|
|
97
99
|
s.stop(`@capacitor/core version is ${coreVersion}, please update to Capacitor v5 first: ${urlMigrateV5}`)
|
|
98
100
|
process.exit()
|
|
99
101
|
}
|
|
102
|
+
else if (semver.lt(coreVersion, '6.0.0')) {
|
|
103
|
+
s.stop(`@capacitor/core version is ${coreVersion}, please update to Capacitor v6: ${urlMigrateV6} to access the best features of Capgo`)
|
|
104
|
+
versionToInstall = '^5.0.0'
|
|
105
|
+
}
|
|
100
106
|
const pm = findPackageManagerType()
|
|
101
107
|
if (pm === 'unknown') {
|
|
102
108
|
s.stop(`Cannot reconize package manager, please run \`capgo init\` in a capacitor project with npm, pnpm or yarn`)
|
|
@@ -110,7 +116,7 @@ async function step4(userId: string, snag: LogSnag, apikey: string, appId: strin
|
|
|
110
116
|
s.stop(`Capgo already installed โ
`)
|
|
111
117
|
}
|
|
112
118
|
else {
|
|
113
|
-
await execSync(`${pm} ${installCmd} @capgo/capacitor-updater
|
|
119
|
+
await execSync(`${pm} ${installCmd} @capgo/capacitor-updater@${versionToInstall}`, execOption as ExecSyncOptions)
|
|
114
120
|
s.stop(`Install Done โ
`)
|
|
115
121
|
}
|
|
116
122
|
}
|