@kumologica/sdk 3.5.5 → 3.6.0-alpha7

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.
Files changed (36) hide show
  1. package/cli/cli.js +31 -8
  2. package/cli/commands/open.js +88 -15
  3. package/cli/commands/run.js +167 -0
  4. package/cli/commands/serve.js +139 -0
  5. package/package.json +5 -5
  6. package/src/app/main-process/main-window.js +1 -0
  7. package/src/app/main-process/modal-home.js +1 -0
  8. package/src/app/main-process/modal-newproject.js +1 -0
  9. package/src/app/main-process/modal-newtab.js +1 -0
  10. package/src/app/main-process/modal-nodelibrary.js +1 -0
  11. package/src/app/main-process/modal-renameTab.js +1 -0
  12. package/src/app/main-process/modal-welcome.js +1 -0
  13. package/src/app/main.js +179 -141
  14. package/src/app/preload.js +225 -139
  15. package/src/app/ui/editor-client/public/red/red.js +1943 -783
  16. package/src/app/ui/editor-client/public/red/red.min.js +2 -2
  17. package/src/app/ui/editor-client/public/red/style.min.css +1 -1
  18. package/src/app/ui/editor-client/public/vendor/ace-linters/javascript-service.js +10 -2
  19. package/src/app/ui/editor-client/src/js/red.js +183 -179
  20. package/src/app/ui/editor-client/src/js/ui/common/commandBox.js +107 -0
  21. package/src/app/ui/editor-client/src/js/ui/common/searchBox.js +91 -90
  22. package/src/app/ui/editor-client/src/js/ui/modules.js +164 -0
  23. package/src/app/ui/editor-client/src/js/ui/search.js +171 -123
  24. package/src/app/ui/editor-client/src/js/ui/sidebar.js +1 -1
  25. package/src/app/ui/editor-client/src/js/ui/ui-settings.js +419 -410
  26. package/src/app/ui/editor-client/src/sass/editor.scss +745 -746
  27. package/src/app/ui/editor-client/src/sass/forms.scss +1 -1
  28. package/src/app/ui/editor-client/src/sass/search.scss +16 -2
  29. package/src/app/ui/editor-client/src/sass/sidebar.scss +1 -1
  30. package/src/app/ui/editor-client/src/sass/style.scss +72 -69
  31. package/src/app/ui/editor-client/src/sass/ui/common/commandBox.scss +100 -0
  32. package/src/app/ui/editor-client/src/sass/ui/common/searchBox.scss +3 -2
  33. package/src/app/ui/editor-client/src/sass/ui-settings.scss +14 -14
  34. package/src/app/ui/editor-client/src/vendor/ace-linters/build/javascript-service.js +10 -2
  35. package/src/app/ui/editor-client/templates/index.mst +2 -2
  36. package/src/server/DesignerServer.js +152 -153
package/src/app/main.js CHANGED
@@ -2,42 +2,43 @@
2
2
  * ipcMain.on('ch', (e.msg){}) <---------------------- ipcRenderer.send('reply', msg)
3
3
  * win.webContents.send('message', msg) -------------> ipcRenderer.on('message' (e,msg){})
4
4
  */
5
- const electron = require('electron');
5
+ const electron = require("electron");
6
6
  // Initialize remote from the main. Refer to: https://www.npmjs.com/package/@electron/remote/v/2.0.8
7
- require('@electron/remote/main').initialize()
8
-
9
- const fixPath = require('./lib/utils/fix-path.js');
10
- const util = require('util');
11
- const path = require('path');
12
- const exec = util.promisify(require('child_process').exec);
13
- const request = require('request');
7
+ require("@electron/remote/main").initialize();
8
+
9
+ const fixPath = require("./lib/utils/fix-path.js");
10
+ const util = require("util");
11
+ const path = require("path");
12
+ const exec = util.promisify(require("child_process").exec);
13
+ const { spawn, execSync } = require("child_process");
14
+ const request = require("request");
14
15
  const requestAsync = util.promisify(request);
15
- const has = require('lodash/has');
16
+ const has = require("lodash/has");
16
17
 
