runcloud 0.1.19 → 0.1.20
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/dist/api.js +4 -0
- package/dist/commands/sandbox.js +6 -11
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -52,6 +52,10 @@ export class ApiClient {
|
|
|
52
52
|
get(path) {
|
|
53
53
|
return this.request('GET', path);
|
|
54
54
|
}
|
|
55
|
+
async getText(path) {
|
|
56
|
+
const response = await this.request('GET', path);
|
|
57
|
+
return response.text();
|
|
58
|
+
}
|
|
55
59
|
post(path, body) {
|
|
56
60
|
return this.request('POST', path, body);
|
|
57
61
|
}
|
package/dist/commands/sandbox.js
CHANGED
|
@@ -527,23 +527,18 @@ export function registerSandbox(program) {
|
|
|
527
527
|
}
|
|
528
528
|
withOutput(sandbox
|
|
529
529
|
.command('logs')
|
|
530
|
-
.description('Show
|
|
530
|
+
.description('Show saved console logs (available after a sandbox is deleted)')
|
|
531
531
|
.argument('<id>', 'sandbox id')
|
|
532
532
|
.option('--lines <n>', 'number of lines to tail', '200')).action((id, opts) => run(async () => {
|
|
533
533
|
const n = Number(opts.lines) || 200;
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
'-c',
|
|
538
|
-
`j="$(journalctl -n ${n} --no-pager 2>/dev/null)"; if [ -n "$j" ]; then printf "%s\\n" "$j"; else tail -n ${n} /root/.natively/expo_server.log 2>&1 || echo '(no logs available)'; fi`,
|
|
539
|
-
],
|
|
540
|
-
});
|
|
534
|
+
const saved = await runCloudApi().getText(`/run-cloud/sandboxes/${encodeURIComponent(id)}/logs`);
|
|
535
|
+
const lines = saved.split('\n');
|
|
536
|
+
const logs = lines.slice(Math.max(0, lines.length - n - (saved.endsWith('\n') ? 1 : 0))).join('\n');
|
|
541
537
|
if (opts.json) {
|
|
542
|
-
|
|
538
|
+
printJson({ sandboxId: id, logs });
|
|
543
539
|
return;
|
|
544
540
|
}
|
|
545
|
-
process.stdout.write(
|
|
546
|
-
process.stderr.write(r.stderr ?? '');
|
|
541
|
+
process.stdout.write(logs);
|
|
547
542
|
}));
|
|
548
543
|
withOutput(sandbox
|
|
549
544
|
.command('desktop')
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = '0.1.
|
|
1
|
+
export const CLI_VERSION = '0.1.20';
|