@capgo/cli 4.0.13 → 4.1.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/CHANGELOG.md +9 -0
- package/dist/index.js +41 -9
- package/package.json +1 -1
- package/src/api/app.ts +4 -4
- package/src/api/channels.ts +42 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
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.1.0](https://github.com/Cap-go/CLI/compare/v4.0.14...v4.1.0) (2024-02-27)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* better channel list ([93c8b04](https://github.com/Cap-go/CLI/commit/93c8b04407d1b3fe43963d9d8f11dc5e419008e8))
|
|
11
|
+
|
|
12
|
+
### [4.0.14](https://github.com/Cap-go/CLI/compare/v4.0.13...v4.0.14) (2024-02-27)
|
|
13
|
+
|
|
5
14
|
### [4.0.13](https://github.com/Cap-go/CLI/compare/v4.0.12...v4.0.13) (2024-02-26)
|
|
6
15
|
|
|
7
16
|
|
package/dist/index.js
CHANGED
|
@@ -61137,7 +61137,7 @@ var {
|
|
|
61137
61137
|
// package.json
|
|
61138
61138
|
var package_default = {
|
|
61139
61139
|
name: "@capgo/cli",
|
|
61140
|
-
version: "4.0
|
|
61140
|
+
version: "4.1.0",
|
|
61141
61141
|
description: "A CLI to upload to capgo servers",
|
|
61142
61142
|
main: "dist/index.js",
|
|
61143
61143
|
bin: {
|
|
@@ -62930,17 +62930,17 @@ async function checkAppExists(supabase, appid) {
|
|
|
62930
62930
|
return !!app2;
|
|
62931
62931
|
}
|
|
62932
62932
|
async function checkAppExistsAndHasPermissionErr(supabase, apikey, appid, shouldExist = true) {
|
|
62933
|
-
const
|
|
62933
|
+
const appExist = await checkAppExists(supabase, appid);
|
|
62934
62934
|
const perm = await isAllowedApp(supabase, apikey, appid);
|
|
62935
|
-
if (
|
|
62935
|
+
if (appExist && !shouldExist) {
|
|
62936
62936
|
f2.error(`App ${appid} already exist`);
|
|
62937
62937
|
program.error("");
|
|
62938
62938
|
}
|
|
62939
|
-
if (!
|
|
62939
|
+
if (!appExist && shouldExist) {
|
|
62940
62940
|
f2.error(`App ${appid} does not exist`);
|
|
62941
62941
|
program.error("");
|
|
62942
62942
|
}
|
|
62943
|
-
if (
|
|
62943
|
+
if (appExist && !perm) {
|
|
62944
62944
|
f2.error(`App ${appid} exist and you don't have permission to access it`);
|
|
62945
62945
|
if (appid === "io.ionic.starter")
|
|
62946
62946
|
f2.info("Modify your appid in your capacitor.config.json file to something unique, this is a default appid for ionic starter app");
|
|
@@ -63342,15 +63342,47 @@ function displayChannels(data) {
|
|
|
63342
63342
|
});
|
|
63343
63343
|
data.reverse().forEach((row) => {
|
|
63344
63344
|
t.addRow({
|
|
63345
|
-
Name: row.name,
|
|
63346
|
-
|
|
63347
|
-
Public: row.public ? "\u2705" : "\u274C"
|
|
63345
|
+
"Name": row.name,
|
|
63346
|
+
...row.version ? { Version: row.version.name } : void 0,
|
|
63347
|
+
"Public": row.public ? "\u2705" : "\u274C",
|
|
63348
|
+
"iOS": row.ios ? "\u274C" : "\u2705",
|
|
63349
|
+
"Android": row.android ? "\u274C" : "\u2705",
|
|
63350
|
+
"\u2B06\uFE0F limit": row.disableAutoUpdate,
|
|
63351
|
+
"\u2B07\uFE0F under native": row.disableAutoUpdateUnderNative ? "\u274C" : "\u2705",
|
|
63352
|
+
"Self assign": row.allow_device_self_set ? "\u2705" : "\u274C",
|
|
63353
|
+
"Progressive": row.enable_progressive_deploy ? "\u2705" : "\u274C",
|
|
63354
|
+
...row.enable_progressive_deploy && row.secondVersion ? { "Next version": row.secondVersion.name } : void 0,
|
|
63355
|
+
...row.enable_progressive_deploy && row.secondVersion ? { "Next %": row.secondaryVersionPercentage } : void 0,
|
|
63356
|
+
"AB Testing": row.enableAbTesting ? "\u2705" : "\u274C",
|
|
63357
|
+
...row.enableAbTesting && row.secondVersion ? { "Version B": row.secondVersion } : void 0,
|
|
63358
|
+
...row.enableAbTesting && row.secondVersion ? { "A/B %": row.secondaryVersionPercentage } : void 0,
|
|
63359
|
+
"Emulator": row.allow_emulator ? "\u2705" : "\u274C",
|
|
63360
|
+
"Dev \u{1F4F1}": row.allow_dev ? "\u2705" : "\u274C"
|
|
63348
63361
|
});
|
|
63349
63362
|
});
|
|
63350
63363
|
f2.success(t.render());
|
|
63351
63364
|
}
|
|
63352
63365
|
async function getActiveChannels(supabase, appid) {
|
|
63353
|
-
const { data, error: vError } = await supabase.from("channels").select(
|
|
63366
|
+
const { data, error: vError } = await supabase.from("channels").select(`
|
|
63367
|
+
id,
|
|
63368
|
+
name,
|
|
63369
|
+
public,
|
|
63370
|
+
allow_emulator,
|
|
63371
|
+
allow_dev,
|
|
63372
|
+
ios,
|
|
63373
|
+
android,
|
|
63374
|
+
allow_device_self_set,
|
|
63375
|
+
disableAutoUpdateUnderNative,
|
|
63376
|
+
disableAutoUpdate,
|
|
63377
|
+
enable_progressive_deploy,
|
|
63378
|
+
enableAbTesting,
|
|
63379
|
+
secondaryVersionPercentage,
|
|
63380
|
+
secondVersion (id, name),
|
|
63381
|
+
created_at,
|
|
63382
|
+
created_by,
|
|
63383
|
+
app_id,
|
|
63384
|
+
version (id, name)
|
|
63385
|
+
`).eq("app_id", appid).order("created_at", { ascending: false });
|
|
63354
63386
|
if (vError) {
|
|
63355
63387
|
f2.error(`App ${appid} not found in database`);
|
|
63356
63388
|
program.error("");
|
package/package.json
CHANGED
package/src/api/app.ts
CHANGED
|
@@ -13,18 +13,18 @@ export async function checkAppExists(supabase: SupabaseClient<Database>, appid:
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export async function checkAppExistsAndHasPermissionErr(supabase: SupabaseClient<Database>, apikey: string, appid: string, shouldExist = true) {
|
|
16
|
-
const
|
|
16
|
+
const appExist = await checkAppExists(supabase, appid)
|
|
17
17
|
const perm = await isAllowedApp(supabase, apikey, appid)
|
|
18
18
|
|
|
19
|
-
if (
|
|
19
|
+
if (appExist && !shouldExist) {
|
|
20
20
|
p.log.error(`App ${appid} already exist`)
|
|
21
21
|
program.error('')
|
|
22
22
|
}
|
|
23
|
-
if (!
|
|
23
|
+
if (!appExist && shouldExist) {
|
|
24
24
|
p.log.error(`App ${appid} does not exist`)
|
|
25
25
|
program.error('')
|
|
26
26
|
}
|
|
27
|
-
if (
|
|
27
|
+
if (appExist && !perm) {
|
|
28
28
|
p.log.error(`App ${appid} exist and you don't have permission to access it`)
|
|
29
29
|
if (appid === 'io.ionic.starter')
|
|
30
30
|
p.log.info('Modify your appid in your capacitor.config.json file to something unique, this is a default appid for ionic starter app')
|
package/src/api/channels.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { program } from 'commander'
|
|
|
4
4
|
import { Table } from 'console-table-printer'
|
|
5
5
|
import * as p from '@clack/prompts'
|
|
6
6
|
import type { Database } from '../types/supabase.types'
|
|
7
|
-
import { formatError
|
|
7
|
+
import { formatError } from '../utils'
|
|
8
8
|
|
|
9
9
|
export async function checkVersionNotUsedInChannel(supabase: SupabaseClient<Database>, appid: string, userId: string, versionData: Database['public']['Tables']['app_versions']['Row']) {
|
|
10
10
|
const { data: channelFound, error: errorChannel } = await supabase
|
|
@@ -72,8 +72,11 @@ export function delChannel(supabase: SupabaseClient<Database>, name: string, app
|
|
|
72
72
|
.eq('created_by', userId)
|
|
73
73
|
.single()
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
interface version {
|
|
76
|
+
id: string
|
|
77
|
+
name: string
|
|
78
|
+
}
|
|
79
|
+
export function displayChannels(data: (Database['public']['Tables']['channels']['Row'] & { version?: version, secondVersion?: version })[]) {
|
|
77
80
|
const t = new Table({
|
|
78
81
|
title: 'Channels',
|
|
79
82
|
charLength: { '❌': 2, '✅': 2 },
|
|
@@ -82,9 +85,22 @@ export function displayChannels(data: (Database['public']['Tables']['channels'][
|
|
|
82
85
|
// add rows with color
|
|
83
86
|
data.reverse().forEach((row) => {
|
|
84
87
|
t.addRow({
|
|
85
|
-
Name: row.name,
|
|
86
|
-
|
|
87
|
-
Public: row.public ? '✅' : '❌',
|
|
88
|
+
'Name': row.name,
|
|
89
|
+
...(row.version ? { Version: row.version.name } : undefined),
|
|
90
|
+
'Public': row.public ? '✅' : '❌',
|
|
91
|
+
'iOS': row.ios ? '❌' : '✅',
|
|
92
|
+
'Android': row.android ? '❌' : '✅',
|
|
93
|
+
'⬆️ limit': row.disableAutoUpdate,
|
|
94
|
+
'⬇️ under native': row.disableAutoUpdateUnderNative ? '❌' : '✅',
|
|
95
|
+
'Self assign': row.allow_device_self_set ? '✅' : '❌',
|
|
96
|
+
'Progressive': row.enable_progressive_deploy ? '✅' : '❌',
|
|
97
|
+
...(row.enable_progressive_deploy && row.secondVersion ? { 'Next version': row.secondVersion.name } : undefined),
|
|
98
|
+
...(row.enable_progressive_deploy && row.secondVersion ? { 'Next %': row.secondaryVersionPercentage } : undefined),
|
|
99
|
+
'AB Testing': row.enableAbTesting ? '✅' : '❌',
|
|
100
|
+
...(row.enableAbTesting && row.secondVersion ? { 'Version B': row.secondVersion } : undefined),
|
|
101
|
+
...(row.enableAbTesting && row.secondVersion ? { 'A/B %': row.secondaryVersionPercentage } : undefined),
|
|
102
|
+
'Emulator': row.allow_emulator ? '✅' : '❌',
|
|
103
|
+
'Dev 📱': row.allow_dev ? '✅' : '❌',
|
|
88
104
|
})
|
|
89
105
|
})
|
|
90
106
|
|
|
@@ -94,7 +110,26 @@ export function displayChannels(data: (Database['public']['Tables']['channels'][
|
|
|
94
110
|
export async function getActiveChannels(supabase: SupabaseClient<Database>, appid: string) {
|
|
95
111
|
const { data, error: vError } = await supabase
|
|
96
112
|
.from('channels')
|
|
97
|
-
.select(
|
|
113
|
+
.select(`
|
|
114
|
+
id,
|
|
115
|
+
name,
|
|
116
|
+
public,
|
|
117
|
+
allow_emulator,
|
|
118
|
+
allow_dev,
|
|
119
|
+
ios,
|
|
120
|
+
android,
|
|
121
|
+
allow_device_self_set,
|
|
122
|
+
disableAutoUpdateUnderNative,
|
|
123
|
+
disableAutoUpdate,
|
|
124
|
+
enable_progressive_deploy,
|
|
125
|
+
enableAbTesting,
|
|
126
|
+
secondaryVersionPercentage,
|
|
127
|
+
secondVersion (id, name),
|
|
128
|
+
created_at,
|
|
129
|
+
created_by,
|
|
130
|
+
app_id,
|
|
131
|
+
version (id, name)
|
|
132
|
+
`)
|
|
98
133
|
.eq('app_id', appid)
|
|
99
134
|
// .eq('created_by', userId)
|
|
100
135
|
.order('created_at', { ascending: false })
|