cloudron 8.2.3 → 8.2.5

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
@@ -132,3 +132,5 @@
132
132
  [8.2.1]
133
133
  * cancel task: wait for cancellation
134
134
 
135
+ [8.2.4]
136
+ * logs: `--ndjson` prints newline-delimited JSON (plain dump or `--tail` follow stream)
package/bin/cloudron CHANGED
@@ -306,6 +306,7 @@ program.command('logs')
306
306
  .description('Application or System logs')
307
307
  .option('-f, --tail', 'Follow')
308
308
  .option('-l, --lines <lines>', 'Number of lines to show (default: 500)')
309
+ .option('--ndjson', 'Print newline-delimited JSON objects instead of HH:MM:SS log lines')
309
310
  .option('--app <id/location>', 'App id or location')
310
311
  .option('--system [service-name]', 'Show System logs or optionally service logs')
311
312
  .action(actions.logs);
@@ -416,6 +417,7 @@ const versionsCommand = program.command('versions').description('Commands for pu
416
417
 
417
418
  versionsCommand.command('add')
418
419
  .description('Add the current build to version file')
420
+ .option('-i, --image <image>', 'Docker image')
419
421
  .option('--state <state>', 'Publish state (published or testing)')
420
422
  .action(versionsActions.addOrUpdate);
421
423
 
@@ -434,6 +436,7 @@ versionsCommand.command('revoke')
434
436
 
435
437
  versionsCommand.command('update')
436
438
  .description('Update existing version')
439
+ .option('-i, --image <image>', 'Docker image')
437
440
  .option('--version <version>', 'Version to update')
438
441
  .option('--state <state>', 'Publish state (published or testing)')
439
442
  .action(versionsActions.addOrUpdate);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudron",
3
- "version": "8.2.3",
3
+ "version": "8.2.5",
4
4
  "license": "MIT",
5
5
  "description": "Cloudron Commandline Tool",
6
6
  "type": "module",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "author": "Cloudron Developers <support@cloudron.io>",
19
19
  "dependencies": {
20
- "@cloudron/manifest-format": "^6.2.0",
20
+ "@cloudron/manifest-format": "^6.2.1",
21
21
  "@cloudron/safetydance": "^3.0.1",
22
22
  "@cloudron/superagent": "^2.1.1",
23
23
  "commander": "^14.0.3",
@@ -27,7 +27,7 @@
27
27
  "eventsource": "^4.1.0",
28
28
  "micromatch": "^4.0.8",
29
29
  "open": "^11.0.0",
30
- "semver": "^7.7.4",
30
+ "semver": "^7.8.0",
31
31
  "tar-fs": "^3.1.2"
32
32
  },
33
33
  "engines": {
@@ -35,8 +35,8 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@eslint/js": "^10.0.1",
38
- "eslint": "^10.2.1",
39
- "globals": "^17.5.0",
38
+ "eslint": "^10.3.0",
39
+ "globals": "^17.6.0",
40
40
  "mocha": "^11.7.5"
41
41
  }
42
42
  }
package/src/actions.js CHANGED
@@ -1074,6 +1074,8 @@ async function logs(localOptions, cmd) {
1074
1074
  const { adminFqdn, token, rejectUnauthorized } = requestOptions(options);
1075
1075
  const lines = options.lines || 500;
1076
1076
  const tail = !!options.tail;
1077
+ const ndjson = !!options.ndjson;
1078
+
1077
1079
  let apiPath;
1078
1080
 
1079
1081
  if (typeof options.system === 'boolean' && options.system) {
@@ -1096,7 +1098,11 @@ async function logs(localOptions, cmd) {
1096
1098
  const es = new EventSource(url, { rejectUnauthorized }); // not sure why this is needed
1097
1099
 
1098
1100
  es.addEventListener('message', function (e) { // e { type, data, lastEventId }. lastEventId is the timestamp
1099
- logPrinter(JSON.parse(e.data));
1101
+ if (ndjson) {
1102
+ console.log(e.data);
1103
+ } else {
1104
+ logPrinter(JSON.parse(e.data));
1105
+ }
1100
1106
  });
1101
1107
 
1102
1108
  es.addEventListener('error', function (error) {
@@ -1110,8 +1116,13 @@ async function logs(localOptions, cmd) {
1110
1116
  const response = await superagent.get(url, { rejectUnauthorized }).ok(() => true);
1111
1117
  if (response.status !== 200) return exit(`Failed to get logs: ${requestError(response)}`);
1112
1118
 
1113
- for (const line of response.body.toString('utf8').trim().split('\n')) {
1114
- logPrinter(JSON.parse(line));
1119
+ const raw = response.body.toString('utf8').trimEnd();
1120
+ if (ndjson) {
1121
+ console.log(raw);
1122
+ } else {
1123
+ for (const line of raw.split('\n')) {
1124
+ logPrinter(JSON.parse(line));
1125
+ }
1115
1126
  }
1116
1127
  }
1117
1128
  }
package/test/test.js CHANGED
@@ -247,6 +247,14 @@ describe('app logs', () => {
247
247
  const out = cli('logs --app ' + app.id);
248
248
  assert.ok(out.stdout.includes('listening on'));
249
249
  });
250
+
251
+ it('supports --ndjson on a log dump', () => {
252
+ const out = cli('logs --ndjson --lines 20 --app ' + app.id);
253
+ const first = out.stdout.trim().split('\n').find((l) => l.length > 0);
254
+ assert.ok(first, 'expected at least one NDJSON line');
255
+ const obj = JSON.parse(first);
256
+ assert.ok('realtimeTimestamp' in obj && 'message' in obj);
257
+ });
250
258
  });
251
259
 
252
260
  describe('Uninstall', function () {