@kumologica/sdk 3.5.4 → 3.6.0-beta2
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/cli/commands/open.js +4 -2
- package/cli/commands/start.js +140 -0
- package/package.json +5 -5
- package/src/app/main-process/main-window.js +1 -0
- package/src/app/main-process/modal-home.js +1 -0
- package/src/app/main-process/modal-newproject.js +1 -0
- package/src/app/main-process/modal-newtab.js +1 -0
- package/src/app/main-process/modal-nodelibrary.js +1 -0
- package/src/app/main-process/modal-renameTab.js +1 -0
- package/src/app/main-process/modal-welcome.js +1 -0
- package/src/app/main.js +3 -1
- package/src/app/preload.js +0 -2
- package/src/app/ui/editor-client/public/red/style.min.css +1 -1
- package/src/app/ui/editor-client/public/vendor/ace-linters/javascript-service.js +10 -2
- package/src/app/ui/editor-client/src/sass/editor.scss +745 -746
- package/src/app/ui/editor-client/src/vendor/ace-linters/build/javascript-service.js +10 -2
- package/src/app/ui/editor-client/templates/index.mst +1 -1
- package/src/server/DesignerServer.js +152 -153
package/cli/commands/open.js
CHANGED
|
@@ -80,7 +80,9 @@ exports.desc = 'Open Kumologica Designer'
|
|
|
80
80
|
|
|
81
81
|
exports.handler = async ({ project_directory }) => {
|
|
82
82
|
const projectDir = project_directory? path.resolve(project_directory): undefined ;
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
if (process.env["KUMOLOGICA_AWS_SDK_SKIP_UPDATE"] && process.env["KUMOLOGICA_AWS_SDK_SKIP_UPDATE"].toLowerCase() !== "true" ){
|
|
84
|
+
await updater(projectDir);
|
|
85
|
+
}
|
|
86
|
+
|
|
85
87
|
startElectron(projectDir);
|
|
86
88
|
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This command should be used to start the kumologica runtime in local mode. And it will
|
|
3
|
+
* be assisting the UI on all aspects of the project development.
|
|
4
|
+
*
|
|
5
|
+
* Example:
|
|
6
|
+
* kl start ./myproject
|
|
7
|
+
* kl start ./myproject/flow.json
|
|
8
|
+
* kl start (this will look for a flow.json in the current directory)
|
|
9
|
+
*
|
|
10
|
+
* If not flow is found, the process will be exited (with code 1)
|
|
11
|
+
*
|
|
12
|
+
* The Runtime API can be found in: packages/runtime/src/runtime/lib/api/rest/index.js
|
|
13
|
+
* The actual runtime is in: packages/runtime/src/runtime/lib/index.js
|
|
14
|
+
*
|
|
15
|
+
* Naming convention used during the code:
|
|
16
|
+
* - AdminApp (express app) is the server that serves the Runtime API
|
|
17
|
+
* - NodeApp (express app) is the server that runs the flow
|
|
18
|
+
*
|
|
19
|
+
* DEVELOPER NOTE:
|
|
20
|
+
* Current implementation seems to be mounting the runtime api in the NodeApp (see runtime/lib/index.js:534)
|
|
21
|
+
* Ideally we wouldl like to separate the two apps and have the AdminApp running on a different port.
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const path = require("path");
|
|
26
|
+
const fs = require("fs");
|
|
27
|
+
const { codegen } = require("@kumologica/builder");
|
|
28
|
+
const { DesignerServer } = require("../../src/server/DesignerServer");
|
|
29
|
+
const { logError, logNotice, logInfo, logFatal } = require("../utils/logger");
|
|
30
|
+
// const opn = require('better-opn');
|
|
31
|
+
|
|
32
|
+
exports.command = "start [project_directory]";
|
|
33
|
+
exports.desc = `Run kumologica runtime in local mode`;
|
|
34
|
+
|
|
35
|
+
exports.builder = (yargs) => {
|
|
36
|
+
yargs.positional(`project_directory`, {
|
|
37
|
+
type: "string",
|
|
38
|
+
describe:
|
|
39
|
+
"Path to a valid kumologica project directory or flow file. (Optional)",
|
|
40
|
+
});
|
|
41
|
+
yargs.option(`loglevel`, {
|
|
42
|
+
describe: "Logging level: [error, warn, info, debug, trace]",
|
|
43
|
+
type: "string",
|
|
44
|
+
nargs: 1,
|
|
45
|
+
});
|
|
46
|
+
yargs.option(`port`, {
|
|
47
|
+
describe: "Specifies the listening port utilized by the application",
|
|
48
|
+
type: "number",
|
|
49
|
+
nargs: 1,
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.desc = "Starting Kumologica Runtime for Development";
|
|
54
|
+
|
|
55
|
+
exports.handler = async ({ project_directory, loglevel, port, secured }) => {
|
|
56
|
+
logNotice(`Launching Kumologica Runtime...`);
|
|
57
|
+
// project_directory can point to a directory or a flow, so lets make sure that first the directory exists
|
|
58
|
+
let absProjectDirectory;
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
absProjectDirectory = fs.realpathSync(project_directory);
|
|
62
|
+
} catch (err) {
|
|
63
|
+
logFatal(`Project not found: ${project_directory}`);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
// Resolve the path to the flow path
|
|
69
|
+
const [projectFlowDirname, projectFlowFullPath] =
|
|
70
|
+
resolveProjectFlowPath(absProjectDirectory);
|
|
71
|
+
logInfo(`> Flow file found: ${projectFlowFullPath}`);
|
|
72
|
+
|
|
73
|
+
// Gather all cli params
|
|
74
|
+
const cliParams = {
|
|
75
|
+
loglevel,
|
|
76
|
+
port,
|
|
77
|
+
noadmin: true,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// Start a server
|
|
81
|
+
let server = new DesignerServer({
|
|
82
|
+
flowPath: projectFlowFullPath,
|
|
83
|
+
cliParams,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
await server.start();
|
|
87
|
+
|
|
88
|
+
// open("http://localhost:1880/hello");
|
|
89
|
+
} catch (e) {
|
|
90
|
+
console.log(e);
|
|
91
|
+
logFatal(e.message);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Resolve a given path to a new path that points to the project flow json file.
|
|
97
|
+
* Scenarios:
|
|
98
|
+
* - If path undefined will resolve using current directory
|
|
99
|
+
* - If path directory, it should look up for a valid flow.json file, if it does not exist create it
|
|
100
|
+
* - If path is pointing to an actual flowFile, just return it.
|
|
101
|
+
*
|
|
102
|
+
* @param {string} projectDir
|
|
103
|
+
*/
|
|
104
|
+
function resolveProjectFlowPath(projectDir) {
|
|
105
|
+
// output
|
|
106
|
+
let projectFlowFullPath;
|
|
107
|
+
let projectFlowDirname;
|
|
108
|
+
|
|
109
|
+
let projectDirOrFile = projectDir || process.cwd();
|
|
110
|
+
|
|
111
|
+
let isDir = isDirectory(projectDirOrFile);
|
|
112
|
+
if (isDir) {
|
|
113
|
+
let flowFileName = codegen.findFlowFile(projectDirOrFile); // returns only the flowname
|
|
114
|
+
|
|
115
|
+
if (!flowFileName) {
|
|
116
|
+
logError(`No flow found in directory: ${projectDirOrFile}`);
|
|
117
|
+
process.exit(1);
|
|
118
|
+
} else {
|
|
119
|
+
projectFlowDirname = projectDirOrFile;
|
|
120
|
+
projectFlowFullPath = path.join(projectDirOrFile, flowFileName);
|
|
121
|
+
}
|
|
122
|
+
} else if (isDir === false) {
|
|
123
|
+
projectFlowDirname = path.dirname(projectDirOrFile);
|
|
124
|
+
projectFlowFullPath = projectDirOrFile;
|
|
125
|
+
} else {
|
|
126
|
+
logError(`Directory does not exist: ${project_directory}`);
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return [projectFlowDirname, projectFlowFullPath];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function isDirectory(dir) {
|
|
134
|
+
try {
|
|
135
|
+
let stats = fs.statSync(dir);
|
|
136
|
+
return stats.isDirectory();
|
|
137
|
+
} catch (err) {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kumologica/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0-beta2",
|
|
4
4
|
"productName": "Kumologica Designer",
|
|
5
5
|
"copyright": "Copyright 2020 Kumologica Pty Ltd, All Rights Reserved.",
|
|
6
6
|
"author": "Kumologica Pty Ltd <contact@kumologica.com>",
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
"@aws-sdk/credential-providers": "^3.556.0",
|
|
83
83
|
"@aws-sdk/lib-dynamodb": "^3.549.0",
|
|
84
84
|
"@electron/remote": "^2.0.8",
|
|
85
|
-
"@kumologica/builder": "3.
|
|
86
|
-
"@kumologica/devkit": "3.
|
|
87
|
-
"@kumologica/runtime": "3.
|
|
85
|
+
"@kumologica/builder": "3.6.0-beta2",
|
|
86
|
+
"@kumologica/devkit": "3.6.0-beta2",
|
|
87
|
+
"@kumologica/runtime": "3.6.0-beta2",
|
|
88
88
|
"adm-zip": "0.4.13",
|
|
89
89
|
"ajv": "8.10.0",
|
|
90
90
|
"archive-type": "^4.0.0",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"dagre": "^0.8.5",
|
|
103
103
|
"debounce": "^1.2.0",
|
|
104
104
|
"decompress": "^4.2.1",
|
|
105
|
-
"electron": "
|
|
105
|
+
"electron": "30.0.0",
|
|
106
106
|
"electron-tabs": "^1.0.1",
|
|
107
107
|
"electron-updater": "4.3.9",
|
|
108
108
|
"enquirer": "2.3.6",
|
package/src/app/main.js
CHANGED
|
@@ -423,7 +423,9 @@ function runtimeEventListener(event) {
|
|
|
423
423
|
}
|
|
424
424
|
|
|
425
425
|
async function openProjectEditor(projectDir, onDidLoad) {
|
|
426
|
-
console.log(
|
|
426
|
+
console.log(`> Node.js version: ${process.versions.node}`);
|
|
427
|
+
console.log('> Project directory:', projectDir);
|
|
428
|
+
|
|
427
429
|
try {
|
|
428
430
|
let startupErrorEvent;
|
|
429
431
|
startupEmitter = new EventEmitter();
|
package/src/app/preload.js
CHANGED
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
// const { AppServer, lambdify } = require('./lib/runtime-loader');
|
|
10
10
|
const { lambdify } = require('@kumologica/runtime');
|
|
11
11
|
const { codegen } = require('@kumologica/builder');
|
|
12
|
-
|
|
13
12
|
const { DesignerServer } = require('../server/DesignerServer')
|
|
14
|
-
|
|
15
13
|
const { Terminal } = require('xterm');
|
|
16
14
|
const { FitAddon } = require('xterm-addon-fit');
|
|
17
15
|
const electron = require('electron');
|