cloudron 5.11.10 → 5.12.0

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/bin/cloudron CHANGED
@@ -170,7 +170,7 @@ program.command('install')
170
170
  .option('-a, --alias-domains [domain,...]', 'Alias domains')
171
171
  .option('--appstore-id <appid[@version]>', 'Use app from the store')
172
172
  .option('--no-sso', 'Disable Cloudron SSO [false]')
173
- .option('--debug [cmd]', 'Enable debug mode')
173
+ .option('--debug [cmd...]', 'Enable debug mode', false)
174
174
  .option('--readonly', 'Mount filesystem readonly. Default is read/write in debug mode.')
175
175
  .action(actions.install);
176
176
 
@@ -31,7 +31,6 @@ program.command('build', { isDefault: true })
31
31
 
32
32
  program.command('login')
33
33
  .description('Login to the build service')
34
- .option('-t, --token <token>', 'Build service token')
35
34
  .action(buildActions.login);
36
35
 
37
36
  program.command('logs')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudron",
3
- "version": "5.11.10",
3
+ "version": "5.12.0",
4
4
  "license": "MIT",
5
5
  "description": "Cloudron Commandline Tool",
6
6
  "main": "main.js",
@@ -17,31 +17,29 @@
17
17
  },
18
18
  "author": "Cloudron Developers <support@cloudron.io>",
19
19
  "dependencies": {
20
- "async": "^3.2.5",
20
+ "async": "^3.2.6",
21
21
  "cloudron-manifestformat": "^5.26.2",
22
22
  "commander": "^12.1.0",
23
- "debug": "^4.3.5",
23
+ "debug": "^4.3.7",
24
24
  "easy-table": "^1.2.0",
25
25
  "ejs": "^3.1.10",
26
26
  "eventsource": "^2.0.2",
27
- "micromatch": "^4.0.7",
28
- "open": "^8.4.0",
27
+ "micromatch": "^4.0.8",
28
+ "open": "^10.1.0",
29
29
  "progress": "^2.0.3",
30
30
  "progress-stream": "^2.0.0",
31
31
  "readline-sync": "^1.4.10",
32
32
  "safetydance": "^2.4.0",
33
33
  "split2": "^4.2.0",
34
- "superagent": "^9.0.2",
34
+ "superagent": "^10.1.1",
35
35
  "tar-fs": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.12.0.tgz",
36
- "underscore": "^1.13.6"
36
+ "underscore": "^1.13.7"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">= 18.x.x"
40
40
  },
41
41
  "devDependencies": {
42
42
  "expect.js": "^0.3.1",
43
- "memorystream": "^0.3.1",
44
- "mocha": "^10.4.0",
45
- "rimraf": "^5.0.7"
43
+ "mocha": "^10.8.2"
46
44
  }
47
45
  }
package/src/actions.js CHANGED
@@ -8,7 +8,6 @@ const assert = require('assert'),
8
8
  fs = require('fs'),
9
9
  https = require('https'),
10
10
  manifestFormat = require('cloudron-manifestformat'),
11
- opn = require('open'),
12
11
  os = require('os'),
13
12
  path = require('path'),
14
13
  ProgressBar = require('progress'),
