@capgo/cli 4.5.0 → 4.6.1

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,21 @@
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.6.1](https://github.com/Cap-go/CLI/compare/v4.6.0...v4.6.1) (2024-05-08)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * force encryption when init and exist ([f6be928](https://github.com/Cap-go/CLI/commit/f6be9281dc8e978fc1a7e80174a884c50d46c495))
11
+
12
+ ## [4.6.0](https://github.com/Cap-go/CLI/compare/v4.5.0...v4.6.0) (2024-05-08)
13
+
14
+
15
+ ### Features
16
+
17
+ * allow set dev device and emulators ([bdb3517](https://github.com/Cap-go/CLI/commit/bdb3517586c34b6a980727f4037540c5d48bda1b))
18
+ * Show migration for v5 apps, but allow work ([df4de91](https://github.com/Cap-go/CLI/commit/df4de915b8805f560137364e5764325a8da5e7ef))
19
+
5
20
  ## [4.5.0](https://github.com/Cap-go/CLI/compare/v4.4.5...v4.5.0) (2024-05-02)
6
21
 
7
22
 
package/dist/index.js CHANGED
@@ -92373,7 +92373,7 @@ var {
92373
92373
  // package.json
92374
92374
  var package_default = {
92375
92375
  name: "@capgo/cli",
92376
- version: "4.5.0",
92376
+ version: "4.6.1",
92377
92377
  description: "A CLI to upload to capgo servers",
92378
92378
  author: "github.com/riderx",
92379
92379
  license: "Apache 2.0",
@@ -95406,6 +95406,7 @@ async function step3(userId, snag, apikey, appId) {
95406
95406
  }
95407
95407
  await markStep(userId, snag, 3);
95408
95408
  }
95409
+ var urlMigrateV6 = "https://capacitorjs.com/docs/updating/6-0";
95409
95410
  var urlMigrateV5 = "https://capacitorjs.com/docs/updating/5-0";
95410
95411
  async function step4(userId, snag, apikey, appId) {
95411
95412
  const doInstall = await se({ message: `Automatic Install "@capgo/capacitor-updater" dependency in ${appId}?` });
@@ -95413,6 +95414,7 @@ async function step4(userId, snag, apikey, appId) {
95413
95414
  if (doInstall) {
95414
95415
  const s = de();
95415
95416
  s.start(`Checking if @capgo/capacitor-updater is installed`);
95417
+ let versionToInstall = "latest";
95416
95418
  const pack = JSON.parse((0, import_node_fs11.readFileSync)("package.json").toString());
95417
95419
  let coreVersion = pack.dependencies["@capacitor/core"] || pack.devDependencies["@capacitor/core"];
95418
95420
  coreVersion = coreVersion?.replace("^", "").replace("~", "");
@@ -95422,6 +95424,9 @@ async function step4(userId, snag, apikey, appId) {
95422
95424
  } else if (import_semver.default.lt(coreVersion, "5.0.0")) {
95423
95425
  s.stop(`@capacitor/core version is ${coreVersion}, please update to Capacitor v5 first: ${urlMigrateV5}`);
95424
95426
  import_node_process16.default.exit();
95427
+ } else if (import_semver.default.lt(coreVersion, "6.0.0")) {
95428
+ s.stop(`@capacitor/core version is ${coreVersion}, please update to Capacitor v6: ${urlMigrateV6} to access the best features of Capgo`);
95429
+ versionToInstall = "^5.0.0";
95425
95430
  }
95426
95431
  const pm = findPackageManagerType();
95427
95432
  if (pm === "unknown") {
@@ -95432,7 +95437,7 @@ async function step4(userId, snag, apikey, appId) {
95432
95437
  if (pack.dependencies["@capgo/capacitor-updater"]) {
95433
95438
  s.stop(`Capgo already installed \u2705`);
95434
95439
  } else {
95435
- await (0, import_node_child_process6.execSync)(`${pm} ${installCmd} @capgo/capacitor-updater@latest`, execOption);
95440
+ await (0, import_node_child_process6.execSync)(`${pm} ${installCmd} @capgo/capacitor-updater@${versionToInstall}`, execOption);
95436
95441
  s.stop(`Install Done \u2705`);
95437
95442
  }
95438
95443
  } else {
@@ -95486,7 +95491,7 @@ async function step6(userId, snag, apikey, appId) {
95486
95491
  if (doEncrypt) {
95487
95492
  const s = de();
95488
95493
  s.start(`Running: npx @capgo/cli@latest key create`);
95489
- const keyRes = await createKey({}, false);
95494
+ const keyRes = await createKey({ force: true }, false);
95490
95495
  if (!keyRes) {
95491
95496
  s.stop(`Cannot create key \u274C`);
95492
95497
  import_node_process16.default.exit(1);
@@ -95934,7 +95939,7 @@ async function setChannel(channel2, appId, options) {
95934
95939
  const userId = await verifyUser(supabase, options.apikey, ["write", "all"]);
95935
95940
  await checkAppExistsAndHasPermissionOrgErr(supabase, options.apikey, appId, 4 /* admin */);
95936
95941
  const orgId = await getOrganizationId(supabase, appId);
95937
- const { bundle: bundle2, latest, downgrade, upgrade, ios, android, selfAssign, state, disableAutoUpdate } = options;
95942
+ const { bundle: bundle2, state, downgrade, latest, upgrade, ios, android, selfAssign, disableAutoUpdate, dev, emulator } = options;
95938
95943
  if (!channel2) {
95939
95944
  f2.error("Missing argument, you need to provide a channel");
95940
95945
  program.error("");
@@ -95943,7 +95948,7 @@ async function setChannel(channel2, appId, options) {
95943
95948
  f2.error("Cannot set latest and bundle at the same time");
95944
95949
  program.error("");
95945
95950
  }
95946
- if (bundle2 == null && state == null && latest == null && downgrade == null && upgrade == null && ios == null && android == null && selfAssign == null && disableAutoUpdate == null) {
95951
+ if (bundle2 == null && state == null && latest == null && downgrade == null && upgrade == null && ios == null && android == null && selfAssign == null && dev == null && emulator == null && disableAutoUpdate == null) {
95947
95952
  f2.error("Missing argument, you need to provide a option to set");
95948
95953
  program.error("");
95949
95954
  }
@@ -96483,7 +96488,7 @@ channel.command("add [channelId] [appId]").alias("a").description("Create channe
96483
96488
  channel.command("delete [channelId] [appId]").alias("d").description("Delete channel").action(deleteChannel).option("-a, --apikey <apikey>", "apikey to link to your account");
96484
96489
  channel.command("list [appId]").alias("l").description("List channel").action(listChannels).option("-a, --apikey <apikey>", "apikey to link to your account");
96485
96490
  channel.command("currentBundle [channel] [appId]").description("Get current bundle for specific channel in Capgo Cloud").action(currentBundle).option("-c, --channel <channel>", "channel to get the current bundle from").option("-a, --apikey <apikey>", "apikey to link to your account").option("--quiet", "only print the bundle version");
96486
- channel.command("set [channelId] [appId]").alias("s").description("Set channel").action(setChannel).option("-a, --apikey <apikey>", "apikey to link to your account").option("-b, --bundle <bundle>", "bundle version number of the file to set").option("-s, --state <state>", "set the state of the channel, default or normal").option("--latest", "get the latest version key in the package.json to set it to the channel").option("--downgrade", "Allow to downgrade to version under native one").option("--no-downgrade", "Disable downgrade to version under native one").option("--upgrade", "Allow to upgrade to version above native one").option("--no-upgrade", "Disable upgrade to version above native one").option("--ios", "Allow sending update to ios devices").option("--no-ios", "Disable sending update to ios devices").option("--android", "Allow sending update to android devices").option("--no-android", "Disable sending update to android devices").option("--self-assign", "Allow to device to self assign to this channel").option("--no-self-assign", "Disable devices to self assign to this channel").option("--disable-auto-update <disableAutoUpdate>", "Disable auto update strategy for this channel.The possible options are: major, minor, metadata, patch, none");
96491
+ channel.command("set [channelId] [appId]").alias("s").description("Set channel").action(setChannel).option("-a, --apikey <apikey>", "apikey to link to your account").option("-b, --bundle <bundle>", "bundle version number of the file to set").option("-s, --state <state>", "set the state of the channel, default or normal").option("--latest", "get the latest version key in the package.json to set it to the channel").option("--downgrade", "Allow to downgrade to version under native one").option("--no-downgrade", "Disable downgrade to version under native one").option("--upgrade", "Allow to upgrade to version above native one").option("--no-upgrade", "Disable upgrade to version above native one").option("--ios", "Allow sending update to ios devices").option("--no-ios", "Disable sending update to ios devices").option("--android", "Allow sending update to android devices").option("--no-android", "Disable sending update to android devices").option("--self-assign", "Allow to device to self assign to this channel").option("--no-self-assign", "Disable devices to self assign to this channel").option("--disable-auto-update <disableAutoUpdate>", "Disable auto update strategy for this channel.The possible options are: major, minor, metadata, patch, none").option("--dev", "Allow sending update to development devices").option("--no-dev", "Disable sending update to development devices").option("--emulator", "Allow sending update to emulator devices").option("--no-emulator", "Disable sending update to emulator devices");
96487
96492
  var key = program.command("key").description("Manage key");
96488
96493
  key.command("save").description("Save base64 signing key in capacitor config, usefull for CI").action(saveKeyCommand).option("-f, --force", "force generate a new one").option("--key", "key path to save in capacitor config").option("--key-data", "key data to save in capacitor config");
96489
96494
  key.command("create").description("Create a new signing key").action(createKeyCommand).option("-f, --force", "force generate a new one");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
- "version": "4.5.0",
3
+ "version": "4.6.1",
4
4
  "description": "A CLI to upload to capgo servers",
5
5
  "author": "github.com/riderx",
6
6
  "license": "Apache 2.0",
@@ -29,7 +29,8 @@ interface Options extends OptionsBase {
29
29
  android?: boolean
30
30
  selfAssign?: boolean
31
31
  disableAutoUpdate: string
32
- channel?: string
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, latest, downgrade, upgrade, ios, android, selfAssign, state, disableAutoUpdate } = options
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('')
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@latest`, execOption as ExecSyncOptions)
119
+ await execSync(`${pm} ${installCmd} @capgo/capacitor-updater@${versionToInstall}`, execOption as ExecSyncOptions)
114
120
  s.stop(`Install Done ✅`)
115
121
  }
116
122
  }
@@ -163,7 +169,7 @@ async function step6(userId: string, snag: LogSnag, apikey: string, appId: strin
163
169
  if (doEncrypt) {
164
170
  const s = p.spinner()
165
171
  s.start(`Running: npx @capgo/cli@latest key create`)
166
- const keyRes = await createKey({}, false)
172
+ const keyRes = await createKey({ force: true }, false)
167
173
  if (!keyRes) {
168
174
  s.stop(`Cannot create key ❌`)
169
175
  process.exit(1)