@capgo/cli 4.0.14 → 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 CHANGED
@@ -2,6 +2,13 @@
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
+
5
12
  ### [4.0.14](https://github.com/Cap-go/CLI/compare/v4.0.13...v4.0.14) (2024-02-27)
6
13
 
7
14
  ### [4.0.13](https://github.com/Cap-go/CLI/compare/v4.0.12...v4.0.13) (2024-02-26)
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.14",
61140
+ version: "4.1.0",
61141
61141
  description: "A CLI to upload to capgo servers",
61142
61142
  main: "dist/index.js",
61143
61143
  bin: {
@@ -63342,15 +63342,47 @@ function displayChannels(data) {
63342
63342
  });
63343
63343
  data.reverse().forEach((row) => {
63344
63344
  t.addRow({
63345
- Name: row.name,
63346
- Created: getHumanDate(row.created_at),
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().eq("app_id", appid).order("created_at", { ascending: false });
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
- "version": "4.0.14",
3
+ "version": "4.1.0",
4
4
  "description": "A CLI to upload to capgo servers",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -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, getHumanDate } from '../utils'
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
- export function displayChannels(data: (Database['public']['Tables']['channels']['Row'] & { keep?: string })[]) {
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
- Created: getHumanDate(row.created_at),
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 })