@@ -244,13 +243,7 @@ async function waitForTask(taskId, options) {
244
243
  const response = await createRequest('GET', `/api/v1/tasks/${taskId}`, options);
245
244
  if (response.statusCode !== 200) throw new Error(`Failed to get task: ${requestError(response)}`);
246
245
 
247
- // TODO remove later, for now keep old behavior on if `pending` is missing
248
- if (typeof response.body.pending === 'undefined') {
249
- // note: for queued tasks, 'active' returns false
250
- if (response.body.error || response.body.percent === 100) return response.body; // task errored or done
251
- } else {
252
- if (!response.body.pending && !response.body.active) return response.body;
253
- }
246
+ if (!response.body.active) return response.body;
254
247
 
255
248
  let message = response.body.message || '';
256
249
 
@@ -427,7 +420,8 @@ async function open(localOptions, cmd) {
427
420
 
428
421
  if (!app) return exit(NO_APP_FOUND_ERROR_STRING);
429
422
 
430
- opn(`https://${app.fqdn}`);
423
+ // pure esm module
424
+ (await import('open')).default(`https://${app.fqdn}`);
431
425
  }
432
426
 
433
427
  async function list(localOptions, cmd) {
@@ -510,16 +504,6 @@ function queryPortBindings(app, manifest) {
510
504
  return portBindings;
511
505
  }
512
506
 
513
- // this function can fail on many levels
514
- function parseDebugCommand(cmd) {
515
- // hack for commander
516
- if (typeof cmd !== 'string' || cmd === '') return [ '/bin/bash', '-c', 'echo "Debug mode. Use cloudron exec to debug. Sleeping" && sleep 100000' ];
517
-
518
- if (cmd == 'default') return null; // another hack
519
-
520
- return cmd.split(' '); // yet another hack
521
- }
522
-
523
507
  async function downloadManifest(appstoreId) {
524
508
  const [ id, version ] = appstoreId.split('@');
525
509
 
@@ -646,10 +630,11 @@ async function install(localOptions, cmd) {
646
630
  // the sso only applies for apps which allow optional sso
647
631
  if (manifest.optionalSso) data.sso = options.sso;
648
632
 
649
- if (options.debug) {
633
+ if (options.debug) { // 'true' when no args. otherwise, array
634
+ const debugCmd = options.debug === true ? [ '/bin/bash', '-c', 'echo "Repair mode. Use the webterminal or cloudron exec to repair. Sleeping" && sleep infinity' ] : options.debug;
650
635
  data.debugMode = {
651
636
  readonlyRootfs: options.readonly ? true : false,
652
- cmd: parseDebugCommand(options.debug)
637
+ cmd: debugCmd
653
638
  };
654
639
  data.memoryLimit = -1;
655
640
  options.wait = false; // in debug mode, health check never succeeds
@@ -835,10 +820,12 @@ async function debug(args, localOptions, cmd) {
835
820
  const app = await getApp(options);
836
821
  if (!app) return exit(NO_APP_FOUND_ERROR_STRING);
837
822
 
823
+ const debugCmd = args.length === 0 ? [ '/bin/bash', '-c', 'echo "Repair mode. Use the webterminal or cloudron exec to repair. Sleeping" && sleep infinity' ] : args;
824
+
838
825
  const data = {
839
826
  debugMode: options.disable ? null : {
840
827
  readonlyRootfs: options.readonly ? true : false,
841
- cmd: parseDebugCommand(args.join(' ').trim())
828
+ cmd: debugCmd
842
829
  }
843
830
  };
844
831
 
@@ -63,8 +63,8 @@ function getBuildServiceConfig(options) {
63
63
  return buildService;
64
64
  }
65
65
 
66
- async function login(options) {
67
- assert.strictEqual(typeof options, 'object');
66
+ async function login(localOptions, cmd) {
67
+ const options = cmd.optsWithGlobals();
68
68
 
69
69
  const buildServiceConfig = getBuildServiceConfig(options);
70
70
 
package/test/test.js CHANGED
@@ -12,7 +12,6 @@ var child_process = require('child_process'),
12
12
  expect = require('expect.js'),
13
13
  fs = require('fs'),
14
14
  path = require('path'),
15
- rimraf = require('rimraf'),
16
15
  safe = require('safetydance'),
17
16
  util = require('util');
18
17
 
@@ -203,7 +202,7 @@ describe('Pull', function () {
203
202
  });
204
203
 
205
204
  it('can pull a directory', function () {
206
- rimraf.sync('/tmp/pulldir');
205
+ fs.rmSync('/tmp/pulldir', { recursive: true, force: true });
207
206
  safe.fs.mkdirSync('/tmp/pulldir');
208
207
  cli(util.format('pull --app %s /app/code/ /tmp/pulldir', app.id));
209
208
  expect(fs.existsSync('/tmp/pulldir/README.md')).to.be.ok();
@@ -213,7 +212,7 @@ describe('Pull', function () {
213
212
  var result = cli(util.format('exec --app %s md5sum /app/code/node_modules/uglify-js/bin/uglifyjs', app.id));
214
213
  expect(result.output[1]).to.contain(md5('/tmp/pulldir/node_modules/uglify-js/bin/uglifyjs'));
215
214
 
216
- rimraf.sync('/tmp/pulldir');
215
+ fs.rmSync('/tmp/pulldir', { recursive: true, force: true });
217
216
  });
218
217
 
219
218
  it('can pull to directory', function () {