@saltcorn/cli 0.6.1-beta.0 → 0.6.2-beta.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/README.md +32 -28
- package/npm-shrinkwrap.json +320 -598
- package/oclif.manifest.json +1 -1
- package/package.json +13 -10
- package/src/commands/add-schema.js +15 -0
- package/src/commands/backup.js +18 -0
- package/src/commands/create-tenant.js +21 -0
- package/src/commands/create-user.js +18 -0
- package/src/commands/fixtures.js +18 -0
- package/src/commands/info.js +29 -0
- package/src/commands/install-pack.js +18 -0
- package/src/commands/install-plugin.js +18 -0
- package/src/commands/list-tenants.js +19 -0
- package/src/commands/localize-plugin.js +38 -12
- package/src/commands/make-migration.js +21 -0
- package/src/commands/migrate.js +22 -1
- package/src/commands/plugins.js +22 -0
- package/src/commands/release.js +36 -1
- package/src/commands/reset-schema.js +18 -0
- package/src/commands/restore.js +34 -0
- package/src/commands/rm-tenant.js +21 -0
- package/src/commands/run-benchmark.js +36 -0
- package/src/commands/run-tests.js +45 -0
- package/src/commands/scheduler.js +19 -0
- package/src/commands/serve.js +24 -1
- package/src/commands/set-cfg.js +23 -0
- package/src/commands/setup-benchmark.js +23 -0
- package/src/commands/setup.js +82 -0
- package/src/commands/test-plugin.js +23 -0
- package/src/commands/transform-field.js +21 -0
- package/src/common.js +18 -0
- package/src/index.js +33 -0
package/src/commands/plugins.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/plugins
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
8
|
* Plugins list and update command
|
|
9
|
+
* @extends oclif.Command
|
|
10
|
+
* @category saltcorn-cli
|
|
5
11
|
*/
|
|
6
12
|
class PluginsCommand extends Command {
|
|
13
|
+
/**
|
|
14
|
+
* @returns {Promise<void>}
|
|
15
|
+
*/
|
|
7
16
|
async run() {
|
|
8
17
|
const db = require("@saltcorn/data/db");
|
|
9
18
|
const { requirePlugin } = require("@saltcorn/server/load_plugins");
|
|
@@ -77,6 +86,9 @@ class PluginsCommand extends Command {
|
|
|
77
86
|
}
|
|
78
87
|
}
|
|
79
88
|
|
|
89
|
+
/**
|
|
90
|
+
* @type {object}
|
|
91
|
+
*/
|
|
80
92
|
PluginsCommand.flags = {
|
|
81
93
|
//list: flags.boolean({ char: "l", description: "List" }),
|
|
82
94
|
upgrade: flags.boolean({ char: "u", description: "Upgrade" }),
|
|
@@ -91,17 +103,27 @@ PluginsCommand.flags = {
|
|
|
91
103
|
};
|
|
92
104
|
|
|
93
105
|
// TODO Extra documentation goes here
|
|
106
|
+
/**
|
|
107
|
+
* @type {string}
|
|
108
|
+
*/
|
|
94
109
|
PluginsCommand.description = `List and upgrade plugins for tenants
|
|
95
110
|
...
|
|
96
111
|
Extra documentation goes here
|
|
97
112
|
`;
|
|
98
113
|
|
|
114
|
+
/**
|
|
115
|
+
* @type {string}
|
|
116
|
+
*/
|
|
99
117
|
PluginsCommand.examples = [ //"plugins -l - outputs detailed information about plugins",
|
|
100
118
|
"plugins -v - verbose output of commands",
|
|
101
119
|
"plugins -u -d - dry-run for plugin update",
|
|
102
120
|
"plugins -u -f - force plugin update"
|
|
103
121
|
];
|
|
122
|
+
|
|
104
123
|
// TODO Extra help here
|
|
124
|
+
/**
|
|
125
|
+
* @type {string}
|
|
126
|
+
*/
|
|
105
127
|
PluginsCommand.help= "Extra help here"
|
|
106
128
|
|
|
107
129
|
// PluginsCommand.usage
|
package/src/commands/release.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/release
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
const fs = require("fs");
|
|
3
7
|
const { spawnSync } = require("child_process");
|
|
4
8
|
|
|
9
|
+
/**
|
|
10
|
+
* ReleaseCommand Class
|
|
11
|
+
* @extends oclif.Command
|
|
12
|
+
* @category saltcorn-cli
|
|
13
|
+
*/
|
|
5
14
|
class ReleaseCommand extends Command {
|
|
15
|
+
/**
|
|
16
|
+
* @returns {Promise<void>}
|
|
17
|
+
*/
|
|
6
18
|
async run() {
|
|
7
19
|
const {
|
|
8
20
|
args: { version },
|
|
@@ -10,6 +22,9 @@ class ReleaseCommand extends Command {
|
|
|
10
22
|
|
|
11
23
|
const pkgs = {
|
|
12
24
|
"@saltcorn/e2e": { dir: "e2e" },
|
|
25
|
+
"@saltcorn/db-common": { dir: "db-common", publish: true },
|
|
26
|
+
"@saltcorn/sqlite": { dir: "sqlite", publish: true },
|
|
27
|
+
"@saltcorn/postgres": { dir: "postgres", publish: true },
|
|
13
28
|
"@saltcorn/builder": { dir: "saltcorn-builder", publish: true },
|
|
14
29
|
"@saltcorn/data": { dir: "saltcorn-data", publish: true },
|
|
15
30
|
"@saltcorn/random-tests": { dir: "saltcorn-random-tests" },
|
|
@@ -29,18 +44,31 @@ class ReleaseCommand extends Command {
|
|
|
29
44
|
json.dependencies[dpkgnm] = version;
|
|
30
45
|
if (json.devDependencies && json.devDependencies[dpkgnm])
|
|
31
46
|
json.devDependencies[dpkgnm] = version;
|
|
47
|
+
if (json.optionalDependencies && json.optionalDependencies[dpkgnm])
|
|
48
|
+
json.optionalDependencies[dpkgnm] = version;
|
|
32
49
|
});
|
|
33
50
|
fs.writeFileSync(
|
|
34
51
|
`packages/${dir}/package.json`,
|
|
35
52
|
JSON.stringify(json, null, 2)
|
|
36
53
|
);
|
|
37
54
|
};
|
|
55
|
+
const compileTsFiles = () => {
|
|
56
|
+
spawnSync("npm", ["install"], {
|
|
57
|
+
stdio: "inherit",
|
|
58
|
+
cwd: ".",
|
|
59
|
+
});
|
|
60
|
+
spawnSync("npm", ["run", "tsc"], {
|
|
61
|
+
stdio: "inherit",
|
|
62
|
+
cwd: ".",
|
|
63
|
+
});
|
|
64
|
+
}
|
|
38
65
|
const publish = (dir) =>
|
|
39
66
|
spawnSync("npm", ["publish"], {
|
|
40
67
|
stdio: "inherit",
|
|
41
68
|
cwd: `packages/${dir}/`,
|
|
42
69
|
});
|
|
43
70
|
|
|
71
|
+
compileTsFiles();
|
|
44
72
|
//for each package:
|
|
45
73
|
// 1. update version
|
|
46
74
|
// 2. update dependencies for other packages
|
|
@@ -71,7 +99,7 @@ class ReleaseCommand extends Command {
|
|
|
71
99
|
publish("saltcorn-cli");
|
|
72
100
|
|
|
73
101
|
// update Dockerfile
|
|
74
|
-
const dockerfile = fs.readFileSync(`Dockerfile.release`,
|
|
102
|
+
const dockerfile = fs.readFileSync(`Dockerfile.release`, "utf8");
|
|
75
103
|
fs.writeFileSync(
|
|
76
104
|
`Dockerfile.release`,
|
|
77
105
|
dockerfile.replace(/cli\@.* --unsafe/, `cli@${version} --unsafe`)
|
|
@@ -91,12 +119,19 @@ class ReleaseCommand extends Command {
|
|
|
91
119
|
});
|
|
92
120
|
console.log("Now run:\n");
|
|
93
121
|
console.log(" rm -rf packages/saltcorn-cli/node_modules\n");
|
|
122
|
+
console.log(" rm -rf node_modules\n");
|
|
94
123
|
this.exit(0);
|
|
95
124
|
}
|
|
96
125
|
}
|
|
97
126
|
|
|
127
|
+
/**
|
|
128
|
+
* @type {string}
|
|
129
|
+
*/
|
|
98
130
|
ReleaseCommand.description = `Release a new saltcorn version`;
|
|
99
131
|
|
|
132
|
+
/**
|
|
133
|
+
* @type {object}
|
|
134
|
+
*/
|
|
100
135
|
ReleaseCommand.args = [
|
|
101
136
|
{ name: "version", required: true, description: "New version number" },
|
|
102
137
|
];
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/reset-schema
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
const { cli } = require("cli-ux");
|
|
3
7
|
const { maybe_as_tenant } = require("../common");
|
|
4
8
|
|
|
9
|
+
/**
|
|
10
|
+
* ResetCommand Class
|
|
11
|
+
* @extends oclif.Command
|
|
12
|
+
* @category saltcorn-cli
|
|
13
|
+
*/
|
|
5
14
|
class ResetCommand extends Command {
|
|
15
|
+
/**
|
|
16
|
+
* @returns {Promise<void>}
|
|
17
|
+
*/
|
|
6
18
|
async run() {
|
|
7
19
|
const reset = require("@saltcorn/data/db/reset_schema");
|
|
8
20
|
const db = require("@saltcorn/data/db/");
|
|
@@ -24,11 +36,17 @@ class ResetCommand extends Command {
|
|
|
24
36
|
}
|
|
25
37
|
}
|
|
26
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @type {string}
|
|
41
|
+
*/
|
|
27
42
|
ResetCommand.description = `Reset the database
|
|
28
43
|
...
|
|
29
44
|
This will delete all existing information
|
|
30
45
|
`;
|
|
31
46
|
|
|
47
|
+
/**
|
|
48
|
+
* @type {object}
|
|
49
|
+
*/
|
|
32
50
|
ResetCommand.flags = {
|
|
33
51
|
force: flags.boolean({ char: "f", description: "force" }),
|
|
34
52
|
tenant: flags.string({
|
package/src/commands/restore.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/restore
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
const { spawnSync } = require("child_process");
|
|
3
7
|
const path = require("path");
|
|
4
8
|
const { maybe_as_tenant } = require("../common");
|
|
5
9
|
|
|
10
|
+
/**
|
|
11
|
+
* RestoreCommand Class
|
|
12
|
+
* @extends oclif.Command
|
|
13
|
+
* @category saltcorn-cli
|
|
14
|
+
*/
|
|
6
15
|
class RestoreCommand extends Command {
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param {string} fnm
|
|
19
|
+
* @returns {Promise<void>}
|
|
20
|
+
*/
|
|
7
21
|
async pg_restore(fnm) {
|
|
8
22
|
const { getConnectObject } = require("@saltcorn/data/db/connect");
|
|
9
23
|
const connobj = getConnectObject();
|
|
@@ -19,6 +33,13 @@ class RestoreCommand extends Command {
|
|
|
19
33
|
);
|
|
20
34
|
this.exit(res.status);
|
|
21
35
|
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param {string} fnm
|
|
40
|
+
* @param {object} tenant
|
|
41
|
+
* @returns {Promise<void>}
|
|
42
|
+
*/
|
|
22
43
|
async zip_restore(fnm, tenant) {
|
|
23
44
|
const { restore } = require("@saltcorn/data/models/backup");
|
|
24
45
|
const User = require("@saltcorn/data/models/user");
|
|
@@ -34,6 +55,10 @@ class RestoreCommand extends Command {
|
|
|
34
55
|
}
|
|
35
56
|
});
|
|
36
57
|
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @returns {Promise<void>}
|
|
61
|
+
*/
|
|
37
62
|
async run() {
|
|
38
63
|
const { args, flags } = this.parse(RestoreCommand);
|
|
39
64
|
switch (path.extname(args.file)) {
|
|
@@ -54,12 +79,21 @@ class RestoreCommand extends Command {
|
|
|
54
79
|
}
|
|
55
80
|
}
|
|
56
81
|
|
|
82
|
+
/**
|
|
83
|
+
* @type {object}
|
|
84
|
+
*/
|
|
57
85
|
RestoreCommand.args = [
|
|
58
86
|
{ name: "file", required: true, description: "backup file to restore" },
|
|
59
87
|
];
|
|
60
88
|
|
|
89
|
+
/**
|
|
90
|
+
* @type {string}
|
|
91
|
+
*/
|
|
61
92
|
RestoreCommand.description = `Restore a previously backed up database (zip or sqlc format)`;
|
|
62
93
|
|
|
94
|
+
/**
|
|
95
|
+
* @type {object}
|
|
96
|
+
*/
|
|
63
97
|
RestoreCommand.flags = {
|
|
64
98
|
tenant: flags.string({
|
|
65
99
|
char: "t",
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/rm-tenant
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
|
|
7
|
+
/**
|
|
8
|
+
* RmTenantCommand Class
|
|
9
|
+
* @extends oclif.Command
|
|
10
|
+
* @category saltcorn-cli
|
|
11
|
+
*/
|
|
3
12
|
class RmTenantCommand extends Command {
|
|
13
|
+
/**
|
|
14
|
+
* @returns {Promise<void>}
|
|
15
|
+
*/
|
|
4
16
|
async run() {
|
|
5
17
|
const { args } = this.parse(RmTenantCommand);
|
|
6
18
|
const { deleteTenant } = require("@saltcorn/data/models/tenant");
|
|
@@ -9,12 +21,21 @@ class RmTenantCommand extends Command {
|
|
|
9
21
|
}
|
|
10
22
|
}
|
|
11
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @type {object}
|
|
26
|
+
*/
|
|
12
27
|
RmTenantCommand.args = [
|
|
13
28
|
{ name: "tenant", required: true, description: "Tenant to remove" },
|
|
14
29
|
];
|
|
15
30
|
|
|
31
|
+
/**
|
|
32
|
+
* @type {string}
|
|
33
|
+
*/
|
|
16
34
|
RmTenantCommand.description = `Remove a tenant`;
|
|
17
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @type {object}
|
|
38
|
+
*/
|
|
18
39
|
RmTenantCommand.flags = {};
|
|
19
40
|
|
|
20
41
|
module.exports = RmTenantCommand;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/run-benchmark
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
const si = require("systeminformation");
|
|
3
7
|
const fetch = require("node-fetch");
|
|
@@ -6,9 +10,19 @@ const wrkCB = require("wrk");
|
|
|
6
10
|
const { sleep } = require("../common");
|
|
7
11
|
const packagejson = require("../../package.json");
|
|
8
12
|
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {string} s
|
|
16
|
+
* @returns {number}
|
|
17
|
+
*/
|
|
9
18
|
const parseMillisecs = (s) =>
|
|
10
19
|
s.endsWith("ms") ? parseFloat(s) : parseFloat(s) * 1000;
|
|
11
20
|
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param {*} args
|
|
24
|
+
* @returns {Promise<object>}
|
|
25
|
+
*/
|
|
12
26
|
const wrk = (args) =>
|
|
13
27
|
new Promise(function (resolve, reject) {
|
|
14
28
|
wrkCB(args, function (err, out) {
|
|
@@ -22,9 +36,22 @@ const wrk = (args) =>
|
|
|
22
36
|
});
|
|
23
37
|
});
|
|
24
38
|
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param {string} s
|
|
42
|
+
* @returns {string}
|
|
43
|
+
*/
|
|
25
44
|
const ensure_no_final_slash = (s) => (s.endsWith("/") ? s.slice(0, -1) : s);
|
|
26
45
|
|
|
46
|
+
/**
|
|
47
|
+
* RunBenchmarkCommand Class
|
|
48
|
+
* @extends oclif.Command
|
|
49
|
+
* @category saltcorn-cli
|
|
50
|
+
*/
|
|
27
51
|
class RunBenchmarkCommand extends Command {
|
|
52
|
+
/**
|
|
53
|
+
* @returns {Promise<void>}
|
|
54
|
+
*/
|
|
28
55
|
async run() {
|
|
29
56
|
const {
|
|
30
57
|
args: { baseurl },
|
|
@@ -108,12 +135,21 @@ class RunBenchmarkCommand extends Command {
|
|
|
108
135
|
}
|
|
109
136
|
}
|
|
110
137
|
|
|
138
|
+
/**
|
|
139
|
+
* @type {object}
|
|
140
|
+
*/
|
|
111
141
|
RunBenchmarkCommand.args = [
|
|
112
142
|
{ name: "baseurl", required: false, description: "Base URL" },
|
|
113
143
|
];
|
|
114
144
|
|
|
145
|
+
/**
|
|
146
|
+
* @type {string}
|
|
147
|
+
*/
|
|
115
148
|
RunBenchmarkCommand.description = `Run benchmark`;
|
|
116
149
|
|
|
150
|
+
/**
|
|
151
|
+
* @type {object}
|
|
152
|
+
*/
|
|
117
153
|
RunBenchmarkCommand.flags = {
|
|
118
154
|
token: flags.string({
|
|
119
155
|
char: "t",
|
|
@@ -1,9 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/run-tests
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
|
|
3
7
|
const { spawnSync, spawn } = require("child_process");
|
|
4
8
|
const { sleep } = require("../common");
|
|
5
9
|
|
|
10
|
+
/**
|
|
11
|
+
* RunTestsCommand Class
|
|
12
|
+
* @extends oclif.Command
|
|
13
|
+
* @category saltcorn-cli
|
|
14
|
+
*/
|
|
6
15
|
class RunTestsCommand extends Command {
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param {string} cmd
|
|
19
|
+
* @param {string[]} args
|
|
20
|
+
* @param {*} env
|
|
21
|
+
* @param {*} cwd
|
|
22
|
+
* @param {boolean} keepalive
|
|
23
|
+
* @returns {object}
|
|
24
|
+
*/
|
|
7
25
|
async do_test(cmd, args, env, cwd, keepalive) {
|
|
8
26
|
const res = spawnSync(cmd, args, {
|
|
9
27
|
stdio: "inherit",
|
|
@@ -13,6 +31,12 @@ class RunTestsCommand extends Command {
|
|
|
13
31
|
if (res.status !== 0 && !keepalive) this.exit(res.status);
|
|
14
32
|
return res;
|
|
15
33
|
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param {*} env
|
|
38
|
+
* @returns {Promise<void>}
|
|
39
|
+
*/
|
|
16
40
|
async e2etest(env) {
|
|
17
41
|
spawnSync("packages/saltcorn-cli/bin/saltcorn", ["fixtures", "-r"], {
|
|
18
42
|
stdio: "inherit",
|
|
@@ -38,6 +62,14 @@ class RunTestsCommand extends Command {
|
|
|
38
62
|
server.kill();
|
|
39
63
|
if (res.status !== 0) this.exit(res.status);
|
|
40
64
|
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @param {object} args
|
|
69
|
+
* @param {object} flags
|
|
70
|
+
* @throws {Error}
|
|
71
|
+
* @returns {void}
|
|
72
|
+
*/
|
|
41
73
|
validateCall(args, flags) {
|
|
42
74
|
if (!args.package && flags.testFilter) {
|
|
43
75
|
throw new Error(
|
|
@@ -50,6 +82,10 @@ class RunTestsCommand extends Command {
|
|
|
50
82
|
);
|
|
51
83
|
}
|
|
52
84
|
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @returns {Promise<void>}
|
|
88
|
+
*/
|
|
53
89
|
async run() {
|
|
54
90
|
const { args, flags } = this.parse(RunTestsCommand);
|
|
55
91
|
this.validateCall(args, flags);
|
|
@@ -111,12 +147,21 @@ class RunTestsCommand extends Command {
|
|
|
111
147
|
}
|
|
112
148
|
}
|
|
113
149
|
|
|
150
|
+
/**
|
|
151
|
+
* @type {object}
|
|
152
|
+
*/
|
|
114
153
|
RunTestsCommand.args = [
|
|
115
154
|
{ name: "package", description: "which package to run tests for" },
|
|
116
155
|
];
|
|
117
156
|
|
|
157
|
+
/**
|
|
158
|
+
* @type {string}
|
|
159
|
+
*/
|
|
118
160
|
RunTestsCommand.description = `Run test suites`;
|
|
119
161
|
|
|
162
|
+
/**
|
|
163
|
+
* @type {object}
|
|
164
|
+
*/
|
|
120
165
|
RunTestsCommand.flags = {
|
|
121
166
|
coverage: flags.boolean({ char: "c", description: "Coverage" }),
|
|
122
167
|
testFilter: flags.string({
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/scheduler
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ScheduleCommand Class
|
|
9
|
+
* @extends oclif.Command
|
|
10
|
+
* @category saltcorn-cli
|
|
11
|
+
*/
|
|
2
12
|
class ScheduleCommand extends Command {
|
|
13
|
+
/**
|
|
14
|
+
* @returns {Promise<void>}
|
|
15
|
+
*/
|
|
3
16
|
async run() {
|
|
4
17
|
const { flags } = this.parse(ScheduleCommand);
|
|
5
18
|
if (flags.verbose) {
|
|
@@ -11,8 +24,14 @@ class ScheduleCommand extends Command {
|
|
|
11
24
|
}
|
|
12
25
|
}
|
|
13
26
|
|
|
27
|
+
/**
|
|
28
|
+
* @type {string}
|
|
29
|
+
*/
|
|
14
30
|
ScheduleCommand.description = `Run the Saltcorn scheduler`;
|
|
15
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @type {object}
|
|
34
|
+
*/
|
|
16
35
|
ScheduleCommand.flags = {
|
|
17
36
|
verbose: flags.boolean({ char: "v", description: "Verbose" }),
|
|
18
37
|
};
|
package/src/commands/serve.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/serve
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
const si = require("systeminformation");
|
|
3
7
|
|
|
8
|
+
/**
|
|
9
|
+
* ServeCommand Class
|
|
10
|
+
* @extends oclif.Command
|
|
11
|
+
* @category saltcorn-cli
|
|
12
|
+
*/
|
|
4
13
|
class ServeCommand extends Command {
|
|
14
|
+
/**
|
|
15
|
+
* @returns {Promise<void>}
|
|
16
|
+
*/
|
|
5
17
|
async run() {
|
|
6
18
|
const { flags } = this.parse(ServeCommand);
|
|
7
19
|
const cpu = await si.cpu();
|
|
@@ -28,6 +40,7 @@ class ServeCommand extends Command {
|
|
|
28
40
|
if (flags.nomigrate) serveArgs.disableMigrate = true;
|
|
29
41
|
if (flags.noscheduler) serveArgs.disableScheduler = true;
|
|
30
42
|
if (flags.watchReaper) serveArgs.watchReaper = true;
|
|
43
|
+
if (flags.dev) serveArgs.dev = true;
|
|
31
44
|
if (flags.verbose) {
|
|
32
45
|
const db = require("@saltcorn/data/db");
|
|
33
46
|
db.set_sql_logging();
|
|
@@ -37,13 +50,23 @@ class ServeCommand extends Command {
|
|
|
37
50
|
}
|
|
38
51
|
}
|
|
39
52
|
|
|
53
|
+
/**
|
|
54
|
+
* @type {string}
|
|
55
|
+
*/
|
|
40
56
|
ServeCommand.description = `Start the Saltcorn server`;
|
|
41
57
|
|
|
58
|
+
/**
|
|
59
|
+
* @type {object}
|
|
60
|
+
*/
|
|
42
61
|
ServeCommand.flags = {
|
|
43
|
-
port: flags.integer({ char: "p", description: "port", default: 3000 }),
|
|
44
62
|
port: flags.integer({ char: "p", description: "port", default: 3000 }),
|
|
45
63
|
verbose: flags.boolean({ char: "v", description: "Verbose" }),
|
|
46
64
|
watchReaper: flags.boolean({ char: "r", description: "Watch reaper" }),
|
|
65
|
+
dev: flags.boolean({
|
|
66
|
+
string: "dev",
|
|
67
|
+
char: "d",
|
|
68
|
+
description: "Run in dev mode and re-start on file changes",
|
|
69
|
+
}),
|
|
47
70
|
addschema: flags.boolean({ char: "a", description: "Add schema if missing" }),
|
|
48
71
|
nomigrate: flags.boolean({ char: "n", description: "No migrations" }),
|
|
49
72
|
noscheduler: flags.boolean({ char: "s", description: "No scheduler" }),
|
package/src/commands/set-cfg.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/set-cfg
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
const { cli } = require("cli-ux");
|
|
3
7
|
const { maybe_as_tenant, parseJSONorString } = require("../common");
|
|
4
8
|
|
|
9
|
+
/**
|
|
10
|
+
* SetCfgCommand Class
|
|
11
|
+
* @extends oclif.Command
|
|
12
|
+
* @category saltcorn-cli
|
|
13
|
+
*/
|
|
5
14
|
class SetCfgCommand extends Command {
|
|
15
|
+
/**
|
|
16
|
+
* @returns {Promise<void>}
|
|
17
|
+
*/
|
|
6
18
|
async run() {
|
|
7
19
|
const { args, flags } = this.parse(SetCfgCommand);
|
|
8
20
|
await maybe_as_tenant(flags.tenant, async () => {
|
|
@@ -20,7 +32,14 @@ class SetCfgCommand extends Command {
|
|
|
20
32
|
}
|
|
21
33
|
}
|
|
22
34
|
|
|
35
|
+
/**
|
|
36
|
+
* @type {string}
|
|
37
|
+
*/
|
|
23
38
|
SetCfgCommand.description = `Set a configuration value`;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @type {object[]}
|
|
42
|
+
*/
|
|
24
43
|
SetCfgCommand.args = [
|
|
25
44
|
{ name: "key", required: true, description: "Configuration key" },
|
|
26
45
|
{
|
|
@@ -29,6 +48,10 @@ SetCfgCommand.args = [
|
|
|
29
48
|
description: "Configuration value (JSON or string)",
|
|
30
49
|
},
|
|
31
50
|
];
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @type {object}
|
|
54
|
+
*/
|
|
32
55
|
SetCfgCommand.flags = {
|
|
33
56
|
tenant: flags.string({
|
|
34
57
|
char: "t",
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/setup-benchmark
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
const { maybe_as_tenant } = require("../common");
|
|
3
7
|
|
|
8
|
+
/**
|
|
9
|
+
* SetupBenchmarkCommand Class
|
|
10
|
+
* @extends oclif.Command
|
|
11
|
+
* @category saltcorn-cli
|
|
12
|
+
*/
|
|
4
13
|
class SetupBenchmarkCommand extends Command {
|
|
14
|
+
/**
|
|
15
|
+
* @returns {Promise<void>}
|
|
16
|
+
*/
|
|
5
17
|
async install_forum_pack() {
|
|
6
18
|
const {
|
|
7
19
|
fetch_pack_by_name,
|
|
@@ -17,6 +29,10 @@ class SetupBenchmarkCommand extends Command {
|
|
|
17
29
|
load_plugins.loadAndSaveNewPlugin(p)
|
|
18
30
|
);
|
|
19
31
|
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @returns {Promise<void>}
|
|
35
|
+
*/
|
|
20
36
|
async run() {
|
|
21
37
|
const { args, flags } = this.parse(SetupBenchmarkCommand);
|
|
22
38
|
await maybe_as_tenant(flags.tenant, async () => {
|
|
@@ -62,10 +78,17 @@ class SetupBenchmarkCommand extends Command {
|
|
|
62
78
|
}
|
|
63
79
|
}
|
|
64
80
|
|
|
81
|
+
/** @type {object[]} */
|
|
65
82
|
SetupBenchmarkCommand.args = [];
|
|
66
83
|
|
|
84
|
+
/**
|
|
85
|
+
* @type {string}
|
|
86
|
+
*/
|
|
67
87
|
SetupBenchmarkCommand.description = `Setup an instance for benchmarking`;
|
|
68
88
|
|
|
89
|
+
/**
|
|
90
|
+
* @type {object}
|
|
91
|
+
*/
|
|
69
92
|
SetupBenchmarkCommand.flags = {
|
|
70
93
|
tenant: flags.string({
|
|
71
94
|
char: "t",
|