@saltcorn/cli 1.0.0-beta.1 → 1.0.0-beta.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/README.md +394 -294
- package/bin/saltcorn +4 -4
- package/npm-shrinkwrap.json +11899 -29030
- package/oclif.manifest.json +1619 -1
- package/package.json +14 -25
- package/src/commands/add-schema.js +7 -8
- package/src/commands/backup.js +6 -6
- package/src/commands/build-app.js +26 -26
- package/src/commands/build-cordova-builder.js +3 -3
- package/src/commands/configuration-check-backups.js +7 -9
- package/src/commands/configuration-check.js +4 -5
- package/src/commands/create-tenant.js +11 -9
- package/src/commands/create-user.js +9 -10
- package/src/commands/delete-tenants.js +1 -1
- package/src/commands/delete-user.js +12 -10
- package/src/commands/dev/localize-plugin.js +12 -10
- package/src/commands/dev/make-migration.js +1 -1
- package/src/commands/dev/plugin-test.js +6 -6
- package/src/commands/dev/post-release.js +6 -7
- package/src/commands/dev/release.js +9 -6
- package/src/commands/dev/test-plugin.js +8 -5
- package/src/commands/fixtures.js +4 -4
- package/src/commands/get-cfg.js +14 -12
- package/src/commands/info.js +8 -8
- package/src/commands/inspect.js +9 -12
- package/src/commands/install-pack.js +5 -5
- package/src/commands/install-plugin.js +6 -6
- package/src/commands/list-tenants.js +27 -19
- package/src/commands/list-triggers.js +29 -18
- package/src/commands/list-users.js +9 -16
- package/src/commands/migrate.js +1 -1
- package/src/commands/modify-user.js +16 -15
- package/src/commands/plugins.js +7 -7
- package/src/commands/reset-schema.js +5 -6
- package/src/commands/restore.js +6 -6
- package/src/commands/rm-tenant.js +7 -9
- package/src/commands/run-benchmark.js +17 -14
- package/src/commands/run-js.js +5 -6
- package/src/commands/run-sql.js +5 -6
- package/src/commands/run-tests.js +15 -13
- package/src/commands/run-trigger.js +13 -8
- package/src/commands/scheduler.js +3 -3
- package/src/commands/serve.js +10 -10
- package/src/commands/set-cfg.js +14 -13
- package/src/commands/set-daily-time.js +7 -9
- package/src/commands/setup-benchmark.js +14 -7
- package/src/commands/setup.js +11 -12
- package/src/commands/sync-upload-data.js +6 -6
- package/src/commands/take-snapshot.js +5 -6
- package/src/commands/transform-field.js +9 -10
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -2,25 +2,22 @@
|
|
|
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.0.0-beta.
|
|
5
|
+
"version": "1.0.0-beta.5",
|
|
6
6
|
"author": "Tom Nielsen @glutamate",
|
|
7
7
|
"bin": {
|
|
8
8
|
"saltcorn": "./bin/saltcorn"
|
|
9
9
|
},
|
|
10
10
|
"bugs": "https://github.com/saltcorn/saltcorn/issues",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@oclif/
|
|
13
|
-
"@oclif/
|
|
14
|
-
"@
|
|
15
|
-
"@
|
|
16
|
-
"@saltcorn/
|
|
17
|
-
"@saltcorn/
|
|
18
|
-
"@saltcorn/
|
|
19
|
-
"@saltcorn/
|
|
20
|
-
"@saltcorn/
|
|
21
|
-
"@saltcorn/plugins-loader": "1.0.0-beta.1",
|
|
22
|
-
"@saltcorn/server": "1.0.0-beta.1",
|
|
23
|
-
"cli-ux": "^5.6.7",
|
|
12
|
+
"@oclif/core": "^2.16.0",
|
|
13
|
+
"@oclif/plugin-plugins": "^3.9.4",
|
|
14
|
+
"@saltcorn/admin-models": "1.0.0-beta.5",
|
|
15
|
+
"@saltcorn/common-code": "1.0.0-beta.5",
|
|
16
|
+
"@saltcorn/data": "1.0.0-beta.5",
|
|
17
|
+
"@saltcorn/mobile-app": "1.0.0-beta.5",
|
|
18
|
+
"@saltcorn/mobile-builder": "1.0.0-beta.5",
|
|
19
|
+
"@saltcorn/plugins-loader": "1.0.0-beta.5",
|
|
20
|
+
"@saltcorn/server": "1.0.0-beta.5",
|
|
24
21
|
"contractis": "^0.1.0",
|
|
25
22
|
"dateformat": "^3.0.3",
|
|
26
23
|
"inquirer": "^7.3.3",
|
|
@@ -34,7 +31,7 @@
|
|
|
34
31
|
"wrk": "^1.2.1"
|
|
35
32
|
},
|
|
36
33
|
"devDependencies": {
|
|
37
|
-
"
|
|
34
|
+
"oclif": "3.17.2",
|
|
38
35
|
"globby": "^10.0.2",
|
|
39
36
|
"ts-node": "^9.1.1"
|
|
40
37
|
},
|
|
@@ -55,22 +52,14 @@
|
|
|
55
52
|
"oclif": {
|
|
56
53
|
"commands": "./src/commands",
|
|
57
54
|
"bin": "saltcorn",
|
|
58
|
-
"
|
|
59
|
-
"@oclif/plugin-help"
|
|
60
|
-
],
|
|
61
|
-
"repositoryPrefix": "<%- repo %>/blob/v<%- version %>/packages/saltcorn-cli/<%- commandPath %>",
|
|
62
|
-
"topics": {
|
|
63
|
-
"dev": {
|
|
64
|
-
"description": "Tools for core and plugin developers"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
55
|
+
"repositoryPrefix": "<%- repo %>/blob/v<%- version %>/packages/saltcorn-cli/<%- commandPath %>"
|
|
67
56
|
},
|
|
68
57
|
"repository": "github:saltcorn/saltcorn",
|
|
69
58
|
"scripts": {
|
|
70
59
|
"postpack": "rm -f oclif.manifest.json",
|
|
71
|
-
"prepack": "oclif
|
|
60
|
+
"prepack": "oclif manifest && oclif readme",
|
|
72
61
|
"test": "echo NO TESTS",
|
|
73
|
-
"version": "oclif
|
|
62
|
+
"version": "oclif readme && git add README.md",
|
|
74
63
|
"tsc": "echo \"Error: no TypeScript support yet\"",
|
|
75
64
|
"clean": "echo \"Error: no TypeScript support yet\""
|
|
76
65
|
},
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* @category saltcorn-cli
|
|
3
3
|
* @module commands/add-schema
|
|
4
4
|
*/
|
|
5
|
-
const { Command,
|
|
6
|
-
const { cli } = require("cli-ux");
|
|
5
|
+
const { Command, Flags, ux } = require("@oclif/core");
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* AddSchemaCommand Class
|
|
@@ -15,12 +14,12 @@ class AddSchemaCommand extends Command {
|
|
|
15
14
|
* @returns {Promise<void>}
|
|
16
15
|
*/
|
|
17
16
|
async run() {
|
|
18
|
-
|
|
19
|
-
const { flags } = this.parse(AddSchemaCommand);
|
|
17
|
+
const { flags } = await this.parse(AddSchemaCommand);
|
|
20
18
|
const reset = require("@saltcorn/data/db/reset_schema");
|
|
21
|
-
if(!flags.force){
|
|
22
|
-
const ans = await
|
|
23
|
-
`This
|
|
19
|
+
if (!flags.force) {
|
|
20
|
+
const ans = await ux.confirm(
|
|
21
|
+
`This adds Saltcorn schema to existing database\nContinue (y/n)?`
|
|
22
|
+
);
|
|
24
23
|
if (!ans) {
|
|
25
24
|
console.log(`Success: Command execution canceled`);
|
|
26
25
|
this.exit(1);
|
|
@@ -46,7 +45,7 @@ AddSchemaCommand.help = `Add Saltcorn schema to existing database`;
|
|
|
46
45
|
* @type {object}
|
|
47
46
|
*/
|
|
48
47
|
AddSchemaCommand.flags = {
|
|
49
|
-
force:
|
|
48
|
+
force: Flags.boolean({ char: "f", description: "force command execution" }),
|
|
50
49
|
};
|
|
51
50
|
|
|
52
51
|
module.exports = AddSchemaCommand;
|
package/src/commands/backup.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @category saltcorn-cli
|
|
4
4
|
* @module commands/backup
|
|
5
5
|
*/
|
|
6
|
-
const { Command,
|
|
6
|
+
const { Command, Flags } = require("@oclif/core");
|
|
7
7
|
const { execSync } = require("child_process");
|
|
8
8
|
const dateFormat = require("dateformat");
|
|
9
9
|
const os = require("os");
|
|
@@ -26,7 +26,7 @@ class BackupCommand extends Command {
|
|
|
26
26
|
* @returns {Promise<void>}
|
|
27
27
|
*/
|
|
28
28
|
async run() {
|
|
29
|
-
const { flags } = this.parse(BackupCommand);
|
|
29
|
+
const { flags } = await this.parse(BackupCommand);
|
|
30
30
|
|
|
31
31
|
if (flags.tenant) {
|
|
32
32
|
// for tenant do saltcorn backup
|
|
@@ -106,16 +106,16 @@ BackupCommand.help = `Backup the PostgreSQL database to a file with pg_dump or s
|
|
|
106
106
|
* @type {object}
|
|
107
107
|
*/
|
|
108
108
|
BackupCommand.flags = {
|
|
109
|
-
verbose:
|
|
110
|
-
output:
|
|
109
|
+
verbose: Flags.boolean({ char: "v", description: "Verbose" }),
|
|
110
|
+
output: Flags.string({
|
|
111
111
|
char: "o",
|
|
112
112
|
description: "output filename",
|
|
113
113
|
}),
|
|
114
|
-
tenant:
|
|
114
|
+
tenant: Flags.string({
|
|
115
115
|
char: "t",
|
|
116
116
|
description: "Backup tenant in saltcorn zip format",
|
|
117
117
|
}),
|
|
118
|
-
zip:
|
|
118
|
+
zip: Flags.boolean({
|
|
119
119
|
char: "z",
|
|
120
120
|
description: "Backup public in saltcorn zip format",
|
|
121
121
|
}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { Command,
|
|
1
|
+
const { Command, Flags } = require("@oclif/core");
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const Plugin = require("@saltcorn/data/models/plugin");
|
|
4
4
|
const { MobileBuilder } = require("@saltcorn/mobile-builder/mobile-builder");
|
|
@@ -61,7 +61,7 @@ class BuildAppCommand extends Command {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
async run() {
|
|
64
|
-
const { flags } = await this.parse(BuildAppCommand);
|
|
64
|
+
const { flags } = await await this.parse(BuildAppCommand);
|
|
65
65
|
this.validateParameters(flags);
|
|
66
66
|
const mobileAppDir = path.join(
|
|
67
67
|
require.resolve("@saltcorn/mobile-app"),
|
|
@@ -122,43 +122,43 @@ class BuildAppCommand extends Command {
|
|
|
122
122
|
BuildAppCommand.description = "Build mobile app";
|
|
123
123
|
|
|
124
124
|
BuildAppCommand.flags = {
|
|
125
|
-
tenantAppName:
|
|
125
|
+
tenantAppName: Flags.string({
|
|
126
126
|
name: "tenant",
|
|
127
127
|
string: "tenant",
|
|
128
128
|
description:
|
|
129
129
|
"Optional name of a tenant application, if set, the app will be build for this tenant",
|
|
130
130
|
}),
|
|
131
|
-
platforms:
|
|
131
|
+
platforms: Flags.string({
|
|
132
132
|
name: "platforms",
|
|
133
133
|
char: "p",
|
|
134
134
|
description: "Platforms to build for, space separated list",
|
|
135
135
|
multiple: true,
|
|
136
136
|
}),
|
|
137
|
-
entryPoint:
|
|
137
|
+
entryPoint: Flags.string({
|
|
138
138
|
name: "entry point",
|
|
139
139
|
char: "e",
|
|
140
140
|
description: "This is the first view or page (see -t) after the login.",
|
|
141
141
|
}),
|
|
142
|
-
entryPointType:
|
|
142
|
+
entryPointType: Flags.string({
|
|
143
143
|
name: "entry point type",
|
|
144
144
|
char: "t",
|
|
145
145
|
description:
|
|
146
146
|
"Type of the entry point ('view' or 'page'). The default is 'view'.",
|
|
147
147
|
}),
|
|
148
|
-
localUserTables:
|
|
148
|
+
localUserTables: Flags.string({
|
|
149
149
|
name: "local user tables",
|
|
150
150
|
char: "l",
|
|
151
151
|
description: "user defined tables that should be replicated into the app",
|
|
152
152
|
multiple: true,
|
|
153
153
|
}),
|
|
154
|
-
synchedTables:
|
|
154
|
+
synchedTables: Flags.string({
|
|
155
155
|
name: "synched tables",
|
|
156
156
|
string: "synchedTables",
|
|
157
157
|
description:
|
|
158
158
|
"Table names for which the offline should be synchronized with the saltcorn server",
|
|
159
159
|
multiple: true,
|
|
160
160
|
}),
|
|
161
|
-
includedPlugins:
|
|
161
|
+
includedPlugins: Flags.string({
|
|
162
162
|
name: "included plugins",
|
|
163
163
|
string: "includedPlugins",
|
|
164
164
|
description:
|
|
@@ -166,92 +166,92 @@ BuildAppCommand.flags = {
|
|
|
166
166
|
"If empty, no modules are used.",
|
|
167
167
|
multiple: true,
|
|
168
168
|
}),
|
|
169
|
-
useDocker:
|
|
169
|
+
useDocker: Flags.boolean({
|
|
170
170
|
name: "use docker build container",
|
|
171
171
|
char: "d",
|
|
172
172
|
description: "Use a docker container to build the app.",
|
|
173
173
|
}),
|
|
174
|
-
buildDirectory:
|
|
174
|
+
buildDirectory: Flags.string({
|
|
175
175
|
name: "build directory",
|
|
176
176
|
char: "b",
|
|
177
177
|
description: "A directory where the app should be build",
|
|
178
178
|
}),
|
|
179
|
-
copyAppDirectory:
|
|
179
|
+
copyAppDirectory: Flags.string({
|
|
180
180
|
name: "app target-directory",
|
|
181
181
|
char: "c",
|
|
182
182
|
description:
|
|
183
183
|
"If set, the app file will be copied here, please set 'user email', too",
|
|
184
184
|
}),
|
|
185
|
-
userEmail:
|
|
185
|
+
userEmail: Flags.string({
|
|
186
186
|
name: "user email",
|
|
187
187
|
char: "u",
|
|
188
188
|
description: "Email of the user building the app",
|
|
189
189
|
}),
|
|
190
|
-
appName:
|
|
190
|
+
appName: Flags.string({
|
|
191
191
|
name: "app name",
|
|
192
192
|
string: "appName",
|
|
193
193
|
description: "Name of the mobile app (default SaltcornMobileApp)",
|
|
194
194
|
}),
|
|
195
|
-
appId:
|
|
195
|
+
appId: Flags.string({
|
|
196
196
|
name: "app id",
|
|
197
197
|
string: "appId",
|
|
198
198
|
description: "Id of the mobile app (default com.saltcorn.mobileapp)",
|
|
199
199
|
}),
|
|
200
|
-
appVersion:
|
|
200
|
+
appVersion: Flags.string({
|
|
201
201
|
name: "app version",
|
|
202
202
|
string: "appVersion",
|
|
203
203
|
description: "Version of the mobile app (default 1.0.0)",
|
|
204
204
|
}),
|
|
205
|
-
appIcon:
|
|
205
|
+
appIcon: Flags.string({
|
|
206
206
|
name: "app icon",
|
|
207
207
|
string: "appIcon",
|
|
208
208
|
description:
|
|
209
209
|
"A png that will be used as launcher icon. The default is a png of a saltcorn symbol.",
|
|
210
210
|
}),
|
|
211
|
-
serverURL:
|
|
211
|
+
serverURL: Flags.string({
|
|
212
212
|
name: "server URL",
|
|
213
213
|
char: "s",
|
|
214
214
|
description: "URL to a saltcorn server",
|
|
215
215
|
}),
|
|
216
|
-
splashPage:
|
|
216
|
+
splashPage: Flags.string({
|
|
217
217
|
name: "splash page",
|
|
218
218
|
string: "splashPage",
|
|
219
219
|
description:
|
|
220
220
|
"Name of a page that should be shown while the app is loading.",
|
|
221
221
|
}),
|
|
222
|
-
autoPublicLogin:
|
|
222
|
+
autoPublicLogin: Flags.boolean({
|
|
223
223
|
name: "auto public login",
|
|
224
224
|
string: "autoPublicLogin",
|
|
225
225
|
description: "Show public entry points before the login as a public user.",
|
|
226
226
|
}),
|
|
227
|
-
allowOfflineMode:
|
|
227
|
+
allowOfflineMode: Flags.boolean({
|
|
228
228
|
name: "Allow offline mode",
|
|
229
229
|
string: "allowOfflineMode",
|
|
230
230
|
description:
|
|
231
231
|
"Switch to offline mode when there is no internet, sync the data when a connection is available again.",
|
|
232
232
|
}),
|
|
233
|
-
provisioningProfile:
|
|
233
|
+
provisioningProfile: Flags.string({
|
|
234
234
|
name: "provisioning profile",
|
|
235
235
|
string: "provisioningProfile",
|
|
236
236
|
description: "This profile will be used to sign your app",
|
|
237
237
|
}),
|
|
238
|
-
buildType:
|
|
238
|
+
buildType: Flags.string({
|
|
239
239
|
name: "build type",
|
|
240
240
|
string: "buildType",
|
|
241
241
|
description: "debug or release build",
|
|
242
242
|
}),
|
|
243
|
-
androidKeystore:
|
|
243
|
+
androidKeystore: Flags.string({
|
|
244
244
|
name: "android key store",
|
|
245
245
|
string: "androidKeyStore",
|
|
246
246
|
description:
|
|
247
247
|
"A self-signed certificate that includes the private key used to sign your app.",
|
|
248
248
|
}),
|
|
249
|
-
androidKeyStoreAlias:
|
|
249
|
+
androidKeyStoreAlias: Flags.string({
|
|
250
250
|
name: "android key store alias",
|
|
251
251
|
string: "keyStoreAlias",
|
|
252
252
|
description: "A unique name to identify the key within the keystore file.",
|
|
253
253
|
}),
|
|
254
|
-
androidKeystorePassword:
|
|
254
|
+
androidKeystorePassword: Flags.string({
|
|
255
255
|
name: "android key store password",
|
|
256
256
|
string: "keyStorePassword",
|
|
257
257
|
description: "he password to access the keystore file.",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { Command,
|
|
1
|
+
const { Command, Flags } = require("@oclif/core");
|
|
2
2
|
const { join } = require("path");
|
|
3
3
|
const { spawnSync } = require("child_process");
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ const { spawnSync } = require("child_process");
|
|
|
9
9
|
*/
|
|
10
10
|
class BuildCordovaBuilder extends Command {
|
|
11
11
|
async run() {
|
|
12
|
-
const { flags } = this.parse(BuildCordovaBuilder);
|
|
12
|
+
const { flags } = await this.parse(BuildCordovaBuilder);
|
|
13
13
|
const dockerDir = join(
|
|
14
14
|
require.resolve("@saltcorn/mobile-builder"),
|
|
15
15
|
"..",
|
|
@@ -38,7 +38,7 @@ BuildCordovaBuilder.help =
|
|
|
38
38
|
"Please make sure docker is callable without using root (see rootless mode, or add the user to the docker group).";
|
|
39
39
|
|
|
40
40
|
BuildCordovaBuilder.flags = {
|
|
41
|
-
buildClean:
|
|
41
|
+
buildClean: Flags.boolean({
|
|
42
42
|
name: "build clean",
|
|
43
43
|
string: "clean",
|
|
44
44
|
description: "run a clean build with --no-cache",
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* @category saltcorn-cli
|
|
3
3
|
* @module commands/configuration-check-backups
|
|
4
4
|
*/
|
|
5
|
-
const { Command,
|
|
6
|
-
const { cli } = require("cli-ux");
|
|
5
|
+
const { Command, Flags, Args, ux } = require("@oclif/core");
|
|
7
6
|
const { maybe_as_tenant, init_some_tenants } = require("../common");
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -17,7 +16,7 @@ class ConfigurationCheckBackupsCommand extends Command {
|
|
|
17
16
|
* @returns {Promise<void>}
|
|
18
17
|
*/
|
|
19
18
|
async run() {
|
|
20
|
-
const { argv, flags } = this.parse(ConfigurationCheckBackupsCommand);
|
|
19
|
+
const { argv, flags } = await this.parse(ConfigurationCheckBackupsCommand);
|
|
21
20
|
//await init_some_tenants(flags.tenant);
|
|
22
21
|
const {
|
|
23
22
|
runConfigurationCheck,
|
|
@@ -95,16 +94,15 @@ ConfigurationCheckBackupsCommand.description = `Check configuration`;
|
|
|
95
94
|
/**
|
|
96
95
|
* @type {object}
|
|
97
96
|
*/
|
|
98
|
-
ConfigurationCheckBackupsCommand.args =
|
|
99
|
-
{
|
|
100
|
-
name: "files",
|
|
97
|
+
ConfigurationCheckBackupsCommand.args = {
|
|
98
|
+
files: Args.string({
|
|
101
99
|
required: true,
|
|
102
100
|
description: "backup file to check. can be repeated, e.g. with *",
|
|
103
|
-
},
|
|
104
|
-
|
|
101
|
+
}),
|
|
102
|
+
};
|
|
105
103
|
|
|
106
104
|
ConfigurationCheckBackupsCommand.flags = {
|
|
107
|
-
destructive:
|
|
105
|
+
destructive: Flags.boolean({
|
|
108
106
|
char: "d",
|
|
109
107
|
description: "destructive",
|
|
110
108
|
}),
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* @category saltcorn-cli
|
|
3
3
|
* @module commands/configuration-check
|
|
4
4
|
*/
|
|
5
|
-
const { Command,
|
|
6
|
-
const { cli } = require("cli-ux");
|
|
5
|
+
const { Command, Flags, ux } = require("@oclif/core");
|
|
7
6
|
const { maybe_as_tenant, init_some_tenants } = require("../common");
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -16,7 +15,7 @@ class ConfigurationCheckCommand extends Command {
|
|
|
16
15
|
* @returns {Promise<void>}
|
|
17
16
|
*/
|
|
18
17
|
async run() {
|
|
19
|
-
const { flags } = this.parse(ConfigurationCheckCommand);
|
|
18
|
+
const { flags } = await this.parse(ConfigurationCheckCommand);
|
|
20
19
|
await init_some_tenants(flags.tenant);
|
|
21
20
|
const {
|
|
22
21
|
runConfigurationCheck,
|
|
@@ -56,11 +55,11 @@ ConfigurationCheckCommand.description = `Check configuration`;
|
|
|
56
55
|
* @type {object}
|
|
57
56
|
*/
|
|
58
57
|
ConfigurationCheckCommand.flags = {
|
|
59
|
-
tenant:
|
|
58
|
+
tenant: Flags.string({
|
|
60
59
|
char: "t",
|
|
61
60
|
description: "tenant",
|
|
62
61
|
}),
|
|
63
|
-
/*destructive:
|
|
62
|
+
/*destructive: Flags.boolean({
|
|
64
63
|
char: "d",
|
|
65
64
|
description: "destructive",
|
|
66
65
|
}),*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @category saltcorn-cli
|
|
3
3
|
* @module commands/create-tenant
|
|
4
4
|
*/
|
|
5
|
-
const { Command,
|
|
5
|
+
const { Command, Flags, Args } = require("@oclif/core");
|
|
6
6
|
|
|
7
7
|
//const {
|
|
8
8
|
// getConfig,
|
|
@@ -18,8 +18,7 @@ class CreateTenantCommand extends Command {
|
|
|
18
18
|
* @returns {Promise<void>}
|
|
19
19
|
*/
|
|
20
20
|
async run() {
|
|
21
|
-
const { args } = this.parse(CreateTenantCommand);
|
|
22
|
-
const { flags } = this.parse(CreateTenantCommand);
|
|
21
|
+
const { args, flags } = await this.parse(CreateTenantCommand);
|
|
23
22
|
const db = require("@saltcorn/data/db");
|
|
24
23
|
const { add_tenant } = require("@saltcorn/data/db/state");
|
|
25
24
|
if (!db.is_it_multi_tenant()) {
|
|
@@ -51,9 +50,12 @@ class CreateTenantCommand extends Command {
|
|
|
51
50
|
/**
|
|
52
51
|
* @type {object}
|
|
53
52
|
*/
|
|
54
|
-
CreateTenantCommand.args =
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
CreateTenantCommand.args = {
|
|
54
|
+
tenant: Args.string({
|
|
55
|
+
required: true,
|
|
56
|
+
description: "Tenant subdomain to create",
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
57
59
|
|
|
58
60
|
/**
|
|
59
61
|
* @type {string}
|
|
@@ -64,17 +66,17 @@ CreateTenantCommand.description = `Create a tenant`;
|
|
|
64
66
|
* @type {object}
|
|
65
67
|
*/
|
|
66
68
|
CreateTenantCommand.flags = {
|
|
67
|
-
url:
|
|
69
|
+
url: Flags.string({
|
|
68
70
|
name: "url",
|
|
69
71
|
//char: "",
|
|
70
72
|
description: "Url of tenant",
|
|
71
73
|
}),
|
|
72
|
-
email:
|
|
74
|
+
email: Flags.string({
|
|
73
75
|
name: "email",
|
|
74
76
|
char: "e",
|
|
75
77
|
description: "Email of owner of tenant",
|
|
76
78
|
}),
|
|
77
|
-
description:
|
|
79
|
+
description: Flags.string({
|
|
78
80
|
name: "description",
|
|
79
81
|
char: "d",
|
|
80
82
|
description: "Description of tenant",
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* @category saltcorn-cli
|
|
3
3
|
* @module commands/create-user
|
|
4
4
|
*/
|
|
5
|
-
const { Command,
|
|
6
|
-
const { cli } = require("cli-ux");
|
|
5
|
+
const { Command, Flags, ux } = require("@oclif/core");
|
|
7
6
|
const { maybe_as_tenant, init_some_tenants } = require("../common");
|
|
8
7
|
|
|
9
8
|
// todo update logic based on modify-user command
|
|
@@ -19,7 +18,7 @@ class CreateUserCommand extends Command {
|
|
|
19
18
|
async run() {
|
|
20
19
|
const User = require("@saltcorn/data/models/user");
|
|
21
20
|
|
|
22
|
-
const { flags } = this.parse(CreateUserCommand);
|
|
21
|
+
const { flags } = await this.parse(CreateUserCommand);
|
|
23
22
|
if (flags.admin && flags.role && flags.role !== "admin") {
|
|
24
23
|
console.error("Error: specify at most one of admin and role");
|
|
25
24
|
this.exit(1);
|
|
@@ -39,9 +38,9 @@ class CreateUserCommand extends Command {
|
|
|
39
38
|
}
|
|
40
39
|
role_id = role.id;
|
|
41
40
|
}
|
|
42
|
-
const email = flags.email || (await
|
|
41
|
+
const email = flags.email || (await ux.prompt("Email address"));
|
|
43
42
|
const password =
|
|
44
|
-
flags.password || (await
|
|
43
|
+
flags.password || (await ux.prompt("Password", { type: "hide" }));
|
|
45
44
|
const u = await User.create({ email, password, role_id });
|
|
46
45
|
if (u instanceof User)
|
|
47
46
|
console.log(
|
|
@@ -66,20 +65,20 @@ CreateUserCommand.description = `Create a new user`;
|
|
|
66
65
|
* @type {object}
|
|
67
66
|
*/
|
|
68
67
|
CreateUserCommand.flags = {
|
|
69
|
-
admin:
|
|
70
|
-
tenant:
|
|
68
|
+
admin: Flags.boolean({ char: "a", description: "Admin user" }),
|
|
69
|
+
tenant: Flags.string({
|
|
71
70
|
char: "t",
|
|
72
71
|
description: "tenant",
|
|
73
72
|
}),
|
|
74
|
-
email:
|
|
73
|
+
email: Flags.string({
|
|
75
74
|
char: "e",
|
|
76
75
|
description: "email",
|
|
77
76
|
}),
|
|
78
|
-
role:
|
|
77
|
+
role: Flags.string({
|
|
79
78
|
char: "r",
|
|
80
79
|
description: "role",
|
|
81
80
|
}),
|
|
82
|
-
password:
|
|
81
|
+
password: Flags.string({
|
|
83
82
|
char: "p",
|
|
84
83
|
description: "password",
|
|
85
84
|
}),
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// todo support for users without emails (using user.id)
|
|
7
|
-
const { Command,
|
|
8
|
-
const { cli } = require("cli-ux");
|
|
7
|
+
const { Command, Flags, Args, ux } = require("@oclif/core");
|
|
9
8
|
const { maybe_as_tenant } = require("../common");
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -20,8 +19,8 @@ class DeleteUserCommand extends Command {
|
|
|
20
19
|
async run() {
|
|
21
20
|
const User = require("@saltcorn/data/models/user");
|
|
22
21
|
|
|
23
|
-
const { args } = this.parse(DeleteUserCommand);
|
|
24
|
-
const { flags } = this.parse(DeleteUserCommand);
|
|
22
|
+
const { args } = await this.parse(DeleteUserCommand);
|
|
23
|
+
const { flags } = await this.parse(DeleteUserCommand);
|
|
25
24
|
|
|
26
25
|
// run function as specified tenant
|
|
27
26
|
await maybe_as_tenant(flags.tenant, async () => {
|
|
@@ -39,7 +38,7 @@ class DeleteUserCommand extends Command {
|
|
|
39
38
|
// make changes
|
|
40
39
|
// todo handle errors
|
|
41
40
|
if (!flags.force) {
|
|
42
|
-
const ans = await
|
|
41
|
+
const ans = await ux.confirm(
|
|
43
42
|
`This will delete user ${args.user_email} ${
|
|
44
43
|
typeof flags.tenant !== "undefined" ? "from " + flags.tenant : ""
|
|
45
44
|
}.\nContinue (y/n)?`
|
|
@@ -65,9 +64,12 @@ class DeleteUserCommand extends Command {
|
|
|
65
64
|
/**
|
|
66
65
|
* @type {object}
|
|
67
66
|
*/
|
|
68
|
-
DeleteUserCommand.args =
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
DeleteUserCommand.args = {
|
|
68
|
+
user_email: Args.string({
|
|
69
|
+
required: true,
|
|
70
|
+
description: "User to delete",
|
|
71
|
+
}),
|
|
72
|
+
};
|
|
71
73
|
|
|
72
74
|
/**
|
|
73
75
|
* @type {string}
|
|
@@ -91,8 +93,8 @@ Command deletes the user specified by USER_EMAIL.
|
|
|
91
93
|
* @type {object}
|
|
92
94
|
*/
|
|
93
95
|
DeleteUserCommand.flags = {
|
|
94
|
-
force:
|
|
95
|
-
tenant:
|
|
96
|
+
force: Flags.boolean({ char: "f", description: "force command execution" }),
|
|
97
|
+
tenant: Flags.string({
|
|
96
98
|
char: "t",
|
|
97
99
|
description: "tenant",
|
|
98
100
|
}),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @category saltcorn-cli
|
|
3
3
|
* @module commands/localize-plugin
|
|
4
4
|
*/
|
|
5
|
-
const { Command,
|
|
5
|
+
const { Command, Flags, Args } = require("@oclif/core");
|
|
6
6
|
const { maybe_as_tenant } = require("../../common");
|
|
7
7
|
const path = require("path");
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ class LocalizePluginCommand extends Command {
|
|
|
18
18
|
async run() {
|
|
19
19
|
const db = require("@saltcorn/data/db");
|
|
20
20
|
const Plugin = require("@saltcorn/data/models/plugin");
|
|
21
|
-
const { args, flags } = this.parse(LocalizePluginCommand);
|
|
21
|
+
const { args, flags } = await this.parse(LocalizePluginCommand);
|
|
22
22
|
await maybe_as_tenant(flags.tenant, async () => {
|
|
23
23
|
const plugin = await Plugin.findOne({ name: args.plugin });
|
|
24
24
|
if (
|
|
@@ -50,13 +50,15 @@ class LocalizePluginCommand extends Command {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
LocalizePluginCommand.args =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
LocalizePluginCommand.args = {
|
|
54
|
+
plugin: Args.string({
|
|
55
|
+
required: true,
|
|
56
|
+
description: "Current plugin name",
|
|
57
|
+
}),
|
|
58
|
+
path: Args.string({
|
|
57
59
|
description: "Absolute path to local plugin",
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
60
62
|
|
|
61
63
|
/**
|
|
62
64
|
* @type {string}
|
|
@@ -67,11 +69,11 @@ LocalizePluginCommand.description = `Convert plugin to local plugin`;
|
|
|
67
69
|
* @type {object}
|
|
68
70
|
*/
|
|
69
71
|
LocalizePluginCommand.flags = {
|
|
70
|
-
unlocalize:
|
|
72
|
+
unlocalize: Flags.boolean({
|
|
71
73
|
char: "u",
|
|
72
74
|
description: "Unlocalize plugin (local to npm)",
|
|
73
75
|
}),
|
|
74
|
-
tenant:
|
|
76
|
+
tenant: Flags.string({
|
|
75
77
|
char: "t",
|
|
76
78
|
description: "tenant",
|
|
77
79
|
}),
|