@capgo/cli 4.12.9 → 4.12.10
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 +7 -0
- package/dist/index.js +91 -69
- package/package.json +1 -1
- package/src/app/debug.ts +110 -87
- package/src/init.ts +2 -2
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.12.10](https://github.com/Cap-go/CLI/compare/v4.12.9...v4.12.10) (2024-07-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* better debug command ([7000651](https://github.com/Cap-go/CLI/commit/700065146e13edd5ff813d025131db91da07dc99))
|
|
11
|
+
|
|
5
12
|
### [4.12.9](https://github.com/Cap-go/CLI/compare/v4.12.8...v4.12.9) (2024-07-12)
|
|
6
13
|
|
|
7
14
|
### [4.12.8](https://github.com/Cap-go/CLI/compare/v4.12.7...v4.12.8) (2024-07-12)
|
package/dist/index.js
CHANGED
|
@@ -86219,7 +86219,7 @@ var {
|
|
|
86219
86219
|
// package.json
|
|
86220
86220
|
var package_default = {
|
|
86221
86221
|
name: "@capgo/cli",
|
|
86222
|
-
version: "4.12.
|
|
86222
|
+
version: "4.12.10",
|
|
86223
86223
|
description: "A CLI to upload to capgo servers",
|
|
86224
86224
|
author: "github.com/riderx",
|
|
86225
86225
|
license: "Apache 2.0",
|
|
@@ -88411,11 +88411,86 @@ async function getStats(apikey, query, after) {
|
|
|
88411
88411
|
return [];
|
|
88412
88412
|
});
|
|
88413
88413
|
if (dataD?.length > 0 && (after === null || after !== dataD[0].created_at))
|
|
88414
|
-
return dataD
|
|
88414
|
+
return dataD;
|
|
88415
88415
|
} catch (error) {
|
|
88416
88416
|
f2.error(`Cannot get stats ${formatError(error)}`);
|
|
88417
88417
|
}
|
|
88418
|
-
return
|
|
88418
|
+
return [];
|
|
88419
|
+
}
|
|
88420
|
+
async function displayError(data, channel2, orgId, snag, baseUrl) {
|
|
88421
|
+
f2.info(`Log from Device: ${data.device_id}`);
|
|
88422
|
+
if (data.action === "get") {
|
|
88423
|
+
f2.info("Update Sent your your device, wait until event download complete");
|
|
88424
|
+
await markSnag(channel2, orgId, snag, "done");
|
|
88425
|
+
} else if (data.action.startsWith("download_")) {
|
|
88426
|
+
const action = data.action.split("_")[1];
|
|
88427
|
+
if (action === "complete") {
|
|
88428
|
+
f2.info("Your bundle has been downloaded on your device, background the app now and open it again to see the update");
|
|
88429
|
+
await markSnag(channel2, orgId, snag, "downloaded");
|
|
88430
|
+
} else if (action === "fail") {
|
|
88431
|
+
f2.error("Your bundle has failed to download on your device.");
|
|
88432
|
+
f2.error("Please check if you have network connection and try again");
|
|
88433
|
+
} else {
|
|
88434
|
+
f2.info(`Your bundle is downloading ${action}% ...`);
|
|
88435
|
+
}
|
|
88436
|
+
} else if (data.action === "set") {
|
|
88437
|
+
f2.info("Your bundle has been set on your device \u2764\uFE0F");
|
|
88438
|
+
await markSnag(channel2, orgId, snag, "set");
|
|
88439
|
+
return false;
|
|
88440
|
+
} else if (data.action === "NoChannelOrOverride") {
|
|
88441
|
+
f2.error(`No default channel or override (channel/device) found, please create it here ${baseUrl}`);
|
|
88442
|
+
} else if (data.action === "needPlanUpgrade") {
|
|
88443
|
+
f2.error("Your are out of quota, please upgrade your plan here https://web.capgo.app/dashboard/settings/plans");
|
|
88444
|
+
} else if (data.action === "missingBundle") {
|
|
88445
|
+
f2.error("Your bundle is missing, please check how you build your app");
|
|
88446
|
+
} else if (data.action === "noNew") {
|
|
88447
|
+
f2.error(`The version number you uploaded to your default channel in Capgo, is the same as the present in the device ${data.device_id}.`);
|
|
88448
|
+
f2.error(`To fix it, ensure the variable:
|
|
88449
|
+
- iOS: keyCFBundleShortVersionString or MARKETING_VERSION
|
|
88450
|
+
- Android: versionName
|
|
88451
|
+
Are lower than the version number you uploaded to Capgo.`);
|
|
88452
|
+
f2.error("More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system");
|
|
88453
|
+
} else if (data.action === "disablePlatformIos") {
|
|
88454
|
+
f2.error(`iOS is disabled in the default channel and your device ${data.device_id} is an iOS device ${baseUrl}`);
|
|
88455
|
+
} else if (data.action === "disablePlatformAndroid") {
|
|
88456
|
+
f2.error(`Android is disabled in the default channel and your device ${data.device_id} is an Android device ${baseUrl}`);
|
|
88457
|
+
} else if (data.action === "disableAutoUpdateToMajor") {
|
|
88458
|
+
f2.error(`The version number you uploaded to your default channel in Capgo, is a major version higher (ex: 1.0.0 in device to 2.0.0 in Capgo) than the present in the device ${data.device_id}.`);
|
|
88459
|
+
f2.error("Capgo is set by default to protect you from this, and avoid sending breaking changes incompatible with the native code present in the device.");
|
|
88460
|
+
f2.error(`To fix it, ensure the variable:
|
|
88461
|
+
- iOS: keyCFBundleShortVersionString or MARKETING_VERSION
|
|
88462
|
+
- Android: versionName
|
|
88463
|
+
Are lower than the version number you uploaded to Capgo.`);
|
|
88464
|
+
f2.error("More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system");
|
|
88465
|
+
} else if (data.action === "disableAutoUpdateUnderNative") {
|
|
88466
|
+
f2.error(`The version number you uploaded to your default channel in Capgo, is lower than the present in the device ${data.device_id}.`);
|
|
88467
|
+
f2.error(`To fix it, ensure the variable:
|
|
88468
|
+
- iOS: keyCFBundleShortVersionString or MARKETING_VERSION
|
|
88469
|
+
- Android: versionName
|
|
88470
|
+
Are lower than the version number you uploaded to Capgo.`);
|
|
88471
|
+
f2.error("More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system");
|
|
88472
|
+
} else if (data.action === "disableDevBuild") {
|
|
88473
|
+
f2.error(`Dev build is disabled in the default channel. ${baseUrl}`);
|
|
88474
|
+
f2.error("Set your channel to allow it if you wanna test your app");
|
|
88475
|
+
} else if (data.action === "disableEmulator") {
|
|
88476
|
+
f2.error(`Emulator is disabled in the default channel. ${baseUrl}`);
|
|
88477
|
+
f2.error("Set your channel to allow it if you wanna test your app");
|
|
88478
|
+
} else if (data.action === "cannotGetBundle") {
|
|
88479
|
+
f2.error(`We cannot get your bundle from the default channel. ${baseUrl}`);
|
|
88480
|
+
f2.error("Are you sure your default channel has a bundle set?");
|
|
88481
|
+
} else if (data.action === "set_fail") {
|
|
88482
|
+
f2.error(`Your bundle seems to be corrupted, try to download from ${baseUrl} to identify the issue`);
|
|
88483
|
+
} else if (data.action === "reset") {
|
|
88484
|
+
f2.error("Your device has been reset to the builtin bundle, did notifyAppReady() is present in the code builded and uploaded to Capgo ?");
|
|
88485
|
+
} else if (data.action === "update_fail") {
|
|
88486
|
+
f2.error("Your bundle has been installed but failed to call notifyAppReady()");
|
|
88487
|
+
f2.error("Please check if you have network connection and try again");
|
|
88488
|
+
} else if (data.action === "checksum_fail") {
|
|
88489
|
+
f2.error("Your bundle has failed to validate checksum, please check your code and send it again to Capgo");
|
|
88490
|
+
} else {
|
|
88491
|
+
f2.error(`Log from Capgo ${data.action}`);
|
|
88492
|
+
}
|
|
88493
|
+
return true;
|
|
88419
88494
|
}
|
|
88420
88495
|
async function waitLog(channel2, apikey, appId, snag, orgId, deviceId) {
|
|
88421
88496
|
let loop = true;
|
|
@@ -88430,76 +88505,24 @@ async function waitLog(channel2, apikey, appId, snag, orgId, deviceId) {
|
|
|
88430
88505
|
key: "created_at",
|
|
88431
88506
|
sortable: "desc"
|
|
88432
88507
|
}],
|
|
88433
|
-
limit: 1,
|
|
88434
88508
|
rangeStart: (/* @__PURE__ */ new Date()).toISOString()
|
|
88435
88509
|
};
|
|
88436
88510
|
let after = null;
|
|
88511
|
+
const s = de();
|
|
88512
|
+
s.start(`Waiting for logs (Expect delay of 30 sec)`);
|
|
88437
88513
|
while (loop) {
|
|
88514
|
+
await wait2(5e3);
|
|
88438
88515
|
const data = await getStats(apikey, query, after);
|
|
88439
|
-
if (data) {
|
|
88440
|
-
after = data.created_at;
|
|
88441
|
-
|
|
88442
|
-
|
|
88443
|
-
|
|
88444
|
-
|
|
88445
|
-
} else if (data.action.startsWith("download_")) {
|
|
88446
|
-
const action = data.action.split("_")[1];
|
|
88447
|
-
if (action === "complete") {
|
|
88448
|
-
f2.info("Your bundle has been downloaded on your device, background the app now and open it again to see the update");
|
|
88449
|
-
await markSnag(channel2, orgId, snag, "downloaded");
|
|
88450
|
-
} else if (action === "fail") {
|
|
88451
|
-
f2.error("Your bundle has failed to download on your device.");
|
|
88452
|
-
f2.error("Please check if you have network connection and try again");
|
|
88453
|
-
} else {
|
|
88454
|
-
f2.info(`Your bundle is downloading ${action}% ...`);
|
|
88455
|
-
}
|
|
88456
|
-
} else if (data.action === "set") {
|
|
88457
|
-
f2.info("Your bundle has been set on your device \u2764\uFE0F");
|
|
88458
|
-
loop = false;
|
|
88459
|
-
await markSnag(channel2, orgId, snag, "set");
|
|
88460
|
-
return Promise.resolve(data);
|
|
88461
|
-
} else if (data.action === "NoChannelOrOverride") {
|
|
88462
|
-
f2.error(`No default channel or override (channel/device) found, please create it here ${baseUrl}`);
|
|
88463
|
-
} else if (data.action === "needPlanUpgrade") {
|
|
88464
|
-
f2.error("Your are out of quota, please upgrade your plan here https://web.capgo.app/dashboard/settings/plans");
|
|
88465
|
-
} else if (data.action === "missingBundle") {
|
|
88466
|
-
f2.error("Your bundle is missing, please check how you build your app ");
|
|
88467
|
-
} else if (data.action === "noNew") {
|
|
88468
|
-
f2.error(`Your version in ${data.device_id} is the same as your version uploaded, change it to see the update`);
|
|
88469
|
-
} else if (data.action === "disablePlatformIos") {
|
|
88470
|
-
f2.error(`iOS is disabled in the default channel and your device is an iOS device ${baseUrl}`);
|
|
88471
|
-
} else if (data.action === "disablePlatformAndroid") {
|
|
88472
|
-
f2.error(`Android is disabled in the default channel and your device is an Android device ${baseUrl}`);
|
|
88473
|
-
} else if (data.action === "disableAutoUpdateToMajor") {
|
|
88474
|
-
f2.error("Auto update to major version is disabled in the default channel.");
|
|
88475
|
-
f2.error("Set your app to the same major version as the default channel");
|
|
88476
|
-
} else if (data.action === "disableAutoUpdateUnderNative") {
|
|
88477
|
-
f2.error("Auto update under native version is disabled in the default channel.");
|
|
88478
|
-
f2.error("Set your app to the same native version as the default channel.");
|
|
88479
|
-
} else if (data.action === "disableDevBuild") {
|
|
88480
|
-
f2.error(`Dev build is disabled in the default channel. ${baseUrl}`);
|
|
88481
|
-
f2.error("Set your channel to allow it if you wanna test your app");
|
|
88482
|
-
} else if (data.action === "disableEmulator") {
|
|
88483
|
-
f2.error(`Emulator is disabled in the default channel. ${baseUrl}`);
|
|
88484
|
-
f2.error("Set your channel to allow it if you wanna test your app");
|
|
88485
|
-
} else if (data.action === "cannotGetBundle") {
|
|
88486
|
-
f2.error(`We cannot get your bundle from the default channel. ${baseUrl}`);
|
|
88487
|
-
f2.error("Are you sure your default channel has a bundle set?");
|
|
88488
|
-
} else if (data.action === "set_fail") {
|
|
88489
|
-
f2.error(`Your bundle seems to be corrupted, try to download from ${baseUrl} to identify the issue`);
|
|
88490
|
-
} else if (data.action === "reset") {
|
|
88491
|
-
f2.error("Your device has been reset to the builtin bundle, did you added notifyAppReady in your code?");
|
|
88492
|
-
} else if (data.action === "update_fail") {
|
|
88493
|
-
f2.error("Your bundle has been installed but failed to call notifyAppReady");
|
|
88494
|
-
f2.error("Please check if you have network connection and try again");
|
|
88495
|
-
} else if (data.action === "checksum_fail") {
|
|
88496
|
-
f2.error("Your bundle has failed to validate checksum, please check your code and send it again to Capgo");
|
|
88497
|
-
} else {
|
|
88498
|
-
f2.error(`Log from Capgo ${data.action}`);
|
|
88516
|
+
if (data.length > 0) {
|
|
88517
|
+
after = data[0].created_at;
|
|
88518
|
+
for (const d3 of data) {
|
|
88519
|
+
loop = await displayError(d3, channel2, orgId, snag, baseUrl);
|
|
88520
|
+
if (!loop)
|
|
88521
|
+
break;
|
|
88499
88522
|
}
|
|
88500
88523
|
}
|
|
88501
|
-
await wait2(5e3);
|
|
88502
88524
|
}
|
|
88525
|
+
s.stop(`Stop watching logs`);
|
|
88503
88526
|
return Promise.resolve();
|
|
88504
88527
|
}
|
|
88505
88528
|
async function debugApp(appId, options) {
|
|
@@ -88526,8 +88549,7 @@ async function debugApp(appId, options) {
|
|
|
88526
88549
|
const doRun = await se({ message: `Automatic check if update working in device ?` });
|
|
88527
88550
|
await cancelCommand("debug", doRun, userId, snag);
|
|
88528
88551
|
if (doRun) {
|
|
88529
|
-
f2.info(`Wait logs sent to Capgo from ${appId} device,
|
|
88530
|
-
f2.info("Waiting... (there is a usual delay of 15 seconds until the backend process the logs)");
|
|
88552
|
+
f2.info(`Wait logs sent to Capgo from ${appId} device, Please open your app \u{1F4AA}`);
|
|
88531
88553
|
await waitLog("debug", options.apikey, appId, snag, orgId, deviceId);
|
|
88532
88554
|
$e(`Done \u2705`);
|
|
88533
88555
|
} else {
|
|
@@ -89852,8 +89874,7 @@ async function step10(orgId, snag, apikey, appId) {
|
|
|
89852
89874
|
const doRun = await se({ message: `Automatic check if update working in device ?` });
|
|
89853
89875
|
await cancelCommand2(doRun, orgId, snag);
|
|
89854
89876
|
if (doRun) {
|
|
89855
|
-
f2.info(`Wait logs sent to Capgo from ${appId} device,
|
|
89856
|
-
f2.info("Waiting... (there is a usual delay of 15 seconds until the backend process the logs)");
|
|
89877
|
+
f2.info(`Wait logs sent to Capgo from ${appId} device, Please open your app \u{1F4AA}`);
|
|
89857
89878
|
await waitLog("onboarding-v2", apikey, appId, snag, orgId);
|
|
89858
89879
|
} else {
|
|
89859
89880
|
const appIdUrl = convertAppName(appId);
|
|
@@ -89926,6 +89947,7 @@ async function initApp(apikeyCommand, appId, options) {
|
|
|
89926
89947
|
f2.info(`Welcome onboard \u2708\uFE0F!`);
|
|
89927
89948
|
f2.info(`Your Capgo update system is setup`);
|
|
89928
89949
|
f2.info(`Next time use \`${pm2.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`);
|
|
89950
|
+
f2.info(`If you have any issue try to use the debug command \`${pm2.runner} @capgo/cli@latest app debug\``);
|
|
89929
89951
|
$e(`Bye \u{1F44B}`);
|
|
89930
89952
|
import_node_process16.default.exit();
|
|
89931
89953
|
}
|
package/package.json
CHANGED
package/src/app/debug.ts
CHANGED
|
@@ -58,7 +58,7 @@ interface LogData {
|
|
|
58
58
|
version?: number
|
|
59
59
|
created_at: string
|
|
60
60
|
}
|
|
61
|
-
export async function getStats(apikey: string, query: QueryStats, after: string | null): Promise<LogData
|
|
61
|
+
export async function getStats(apikey: string, query: QueryStats, after: string | null): Promise<LogData[]> {
|
|
62
62
|
try {
|
|
63
63
|
const dataD = await ky
|
|
64
64
|
.post(`${defaultApiHost}/private/stats`, {
|
|
@@ -74,12 +74,108 @@ export async function getStats(apikey: string, query: QueryStats, after: string
|
|
|
74
74
|
return [] as LogData[]
|
|
75
75
|
})
|
|
76
76
|
if (dataD?.length > 0 && (after === null || after !== dataD[0].created_at))
|
|
77
|
-
return dataD
|
|
77
|
+
return dataD
|
|
78
78
|
}
|
|
79
79
|
catch (error) {
|
|
80
80
|
p.log.error(`Cannot get stats ${formatError(error)}`)
|
|
81
81
|
}
|
|
82
|
-
return
|
|
82
|
+
return []
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function displayError(data: LogData, channel: string, orgId: string, snag: LogSnag, baseUrl: string) {
|
|
86
|
+
p.log.info(`Log from Device: ${data.device_id}`)
|
|
87
|
+
if (data.action === 'get') {
|
|
88
|
+
p.log.info('Update Sent your your device, wait until event download complete')
|
|
89
|
+
await markSnag(channel, orgId, snag, 'done')
|
|
90
|
+
}
|
|
91
|
+
else if (data.action.startsWith('download_')) {
|
|
92
|
+
const action = data.action.split('_')[1]
|
|
93
|
+
if (action === 'complete') {
|
|
94
|
+
p.log.info('Your bundle has been downloaded on your device, background the app now and open it again to see the update')
|
|
95
|
+
await markSnag(channel, orgId, snag, 'downloaded')
|
|
96
|
+
}
|
|
97
|
+
else if (action === 'fail') {
|
|
98
|
+
p.log.error('Your bundle has failed to download on your device.')
|
|
99
|
+
p.log.error('Please check if you have network connection and try again')
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
p.log.info(`Your bundle is downloading ${action}% ...`)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else if (data.action === 'set') {
|
|
106
|
+
p.log.info('Your bundle has been set on your device ❤️')
|
|
107
|
+
await markSnag(channel, orgId, snag, 'set')
|
|
108
|
+
return false
|
|
109
|
+
}
|
|
110
|
+
else if (data.action === 'NoChannelOrOverride') {
|
|
111
|
+
p.log.error(`No default channel or override (channel/device) found, please create it here ${baseUrl}`)
|
|
112
|
+
}
|
|
113
|
+
else if (data.action === 'needPlanUpgrade') {
|
|
114
|
+
p.log.error('Your are out of quota, please upgrade your plan here https://web.capgo.app/dashboard/settings/plans')
|
|
115
|
+
}
|
|
116
|
+
else if (data.action === 'missingBundle') {
|
|
117
|
+
p.log.error('Your bundle is missing, please check how you build your app')
|
|
118
|
+
}
|
|
119
|
+
else if (data.action === 'noNew') {
|
|
120
|
+
p.log.error(`The version number you uploaded to your default channel in Capgo, is the same as the present in the device ${data.device_id}.`)
|
|
121
|
+
p.log.error(`To fix it, ensure the variable:
|
|
122
|
+
- iOS: keyCFBundleShortVersionString or MARKETING_VERSION
|
|
123
|
+
- Android: versionName
|
|
124
|
+
Are lower than the version number you uploaded to Capgo.`)
|
|
125
|
+
p.log.error('More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system')
|
|
126
|
+
}
|
|
127
|
+
else if (data.action === 'disablePlatformIos') {
|
|
128
|
+
p.log.error(`iOS is disabled in the default channel and your device ${data.device_id} is an iOS device ${baseUrl}`)
|
|
129
|
+
}
|
|
130
|
+
else if (data.action === 'disablePlatformAndroid') {
|
|
131
|
+
p.log.error(`Android is disabled in the default channel and your device ${data.device_id} is an Android device ${baseUrl}`)
|
|
132
|
+
}
|
|
133
|
+
else if (data.action === 'disableAutoUpdateToMajor') {
|
|
134
|
+
p.log.error(`The version number you uploaded to your default channel in Capgo, is a major version higher (ex: 1.0.0 in device to 2.0.0 in Capgo) than the present in the device ${data.device_id}.`)
|
|
135
|
+
p.log.error('Capgo is set by default to protect you from this, and avoid sending breaking changes incompatible with the native code present in the device.')
|
|
136
|
+
p.log.error(`To fix it, ensure the variable:
|
|
137
|
+
- iOS: keyCFBundleShortVersionString or MARKETING_VERSION
|
|
138
|
+
- Android: versionName
|
|
139
|
+
Are lower than the version number you uploaded to Capgo.`)
|
|
140
|
+
p.log.error('More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system')
|
|
141
|
+
}
|
|
142
|
+
else if (data.action === 'disableAutoUpdateUnderNative') {
|
|
143
|
+
p.log.error(`The version number you uploaded to your default channel in Capgo, is lower than the present in the device ${data.device_id}.`)
|
|
144
|
+
p.log.error(`To fix it, ensure the variable:
|
|
145
|
+
- iOS: keyCFBundleShortVersionString or MARKETING_VERSION
|
|
146
|
+
- Android: versionName
|
|
147
|
+
Are lower than the version number you uploaded to Capgo.`)
|
|
148
|
+
p.log.error('More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system')
|
|
149
|
+
}
|
|
150
|
+
else if (data.action === 'disableDevBuild') {
|
|
151
|
+
p.log.error(`Dev build is disabled in the default channel. ${baseUrl}`)
|
|
152
|
+
p.log.error('Set your channel to allow it if you wanna test your app')
|
|
153
|
+
}
|
|
154
|
+
else if (data.action === 'disableEmulator') {
|
|
155
|
+
p.log.error(`Emulator is disabled in the default channel. ${baseUrl}`)
|
|
156
|
+
p.log.error('Set your channel to allow it if you wanna test your app')
|
|
157
|
+
}
|
|
158
|
+
else if (data.action === 'cannotGetBundle') {
|
|
159
|
+
p.log.error(`We cannot get your bundle from the default channel. ${baseUrl}`)
|
|
160
|
+
p.log.error('Are you sure your default channel has a bundle set?')
|
|
161
|
+
}
|
|
162
|
+
else if (data.action === 'set_fail') {
|
|
163
|
+
p.log.error(`Your bundle seems to be corrupted, try to download from ${baseUrl} to identify the issue`)
|
|
164
|
+
}
|
|
165
|
+
else if (data.action === 'reset') {
|
|
166
|
+
p.log.error('Your device has been reset to the builtin bundle, did notifyAppReady() is present in the code builded and uploaded to Capgo ?')
|
|
167
|
+
}
|
|
168
|
+
else if (data.action === 'update_fail') {
|
|
169
|
+
p.log.error('Your bundle has been installed but failed to call notifyAppReady()')
|
|
170
|
+
p.log.error('Please check if you have network connection and try again')
|
|
171
|
+
}
|
|
172
|
+
else if (data.action === 'checksum_fail') {
|
|
173
|
+
p.log.error('Your bundle has failed to validate checksum, please check your code and send it again to Capgo')
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
p.log.error(`Log from Capgo ${data.action}`)
|
|
177
|
+
}
|
|
178
|
+
return true
|
|
83
179
|
}
|
|
84
180
|
|
|
85
181
|
export async function waitLog(channel: string, apikey: string, appId: string, snag: LogSnag, orgId: string, deviceId?: string) {
|
|
@@ -95,96 +191,24 @@ export async function waitLog(channel: string, apikey: string, appId: string, sn
|
|
|
95
191
|
key: 'created_at',
|
|
96
192
|
sortable: 'desc',
|
|
97
193
|
}],
|
|
98
|
-
limit: 1,
|
|
99
194
|
rangeStart: new Date().toISOString(),
|
|
100
195
|
}
|
|
101
196
|
let after: string | null = null
|
|
197
|
+
const s = p.spinner()
|
|
198
|
+
s.start(`Waiting for logs (Expect delay of 30 sec)`)
|
|
102
199
|
while (loop) {
|
|
200
|
+
await wait(5000)
|
|
103
201
|
const data = await getStats(apikey, query, after)
|
|
104
|
-
if (data) {
|
|
105
|
-
after = data.created_at
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
else if (data.action.startsWith('download_')) {
|
|
112
|
-
const action = data.action.split('_')[1]
|
|
113
|
-
if (action === 'complete') {
|
|
114
|
-
p.log.info('Your bundle has been downloaded on your device, background the app now and open it again to see the update')
|
|
115
|
-
await markSnag(channel, orgId, snag, 'downloaded')
|
|
116
|
-
}
|
|
117
|
-
else if (action === 'fail') {
|
|
118
|
-
p.log.error('Your bundle has failed to download on your device.')
|
|
119
|
-
p.log.error('Please check if you have network connection and try again')
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
p.log.info(`Your bundle is downloading ${action}% ...`)
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
else if (data.action === 'set') {
|
|
126
|
-
p.log.info('Your bundle has been set on your device ❤️')
|
|
127
|
-
loop = false
|
|
128
|
-
await markSnag(channel, orgId, snag, 'set')
|
|
129
|
-
return Promise.resolve(data)
|
|
130
|
-
}
|
|
131
|
-
else if (data.action === 'NoChannelOrOverride') {
|
|
132
|
-
p.log.error(`No default channel or override (channel/device) found, please create it here ${baseUrl}`)
|
|
133
|
-
}
|
|
134
|
-
else if (data.action === 'needPlanUpgrade') {
|
|
135
|
-
p.log.error('Your are out of quota, please upgrade your plan here https://web.capgo.app/dashboard/settings/plans')
|
|
136
|
-
}
|
|
137
|
-
else if (data.action === 'missingBundle') {
|
|
138
|
-
p.log.error('Your bundle is missing, please check how you build your app ')
|
|
139
|
-
}
|
|
140
|
-
else if (data.action === 'noNew') {
|
|
141
|
-
p.log.error(`Your version in ${data.device_id} is the same as your version uploaded, change it to see the update`)
|
|
142
|
-
}
|
|
143
|
-
else if (data.action === 'disablePlatformIos') {
|
|
144
|
-
p.log.error(`iOS is disabled in the default channel and your device is an iOS device ${baseUrl}`)
|
|
145
|
-
}
|
|
146
|
-
else if (data.action === 'disablePlatformAndroid') {
|
|
147
|
-
p.log.error(`Android is disabled in the default channel and your device is an Android device ${baseUrl}`)
|
|
148
|
-
}
|
|
149
|
-
else if (data.action === 'disableAutoUpdateToMajor') {
|
|
150
|
-
p.log.error('Auto update to major version is disabled in the default channel.')
|
|
151
|
-
p.log.error('Set your app to the same major version as the default channel')
|
|
152
|
-
}
|
|
153
|
-
else if (data.action === 'disableAutoUpdateUnderNative') {
|
|
154
|
-
p.log.error('Auto update under native version is disabled in the default channel.')
|
|
155
|
-
p.log.error('Set your app to the same native version as the default channel.')
|
|
156
|
-
}
|
|
157
|
-
else if (data.action === 'disableDevBuild') {
|
|
158
|
-
p.log.error(`Dev build is disabled in the default channel. ${baseUrl}`)
|
|
159
|
-
p.log.error('Set your channel to allow it if you wanna test your app')
|
|
160
|
-
}
|
|
161
|
-
else if (data.action === 'disableEmulator') {
|
|
162
|
-
p.log.error(`Emulator is disabled in the default channel. ${baseUrl}`)
|
|
163
|
-
p.log.error('Set your channel to allow it if you wanna test your app')
|
|
164
|
-
}
|
|
165
|
-
else if (data.action === 'cannotGetBundle') {
|
|
166
|
-
p.log.error(`We cannot get your bundle from the default channel. ${baseUrl}`)
|
|
167
|
-
p.log.error('Are you sure your default channel has a bundle set?')
|
|
168
|
-
}
|
|
169
|
-
else if (data.action === 'set_fail') {
|
|
170
|
-
p.log.error(`Your bundle seems to be corrupted, try to download from ${baseUrl} to identify the issue`)
|
|
171
|
-
}
|
|
172
|
-
else if (data.action === 'reset') {
|
|
173
|
-
p.log.error('Your device has been reset to the builtin bundle, did you added notifyAppReady in your code?')
|
|
174
|
-
}
|
|
175
|
-
else if (data.action === 'update_fail') {
|
|
176
|
-
p.log.error('Your bundle has been installed but failed to call notifyAppReady')
|
|
177
|
-
p.log.error('Please check if you have network connection and try again')
|
|
178
|
-
}
|
|
179
|
-
else if (data.action === 'checksum_fail') {
|
|
180
|
-
p.log.error('Your bundle has failed to validate checksum, please check your code and send it again to Capgo')
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
p.log.error(`Log from Capgo ${data.action}`)
|
|
202
|
+
if (data.length > 0) {
|
|
203
|
+
after = data[0].created_at
|
|
204
|
+
for (const d of data) {
|
|
205
|
+
loop = await displayError(d, channel, orgId, snag, baseUrl)
|
|
206
|
+
if (!loop)
|
|
207
|
+
break
|
|
184
208
|
}
|
|
185
209
|
}
|
|
186
|
-
await wait(5000)
|
|
187
210
|
}
|
|
211
|
+
s.stop(`Stop watching logs`)
|
|
188
212
|
return Promise.resolve()
|
|
189
213
|
}
|
|
190
214
|
|
|
@@ -221,8 +245,7 @@ export async function debugApp(appId: string, options: OptionsBaseDebug) {
|
|
|
221
245
|
const doRun = await p.confirm({ message: `Automatic check if update working in device ?` })
|
|
222
246
|
await cancelCommand('debug', doRun, userId, snag)
|
|
223
247
|
if (doRun) {
|
|
224
|
-
p.log.info(`Wait logs sent to Capgo from ${appId} device,
|
|
225
|
-
p.log.info('Waiting... (there is a usual delay of 15 seconds until the backend process the logs)')
|
|
248
|
+
p.log.info(`Wait logs sent to Capgo from ${appId} device, Please open your app 💪`)
|
|
226
249
|
await waitLog('debug', options.apikey, appId, snag, orgId, deviceId)
|
|
227
250
|
p.outro(`Done ✅`)
|
|
228
251
|
}
|
package/src/init.ts
CHANGED
|
@@ -398,8 +398,7 @@ async function step10(orgId: string, snag: LogSnag, apikey: string, appId: strin
|
|
|
398
398
|
const doRun = await p.confirm({ message: `Automatic check if update working in device ?` })
|
|
399
399
|
await cancelCommand(doRun, orgId, snag)
|
|
400
400
|
if (doRun) {
|
|
401
|
-
p.log.info(`Wait logs sent to Capgo from ${appId} device,
|
|
402
|
-
p.log.info('Waiting... (there is a usual delay of 15 seconds until the backend process the logs)')
|
|
401
|
+
p.log.info(`Wait logs sent to Capgo from ${appId} device, Please open your app 💪`)
|
|
403
402
|
await waitLog('onboarding-v2', apikey, appId, snag, orgId)
|
|
404
403
|
}
|
|
405
404
|
else {
|
|
@@ -490,6 +489,7 @@ export async function initApp(apikeyCommand: string, appId: string, options: Sup
|
|
|
490
489
|
p.log.info(`Welcome onboard ✈️!`)
|
|
491
490
|
p.log.info(`Your Capgo update system is setup`)
|
|
492
491
|
p.log.info(`Next time use \`${pm.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`)
|
|
492
|
+
p.log.info(`If you have any issue try to use the debug command \`${pm.runner} @capgo/cli@latest app debug\``)
|
|
493
493
|
p.outro(`Bye 👋`)
|
|
494
494
|
process.exit()
|
|
495
495
|
}
|