@kumologica/sdk 3.6.0-beta6 → 3.6.0-beta7

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.
@@ -4,7 +4,7 @@ const { Updater } = require('@kumologica/builder');
4
4
  const { confirm } = require('enquirer');
5
5
 
6
6
  const { logError } = require('../utils/logger');
7
- const rootPath = path.join(__dirname, '..', '..');
7
+ const rootPath = path.join(__dirname, '..', '..', '..', '..');
8
8
 
9
9
  function displayTable(data) {
10
10
  if (!data.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumologica/sdk",
3
- "version": "3.6.0-beta6",
3
+ "version": "3.6.0-beta7",
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.6.0-beta6",
86
- "@kumologica/devkit": "3.6.0-beta6",
87
- "@kumologica/runtime": "3.6.0-beta6",
85
+ "@kumologica/builder": "3.6.0-beta7",
86
+ "@kumologica/devkit": "3.6.0-beta7",
87
+ "@kumologica/runtime": "3.6.0-beta7",
88
88
  "adm-zip": "0.4.13",
89
89
  "ajv": "8.10.0",
90
90
  "archive-type": "^4.0.0",
package/src/app/main.js CHANGED
@@ -10,6 +10,7 @@ const fixPath = require("./lib/utils/fix-path.js");
10
10
  const util = require("util");
11
11
  const path = require("path");
12
12
  const exec = util.promisify(require("child_process").exec);
13
+ const { spawn, execSync } = require("child_process");
13
14
  const request = require("request");
14
15
  const requestAsync = util.promisify(request);
15
16
  const has = require("lodash/has");
@@ -276,36 +277,57 @@ ipcMain.on("modal-node-library:fetch-installed-nodes", (event, payload) => {
276
277
  });
277
278
  });
278
279
 
279
- // - Install package command event
280
- ipcMain.on("modal-node-library:install-package", async (event, payload) => {
281
- let { source } = payload;
282
-
283
- // Send signal to modal window that we are going to start installing it
284
- event.sender.send("modal-node-library:install-package-initiated", {
285
- source: source,
286
- });
287
-
288
- // Dev Dependencies to be installed
289
- if (source.hasOwnProperty("devPackages")) {
290
- let devDependencies = source["devPackages"].join(" ");
291
- const npmCmd = `npm install --save-dev ${devDependencies}`;
292
- const currentProjectDir = EditorManager.getCurrentUserDir();
293
- await exec(npmCmd, { cwd: currentProjectDir });
294
- }
295
-
296
- // Dependency to be installed
297
- let dependency = source.package;
298
-
299
- // Execute the command: npm install <package>
300
- const npmCmd = `npm install --save ${dependency}`;
301
- const currentProjectDir = EditorManager.getCurrentUserDir();
302
- await exec(npmCmd, { cwd: currentProjectDir });
303
-
304
- // Send signal to modal window that we have finished with the installation and a restart is required
305
- event.sender.send("modal-node-library:install-package-finished", {
306
- source: source,
307
- });
308
- });
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
+ // });
309
331
 
310
332
  // - Uninstall package command event
311
333
  ipcMain.on("modal-node-library:uninstall-package", async (event, payload) => {