17
18
  // using electron-updater instead of builtin autoUpdater
18
19
  // see why: https://www.electron.build/auto-update
19
20
  //const { autoUpdater } = require('electron-updater');
20
21
 
21
- const fs = require('fs');
22
+ const fs = require("fs");
22
23
  let { app, Menu, ipcMain, shell } = electron;
23
24
 
24
- const { appMenu, dockMenu } = require('./main-process/menu');
25
- const EditorManager = require('./main-process/editor-manager');
26
- const { codegen } = require('@kumologica/builder');
25
+ const { appMenu, dockMenu } = require("./main-process/menu");
26
+ const EditorManager = require("./main-process/editor-manager");
27
+ const { codegen } = require("@kumologica/builder");
27
28
 
28
- const MainWindow = require('./main-process/main-window');
29
- const ModalNewProject = require('./main-process/modal-newproject');
30
- const ModalHome = require('./main-process/modal-home');
31
- const ModalNewTab = require('./main-process/modal-newtab');
32
- const ModalRenameTab = require('./main-process/modal-renameTab');
33
- const ModalWelcome = require('./main-process/modal-welcome');
34
- const EventEmitter = require('events');
35
- const ModalNodeLibrary = require('./main-process/modal-nodelibrary');
29
+ const MainWindow = require("./main-process/main-window");
30
+ const ModalNewProject = require("./main-process/modal-newproject");
31
+ const ModalHome = require("./main-process/modal-home");
32
+ const ModalNewTab = require("./main-process/modal-newtab");
33
+ const ModalRenameTab = require("./main-process/modal-renameTab");
34
+ const ModalWelcome = require("./main-process/modal-welcome");
35
+ const EventEmitter = require("events");
36
+ const ModalNodeLibrary = require("./main-process/modal-nodelibrary");
36
37
 
37
38
  const {
38
39
  UserPreferenceStore,
39
40
  defaultKeys,
40
- } = require('./lib/stores/user-preference-store');
41
+ } = require("./lib/stores/user-preference-store");
41
42
 
42
43
  let RUNTIME_PORT;
43
44
 
