@saltcorn/cli 1.6.0-alpha.9 → 1.6.0-beta.1

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.
@@ -878,6 +878,14 @@
878
878
  "multiple": false,
879
879
  "type": "option"
880
880
  },
881
+ "npm": {
882
+ "char": "p",
883
+ "description": "Install plugin directly from npm by package name",
884
+ "name": "npm",
885
+ "hasDynamicHelp": false,
886
+ "multiple": false,
887
+ "type": "option"
888
+ },
881
889
  "unsafe": {
882
890
  "char": "u",
883
891
  "description": "Allow unsafe plugins on tenants",
@@ -1116,6 +1124,13 @@
1116
1124
  "name": "imode",
1117
1125
  "allowNo": false,
1118
1126
  "type": "boolean"
1127
+ },
1128
+ "generate-api-token": {
1129
+ "char": "g",
1130
+ "description": "generate a new API token for the user and print it to stdout",
1131
+ "name": "generate-api-token",
1132
+ "allowNo": false,
1133
+ "type": "boolean"
1119
1134
  }
1120
1135
  },
1121
1136
  "hasDynamicHelp": false,
@@ -2420,5 +2435,5 @@
2420
2435
  ]
2421
2436
  }
2422
2437
  },
2423
- "version": "1.6.0-alpha.9"
2438
+ "version": "1.6.0-beta.1"
2424
2439
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@saltcorn/cli",
3
3
  "description": "Command-line interface for Saltcorn, open-source no-code platform",
4
4
  "homepage": "https://saltcorn.com",
5
- "version": "1.6.0-alpha.9",
5
+ "version": "1.6.0-beta.1",
6
6
  "author": "Tom Nielsen @glutamate",
7
7
  "bin": {
8
8
  "saltcorn": "./bin/saltcorn"
@@ -11,13 +11,13 @@
11
11
  "dependencies": {
12
12
  "@oclif/core": "4.4.0",
13
13
  "@oclif/plugin-plugins": "^5.4.26",
14
- "@saltcorn/admin-models": "1.6.0-alpha.9",
15
- "@saltcorn/common-code": "1.6.0-alpha.9",
16
- "@saltcorn/data": "1.6.0-alpha.9",
17
- "@saltcorn/mobile-app": "1.6.0-alpha.9",
18
- "@saltcorn/mobile-builder": "1.6.0-alpha.9",
19
- "@saltcorn/plugins-loader": "1.6.0-alpha.9",
20
- "@saltcorn/server": "1.6.0-alpha.9",
14
+ "@saltcorn/admin-models": "1.6.0-beta.1",
15
+ "@saltcorn/common-code": "1.6.0-beta.1",
16
+ "@saltcorn/data": "1.6.0-beta.1",
17
+ "@saltcorn/mobile-app": "1.6.0-beta.1",
18
+ "@saltcorn/mobile-builder": "1.6.0-beta.1",
19
+ "@saltcorn/plugins-loader": "1.6.0-beta.1",
20
+ "@saltcorn/server": "1.6.0-beta.1",
21
21
  "contractis": "^0.1.0",
22
22
  "dateformat": "^4.6.3",
23
23
  "inquirer": "^12.3.3",
@@ -159,7 +159,7 @@ class ReleaseCommand extends Command {
159
159
  for (const p of Object.values(pkgs)) {
160
160
  updatePkgJson(p.dir);
161
161
  if (p.publish) {
162
- await publish(p.dir);
162
+ await publish(p.dir, tag);
163
163
  await sleep(5000);
164
164
  }
165
165
  }
@@ -3,7 +3,10 @@
3
3
  * @module commands/install-plugin
4
4
  */
5
5
  const { Command, Flags } = require("@oclif/core");
6
- const { maybe_as_tenant_in_transaction, init_some_tenants } = require("../common");
6
+ const {
7
+ maybe_as_tenant_in_transaction,
8
+ init_some_tenants,
9
+ } = require("../common");
7
10
  const fs = require("fs");
8
11
  const path = require("path");
9
12
 
@@ -24,9 +27,9 @@ class InstallPluginCommand extends Command {
24
27
  } = require("@saltcorn/admin-models/models/pack");
25
28
  const load_plugins = require("@saltcorn/server/load_plugins");
26
29
 
27
- if (!flags.name && !flags.directory) {
30
+ if (!flags.name && !flags.directory && !flags.npm) {
28
31
  console.error(
29
- "You must provide either a plugin name (-n) or a directory with the plugin (-d)"
32
+ "You must provide either a plugin name (-n), a directory (-d), or an npm package (-p)"
30
33
  );
31
34
  this.exit(1);
32
35
  }
@@ -44,6 +47,19 @@ class InstallPluginCommand extends Command {
44
47
  }
45
48
  delete plugin.id;
46
49
 
50
+ await load_plugins.loadAndSaveNewPlugin(
51
+ plugin,
52
+ undefined,
53
+ undefined,
54
+ (s) => s,
55
+ !!flags.unsafe
56
+ );
57
+ } else if (flags.npm) {
58
+ const plugin = new Plugin({
59
+ name: flags.npm,
60
+ source: "npm",
61
+ location: flags.npm,
62
+ });
47
63
  await load_plugins.loadAndSaveNewPlugin(
48
64
  plugin,
49
65
  undefined,
@@ -64,7 +80,7 @@ class InstallPluginCommand extends Command {
64
80
  source: "local",
65
81
  location: path.resolve(flags.directory),
66
82
  });
67
- await load_plugins.loadAndSaveNewPlugin(plugin);
83
+ await load_plugins.loadAndSaveNewPlugin(plugin, true);
68
84
  } catch (e) {
69
85
  console.error(e);
70
86
  this.exit(1);
@@ -96,6 +112,10 @@ InstallPluginCommand.flags = {
96
112
  char: "d",
97
113
  description: "Directory with local plugin",
98
114
  }),
115
+ npm: Flags.string({
116
+ char: "p",
117
+ description: "Install plugin directly from npm by package name",
118
+ }),
99
119
  unsafe: Flags.boolean({
100
120
  char: "u",
101
121
  description: "Allow unsafe plugins on tenants",
@@ -113,6 +113,12 @@ class ModifyUserCommand extends Command {
113
113
 
114
114
  if (password) await u.changePasswordTo(password, false);
115
115
 
116
+ if (flags["generate-api-token"]) {
117
+ const token = await u.getNewAPIToken();
118
+ console.log(token);
119
+ return;
120
+ }
121
+
116
122
  console.log(
117
123
  `Success: User ${
118
124
  email ? email : args.user_email
@@ -181,6 +187,10 @@ ModifyUserCommand.flags = {
181
187
  description: "new password",
182
188
  }),
183
189
  imode: Flags.boolean({ char: "i", description: "interactive mode" }),
190
+ "generate-api-token": Flags.boolean({
191
+ char: "g",
192
+ description: "generate a new API token for the user and print it to stdout",
193
+ }),
184
194
  };
185
195
 
186
196
  module.exports = ModifyUserCommand;