@capgo/cli 4.18.1 β†’ 4.20.2

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.
Files changed (3) hide show
  1. package/README.md +186 -37
  2. package/dist/index.js +302 -284
  3. package/package.json +3 -4
package/README.md CHANGED
@@ -13,9 +13,11 @@ Before use the CLI, you should register here : https://capgo.app/
13
13
 
14
14
  Then go to your account in `apikey` section and click in the `all` key to copy it.
15
15
 
16
+ Follow the documentation here : "https://capacitorjs.com/docs/getting-started/
17
+
16
18
  ### **Init**
17
19
 
18
- `npx @capgo/cli init [apikey]`
20
+ `npx @capgo/cli@latest init [apikey]`
19
21
 
20
22
  This method is here to onboard you step by step.
21
23
 
@@ -49,7 +51,7 @@ This command will also be useful for bug report.
49
51
 
50
52
  `npx @capgo/cli app add [appId]`
51
53
 
52
- `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init).
54
+ `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
53
55
 
54
56
  > πŸ’‘ All option will be guessed in your config if not provided.
55
57
 
@@ -58,6 +60,7 @@ Optionally, you can give:
58
60
  * `--icon [/path/to/my/icon]` to have a custom icon display in Capgo web app.
59
61
  * `--name [test]` to have a custom name in the list.
60
62
  * `--apikey [key]` API key to link to your account.
63
+ * `--retention [retention]` retention period of app bundle in days, 0 by default = infinite.
61
64
 
62
65
  Example of `capacitor.config.json` for appId and AppName, the icon is guess in the resources folder
63
66
 
@@ -73,7 +76,7 @@ Example of `capacitor.config.json` for appId and AppName, the icon is guess in t
73
76
 
74
77
  `npx @capgo/cli app set [appId]`
75
78
 
