@saltcorn/cli 1.6.0-alpha.2 → 1.6.0-alpha.3
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 +87 -50
- package/npm-shrinkwrap.json +310 -299
- package/oclif.manifest.json +73 -1
- package/package.json +8 -8
- package/src/commands/dev/build.js +47 -0
- package/src/commands/dev/serve.js +75 -0
package/oclif.manifest.json
CHANGED
|
@@ -2040,6 +2040,38 @@
|
|
|
2040
2040
|
"transform-field.js"
|
|
2041
2041
|
]
|
|
2042
2042
|
},
|
|
2043
|
+
"dev:build": {
|
|
2044
|
+
"aliases": [],
|
|
2045
|
+
"args": {
|
|
2046
|
+
"component": {
|
|
2047
|
+
"description": "Component to rebuild",
|
|
2048
|
+
"name": "component",
|
|
2049
|
+
"options": [
|
|
2050
|
+
"builder",
|
|
2051
|
+
"filemanager",
|
|
2052
|
+
"workflow-editor"
|
|
2053
|
+
],
|
|
2054
|
+
"required": false
|
|
2055
|
+
}
|
|
2056
|
+
},
|
|
2057
|
+
"description": "Rebuild static assets",
|
|
2058
|
+
"flags": {},
|
|
2059
|
+
"hasDynamicHelp": false,
|
|
2060
|
+
"hiddenAliases": [],
|
|
2061
|
+
"id": "dev:build",
|
|
2062
|
+
"pluginAlias": "@saltcorn/cli",
|
|
2063
|
+
"pluginName": "@saltcorn/cli",
|
|
2064
|
+
"pluginType": "core",
|
|
2065
|
+
"strict": true,
|
|
2066
|
+
"enableJsonFlag": false,
|
|
2067
|
+
"isESM": false,
|
|
2068
|
+
"relativePath": [
|
|
2069
|
+
"src",
|
|
2070
|
+
"commands",
|
|
2071
|
+
"dev",
|
|
2072
|
+
"build.js"
|
|
2073
|
+
]
|
|
2074
|
+
},
|
|
2043
2075
|
"dev:localize-plugin": {
|
|
2044
2076
|
"aliases": [],
|
|
2045
2077
|
"args": {
|
|
@@ -2277,6 +2309,46 @@
|
|
|
2277
2309
|
"release.js"
|
|
2278
2310
|
]
|
|
2279
2311
|
},
|
|
2312
|
+
"dev:serve": {
|
|
2313
|
+
"aliases": [],
|
|
2314
|
+
"args": {},
|
|
2315
|
+
"description": "Development server. Serve on port 3000, restart when source files change",
|
|
2316
|
+
"flags": {
|
|
2317
|
+
"port": {
|
|
2318
|
+
"char": "p",
|
|
2319
|
+
"description": "port",
|
|
2320
|
+
"name": "port",
|
|
2321
|
+
"default": 3000,
|
|
2322
|
+
"hasDynamicHelp": false,
|
|
2323
|
+
"multiple": false,
|
|
2324
|
+
"type": "option"
|
|
2325
|
+
},
|
|
2326
|
+
"workers": {
|
|
2327
|
+
"char": "w",
|
|
2328
|
+
"description": "workers",
|
|
2329
|
+
"name": "workers",
|
|
2330
|
+
"default": 1,
|
|
2331
|
+
"hasDynamicHelp": false,
|
|
2332
|
+
"multiple": false,
|
|
2333
|
+
"type": "option"
|
|
2334
|
+
}
|
|
2335
|
+
},
|
|
2336
|
+
"hasDynamicHelp": false,
|
|
2337
|
+
"hiddenAliases": [],
|
|
2338
|
+
"id": "dev:serve",
|
|
2339
|
+
"pluginAlias": "@saltcorn/cli",
|
|
2340
|
+
"pluginName": "@saltcorn/cli",
|
|
2341
|
+
"pluginType": "core",
|
|
2342
|
+
"strict": true,
|
|
2343
|
+
"enableJsonFlag": false,
|
|
2344
|
+
"isESM": false,
|
|
2345
|
+
"relativePath": [
|
|
2346
|
+
"src",
|
|
2347
|
+
"commands",
|
|
2348
|
+
"dev",
|
|
2349
|
+
"serve.js"
|
|
2350
|
+
]
|
|
2351
|
+
},
|
|
2280
2352
|
"dev:test-plugin": {
|
|
2281
2353
|
"aliases": [],
|
|
2282
2354
|
"args": {
|
|
@@ -2341,5 +2413,5 @@
|
|
|
2341
2413
|
]
|
|
2342
2414
|
}
|
|
2343
2415
|
},
|
|
2344
|
-
"version": "1.6.0-alpha.
|
|
2416
|
+
"version": "1.6.0-alpha.3"
|
|
2345
2417
|
}
|
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.
|
|
5
|
+
"version": "1.6.0-alpha.3",
|
|
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.
|
|
15
|
-
"@saltcorn/common-code": "1.6.0-alpha.
|
|
16
|
-
"@saltcorn/data": "1.6.0-alpha.
|
|
17
|
-
"@saltcorn/mobile-app": "1.6.0-alpha.
|
|
18
|
-
"@saltcorn/mobile-builder": "1.6.0-alpha.
|
|
19
|
-
"@saltcorn/plugins-loader": "1.6.0-alpha.
|
|
20
|
-
"@saltcorn/server": "1.6.0-alpha.
|
|
14
|
+
"@saltcorn/admin-models": "1.6.0-alpha.3",
|
|
15
|
+
"@saltcorn/common-code": "1.6.0-alpha.3",
|
|
16
|
+
"@saltcorn/data": "1.6.0-alpha.3",
|
|
17
|
+
"@saltcorn/mobile-app": "1.6.0-alpha.3",
|
|
18
|
+
"@saltcorn/mobile-builder": "1.6.0-alpha.3",
|
|
19
|
+
"@saltcorn/plugins-loader": "1.6.0-alpha.3",
|
|
20
|
+
"@saltcorn/server": "1.6.0-alpha.3",
|
|
21
21
|
"contractis": "^0.1.0",
|
|
22
22
|
"dateformat": "^4.6.3",
|
|
23
23
|
"inquirer": "^12.3.3",
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/dev/build
|
|
4
|
+
*/
|
|
5
|
+
const { Command, Flags, Args } = require("@oclif/core");
|
|
6
|
+
const { spawnSync } = require("child_process");
|
|
7
|
+
const { sleep } = require("../../common");
|
|
8
|
+
/**
|
|
9
|
+
* DevBuildCommand Class
|
|
10
|
+
* @extends oclif.Command
|
|
11
|
+
* @category saltcorn-cli
|
|
12
|
+
*/
|
|
13
|
+
class DevBuildCommand extends Command {
|
|
14
|
+
/**
|
|
15
|
+
* @returns {Promise<void>}
|
|
16
|
+
*/
|
|
17
|
+
async run() {
|
|
18
|
+
const { args } = await this.parse(DevBuildCommand);
|
|
19
|
+
|
|
20
|
+
const { reactPackages } = require("@saltcorn/server/restart_watcher");
|
|
21
|
+
|
|
22
|
+
for (const { buildDir } of reactPackages) {
|
|
23
|
+
if (args.component && !buildDir.includes(args.component)) continue;
|
|
24
|
+
|
|
25
|
+
const { status, signal } = spawnSync("npm", ["run", "build"], {
|
|
26
|
+
stdio: "inherit",
|
|
27
|
+
cwd: buildDir,
|
|
28
|
+
});
|
|
29
|
+
if (status) process.exit(status);
|
|
30
|
+
if (signal) process.exit();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @type {string}
|
|
37
|
+
*/
|
|
38
|
+
DevBuildCommand.description = `Rebuild static assets`;
|
|
39
|
+
|
|
40
|
+
DevBuildCommand.args = {
|
|
41
|
+
component: Args.string({
|
|
42
|
+
required: false,
|
|
43
|
+
description: "Component to rebuild",
|
|
44
|
+
options: ["builder", "filemanager", "workflow-editor"],
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
module.exports = DevBuildCommand;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/dev/serve
|
|
4
|
+
*/
|
|
5
|
+
const { Command, Flags } = require("@oclif/core");
|
|
6
|
+
const { execSync, spawnSync } = require("child_process");
|
|
7
|
+
const { sleep } = require("../../common");
|
|
8
|
+
/**
|
|
9
|
+
* DevServeCommand Class
|
|
10
|
+
* @extends oclif.Command
|
|
11
|
+
* @category saltcorn-cli
|
|
12
|
+
*/
|
|
13
|
+
class DevServeCommand extends Command {
|
|
14
|
+
/**
|
|
15
|
+
* @returns {Promise<void>}
|
|
16
|
+
*/
|
|
17
|
+
async run() {
|
|
18
|
+
const { flags } = await this.parse(DevServeCommand);
|
|
19
|
+
|
|
20
|
+
await this.tryTsc();
|
|
21
|
+
for (;;) {
|
|
22
|
+
const scResult = spawnSync(
|
|
23
|
+
"saltcorn",
|
|
24
|
+
[
|
|
25
|
+
"serve",
|
|
26
|
+
"--dev",
|
|
27
|
+
"--addschema",
|
|
28
|
+
...(flags.port ? ["-p", flags.port] : []),
|
|
29
|
+
],
|
|
30
|
+
{
|
|
31
|
+
env: {
|
|
32
|
+
...process.env,
|
|
33
|
+
SALTCORN_NWORKERS:
|
|
34
|
+
flags.workers || process.env.SALTCORN_NWORKERS || 1,
|
|
35
|
+
},
|
|
36
|
+
stdio: "inherit",
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
if (scResult.signal) process.exit();
|
|
40
|
+
switch (scResult.status) {
|
|
41
|
+
case 3:
|
|
42
|
+
//root tsc error
|
|
43
|
+
await this.tryTsc();
|
|
44
|
+
break;
|
|
45
|
+
|
|
46
|
+
// todo builder error
|
|
47
|
+
default:
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async tryTsc() {
|
|
54
|
+
const tscResult = spawnSync("npm", ["run", "tsc"], {
|
|
55
|
+
stdio: "inherit",
|
|
56
|
+
});
|
|
57
|
+
if (tscResult.status) {
|
|
58
|
+
//todo watch instead
|
|
59
|
+
await sleep(3000);
|
|
60
|
+
await this.tryTsc();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @type {string}
|
|
67
|
+
*/
|
|
68
|
+
DevServeCommand.description = `Development server. Serve on port 3000, restart when source files change`;
|
|
69
|
+
|
|
70
|
+
DevServeCommand.flags = {
|
|
71
|
+
port: Flags.integer({ char: "p", description: "port", default: 3000 }),
|
|
72
|
+
workers: Flags.integer({ char: "w", description: "workers", default: 1 }),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
module.exports = DevServeCommand;
|