@@ -66,17 +67,17 @@ class WindowsController {
66
67
  let winController = new WindowsController();
67
68
 
68
69
  // Disable security warnings
69
- process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
70
+ process.env["ELECTRON_DISABLE_SECURITY_WARNINGS"] = "true";
70
71
 
71
72
  // ***** Events from 'modal-welcome *****
72
- ipcMain.on('modal-welcome:show-dialog-newproject', async () => {
73
+ ipcMain.on("modal-welcome:show-dialog-newproject", async () => {
73
74
  winController.setKeepAppRunningIfAllWindowsClosed(true);
74
75
  currentModalWindow.close();
75
- const { version } = require('../../package.json');
76
+ const { version } = require("../../package.json");
76
77
 
77
78
  let userDir = codegen.generateInitialCode(
78
79
  userPrefStore.getUserDataPath(),
79
- '__untitled__',
80
+ "__untitled__",
80
81
  null,
81
82
  version
82
83
  );
@@ -87,11 +88,11 @@ ipcMain.on('modal-welcome:show-dialog-newproject', async () => {
87
88
  winController.setKeepAppRunningIfAllWindowsClosed(false);
88
89
  });
89
90
 
90
- ipcMain.on('modal-welcome:show-dialog-openproject', async () => {
91
+ ipcMain.on("modal-welcome:show-dialog-openproject", async () => {
91
92
  let openDialog = electron.dialog;
92
93
  let options = {
93
- title: 'Open project directory',
94
- properties: ['openDirectory'],
94
+ title: "Open project directory",
95
+ properties: ["openDirectory"],
95
96
  };
96
97
  openDialog
97
98
  .showOpenDialog(currentModalWindow.window, options)
@@ -110,54 +111,54 @@ ipcMain.on('modal-welcome:show-dialog-openproject', async () => {
110
111
 
111
112
  // **** Events from "modal-home" ****
112
113
 
113
- ipcMain.on('modal-home:show-dialog-newproject', () => {
114
+ ipcMain.on("modal-home:show-dialog-newproject", () => {
114
115
  currentModalWindow.close();
115
116
  showNewProjectDialog(true);
116
117
  });
117
118
 
118
- ipcMain.on('modal-home:show-dialog-openproject', () => {
119
+ ipcMain.on("modal-home:show-dialog-openproject", () => {
119
120
  currentModalWindow.close();
120
121
  showOpenProjectDialog(mainWindow.window);
121
122
  });
122
123
 
123
- ipcMain.on('modal-home:open-project-in-editor', async (event, msg) => {
124
+ ipcMain.on("modal-home:open-project-in-editor", async (event, msg) => {
124
125
  if (currentModalWindow) currentModalWindow.close();
125
126
  await openProjectEditor(msg.payload.projectLocation);
126
127
  });
127
128
 
128
129
  // menu events
129
130
 
130
- ipcMain.on('menu-help-documentation', () => {
131
- shell.openExternal('https://docs.kumologica.com/docs/guide/Intro.html');
131
+ ipcMain.on("menu-help-documentation", () => {
132
+ shell.openExternal("https://docs.kumologica.com/docs/guide/Intro.html");
132
133
  });
133
134
 
134
- ipcMain.on('menu-help-training-videos', () => {
135
+ ipcMain.on("menu-help-training-videos", () => {
135
136
  shell.openExternal(
136
- 'https://www.youtube.com/channel/UCsTDAlhijUFpsfThJu3hF9g'
137
+ "https://www.youtube.com/channel/UCsTDAlhijUFpsfThJu3hF9g"
137
138
  );
138
139
  });
139
140
 
140
- ipcMain.on('menu-help-release-notes', () => {
141
+ ipcMain.on("menu-help-release-notes", () => {
141
142
  shell.openExternal(
142
- 'https://github.com/KumologicaHQ/kumologica-designer-releases/releases/'
143
+ "https://github.com/KumologicaHQ/kumologica-designer-releases/releases/"
143
144
  );
144
145
  });
145
146
 
146
- ipcMain.on('menu-help-join-twitter', () => {
147
- shell.openExternal('https://twitter.com/kumologica');
147
+ ipcMain.on("menu-help-join-twitter", () => {
148
+ shell.openExternal("https://twitter.com/kumologica");
148
149
  });
149
150
 
150
- ipcMain.on('menu-help-join-discord', () => {
151
- shell.openExternal('https://discord.com/invite/HrTCY8zXxM');
151
+ ipcMain.on("menu-help-join-discord", () => {
152
+ shell.openExternal("https://discord.com/invite/HrTCY8zXxM");
152
153
  });
153
154
 
154
- ipcMain.on('kumologica-contact-us', () => {
155
- shell.openExternal('https://kumologica.com/contact.html');
156
- })
155
+ ipcMain.on("kumologica-contact-us", () => {
156
+ shell.openExternal("https://kumologica.com/contact.html");
157
+ });
157
158
 
158
159
  // **** Events from 'NewProject modal' ****
159
160
 
160
- ipcMain.on('modal-projects:close', () => {
161
+ ipcMain.on("modal-projects:close", () => {
161
162
  if (currentModalWindow.isCancellable()) {
162
163
  currentModalWindow.close();
163
164
  } else {
@@ -167,11 +168,11 @@ ipcMain.on('modal-projects:close', () => {
167
168
  }
168
169
  });
169
170
 
170
- ipcMain.on('modal-projects:create-project', async (event, payload) => {
171
+ ipcMain.on("modal-projects:create-project", async (event, payload) => {
171
172
  const { projectName, projectBaseDir, flow } = payload;
172
173
 
173
174
  app.addRecentDocument(projectBaseDir);
174
- const { version } = require('../../package.json');
175
+ const { version } = require("../../package.json");
175
176
 
176
177
  currentModalWindow.close();
177
178
  const projectDir = codegen.generateInitialCode(
@@ -185,59 +186,62 @@ ipcMain.on('modal-projects:create-project', async (event, payload) => {
185
186
 
186
187
  // Events from menu
187
188
 
188
- ipcMain.on('core:show-import-dialog', () => {
189
+ ipcMain.on("core:show-import-dialog", () => {
189
190
  mainWindow.sendEventToRenderer("core:show-import-dialog");
190
191
  });
191
192
 
192
- ipcMain.on('core:show-export-dialog', () => {
193
+ ipcMain.on("core:show-export-dialog", () => {
193
194
  mainWindow.sendEventToRenderer("core:show-export-dialog");
194
195
  });
195
196
 
196
- ipcMain.on('core:search', () => {
197
+ ipcMain.on("core:search", () => {
197
198
  mainWindow.sendEventToRenderer("core:search");
198
199
  });
199
200
 
200
- ipcMain.on('core:search', () => {
201
+ ipcMain.on("core:search", () => {
201
202
  mainWindow.sendEventToRenderer("core:search");
202
203
  });
203
204
 
204
- ipcMain.on('core:toggle-terminal', () => {
205
+ ipcMain.on("core:toggle-terminal", () => {
205
206
  mainWindow.sendEventToRenderer("core:toggle-terminal");
206
207
  });
207
- ipcMain.on('core:toggle-palette', () => {
208
+ ipcMain.on("core:toggle-palette", () => {
208
209
  mainWindow.sendEventToRenderer("core:toggle-palette");
209
210
  });
210
- ipcMain.on('core:view-main-workspace', () => {
211
+ ipcMain.on("core:view-main-workspace", () => {
211
212
  mainWindow.sendEventToRenderer("core:view-main-flow");
212
213
  });
213
- ipcMain.on('core:view-test-workspace', () => {
214
+ ipcMain.on("core:view-test-workspace", () => {
214
215
  mainWindow.sendEventToRenderer("core:view-test-flow");
215
216
  });
216
- ipcMain.on('core:view-settings', () => {
217
+ ipcMain.on("core:view-settings", () => {
217
218
  mainWindow.sendEventToRenderer("core:toggle-settings");
218
219
  });
219
220
 
220
- ipcMain.on('show-newProject-modal', () => {
221
+ ipcMain.on("show-newProject-modal", () => {
221
222
  showNewProjectDialog(true);
222
223
  });
223
- ipcMain.on('show-openProject-dialog', () => {
224
+ ipcMain.on("show-openProject-dialog", () => {
224
225
  showOpenProjectDialog();
225
226
  });
226
227
 
227
- ipcMain.on('app_version', (event) => {
228
- event.sender.send('app_version', { version: app.getVersion() });
228
+ ipcMain.on("app_version", (event) => {
229
+ event.sender.send("app_version", { version: app.getVersion() });
229
230
  });
230
- ipcMain.on('main-header:show-modal-home', () => {
231
+ ipcMain.on("main-header:show-modal-home", () => {
231
232
  currentModalWindow = new ModalHome(findRecentProjects());
232
233
  currentModalWindow.load();
233
234
  });
234
- ipcMain.on('navigator:open-new-tab-dialog', () => {
235
+ ipcMain.on("navigator:open-new-tab-dialog", () => {
235
236
  currentModalWindow = new ModalNewTab(mainWindow.window, true);
236
237
  currentModalWindow.load();
237
238
  });
238
- ipcMain.on('navigator:open-rename-tab-dialog', (event, payload) => {
239
+ ipcMain.on("navigator:open-rename-tab-dialog", (event, payload) => {
239
240
  const { tabId, oldTabName } = payload;
240
- currentModalWindow = new ModalRenameTab(mainWindow.window, true, { tabId, oldTabName });
241
+ currentModalWindow = new ModalRenameTab(mainWindow.window, true, {
242
+ tabId,
243
+ oldTabName,
244
+ });
241
245
  currentModalWindow.load();
242
246
  });
243
247
 
@@ -245,22 +249,22 @@ ipcMain.on('navigator:open-rename-tab-dialog', (event, payload) => {
245
249
 
246
250
  // - Modal window launch event
247
251
 
248
- ipcMain.on('show-node-library-modal', () => {
252
+ ipcMain.on("show-node-library-modal", () => {
249
253
  currentModalWindow = new ModalNodeLibrary();
250
254
  currentModalWindow.load();
251
255
  });
252
256
 
253
257
  // Ask for the project directory
254
- ipcMain.on('modal-node-library:fetch-installed-nodes', (event, payload) => {
258
+ ipcMain.on("modal-node-library:fetch-installed-nodes", (event, payload) => {
255
259
  let results = [];
256
260
  let projectDir = EditorManager.getCurrentUserDir();
257
261
  try {
258
- const packageJsonPath = path.join(projectDir, 'package.json');
259
- let data = fs.readFileSync(packageJsonPath, 'utf-8');
262
+ const packageJsonPath = path.join(projectDir, "package.json");
263
+ let data = fs.readFileSync(packageJsonPath, "utf-8");
260
264
  const pkg = JSON.parse(data);
261
265
  const dependencies = pkg.dependencies;
262
266
  results = Object.keys(dependencies).filter((dep) =>
263
- dep.includes('kumologica-contrib')
267
+ dep.includes("kumologica-contrib")
264
268
  );
265
269
  } catch (err) {
266
270
  console.log(err);
@@ -268,44 +272,65 @@ ipcMain.on('modal-node-library:fetch-installed-nodes', (event, payload) => {
268
272
  `package.json file not found in the project directory: ${projectDir}`
269
273
  );
270
274
  }
271
- event.sender.send('modal-node-library:fetch-installed-nodes-response', {
275
+ event.sender.send("modal-node-library:fetch-installed-nodes-response", {
272
276
  installedNodes: results,
273
277
  });
274
278
  });
275
279
 
276
- // - Install package command event
277
- ipcMain.on('modal-node-library:install-package', async (event, payload) => {
278
- let { source } = payload;
279
-
280
- // Send signal to modal window that we are going to start installing it
281
- event.sender.send('modal-node-library:install-package-initiated', {
282
- source: source,
283
- });
284
-
285
- // Dev Dependencies to be installed
286
- if (source.hasOwnProperty('devPackages')) {
287
- let devDependencies = source['devPackages'].join(' ');
288
- const npmCmd = `npm install --save-dev ${devDependencies}`;
289
- const currentProjectDir = EditorManager.getCurrentUserDir();
290
- await exec(npmCmd, { cwd: currentProjectDir });
291
- }
292
-
293
- // Dependency to be installed
294
- let dependency = source.package;
295
-
296
- // Execute the command: npm install <package>
297
- const npmCmd = `npm install --save ${dependency}`;
298
- const currentProjectDir = EditorManager.getCurrentUserDir();
299
- await exec(npmCmd, { cwd: currentProjectDir });
300
-
301
- // Send signal to modal window that we have finished with the installation and a restart is required
302
- event.sender.send('modal-node-library:install-package-finished', {
303
- source: source,
304
- });
305
- });
280
+ ipcMain.on("modal-node-library:install-package", (event, payload) => {
281
+ // let { command } = payload;
282
+ // let newEnv = {
283
+ // ...process.env,
284
+ // PATH: includeNodePathIntoPath(),
285
+ // };
286
+ // const child = spawn("npm", ["install"], {
287
+ // cwd: EditorManager.getCurrentUserDir(),
288
+ // env: newEnv,
289
+ // });
290
+ // // Stream stdout data
291
+ // child.stdout.on("data", (data) => {
292
+ // window.__kumologica.editor.terminal.eventEmitter.emit(
293
+ // "terminal-output",
294
+ // data.toString()
295
+ // );
296
+ // // console.log(data.toString());
297
+ // });
298
+ // // Stream stderr data
299
+ // child.stderr.on("data", (data) => {
300
+ // console.log(data.toString());
301
+ // });
302
+ // // Handle process exit
303
+ // child.on("close", (code) => {
304
+ // if (code !== 0) {
305
+ // let message =
306
+ // code === 127
307
+ // ? `Command: 'node' could not be found. Please ensure that the NODE_PATH environment variable is correctly set and exported in your system's environment.`
308
+ // : `Command failed with exit code ${code}`;
309
+ // window.__kumologica.editor.terminal.eventEmitter.emit(
310
+ // "terminal-output",
311
+ // `Error: ${message}`
312
+ // );
313
+ // // console.log(error.message);
314
+ // const error = new Error(message);
315
+ // // reject(error);
316
+ // } else {
317
+ // // resolve();
318
+ // }
319
+ // });
320
+ // // Handle execution errors
321
+ // child.on("error", (error) => {
322
+ // console.log(error.message);
323
+ // // reject(error);
324
+ // });
325
+ });
326
+
327
+ // Send signal to modal window that we have finished with the installation and a restart is required
328
+ // event.sender.send("modal-node-library:install-package-finished", {
329
+ // source: source,
330
+ // });
306
331
 
307
332
  // - Uninstall package command event
308
- ipcMain.on('modal-node-library:uninstall-package', async (event, payload) => {
333
+ ipcMain.on("modal-node-library:uninstall-package", async (event, payload) => {
309
334
  let { source } = payload;
310
335
 
311
336
  // Execute the command: npm install <package>
@@ -314,16 +339,16 @@ ipcMain.on('modal-node-library:uninstall-package', async (event, payload) => {
314
339
  await exec(npmCmd, { cwd: currentProjectDir });
315
340
 
316
341
  // Send signal to modal window that we have finished with the installation and a restart is required
317
- event.sender.send('modal-node-library:uninstall-package-finished', {
342
+ event.sender.send("modal-node-library:uninstall-package-finished", {
318
343
  source: source,
319
344
  });
320
345
  });
321
- ipcMain.on('restart-requested', async (event, msg) => {
346
+ ipcMain.on("restart-requested", async (event, msg) => {
322
347
  // reload the nodes available in the palette
323
348
  try {
324
349
  await requestAsync({
325
350
  uri: `http://127.0.0.1:${RUNTIME_PORT}/nodes-reload`,
326
- method: 'POST',
351
+ method: "POST",
327
352
  json: true,
328
353
  });
329
354
  } catch (err) {
@@ -333,13 +358,13 @@ ipcMain.on('restart-requested', async (event, msg) => {
333
358
  mainWindow.reload();
334
359
  });
335
360
 
336
- ipcMain.on('modal-node-library:restart-requested', async (event, msg) => {
361
+ ipcMain.on("modal-node-library:restart-requested", async (event, msg) => {
337
362
  currentModalWindow.close();
338
363
  // reload the nodes available in the palette
339
364
  try {
340
365
  await requestAsync({
341
366
  uri: `http://127.0.0.1:${RUNTIME_PORT}/nodes-reload`,
342
- method: 'POST',
367
+ method: "POST",
343
368
  json: true,
344
369
  });
345
370
  } catch (err) {
@@ -349,7 +374,7 @@ ipcMain.on('modal-node-library:restart-requested', async (event, msg) => {
349
374
  mainWindow.reload();
350
375
  });
351
376
 
352
- ipcMain.on('open-new-tab-dialog:close', async (event, payload) => {
377
+ ipcMain.on("open-new-tab-dialog:close", async (event, payload) => {
353
378
  if (currentModalWindow.isCancellable()) {
354
379
  currentModalWindow.close();
355
380
  } else {
@@ -359,7 +384,7 @@ ipcMain.on('open-new-tab-dialog:close', async (event, payload) => {
359
384
  }
360
385
  });
361
386
 
362
- ipcMain.on('open-rename-tab-dialog:close', async (event, payload) => {
387
+ ipcMain.on("open-rename-tab-dialog:close", async (event, payload) => {
363
388
  if (currentModalWindow.isCancellable()) {
364
389
  currentModalWindow.close();
365
390
  } else {
@@ -369,19 +394,18 @@ ipcMain.on('open-rename-tab-dialog:close', async (event, payload) => {
369
394
  }
370
395
  });
371
396
 
372
- ipcMain.on('open-new-tab-dialog:create-tab', async (event, payload) => {
397
+ ipcMain.on("open-new-tab-dialog:create-tab", async (event, payload) => {
373
398
  currentModalWindow.close();
374
- let tabName = payload['createTabName'];
375
- mainWindow.sendEventToRenderer('create-new-tab', { tabName });
399
+ let tabName = payload["createTabName"];
400
+ mainWindow.sendEventToRenderer("create-new-tab", { tabName });
376
401
  });
377
402
 
378
- ipcMain.on('open-rename-tab-dialog:rename-tab', async (event, payload) => {
403
+ ipcMain.on("open-rename-tab-dialog:rename-tab", async (event, payload) => {
379
404
  currentModalWindow.close();
380
405
  const { tabId, newTabName } = payload;
381
- mainWindow.sendEventToRenderer('explorer:rename-tab', { tabId, newTabName });
406
+ mainWindow.sendEventToRenderer("explorer:rename-tab", { tabId, newTabName });
382
407
  });
383
408
 
384
-
385
409
  function showNewProjectDialog(cancellable) {
386
410
  currentModalWindow = new ModalNewProject(mainWindow.window, cancellable);
387
411
  currentModalWindow.load();
@@ -390,8 +414,8 @@ function showNewProjectDialog(cancellable) {
390
414
  function showOpenProjectDialog(parent) {
391
415
  let openDialog = electron.dialog;
392
416
  let options = {
393
- title: 'Open project directory',
394
- properties: ['openDirectory'],
417
+ title: "Open project directory",
418
+ properties: ["openDirectory"],
395
419
  };
396
420
 
397
421
  openDialog.showOpenDialog(parent, options).then(async (result) => {
@@ -407,28 +431,42 @@ function showOpenProjectDialog(parent) {
407
431
  function runtimeEventListener(event) {
408
432
  // console.log('runtimeEventListener hit with event:', event);
409
433
  // runtime events @Terminal
410
- if (event && event.id && event.id == 'terminal-output'
411
- && mainWindow && mainWindow.window && mainWindow.window.webContents) {
412
- mainWindow.window.webContents.send('terminal-output', event);
434
+ if (
435
+ event &&
436
+ event.id &&
437
+ event.id == "terminal-output" &&
438
+ mainWindow &&
439
+ mainWindow.window &&
440
+ mainWindow.window.webContents
441
+ ) {
442
+ mainWindow.window.webContents.send("terminal-output", event);
413
443
  }
414
444
  // runtime events @tests
415
- if (event && event.id && event.id.startsWith('test:')
416
- && mainWindow && mainWindow.window && mainWindow.window.webContents) {
445
+ if (
446
+ event &&
447
+ event.id &&
448
+ event.id.startsWith("test:") &&
449
+ mainWindow &&
450
+ mainWindow.window &&
451
+ mainWindow.window.webContents
452
+ ) {
417
453
  mainWindow.window.webContents.send(event.id, event);
418
454
  }
419
455
 
420
- if (has(event, 'id') && event.id.startsWith('debugger:')) {
456
+ if (has(event, "id") && event.id.startsWith("debugger:")) {
421
457
  mainWindow.window.webContents.send(event.id, event);
422
458
  }
423
459
  }
424
460
 
425
461
  async function openProjectEditor(projectDir, onDidLoad) {
426
- console.log('> openProjectDir:', projectDir)
462
+ console.log(`> Node.js version: ${process.versions.node}`);
463
+ console.log("> Project directory:", projectDir);
464
+
427
465
  try {
428
466
  let startupErrorEvent;
429
467
  startupEmitter = new EventEmitter();
430
468
 
431
- startupEmitter.on('runtime-startup-error', (event) => {
469
+ startupEmitter.on("runtime-startup-error", (event) => {
432
470
  startupErrorEvent = event;
433
471
  });
434
472
 
@@ -439,11 +477,11 @@ async function openProjectEditor(projectDir, onDidLoad) {
439
477
  // otherwise, we will have duplicated listeners on runtime-events
440
478
  // causing the events to trigger multiple times.
441
479
  EditorManager.appServer.events.removeAllListeners(
442
- 'runtime-event',
480
+ "runtime-event",
443
481
  runtimeEventListener
444
482
  );
445
483
 
446
- EditorManager.appServer.events.on('runtime-event', runtimeEventListener);
484
+ EditorManager.appServer.events.on("runtime-event", runtimeEventListener);
447
485
 
448
486
  if (mainWindow) {
449
487
  // Updating the project information
@@ -462,7 +500,7 @@ async function openProjectEditor(projectDir, onDidLoad) {
462
500
  app.addRecentDocument(projectDir);
463
501
 
464
502
  if (startupErrorEvent) {
465
- ipcMain.emit('runtime-startup-error', startupErrorEvent);
503
+ ipcMain.emit("runtime-startup-error", startupErrorEvent);
466
504
  }
467
505
  } catch (err) {
468
506
  // throw err;
@@ -477,11 +515,11 @@ async function openProjectEditor(projectDir, onDidLoad) {
477
515
 
478
516
  let openDialog = electron.dialog;
479
517
  let options = {
480
- type: 'error',
481
- buttons: ['OK'],
518
+ type: "error",
519
+ buttons: ["OK"],
482
520
  message: `Kumologica Designer is unable to open project`,
483
521
  detail: `${err}`,
484
- icon: electron.nativeImage.createEmpty()
522
+ icon: electron.nativeImage.createEmpty(),
485
523
  };
486
524
  openDialog.showMessageBoxSync(parentWindow, options, async (response) => {
487
525
  // no need to do anything, the runtime has already been recovered with a safe userDir
@@ -499,11 +537,11 @@ async function openWelcomePage() {
499
537
  // There is no project recently opened - we will create one just to kick the runtime
500
538
  // This project will be created in the dataPath of the store:
501
539
  // ~/Library/Application Support/Kumologica
502
- const { version } = require('../../package.json');
540
+ const { version } = require("../../package.json");
503
541
 
504
542
  let userDir = codegen.generateInitialCode(
505
543
  userPrefStore.getUserDataPath(),
506
- '__untitled__',
544
+ "__untitled__",
507
545
  null,
508
546
  version
509
547
  );
@@ -550,7 +588,7 @@ function findLatestProject() {
550
588
  // This method will be called when Electron has finished
551
589
  // initialization and is ready to create browser windows.
552
590
  // Some APIs can only be used after this event occurs.
553
- app.on('ready', async () => {
591
+ app.on("ready", async () => {
554
592
  Menu.setApplicationMenu(appMenu);
555
593
  if (app.dock) {
556
594
  app.dock.setMenu(dockMenu);
@@ -582,14 +620,14 @@ app.on('ready', async () => {
582
620
  });
583
621
 
584
622
  // event triggered from open recent api
585
- app.on('open-file', (event, path) => {
623
+ app.on("open-file", (event, path) => {
586
624
  event.preventDefault();
587
625
  openProjectEditor(path, true);
588
626
  });
589
627
 
590
628
  // Called before quitting...gives us an opportunity to shutdown the child process
591
- app.on('before-quit', async () => {
592
- console.log('> Gracefully shutting down...');
629
+ app.on("before-quit", async () => {
630
+ console.log("> Gracefully shutting down...");
593
631
 
594
632
  // Kill the web process
595
633
  await EditorManager.stop();
@@ -599,7 +637,7 @@ app.on('before-quit', async () => {
599
637
  });
600
638
 
601
639
  // Quit when all windows are closed.
602
- app.on('window-all-closed', function () {
640
+ app.on("window-all-closed", function () {
603
641
  if (!winController.isKeepRunning()) {
604
642
  //recreateWindowRequired = true;
605
643
  // mainWindow.window.destroy();
@@ -614,7 +652,7 @@ app.on('window-all-closed', function () {
614
652
  }
615
653
  });
616
654
 
617
- app.on('activate', function () {
655
+ app.on("activate", function () {
618
656
  // On OS X it's common to re-create a window in the app when the
619
657
  // dock icon is clicked and there are no other windows open.
620
658
  if (mainWindow === null) {
@@ -639,8 +677,8 @@ autoUpdater.on('update-available', () => {
639
677
  });
640
678
  */
641
679
 
642
- process.on('SIGINT', function () {
680
+ process.on("SIGINT", function () {
643
681
  //graceful shutdown
644
- console.log('SIGNINT SENT');
682
+ console.log("SIGNINT SENT");
645
683
  process.exit();
646
684
  });