@capgo/cli 4.10.22 โ†’ 4.10.23

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,8 @@
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.10.23](https://github.com/Cap-go/CLI/compare/v4.10.22...v4.10.23) (2024-06-19)
6
+
5
7
  ### [4.10.22](https://github.com/Cap-go/CLI/compare/v4.10.21...v4.10.22) (2024-06-19)
6
8
 
7
9
 
package/dist/index.js CHANGED
@@ -108745,7 +108745,7 @@ var {
108745
108745
  // package.json
108746
108746
  var package_default = {
108747
108747
  name: "@capgo/cli",
108748
- version: "4.10.22",
108748
+ version: "4.10.23",
108749
108749
  description: "A CLI to upload to capgo servers",
108750
108750
  author: "github.com/riderx",
108751
108751
  license: "Apache 2.0",
@@ -111088,8 +111088,8 @@ async function createKey(options, log = true) {
111088
111088
  oe(`Create keys \u{1F511}`);
111089
111089
  const { publicKey, privateKey } = createRSA();
111090
111090
  if ((0, import_node_fs7.existsSync)(baseKeyPub) && !options.force) {
111091
+ f2.error("Public Key already exists, use --force to overwrite");
111091
111092
  if (log) {
111092
- f2.error("Public Key already exists, use --force to overwrite");
111093
111093
  program.error("");
111094
111094
  } else {
111095
111095
  return false;
@@ -111097,8 +111097,8 @@ async function createKey(options, log = true) {
111097
111097
  }
111098
111098
  (0, import_node_fs7.writeFileSync)(baseKeyPub, publicKey);
111099
111099
  if ((0, import_node_fs7.existsSync)(baseKey) && !options.force) {
111100
+ f2.error("Private Key already exists, use --force to overwrite");
111100
111101
  if (log) {
111101
- f2.error("Private Key already exists, use --force to overwrite");
111102
111102
  program.error("");
111103
111103
  } else {
111104
111104
  return false;
@@ -111171,7 +111171,14 @@ async function checkVersionNotUsedInChannel(supabase, appid, versionData) {
111171
111171
  }
111172
111172
  }
111173
111173
  function findUnknownVersion(supabase, appId) {
111174
- return supabase.from("app_versions").select("id").eq("app_id", appId).eq("name", "unknown").throwOnError().single().then(({ data }) => data);
111174
+ return supabase.from("app_versions").select("id").eq("app_id", appId).eq("name", "unknown").throwOnError().single().then(({ data, error }) => {
111175
+ if (error) {
111176
+ f2.error(`Cannot call findUnknownVersion as it returned an error.
111177
+ ${formatError(error)}`);
111178
+ program.error("");
111179
+ }
111180
+ return data;
111181
+ });
111175
111182
  }
111176
111183
  function createChannel(supabase, update) {
111177
111184
  return supabase.from("channels").insert(update).select().single();
@@ -111260,12 +111267,17 @@ async function addChannel(channelId, appId, options, shouldExit = true) {
111260
111267
  f2.error(`Cannot find default version for channel creation, please contact Capgo support \u{1F928}`);
111261
111268
  program.error("");
111262
111269
  }
111263
- await createChannel(supabase, {
111270
+ const res = await createChannel(supabase, {
111264
111271
  name: channelId,
111265
111272
  app_id: appId,
111266
111273
  version: data.id,
111267
111274
  owner_org: orgId
111268
111275
  });
111276
+ if (res.error) {
111277
+ f2.error(`Cannot create Channel \u{1F640}
111278
+ ${formatError(res.error)}`);
111279
+ program.error("");
111280
+ }
111269
111281
  f2.success(`Channel created \u2705`);
111270
111282
  await snag.track({
111271
111283
  channel: "channel",
@@ -111979,7 +111991,7 @@ async function step2(organization, snag, appId, options) {
111979
111991
  else
111980
111992
  s.stop(`App add Done \u2705`);
111981
111993
  } else {
111982
- f2.info(`Run yourself "${pm2.runner} @capgo/cli@latest app add ${appId}"`);
111994
+ f2.info(`If you change your mind, run it for yourself with: "${pm2.runner} @capgo/cli@latest app add ${appId}"`);
111983
111995
  }
111984
111996
  await markStep(organization.gid, snag, 2);
111985
111997
  }
@@ -111999,7 +112011,7 @@ async function step3(orgId, snag, apikey, appId) {
111999
112011
  else
112000
112012
  s.stop(`Channel add Done \u2705`);
112001
112013
  } else {
112002
- f2.info(`Run yourself "${pm2.runner} @capgo/cli@latest channel add ${defaultChannel} ${appId} --default"`);
112014
+ f2.info(`If you change your mind, run it for yourself with: "${pm2.runner} @capgo/cli@latest channel add ${defaultChannel} ${appId} --default"`);
112003
112015
  }
112004
112016
  await markStep(orgId, snag, 3);
112005
112017
  }
@@ -112043,7 +112055,7 @@ async function step4(orgId, snag, apikey, appId) {
112043
112055
  s.stop(`Install Done \u2705`);
112044
112056
  }
112045
112057
  } else {
112046
- f2.info(`Run yourself "${pm2.installCommand} @capgo/capacitor-updater@latest"`);
112058
+ f2.info(`If you change your mind, run it for yourself with: "${pm2.installCommand} @capgo/capacitor-updater@latest"`);
112047
112059
  }
112048
112060
  await markStep(orgId, snag, 4);
112049
112061
  }
@@ -112185,7 +112197,7 @@ async function step9(orgId, snag) {
112185
112197
  await (0, import_node_child_process6.spawnSync)(pm2.runner, ["cap", "run", platform2], { stdio: "inherit" });
112186
112198
  s.stop(`Started Done \u2705`);
112187
112199
  } else {
112188
- f2.info(`Run yourself with command: ${pm2.runner} cap run <ios|android>`);
112200
+ f2.info(`If you change your mind, run it for yourself with: ${pm2.runner} cap run <ios|android>`);
112189
112201
  }
112190
112202
  await markStep(orgId, snag, 9);
112191
112203
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
- "version": "4.10.22",
3
+ "version": "4.10.23",
4
4
  "description": "A CLI to upload to capgo servers",
5
5
  "author": "github.com/riderx",
6
6
  "license": "Apache 2.0",
@@ -51,7 +51,13 @@ export function findUnknownVersion(supabase: SupabaseClient<Database>, appId: st
51
51
  .eq('app_id', appId)
52
52
  .eq('name', 'unknown')
53
53
  .throwOnError()
54
- .single().then(({ data }) => data)
54
+ .single().then(({ data, error }) => {
55
+ if (error) {
56
+ p.log.error(`Cannot call findUnknownVersion as it returned an error.\n${formatError(error)}`)
57
+ program.error('')
58
+ }
59
+ return data
60
+ })
55
61
  }
56
62
 
57
63
  export function createChannel(supabase: SupabaseClient<Database>, update: Database['public']['Tables']['channels']['Insert']) {
@@ -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 { OrganizationPerm, createSupabaseClient, findSavedKey, getConfig, getOrganizationId, useLogSnag, verifyUser } from '../utils'
7
+ import { OrganizationPerm, createSupabaseClient, findSavedKey, formatError, getConfig, getOrganizationId, useLogSnag, verifyUser } from '../utils'
8
8
 
9
9
  interface Options extends OptionsBase {
10
10
  default?: boolean
@@ -39,12 +39,18 @@ export async function addChannel(channelId: string, appId: string, options: Opti
39
39
  p.log.error(`Cannot find default version for channel creation, please contact Capgo support ๐Ÿคจ`)
40
40
  program.error('')
41
41
  }
42
- await createChannel(supabase, {
42
+ const res = await createChannel(supabase, {
43
43
  name: channelId,
44
44
  app_id: appId,
45
45
  version: data.id,
46
46
  owner_org: orgId,
47
47
  })
48
+
49
+ if (res.error) {
50
+ p.log.error(`Cannot create Channel ๐Ÿ™€\n${formatError(res.error)}`)
51
+ program.error('')
52
+ }
53
+
48
54
  p.log.success(`Channel created โœ…`)
49
55
  await snag.track({
50
56
  channel: 'channel',
package/src/init.ts CHANGED
@@ -51,7 +51,7 @@ async function step2(organization: Organization, snag: LogSnag, appId: string, o
51
51
  s.stop(`App add Done โœ…`)
52
52
  }
53
53
  else {
54
- p.log.info(`Run yourself "${pm.runner} @capgo/cli@latest app add ${appId}"`)
54
+ p.log.info(`If you change your mind, run it for yourself with: "${pm.runner} @capgo/cli@latest app add ${appId}"`)
55
55
  }
56
56
  await markStep(organization.gid, snag, 2)
57
57
  }
@@ -74,7 +74,7 @@ async function step3(orgId: string, snag: LogSnag, apikey: string, appId: string
74
74
  s.stop(`Channel add Done โœ…`)
75
75
  }
76
76
  else {
77
- p.log.info(`Run yourself "${pm.runner} @capgo/cli@latest channel add ${defaultChannel} ${appId} --default"`)
77
+ p.log.info(`If you change your mind, run it for yourself with: "${pm.runner} @capgo/cli@latest channel add ${defaultChannel} ${appId} --default"`)
78
78
  }
79
79
  await markStep(orgId, snag, 3)
80
80
  }
@@ -126,7 +126,7 @@ async function step4(orgId: string, snag: LogSnag, apikey: string, appId: string
126
126
  }
127
127
  }
128
128
  else {
129
- p.log.info(`Run yourself "${pm.installCommand} @capgo/capacitor-updater@latest"`)
129
+ p.log.info(`If you change your mind, run it for yourself with: "${pm.installCommand} @capgo/capacitor-updater@latest"`)
130
130
  }
131
131
  await markStep(orgId, snag, 4)
132
132
  }
@@ -277,7 +277,7 @@ async function step9(orgId: string, snag: LogSnag) {
277
277
  s.stop(`Started Done โœ…`)
278
278
  }
279
279
  else {
280
- p.log.info(`Run yourself with command: ${pm.runner} cap run <ios|android>`)
280
+ p.log.info(`If you change your mind, run it for yourself with: ${pm.runner} cap run <ios|android>`)
281
281
  }
282
282
  await markStep(orgId, snag, 9)
283
283
  }
package/src/key.ts CHANGED
@@ -76,8 +76,8 @@ export async function createKey(options: Options, log = true) {
76
76
 
77
77
  // check if baseName already exist
78
78
  if (existsSync(baseKeyPub) && !options.force) {
79
+ p.log.error('Public Key already exists, use --force to overwrite')
79
80
  if (log) {
80
- p.log.error('Public Key already exists, use --force to overwrite')
81
81
  program.error('')
82
82
  }
83
83
  else {
@@ -86,8 +86,8 @@ export async function createKey(options: Options, log = true) {
86
86
  }
87
87
  writeFileSync(baseKeyPub, publicKey)
88
88
  if (existsSync(baseKey) && !options.force) {
89
+ p.log.error('Private Key already exists, use --force to overwrite')
89
90
  if (log) {
90
- p.log.error('Private Key already exists, use --force to overwrite')
91
91
  program.error('')
92
92
  }
93
93
  else {