cloudron 5.14.1 → 5.14.3

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.
@@ -7,6 +7,12 @@ const { program } = require('commander'),
7
7
 
8
8
  program.version(require('../package.json').version);
9
9
 
10
+ program.addHelpText('after', `
11
+
12
+ Show help for default subcommand:
13
+ $ cloudron build build --help`);
14
+
15
+
10
16
  function collectArgs(value, collected) {
11
17
  collected.push(value);
12
18
  return collected;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudron",
3
- "version": "5.14.1",
3
+ "version": "5.14.3",
4
4
  "license": "MIT",
5
5
  "description": "Cloudron Commandline Tool",
6
6
  "main": "main.js",
package/src/actions.js CHANGED
@@ -7,7 +7,6 @@ const assert = require('assert'),
7
7
  { EventSource } = require('eventsource'),
8
8
  fs = require('fs'),
9
9
  https = require('https'),
10
- LineStream = require('./line-stream.js'),
11
10
  manifestFormat = require('cloudron-manifestformat'),
12
11
  os = require('os'),
13
12
  path = require('path'),
@@ -966,19 +965,12 @@ async function logs(localOptions, cmd) {
966
965
  } else {
967
966
  const url = `${apiPath}?access_token=${token}&lines=${lines}&format=json`;
968
967
 
969
- const req = superagent.get(url, { rejectUnauthorized });
970
- req.on('response', function (response) {
971
- if (response.status !== 200) return exit(`Failed to get logs: ${requestError(response)}`);
972
- });
973
- req.on('error', (error) => exit(`Pipe error: ${error.message}`));
974
-
975
- const lineStream = new LineStream();
976
- lineStream
977
- .on('line', (line) => { logPrinter(JSON.parse(line)); } )
978
- .on('error', (error) => exit(`JSON parse error: ${error.message}`))
979
- .on('end', process.exit);
968
+ const response = await superagent.get(url, { rejectUnauthorized }).ok(() => true);
969
+ if (response.status !== 200) return exit(`Failed to get logs: ${requestError(response)}`);
980
970
 
981
- req.pipe(lineStream);
971
+ for (const line of response.body.toString('utf8').trim().split('\n')) {
972
+ logPrinter(JSON.parse(line));
973
+ }
982
974
  }
983
975
  }
984
976
 
@@ -118,6 +118,7 @@ async function info(localOptions, cmd) {
118
118
  const [id, version] = await getAppstoreId(options.appstoreId);
119
119
 
120
120
  const response = await createRequest('GET', `/api/v1/developers/apps/${id}/versions/${version}`, options);
121
+ if (response.status === 404) return exit(new Error(`No published app found with id ${id}`));
121
122
  if (response.status !== 200) return exit(new Error(`Failed to list versions: ${requestError(response)}`));
122
123
 
123
124
  const manifest = response.body.manifest;
@@ -327,6 +327,9 @@ async function build(localOptions, cmd) {
327
327
  console.log();
328
328
  }
329
329
 
330
+ const parts = repository.split('://');
331
+ if (parts.length > 1) exit(`repository should not be a URL. Try again without ${parts[0]}://`);
332
+
330
333
  appConfig.repository = repository;
331
334
  config.setAppConfig(sourceDir, appConfig);
332
335
  }
@@ -1,30 +0,0 @@
1
- 'use strict';
2
-
3
- const { Transform } = require('stream');
4
-
5
- class LineStream extends Transform {
6
- constructor(options) {
7
- super();
8
- this._buffer = '';
9
- }
10
-
11
- _transform(chunk, encoding, callback) {
12
- this._buffer += chunk.toString('utf8');
13
-
14
- const lines = this._buffer.split('\n');
15
- this._buffer = lines.pop(); // maybe incomplete line
16
-
17
- for (const line of lines) {
18
- this.emit('line', line);
19
- }
20
-
21
- callback();
22
- }
23
-
24
- _flush(callback) {
25
- if (this._buffer) this.emit('line', this.buff_bufferer);
26
- callback();
27
- }
28
- }
29
-
30
- exports = module.exports = LineStream;