@bigbongo/cli 3.0.1 → 3.0.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.
@@ -17,17 +17,14 @@ function fmtTs(ms) {
17
17
  }
18
18
  export async function logs(opts = {}) {
19
19
  const cfg = requireProject();
20
- const lines = opts.lines ? parseInt(opts.lines, 10) : undefined;
21
- const { events } = await api.logs(cfg.app_id, {
22
- lines: lines && !isNaN(lines) ? lines : undefined,
23
- search: opts.search,
24
- level: opts.level,
25
- });
20
+ const parsed = opts.lines ? parseInt(opts.lines, 10) : NaN;
21
+ const lines = isNaN(parsed) ? undefined : Math.min(Math.max(parsed, 1), 500);
22
+ const { events } = await api.logs(cfg.app_id, { lines, search: opts.search, level: opts.level });
26
23
  if (!events?.length) {
27
24
  console.log("No logs yet.");
28
25
  return;
29
26
  }
30
- for (const e of events) {
27
+ for (const e of [...events].reverse()) {
31
28
  const tag = LEVEL_TAG[e.level] ?? (e.level ? String(e.level).toUpperCase().slice(0, 3) : " ");
32
29
  console.log(`${fmtTs(e.timestamp)} ${tag} ${e.message}`);
33
30
  }
@@ -22,6 +22,8 @@ export async function status() {
22
22
  const b = s.latest_build;
23
23
  if (b) {
24
24
  let line = ` Build: ${b.source_type} ${b.status}`;
25
+ if (b.git_sha)
26
+ line += ` (${String(b.git_sha).slice(0, 7)})`;
25
27
  if (b.deployment_status)
26
28
  line += ` (deploy: ${b.deployment_status})`;
27
29
  console.log(line);
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ program.command("login").description("Authenticate against BigBongo").option("--
12
12
  program.command("clone [app]").description("Clone your app's repo (BigBongo brokers GitHub access)").action(clone);
13
13
  program.command("status").description("Show app + deployment status").action(status);
14
14
  program.command("logs").description("Show app runtime logs")
15
- .option("--lines <n>", "number of log lines (default 100)")
15
+ .option("--lines <n>", "number of log lines (default 50, max 500)")
16
16
  .option("--search <text>", "filter to lines containing text")
17
17
  .option("--level <level>", "filter by level: error | warn | info")
18
18
  .action(logs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbongo/cli",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "BigBongo CLI - edit your BigBongo app locally and git push to deploy.",
5
5
  "type": "module",
6
6
  "bin": {