@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/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.6.1-beta.0","commands":{"add-schema":{"id":"add-schema","description":"Add Saltcorn schema to existing database","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"backup":{"id":"backup","description":"Backup the PostgreSQL database to a file with pg_dump or zip","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"output":{"name":"output","type":"option","char":"o","description":"output filename"},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"zip":{"name":"zip","type":"boolean","char":"z","description":"zip format","allowNo":false}},"args":[]},"create-tenant":{"id":"create-tenant","description":"Create a tenant","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"email":{"name":"email","type":"option","char":"e","description":"Email of owner of tenant"},"description":{"name":"description","type":"option","char":"d","description":"Description of tenant"}},"args":[{"name":"tenant","description":"Tenant subdomain to create","required":true}]},"create-user":{"id":"create-user","description":"Create a new user","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"admin":{"name":"admin","type":"boolean","char":"a","description":"Admin user","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"email":{"name":"email","type":"option","char":"e","description":"email"},"role":{"name":"role","type":"option","char":"r","description":"role"},"password":{"name":"password","type":"option","char":"p","description":"password"}},"args":[]},"fixtures":{"id":"fixtures","description":"Load fixtures for testing\n...\nThis manual step it is never required for users and rarely required for developers\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"reset":{"name":"reset","type":"boolean","char":"r","description":"Also reset schema","allowNo":false}},"args":[]},"info":{"id":"info","description":"Show paths\n...\nShow configuration and file store paths\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":["paths"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"json format","allowNo":false}},"args":[]},"install-pack":{"id":"install-pack","description":"Install a pack","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"name":{"name":"name","type":"option","char":"n","description":"Pack name in store"},"file":{"name":"file","type":"option","char":"f","description":"File with pack JSON"}},"args":[]},"install-plugin":{"id":"install-plugin","description":"Install a plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"name":{"name":"name","type":"option","char":"n","description":"Plugin name in store"},"directory":{"name":"directory","type":"option","char":"d","description":"Directory with local plugin"}},"args":[]},"list-tenants":{"id":"list-tenants","description":"List tenants in CSV format","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"localize-plugin":{"id":"localize-plugin","description":"Convert plugin to local plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"plugin","description":"Current plugin name","required":true},{"name":"path","description":"path to local plugin","required":true}]},"make-migration":{"id":"make-migration","description":"Create a new blank Database structure migration file.\nThese migrations update database structure.\nYou should not normally need to run this\nunless you are a developer.\n","usage":"make-migration","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"migrate":{"id":"migrate","description":"Run Database structure migrations\n...\nNOTE!\n- Please stop Saltcorn before run DB migrations.\n- Please make db backup before migration.\n- There are no way to rollback migration if you doesn't make backup.\n\nThis is not normally required as migrations will be run when the server starts.\nHowever, this command may be useful if you are running multiple application\nservers and need to control when the migrations are run.\n","usage":"saltcorn migrate","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"plugins":{"id":"plugins","description":"List and upgrade plugins for tenants\n...\nExtra documentation goes here\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"examples":["plugins -v - verbose output of commands","plugins -u -d - dry-run for plugin update","plugins -u -f - force plugin update"],"flags":{"upgrade":{"name":"upgrade","type":"boolean","char":"u","description":"Upgrade","allowNo":false},"dryRun":{"name":"dryRun","type":"boolean","char":"d","description":"Upgrade dry-run","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Force update","allowNo":false},"name":{"name":"name","type":"option","char":"n","description":"Plugin name"}},"args":[]},"release":{"id":"release","description":"Release a new saltcorn version","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"version","description":"New version number","required":true}]},"reset-schema":{"id":"reset-schema","description":"Reset the database\n...\nThis will delete all existing information\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"force","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"restore":{"id":"restore","description":"Restore a previously backed up database (zip or sqlc format)","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"file","description":"backup file to restore","required":true}]},"rm-tenant":{"id":"rm-tenant","description":"Remove a tenant","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"tenant","description":"Tenant to remove","required":true}]},"run-benchmark":{"id":"run-benchmark","description":"Run benchmark","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"API Token for reporting results"},"benchmark":{"name":"benchmark","type":"option","char":"b","description":"Which benchmark to run"},"delay":{"name":"delay","type":"option","char":"d","description":"delay between runs (s)","default":30}},"args":[{"name":"baseurl","description":"Base URL","required":false}]},"run-tests":{"id":"run-tests","description":"Run test suites","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"coverage":{"name":"coverage","type":"boolean","char":"c","description":"Coverage","allowNo":false},"testFilter":{"name":"testFilter","type":"option","char":"t","description":"Filter tests by suite or test name"},"watch":{"name":"watch","type":"boolean","description":"Watch files for changes and rerun tests related to changed files.","allowNo":false},"watchAll":{"name":"watchAll","type":"boolean","description":"Watch files for changes and rerun all tests.","allowNo":false}},"args":[{"name":"package","description":"which package to run tests for"}]},"scheduler":{"id":"scheduler","description":"Run the Saltcorn scheduler","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false}},"args":[]},"serve":{"id":"serve","description":"Start the Saltcorn server","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"port","default":3000},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false},"watchReaper":{"name":"watchReaper","type":"boolean","char":"r","description":"Watch reaper","allowNo":false},"addschema":{"name":"addschema","type":"boolean","char":"a","description":"Add schema if missing","allowNo":false},"nomigrate":{"name":"nomigrate","type":"boolean","char":"n","description":"No migrations","allowNo":false},"noscheduler":{"name":"noscheduler","type":"boolean","char":"s","description":"No scheduler","allowNo":false}},"args":[]},"set-cfg":{"id":"set-cfg","description":"Set a configuration value","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"plugin":{"name":"plugin","type":"option","char":"p","description":"plugin"}},"args":[{"name":"key","description":"Configuration key","required":true},{"name":"value","description":"Configuration value (JSON or string)","required":true}]},"setup-benchmark":{"id":"setup-benchmark","description":"Setup an instance for benchmarking","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"setup":{"id":"setup","description":"Set up a new system\n...\nThis will attempt to install or connect a database, and set up a \nconfiguration file\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"coverage":{"name":"coverage","type":"boolean","char":"c","description":"Coverage","allowNo":false}},"args":[]},"test-plugin":{"id":"test-plugin","description":"Test a plugin\n...\nExtra documentation goes here\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"path to plugin package","required":true}]},"transform-field":{"id":"transform-field","description":"transform an existing field by applying a calculated expression","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"expression","description":"expression to calculate field","required":true},{"name":"field","description":"field name","required":true},{"name":"table","description":"table name","required":true},{"name":"tenant","description":"tenant name","required":false}]}}}
|
|
1
|
+
{"version":"0.6.2-beta.0","commands":{"add-schema":{"id":"add-schema","description":"Add Saltcorn schema to existing database","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"backup":{"id":"backup","description":"Backup the PostgreSQL database to a file with pg_dump or zip","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"output":{"name":"output","type":"option","char":"o","description":"output filename"},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"zip":{"name":"zip","type":"boolean","char":"z","description":"zip format","allowNo":false}},"args":[]},"create-tenant":{"id":"create-tenant","description":"Create a tenant","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"email":{"name":"email","type":"option","char":"e","description":"Email of owner of tenant"},"description":{"name":"description","type":"option","char":"d","description":"Description of tenant"}},"args":[{"name":"tenant","description":"Tenant subdomain to create","required":true}]},"create-user":{"id":"create-user","description":"Create a new user","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"admin":{"name":"admin","type":"boolean","char":"a","description":"Admin user","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"email":{"name":"email","type":"option","char":"e","description":"email"},"role":{"name":"role","type":"option","char":"r","description":"role"},"password":{"name":"password","type":"option","char":"p","description":"password"}},"args":[]},"fixtures":{"id":"fixtures","description":"Load fixtures for testing\n...\nThis manual step it is never required for users and rarely required for developers\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"reset":{"name":"reset","type":"boolean","char":"r","description":"Also reset schema","allowNo":false}},"args":[]},"info":{"id":"info","description":"Show paths\n...\nShow configuration and file store paths\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":["paths"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"json format","allowNo":false}},"args":[]},"install-pack":{"id":"install-pack","description":"Install a pack","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"name":{"name":"name","type":"option","char":"n","description":"Pack name in store"},"file":{"name":"file","type":"option","char":"f","description":"File with pack JSON"}},"args":[]},"install-plugin":{"id":"install-plugin","description":"Install a plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"name":{"name":"name","type":"option","char":"n","description":"Plugin name in store"},"directory":{"name":"directory","type":"option","char":"d","description":"Directory with local plugin"}},"args":[]},"list-tenants":{"id":"list-tenants","description":"List tenants in CSV format","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"localize-plugin":{"id":"localize-plugin","description":"Convert plugin to local plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"plugin","description":"Current plugin name","required":true},{"name":"path","description":"path to local plugin","required":true}]},"make-migration":{"id":"make-migration","description":"Create a new blank Database structure migration file.\nThese migrations update database structure.\nYou should not normally need to run this\nunless you are a developer.\n","usage":"make-migration","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"migrate":{"id":"migrate","description":"Run Database structure migrations\n...\nNOTE!\n- Please stop Saltcorn before run DB migrations.\n- Please make db backup before migration.\n- There are no way to rollback migration if you doesn't make backup.\n\nThis is not normally required as migrations will be run when the server starts.\nHowever, this command may be useful if you are running multiple application\nservers and need to control when the migrations are run.\n","usage":"saltcorn migrate","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"plugins":{"id":"plugins","description":"List and upgrade plugins for tenants\n...\nExtra documentation goes here\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"examples":["plugins -v - verbose output of commands","plugins -u -d - dry-run for plugin update","plugins -u -f - force plugin update"],"flags":{"upgrade":{"name":"upgrade","type":"boolean","char":"u","description":"Upgrade","allowNo":false},"dryRun":{"name":"dryRun","type":"boolean","char":"d","description":"Upgrade dry-run","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Force update","allowNo":false},"name":{"name":"name","type":"option","char":"n","description":"Plugin name"}},"args":[]},"release":{"id":"release","description":"Release a new saltcorn version","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"version","description":"New version number","required":true}]},"reset-schema":{"id":"reset-schema","description":"Reset the database\n...\nThis will delete all existing information\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"force","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"restore":{"id":"restore","description":"Restore a previously backed up database (zip or sqlc format)","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"file","description":"backup file to restore","required":true}]},"rm-tenant":{"id":"rm-tenant","description":"Remove a tenant","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"tenant","description":"Tenant to remove","required":true}]},"run-benchmark":{"id":"run-benchmark","description":"Run benchmark","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"API Token for reporting results"},"benchmark":{"name":"benchmark","type":"option","char":"b","description":"Which benchmark to run"},"delay":{"name":"delay","type":"option","char":"d","description":"delay between runs (s)","default":30}},"args":[{"name":"baseurl","description":"Base URL","required":false}]},"run-tests":{"id":"run-tests","description":"Run test suites","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"coverage":{"name":"coverage","type":"boolean","char":"c","description":"Coverage","allowNo":false},"testFilter":{"name":"testFilter","type":"option","char":"t","description":"Filter tests by suite or test name"},"watch":{"name":"watch","type":"boolean","description":"Watch files for changes and rerun tests related to changed files.","allowNo":false},"watchAll":{"name":"watchAll","type":"boolean","description":"Watch files for changes and rerun all tests.","allowNo":false}},"args":[{"name":"package","description":"which package to run tests for"}]},"scheduler":{"id":"scheduler","description":"Run the Saltcorn scheduler","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false}},"args":[]},"serve":{"id":"serve","description":"Start the Saltcorn server","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"port","default":3000},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false},"watchReaper":{"name":"watchReaper","type":"boolean","char":"r","description":"Watch reaper","allowNo":false},"dev":{"name":"dev","type":"boolean","char":"d","description":"Run in dev mode and re-start on file changes","allowNo":false},"addschema":{"name":"addschema","type":"boolean","char":"a","description":"Add schema if missing","allowNo":false},"nomigrate":{"name":"nomigrate","type":"boolean","char":"n","description":"No migrations","allowNo":false},"noscheduler":{"name":"noscheduler","type":"boolean","char":"s","description":"No scheduler","allowNo":false}},"args":[]},"set-cfg":{"id":"set-cfg","description":"Set a configuration value","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"plugin":{"name":"plugin","type":"option","char":"p","description":"plugin"}},"args":[{"name":"key","description":"Configuration key","required":true},{"name":"value","description":"Configuration value (JSON or string)","required":true}]},"setup-benchmark":{"id":"setup-benchmark","description":"Setup an instance for benchmarking","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"setup":{"id":"setup","description":"Set up a new system\n...\nThis will attempt to install or connect a database, and set up a \nconfiguration file\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"coverage":{"name":"coverage","type":"boolean","char":"c","description":"Coverage","allowNo":false}},"args":[]},"test-plugin":{"id":"test-plugin","description":"Test a plugin\n...\nExtra documentation goes here\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"path to plugin package","required":true}]},"transform-field":{"id":"transform-field","description":"transform an existing field by applying a calculated expression","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"expression","description":"expression to calculate field","required":true},{"name":"field","description":"field name","required":true},{"name":"table","description":"table name","required":true},{"name":"tenant","description":"tenant name","required":false}]}}}
|
package/package.json
CHANGED
|
@@ -2,31 +2,32 @@
|
|
|
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": "0.6.
|
|
5
|
+
"version": "0.6.2-beta.0",
|
|
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/command": "^1.8.
|
|
13
|
-
"@oclif/config": "^1.17.
|
|
14
|
-
"@oclif/plugin-help": "^3.2.
|
|
15
|
-
"@saltcorn/data": "0.6.
|
|
16
|
-
"@saltcorn/server": "0.6.
|
|
17
|
-
"cli-ux": "^5.6.
|
|
12
|
+
"@oclif/command": "^1.8.4",
|
|
13
|
+
"@oclif/config": "^1.17.1",
|
|
14
|
+
"@oclif/plugin-help": "^3.2.7",
|
|
15
|
+
"@saltcorn/data": "0.6.2-beta.0",
|
|
16
|
+
"@saltcorn/server": "0.6.2-beta.0",
|
|
17
|
+
"cli-ux": "^5.6.4",
|
|
18
18
|
"contractis": "^0.1.0",
|
|
19
19
|
"dateformat": "^3.0.3",
|
|
20
20
|
"inquirer": "^7.3.3",
|
|
21
21
|
"js-yaml": "^4.1.0",
|
|
22
22
|
"node-fetch": "2.6.2",
|
|
23
|
+
"node-watch": "^0.7.2",
|
|
23
24
|
"sudo": "^1.0.3",
|
|
24
|
-
"systeminformation": "^5.9.
|
|
25
|
+
"systeminformation": "^5.9.15",
|
|
25
26
|
"tcp-port-used": "^1.0.2",
|
|
26
27
|
"wrk": "^1.2.1"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"@oclif/dev-cli": "^1.26.
|
|
30
|
+
"@oclif/dev-cli": "^1.26.3",
|
|
30
31
|
"globby": "^10.0.2"
|
|
31
32
|
},
|
|
32
33
|
"engines": {
|
|
@@ -55,7 +56,9 @@
|
|
|
55
56
|
"postpack": "rm -f oclif.manifest.json",
|
|
56
57
|
"prepack": "oclif-dev manifest && oclif-dev readme",
|
|
57
58
|
"test": "echo NO TESTS",
|
|
58
|
-
"version": "oclif-dev readme && git add README.md"
|
|
59
|
+
"version": "oclif-dev readme && git add README.md",
|
|
60
|
+
"tsc": "echo \"Error: no TypeScript support yet\"",
|
|
61
|
+
"clean": "echo \"Error: no TypeScript support yet\""
|
|
59
62
|
},
|
|
60
63
|
"publishConfig": {
|
|
61
64
|
"access": "public"
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/add-schema
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
const { cli } = require("cli-ux");
|
|
3
7
|
|
|
8
|
+
/**
|
|
9
|
+
* AddSchemaCommand Class
|
|
10
|
+
* @extends oclif.Command
|
|
11
|
+
* @category saltcorn-cli
|
|
12
|
+
*/
|
|
4
13
|
class AddSchemaCommand extends Command {
|
|
14
|
+
/**
|
|
15
|
+
* @returns {Promise<void>}
|
|
16
|
+
*/
|
|
5
17
|
async run() {
|
|
6
18
|
const reset = require("@saltcorn/data/db/reset_schema");
|
|
7
19
|
await reset(true);
|
|
@@ -10,6 +22,9 @@ class AddSchemaCommand extends Command {
|
|
|
10
22
|
}
|
|
11
23
|
}
|
|
12
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @type {string}
|
|
27
|
+
*/
|
|
13
28
|
AddSchemaCommand.description = `Add Saltcorn schema to existing database`;
|
|
14
29
|
|
|
15
30
|
module.exports = AddSchemaCommand;
|
package/src/commands/backup.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/backup
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
const { execSync } = require("child_process");
|
|
3
7
|
const dateFormat = require("dateformat");
|
|
@@ -11,7 +15,15 @@ const pgdb = connobj.database;
|
|
|
11
15
|
|
|
12
16
|
var default_filenm = `${day}-${pgdb}-${os.hostname}.sqlc`;
|
|
13
17
|
|
|
18
|
+
/**
|
|
19
|
+
* BackupCommand Class
|
|
20
|
+
* @extends oclif.Command
|
|
21
|
+
* @category saltcorn-cli
|
|
22
|
+
*/
|
|
14
23
|
class BackupCommand extends Command {
|
|
24
|
+
/**
|
|
25
|
+
* @returns {Promise<void>}
|
|
26
|
+
*/
|
|
15
27
|
async run() {
|
|
16
28
|
const { flags } = this.parse(BackupCommand);
|
|
17
29
|
|
|
@@ -49,8 +61,14 @@ class BackupCommand extends Command {
|
|
|
49
61
|
}
|
|
50
62
|
}
|
|
51
63
|
|
|
64
|
+
/**
|
|
65
|
+
* @type {string}
|
|
66
|
+
*/
|
|
52
67
|
BackupCommand.description = `Backup the PostgreSQL database to a file with pg_dump or zip`;
|
|
53
68
|
|
|
69
|
+
/**
|
|
70
|
+
* @type {object}
|
|
71
|
+
*/
|
|
54
72
|
BackupCommand.flags = {
|
|
55
73
|
output: flags.string({
|
|
56
74
|
char: "o",
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/create-tenant
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
|
|
3
7
|
//const {
|
|
4
8
|
// getConfig,
|
|
5
9
|
//} = require("@saltcorn/data/models/config");
|
|
6
10
|
|
|
11
|
+
/**
|
|
12
|
+
* CreateTenantCommand Class
|
|
13
|
+
* @extends oclif.Command
|
|
14
|
+
* @category saltcorn-cli
|
|
15
|
+
*/
|
|
7
16
|
class CreateTenantCommand extends Command {
|
|
17
|
+
/**
|
|
18
|
+
* @returns {Promise<void>}
|
|
19
|
+
*/
|
|
8
20
|
async run() {
|
|
9
21
|
const { args } = this.parse(CreateTenantCommand);
|
|
10
22
|
const { flags } = this.parse(CreateTenantCommand);
|
|
@@ -26,12 +38,21 @@ class CreateTenantCommand extends Command {
|
|
|
26
38
|
}
|
|
27
39
|
}
|
|
28
40
|
|
|
41
|
+
/**
|
|
42
|
+
* @type {object}
|
|
43
|
+
*/
|
|
29
44
|
CreateTenantCommand.args = [
|
|
30
45
|
{ name: "tenant", required: true, description: "Tenant subdomain to create" },
|
|
31
46
|
];
|
|
32
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @type {string}
|
|
50
|
+
*/
|
|
33
51
|
CreateTenantCommand.description = `Create a tenant`;
|
|
34
52
|
|
|
53
|
+
/**
|
|
54
|
+
* @type {object}
|
|
55
|
+
*/
|
|
35
56
|
CreateTenantCommand.flags = {
|
|
36
57
|
email: flags.string({
|
|
37
58
|
name: "url",
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/create-user
|
|
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
|
+
* CreateUserCommand Class
|
|
11
|
+
* @extends oclif.Command
|
|
12
|
+
* @category saltcorn-cli
|
|
13
|
+
*/
|
|
5
14
|
class CreateUserCommand extends Command {
|
|
15
|
+
/**
|
|
16
|
+
* @returns {Promise<void>}
|
|
17
|
+
*/
|
|
6
18
|
async run() {
|
|
7
19
|
const User = require("@saltcorn/data/models/user");
|
|
8
20
|
const { flags } = this.parse(CreateUserCommand);
|
|
@@ -31,8 +43,14 @@ class CreateUserCommand extends Command {
|
|
|
31
43
|
}
|
|
32
44
|
}
|
|
33
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @type {string}
|
|
48
|
+
*/
|
|
34
49
|
CreateUserCommand.description = `Create a new user`;
|
|
35
50
|
|
|
51
|
+
/**
|
|
52
|
+
* @type {object}
|
|
53
|
+
*/
|
|
36
54
|
CreateUserCommand.flags = {
|
|
37
55
|
admin: flags.boolean({ char: "a", description: "Admin user" }),
|
|
38
56
|
tenant: flags.string({
|
package/src/commands/fixtures.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/fixtures
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
|
|
7
|
+
/**
|
|
8
|
+
* FixturesCommand Class
|
|
9
|
+
* @extends oclif.Command
|
|
10
|
+
* @category saltcorn-cli
|
|
11
|
+
*/
|
|
3
12
|
class FixturesCommand extends Command {
|
|
13
|
+
/**
|
|
14
|
+
* @returns {Promise<void>}
|
|
15
|
+
*/
|
|
4
16
|
async run() {
|
|
5
17
|
const fixtures = require("@saltcorn/data/db/fixtures");
|
|
6
18
|
const reset = require("@saltcorn/data/db/reset_schema");
|
|
@@ -14,11 +26,17 @@ class FixturesCommand extends Command {
|
|
|
14
26
|
}
|
|
15
27
|
}
|
|
16
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @type {string}
|
|
31
|
+
*/
|
|
17
32
|
FixturesCommand.description = `Load fixtures for testing
|
|
18
33
|
...
|
|
19
34
|
This manual step it is never required for users and rarely required for developers
|
|
20
35
|
`;
|
|
21
36
|
|
|
37
|
+
/**
|
|
38
|
+
* @type {object}
|
|
39
|
+
*/
|
|
22
40
|
FixturesCommand.flags = {
|
|
23
41
|
reset: flags.boolean({ char: "r", description: "Also reset schema" }),
|
|
24
42
|
};
|
package/src/commands/info.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/info
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
const {
|
|
3
7
|
configFilePath,
|
|
@@ -6,13 +10,31 @@ const {
|
|
|
6
10
|
const { dump } = require("js-yaml");
|
|
7
11
|
const packagejson = require("../../package.json");
|
|
8
12
|
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {object[]} results
|
|
16
|
+
* @param {boolean} json
|
|
17
|
+
* @returns {void}
|
|
18
|
+
*/
|
|
9
19
|
const print_it = (results, json) => {
|
|
10
20
|
if (json) console.log(JSON.stringify(results, null, 2));
|
|
11
21
|
else console.log(dump(results, { lineWidth: process.stdout.columns }));
|
|
12
22
|
};
|
|
13
23
|
|
|
24
|
+
/**
|
|
25
|
+
* InfoCommand Class
|
|
26
|
+
* @extends oclif.Command
|
|
27
|
+
* @category saltcorn-cli
|
|
28
|
+
*/
|
|
14
29
|
class InfoCommand extends Command {
|
|
30
|
+
/**
|
|
31
|
+
* @type {string[]}
|
|
32
|
+
*/
|
|
15
33
|
static aliases = ["paths"];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @returns {Promise<void>}
|
|
37
|
+
*/
|
|
16
38
|
async run() {
|
|
17
39
|
const { flags } = this.parse(InfoCommand);
|
|
18
40
|
const db = require("@saltcorn/data/db");
|
|
@@ -45,12 +67,19 @@ class InfoCommand extends Command {
|
|
|
45
67
|
}
|
|
46
68
|
}
|
|
47
69
|
|
|
70
|
+
/**
|
|
71
|
+
* @type {string}
|
|
72
|
+
*/
|
|
48
73
|
InfoCommand.description = `Show paths
|
|
49
74
|
...
|
|
50
75
|
Show configuration and file store paths
|
|
51
76
|
`;
|
|
52
77
|
|
|
78
|
+
/**
|
|
79
|
+
* @type {object}
|
|
80
|
+
*/
|
|
53
81
|
InfoCommand.flags = {
|
|
54
82
|
json: flags.boolean({ char: "j", description: "json format" }),
|
|
55
83
|
};
|
|
84
|
+
|
|
56
85
|
module.exports = InfoCommand;
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/install-pack
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
const { maybe_as_tenant } = require("../common");
|
|
3
7
|
const fs = require("fs");
|
|
4
8
|
|
|
9
|
+
/**
|
|
10
|
+
* InstallPackCommand Class
|
|
11
|
+
* @extends oclif.Command
|
|
12
|
+
* @category saltcorn-cli
|
|
13
|
+
*/
|
|
5
14
|
class InstallPackCommand extends Command {
|
|
15
|
+
/**
|
|
16
|
+
* @returns {Promise<void>}
|
|
17
|
+
*/
|
|
6
18
|
async run() {
|
|
7
19
|
const { flags } = this.parse(InstallPackCommand);
|
|
8
20
|
const {
|
|
@@ -49,8 +61,14 @@ class InstallPackCommand extends Command {
|
|
|
49
61
|
}
|
|
50
62
|
}
|
|
51
63
|
|
|
64
|
+
/**
|
|
65
|
+
* @type {string}
|
|
66
|
+
*/
|
|
52
67
|
InstallPackCommand.description = `Install a pack`;
|
|
53
68
|
|
|
69
|
+
/**
|
|
70
|
+
* @type {object}
|
|
71
|
+
*/
|
|
54
72
|
InstallPackCommand.flags = {
|
|
55
73
|
tenant: flags.string({
|
|
56
74
|
char: "t",
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/install-plugin
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
const { maybe_as_tenant } = require("../common");
|
|
3
7
|
const fs = require("fs");
|
|
4
8
|
const path = require("path");
|
|
5
9
|
|
|
10
|
+
/**
|
|
11
|
+
* InstallPluginCommand Class
|
|
12
|
+
* @extends oclif.Command
|
|
13
|
+
* @category saltcorn-cli
|
|
14
|
+
*/
|
|
6
15
|
class InstallPluginCommand extends Command {
|
|
16
|
+
/**
|
|
17
|
+
* @returns {Promise<void>}
|
|
18
|
+
*/
|
|
7
19
|
async run() {
|
|
8
20
|
const { flags } = this.parse(InstallPluginCommand);
|
|
9
21
|
const {
|
|
@@ -59,8 +71,14 @@ class InstallPluginCommand extends Command {
|
|
|
59
71
|
}
|
|
60
72
|
}
|
|
61
73
|
|
|
74
|
+
/**
|
|
75
|
+
* @type {string}
|
|
76
|
+
*/
|
|
62
77
|
InstallPluginCommand.description = `Install a plugin`;
|
|
63
78
|
|
|
79
|
+
/**
|
|
80
|
+
* @type {object}
|
|
81
|
+
*/
|
|
64
82
|
InstallPluginCommand.flags = {
|
|
65
83
|
tenant: flags.string({
|
|
66
84
|
char: "t",
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/list-tenants
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ListTenantsCommand Class
|
|
10
|
+
* @extends oclif.Command
|
|
11
|
+
* @category saltcorn-cli
|
|
12
|
+
*/
|
|
3
13
|
class ListTenantsCommand extends Command {
|
|
14
|
+
/**
|
|
15
|
+
* @returns {Promise<void>}
|
|
16
|
+
*/
|
|
4
17
|
async run() {
|
|
5
18
|
const { getAllTenants } = require("@saltcorn/data/models/tenant");
|
|
6
19
|
const db = require("@saltcorn/data/db");
|
|
@@ -21,9 +34,15 @@ class ListTenantsCommand extends Command {
|
|
|
21
34
|
}
|
|
22
35
|
}
|
|
23
36
|
|
|
37
|
+
/**
|
|
38
|
+
* @type {string}
|
|
39
|
+
*/
|
|
24
40
|
ListTenantsCommand.description = `List tenants in CSV format`;
|
|
25
41
|
|
|
26
42
|
// TODO Extra help here
|
|
43
|
+
/**
|
|
44
|
+
* @type {string}
|
|
45
|
+
*/
|
|
27
46
|
ListTenantsCommand.help= "Extra help here"
|
|
28
47
|
|
|
29
48
|
module.exports = ListTenantsCommand;
|
|
@@ -1,21 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/localize-plugin
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
6
|
+
const { maybe_as_tenant } = require("../common");
|
|
2
7
|
|
|
8
|
+
/**
|
|
9
|
+
* LocalizePluginCommand Class
|
|
10
|
+
* @extends oclif.Command
|
|
11
|
+
* @category saltcorn-cli
|
|
12
|
+
*/
|
|
3
13
|
class LocalizePluginCommand extends Command {
|
|
14
|
+
/**
|
|
15
|
+
* @returns {Promise<void>}
|
|
16
|
+
*/
|
|
4
17
|
async run() {
|
|
5
18
|
const db = require("@saltcorn/data/db");
|
|
6
19
|
const Plugin = require("@saltcorn/data/models/plugin");
|
|
7
|
-
const { args } = this.parse(LocalizePluginCommand);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
const { args, flags } = this.parse(LocalizePluginCommand);
|
|
21
|
+
await maybe_as_tenant(flags.tenant, async () => {
|
|
22
|
+
const plugin = await Plugin.findOne({ name: args.plugin });
|
|
23
|
+
if (!plugin || plugin.source === "local") {
|
|
24
|
+
console.error("Localisable plugin not found");
|
|
25
|
+
this.exit(1);
|
|
26
|
+
}
|
|
13
27
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
28
|
+
plugin.name = plugin.source === "npm" ? plugin.location : args.plugin;
|
|
29
|
+
plugin.source = "local";
|
|
30
|
+
plugin.location = args.path;
|
|
31
|
+
await plugin.upsert();
|
|
32
|
+
console.log("Plugin saved", plugin);
|
|
33
|
+
});
|
|
19
34
|
this.exit(0);
|
|
20
35
|
}
|
|
21
36
|
}
|
|
@@ -25,8 +40,19 @@ LocalizePluginCommand.args = [
|
|
|
25
40
|
{ name: "path", required: true, description: "path to local plugin" },
|
|
26
41
|
];
|
|
27
42
|
|
|
43
|
+
/**
|
|
44
|
+
* @type {string}
|
|
45
|
+
*/
|
|
28
46
|
LocalizePluginCommand.description = `Convert plugin to local plugin`;
|
|
29
47
|
|
|
30
|
-
|
|
48
|
+
/**
|
|
49
|
+
* @type {object}
|
|
50
|
+
*/
|
|
51
|
+
LocalizePluginCommand.flags = {
|
|
52
|
+
tenant: flags.string({
|
|
53
|
+
char: "t",
|
|
54
|
+
description: "tenant",
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
31
57
|
|
|
32
58
|
module.exports = LocalizePluginCommand;
|
|
@@ -1,24 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/make-migration
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
|
|
7
|
+
/**
|
|
8
|
+
* MigrationCommand Class
|
|
9
|
+
* @extends oclif.Command
|
|
10
|
+
* @category saltcorn-cli
|
|
11
|
+
*/
|
|
3
12
|
class MigrationCommand extends Command {
|
|
13
|
+
/**
|
|
14
|
+
* @returns {Promise<void>}
|
|
15
|
+
*/
|
|
4
16
|
async run() {
|
|
5
17
|
const { create_blank_migration } = require("@saltcorn/data/migrate");
|
|
6
18
|
await create_blank_migration();
|
|
7
19
|
}
|
|
8
20
|
}
|
|
9
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @type {string}
|
|
24
|
+
*/
|
|
10
25
|
MigrationCommand.description = `Create a new blank Database structure migration file.
|
|
11
26
|
These migrations update database structure.
|
|
12
27
|
You should not normally need to run this
|
|
13
28
|
unless you are a developer.
|
|
14
29
|
`;
|
|
15
30
|
|
|
31
|
+
/**
|
|
32
|
+
* @type {string}
|
|
33
|
+
*/
|
|
16
34
|
MigrationCommand.help = `Create a new blank Database structure migration file.
|
|
17
35
|
These migrations update database structure.
|
|
18
36
|
You should not normally need to run this
|
|
19
37
|
unless you are a developer.
|
|
20
38
|
`;
|
|
21
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @type {string}
|
|
42
|
+
*/
|
|
22
43
|
MigrationCommand.usage = "make-migration";
|
|
23
44
|
|
|
24
45
|
module.exports = MigrationCommand;
|
package/src/commands/migrate.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/migrate
|
|
4
|
+
*/
|
|
1
5
|
const { Command, flags } = require("@oclif/command");
|
|
2
6
|
const db = require("@saltcorn/data/db");
|
|
3
7
|
const { eachTenant } = require("@saltcorn/data/models/tenant");
|
|
4
8
|
// todo add dryrun mode
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* MigrateCommand Class
|
|
12
|
+
* @extends oclif.Command
|
|
13
|
+
* @category saltcorn-cli
|
|
14
|
+
*/
|
|
5
15
|
class MigrateCommand extends Command {
|
|
16
|
+
/**
|
|
17
|
+
* @returns {Promise<void>}
|
|
18
|
+
*/
|
|
6
19
|
async run() {
|
|
7
20
|
const { migrate } = require("@saltcorn/data/migrate");
|
|
8
21
|
await eachTenant(async () => {
|
|
@@ -14,6 +27,9 @@ class MigrateCommand extends Command {
|
|
|
14
27
|
}
|
|
15
28
|
}
|
|
16
29
|
|
|
30
|
+
/**
|
|
31
|
+
* @type {string}
|
|
32
|
+
*/
|
|
17
33
|
MigrateCommand.description = `Run Database structure migrations
|
|
18
34
|
...
|
|
19
35
|
NOTE!
|
|
@@ -26,6 +42,9 @@ However, this command may be useful if you are running multiple application
|
|
|
26
42
|
servers and need to control when the migrations are run.
|
|
27
43
|
`;
|
|
28
44
|
|
|
45
|
+
/**
|
|
46
|
+
* @type {string}
|
|
47
|
+
*/
|
|
29
48
|
MigrateCommand.help = `Run Database structure migrations.
|
|
30
49
|
Command goes in circle via all tenants and applies all unapplyed database structure migrations.
|
|
31
50
|
|
|
@@ -35,7 +54,9 @@ NOTE!
|
|
|
35
54
|
- There are no way to rollback migration if you doesn't make backup.
|
|
36
55
|
`;
|
|
37
56
|
|
|
38
|
-
|
|
57
|
+
/**
|
|
58
|
+
* @type {string}
|
|
59
|
+
*/
|
|
39
60
|
MigrateCommand.usage = "saltcorn migrate";
|
|
40
61
|
|
|
41
62
|
module.exports = MigrateCommand;
|