76
- `[appId]` is your app ID, the format is explained [here](https://capacitorjs.com/docs/cli/commands/init).
79
+ `[appId]` is your app ID, the format is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
77
80
 
78
81
  Optionally, you can give:
79
82
 
@@ -86,7 +89,7 @@ Optionally, you can give:
86
89
 
87
90
  `npx @capgo/cli app list [appId]`
88
91
 
89
- `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init).
92
+ `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
90
93
 
91
94
  Optionally, you can give:
92
95
 
@@ -96,7 +99,7 @@ Optionally, you can give:
96
99
 
97
100
  `npx @capgo/cli app delete [appId]`
98
101
 
99
- `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init).
102
+ `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
100
103
 
101
104
  Optionally, you can give:
102
105
 
@@ -107,38 +110,67 @@ Optionally, you can give:
107
110
 
108
111
  `npx @capgo/cli app debug [appId]`
109
112
 
110
- `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init).
113
+ `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
111
114
 
112
115
  Optionally, you can give:
113
116
 
114
117
  * `--apikey [key]` API key to link to your account.
115
118
  * `--device` with the specific device you want to debug
116
119
 
120
+ ### Setting
121
+
122
+ `npx @capgo/cli app setting [path]`
123
+
124
+ Edit the Capacitor config.
125
+
126
+ `[path]` - path of the setting that you would like to change. For example, to change the `appId`, provide `appId`.
127
+ If you wish to disable auto update in the `capacitor-updater` provide `plugins.CapacitorUpdater.autoUpdate`
128
+
129
+ You MUST provide either `--string` or `--bool`!
130
+
131
+ Options:
132
+ - `--string <string>` - sets the setting to a string
133
+ - `--bool <true | false>` - sets the setting to a boolean
134
+
117
135
  ## Bundle
118
136
 
119
137
  ### Upload
120
138
 
121
139
  `npx @capgo/cli bundle upload [appId]`
122
140
 
123
- `[appId]` is your app ID, the format is explained [here](https://capacitorjs.com/docs/cli/commands/init).
124
-
125
- Optionally, you can give:
126
-
127
- * `--apikey [key]` API key to link to your account.
128
- * `--path [/path/to/my/bundle]` to upload a specific folder.
129
- * `--channel [test]` to upload to a specific channel.
130
- * `--external="https://mydomain.com/myapp.zip"` to link to an external URL instead of upload to Capgo cloud, it should be a zip URL in HTTPS.
131
- * `--key [/path/to/my/private_key]` the path of your private key.
132
- * `--key-data [privateKey]` the private key data, if you want to use inline.
133
- * `--no-key` to ignore the signing key and send clear update.
134
- * `--bundle [1.0.0]` to set the bundle version number of the file to upload.
135
- * `--iv-session-key [key]` to send a custom session key to the cloud.
136
- * `--s3-apikey [key]` API key to upload to an AWS S3 account directly.
137
- * `--s3-apisecret [secretkey]` API secret necessary for uploading to S3.
138
- * `--s3-region [region]` to set the region of the AWS S3 account of the two previous API keys.
139
- * `--s3-bucket-name [bucketName]` to set the name of the AWS S3 bucket to which upload.
140
- * `--bundle-url` prints bundle url into stdout. Useful when [parsing bundle url from shell](https://github.com/Cap-go/CLI/pull/132).
141
- * `--no-code-check` to ignore the code check and send the bundle anyway.
141
+ `[appId]` is your app ID, the format is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
142
+
143
+ Options:
144
+
145
+ * `--apikey <apikey>` API key to link to your account.
146
+ * `--path <path>` Path of the folder to upload.
147
+ * `--channel <channel>` Channel to link to.
148
+ * `--external <url>` Link to external URL instead of uploading to Capgo Cloud.
149
+ * `--iv-session-key <key>` Set the IV and session key for bundle URL external.
150
+ * `--s3-region <region>` Region for your S3 bucket.
151
+ * `--s3-apikey <apikey>` API key for your S3 endpoint.
152
+ * `--s3-apisecret <apisecret>` API secret for your S3 endpoint.
153
+ * `--s3-endpoint <s3Endpoint>` URL of S3 endpoint.
154
+ * `--s3-bucket-name <bucketName>` Name for your AWS S3 bucket.
155
+ * `--s3-port <port>` Port for your S3 endpoint.
156
+ * `--no-s3-ssl` Disable SSL for S3 upload.
157
+ * `--key <key>` Custom path for public signing key.
158
+ * `--key-data <keyData>` Public signing key.
159
+ * `--key-v2 <key>` Custom path for private signing key.
160
+ * `--key-data-v2 <keyData>` Private signing key.
161
+ * `--bundle-url` Prints bundle URL into stdout.
162
+ * `--no-key` Ignore signing key and send clear update.
163
+ * `--no-code-check` Ignore checking if notifyAppReady() is called in source code and index present in root folder.
164
+ * `--display-iv-session` Show in the console the IV and session key used to encrypt the update.
165
+ * `--tus` Upload the bundle using TUS protocol.
166
+ * `--bundle <bundle>` Bundle version number of the bundle to upload.
167
+ * `--min-update-version <minUpdateVersion>` Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel.
168
+ * `--auto-min-update-version` Set the min update version based on native packages.
169
+ * `--ignore-metadata-check` Ignores the metadata (node_modules) check when uploading.
170
+ * `--ignore-checksum-check` Ignores the checksum check when uploading.
171
+ * `--timeout <timeout>` Timeout for the upload process in seconds.
172
+ * `--ignore-partial` Does not upload partial files to S3.
173
+ * `--encrypted-checksum <encryptedChecksum>` An encrypted checksum (signature). Used only when uploading an external bundle.
142
174
 
143
175
  > ⭐️ External option helps to unlock 2 cases: corporate with privacy concern, don't send the code to a third part and app bigger than 200 MB. With this setting, Capgo store only the link to the zip and sends the link to all apps.
144
176
 
@@ -156,13 +188,13 @@ Example of `package.json` for version
156
188
 
157
189
  > β›” Version should be greater than β€œ0.0.0”.
158
190
 
159
- > πŸ’‘ Don't forget to update the version number each time you send one, or the device will don't see the update.
191
+ > πŸ’‘ Don't forget to update the version number each time you send one, version number cannot be overrode, or reused after deletion for security reason.
160
192
 
161
193
  ### **List**
162
194
 
163
195
  `npx @capgo/cli bundle list [appId]`
164
196
 
165
- `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init).
197
+ `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
166
198
 
167
199
  Optionally, you can give:
168
200
 
@@ -172,7 +204,7 @@ Optionally, you can give:
172
204
 
173
205
  `npx @capgo/cli bundle delete [appId]`
174
206
 
175
- `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init).
207
+ `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
176
208
 
177
209
  Optionally, you can give:
178
210
 
@@ -185,7 +217,7 @@ in a SemVer range for a major version to Cloud
185
217
 
186
218
  `npx @capgo/cli bundle cleanup [appId] --bundle=[majorVersion] --keep=[numberToKeep]`
187
219
 
188
- `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init).
220
+ `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
189
221
 
190
222
  Optionally, you can give:
191
223
 
@@ -205,14 +237,31 @@ This command will ignore bundles which are currently in use in any channel.
205
237
 
206
238
  ### **Encrypt**
207
239
 
240
+ > **Warning**: This command is deprecated and will be removed in the next major release. Please use the new encryption system.
208
241
  `npx @capgo/cli bundle encrypt [path/to/zip]`
209
242
 
210
- This command is used when you use external source to store your code or for test purpose.
243
+ This command is used when you use external source to store your code or for test purpose.
211
244
 
212
245
  Optionally, you can give:
213
246
 
214
247
  `--key [/path/to/my/private_key]` the path of your private key.
215
- `--key-data [privateKey]` the private key data, if you want to use inline.
248
+ `--key-data [privateKey]` the private key data, if you want to use inline.
249
+ The command will print your `ivSessionKey`y and generate an encrypted zip, to use it with the upload command or decryt command.
250
+
251
+ ### **Encrypt V2**
252
+
253
+ `npx @capgo/cli bundle encryptV2 [path/to/zip] [checksum]`
254
+
255
+ This command is used when you use external source to store your code or for test purpose.
256
+ The checksum is the sha256 of the bundle (generated by --key-v2), it is used to verify the integrity of the file after decryption.
257
+ It will be enncrypted with the private key and sent along with the bundle.
258
+ In encryption v2 the checksum is upgraded to become a "signature" of the bundle.
259
+
260
+ Optionally, you can give:
261
+
262
+ `--key [/path/to/my/private_key]` the path of your private key.
263
+ `--key-data [privateKey]` the private key data, if you want to use inline.
264
+ `--json` to output info as json.
216
265
  The command will print your `ivSessionKey`y and generate an encrypted zip, to use it with the upload command or decryt command.
217
266
 
218
267
  ### **Decrypt**
@@ -225,17 +274,42 @@ Optionally, you can give:
225
274
 
226
275
  `--key-data [privateKey]` the private key data, if you want to use inline. This command is mainly used for test purpose, it will decrypt the zip and print the base64 decrypted session key in the console.
227
276
 
277
+ ### **Decrypt V2**
278
+
279
+ `npx @capgo/cli bundle decryptV2 [path/to/zip] [ivSessionKey]`
280
+
281
+ Optionally, you can give:
282
+
283
+ `--key [/path/to/my/private_key]` the path of your private key.
284
+ `--key-data [privateKey]` the private key data, if you want to use inline. This command is mainly used for test purpose, it will decrypt the zip and print the base64 decrypted session key in the console.
285
+ `--checksum [checksum]` the checksum of the file, it will verify the checksum after decryption.
286
+
228
287
  ### **Zip**
229
288
 
230
289
  `npx @capgo/cli bundle zip [appId]`
231
290
 
232
- `[appId]` is your app ID, the format is explained [here](https://capacitorjs.com/docs/cli/commands/init).
291
+ `[appId]` is your app ID, the format is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
233
292
 
234
293
  Optionally, you can give:
235
294
 
236
295
  * `--path [/path/to/my/bundle]` to upload a specific folder.
237
296
  * `--bundle [1.0.0]` to set the bundle version number of the filename.
238
297
  * `--name [myapp]` to override the filename.
298
+ * `--json` to output info as json.
299
+ * `--no-code-check` to ignore the code check and send the bundle anyway.
300
+ * `--key-v2` to use the new encryption system. This is required as new encryption system use better checksums to verify the integrity of the file.
301
+
302
+ ### **Compatibility**
303
+
304
+ `npx @capgo/cli bundle compatibility [appId] -c [channelId]`
305
+
306
+ `[appId]` is your app ID, the format is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
307
+ `[channelId]` the name of your new channel.
308
+
309
+ Optionally, you can give:
310
+
311
+ * `--apikey [key]` API key to link to your account.
312
+ * `--text` use text instead of emojis in the table
239
313
 
240
314
  ## Channel
241
315
 
@@ -243,19 +317,19 @@ Optionally, you can give:
243
317
 
244
318
  `npx @capgo/cli channel add [channelId] [appId]`
245
319
 
246
- `[channelId]` the name of your new channel. `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init).
320
+ `[channelId]` the name of your new channel. `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
247
321
 
248
322
  ### **Delete**
249
323
 
250
324
  `npx @capgo/cli channel delete [channelId] [appId]`
251
325
 
252
- `[channelId]` the name of your channel you want to delete. `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init).
326
+ `[channelId]` the name of your channel you want to delete. `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
253
327
 
254
328
  ### **List**
255
329
 
256
330
  `npx @capgo/cli channel list [appId]`
257
331
 
258
- `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init).
332
+ `[appId]` your app ID the format `com.test.app` is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
259
333
 
260
334
  Optionally, you can give:
261
335
 
@@ -265,7 +339,7 @@ Optionally, you can give:
265
339
 
266
340
  `npx @capgo/cli channel set [channelId] [appId]`
267
341
 
268
- `[appId]` is your app ID, the format is explained [here](https://capacitorjs.com/docs/cli/commands/init).
342
+ `[appId]` is your app ID, the format is explained [here](https://capacitorjs.com/docs/cli/commands/init/).
269
343
 
270
344
  Optionally, you can give:
271
345
 
@@ -282,8 +356,68 @@ Optionally, you can give:
282
356
  * `--no-android` disallows the channel to send version to android devices.
283
357
  * `--self-assign` allows devices to self assign to this channel.
284
358
  * `--no-self-assign` disallows devices to self assign to this channel.
359
+ * `--disable-auto-update STRATEGY` Disable auto update strategy for this channel. The possible options are: major, minor, metadata, none.
285
360
  * `--apikey [key]` API key to link to your account.
286
361
 
362
+ ## Disable updates strategy
363
+
364
+ There are a few ways to handle disabling updates for too old versions.\
365
+ Capgo cannot update native code thus an update from a version with the old native code to a version with the updated native code should not be possible.
366
+ There are a couple of ways to achieve that.
367
+
368
+ First, the `major` strategy. It prevents an update from `0.0.0` -> `1.0.0`. The major is the highlighted number (**1**.0.0 and **0**.0.0).\
369
+ Second is the `minor` strategy. It prevents an update from `0.0.0` -> `1.1.0` or an update from `1.1.0` to `1.2.0`.
370
+ **BE AWARE** this strategy does not prevent an update from `0.1.0` -> `1.1.0`
371
+
372
+ Third, the `patch` strategy. It was added into capgo as a very strict mode. It's not recomended to be used unless you fully understand how it works.
373
+ In order for it to accept a update the following conditions must be meet:
374
+ - The major is the same between the new and the old version
375
+ - The minor is the same between the new and the old version
376
+ - The patch of the new version if greater then the patch of the old version
377
+
378
+ Here is an example of which scenarios the update is allowed or denied
379
+
380
+ - 0.0.311 -> 0.0.314 βœ…
381
+ - 0.0.0 -> 0.0.314 βœ…
382
+ - 0.0.316 -> 0.0.314 ❌
383
+ - 0.1.312 -> 0.0.314 ❌
384
+ - 1.0.312 -> 0.0.314 ❌
385
+
386
+ Lastly the most complicated strategy. The `metadata` strategy.\
387
+ First you need to know that initially after you enable it the updates **WILL** fail as the channel is lacking the required metadata.\
388
+ If the channel is lacking metadata you will see a message like this:
389
+ <img src="/fail-metadata.webp" alt="Cannot find metadata"/>
390
+
391
+ If you see something like this you know that you have to go to the current bundle for the failing channel and set the metadata.\
392
+ First, figure out what channel is failing. You can do that by looking at the `misconfigured` column
393
+ <img src="/misconfigured-table.webp" alt="Misconfigured table"/>
394
+
395
+ Then go to the failing channel and click on `Bundle number`. This should take you to the bundle page.
396
+ <img src="/fail-channel-show.webp" alt="Locate failing channel"/>
397
+
398
+ Once there fill the `Minimal update version` field. This should be a [semver](https://devhints.io/semver/).\
399
+ If the value you pass is not a semver you will get an error, but if everything goes correctly you should see something like this:
400
+ <img src="/set-min-update-version.webp" alt="Set min version"/>
401
+
402
+ Now, you likely do not want to set this data manually every time you update. Fortunately, the CLI will prevent you from sending an update without this metadata
403
+ <img src="/cli-fail-no-metadata.webp" alt="CLI fail no metadata"/>
404
+
405
+ To properly upload a bundle when using the `metadata` option you need to pass the `--min-update-version` with the valid semver. Something like this:
406
+ <img src="/cli-upload-with-metadata.webp" alt="CLI upload with metadata"/>
407
+
408
+ The `--min-update-version` is not the ONLY way to do compatibility.
409
+ There also exists the `--auto-min-update-version`. Here is how it works.
410
+
411
+ First, it takes a look at the version curently uploaded to the channel. It checks compatibility same as `bundle compatibility` command would.
412
+ Second, if the new version is 100% compatible it reuses the `min_update_version` from the latest version in the channel.
413
+ If not, then it sets the `min_update_version` to the bundle number of the newly uploaded version.
414
+
415
+ You will always get an information what is the `min_update_version` when using this option. It will look something like this:
416
+ <img src="/min_update_version_info.webp" alt="Min update version"/>
417
+
418
+ If the new version is not compatible it should look something like this
419
+ <img src="/min_update_version_not_compatible.webp" alt="Min update version not compatible"/>
420
+
287
421
  ## End-to-End encryption (Trustless)
288
422
 
289
423
  Capgo supports end-to-end encryption, this means that your bundle(code) is encrypted before sent to the cloud and decrypted on the device. For that, you need to generate an RSA key pair, you can use the following command to generate it.
@@ -294,11 +428,13 @@ See below for more information about the encryption system.
294
428
 
295
429
  <figure><img src="/crypto_explained.png" alt=""><figcaption><p>Ecryption schema</p></figcaption></figure>
296
430
 
431
+ Ecryption schema
432
+
297
433
  ### Create key for your app
298
434
 
299
435
  `npx @capgo/cli key create`
300
436
 
301
- Optionally, you can give: `--force` to overwrite the existing key. This command will create for you a key pair in your app, and will ask you to save the private key in a safe place. It's recommended to not git commit the private and public key, and to not share it with anyone.
437
+ Optionally, you can give: `--force` to overwrite the existing key. This command will create for you a key pair in your app, and will ask you to save the private key in a safe place. It's recommended to not git commit the private key, and to not share it with anyone.
302
438
 
303
439
  > After your local test, remove the key from the config file and add it on the CI step with `key save`
304
440
 
@@ -311,6 +447,19 @@ Optionally, you can give:
311
447
  `--key [/path/to/my/private_key]` the path of your private key.
312
448
 
313
449
  `--key-data [privateKey]` the private key data, if you want to use inline. This command is useful if you followed the recommendation and didn't commit the key in your app, and in the config.
450
+
451
+ ## Ci integration
452
+
453
+ To automate your work, I recommend you make GitHub action do the job of pushing to our server
454
+
455
+ [GitHub action tutorial](https://capgo.app/blog/automatic-build-and-release-with-github-actions/)
456
+
457
+ ## Our demo app
458
+
459
+ [GitHub - Cap-go/demo-app](https://github.com/Cap-go/demo-app/)
460
+
461
+ Don’t forget to configure CI env variable with your API key
462
+
314
463
  ## Dev contribution
315
464
 
316
465
  1. Install development dependencies