@kapeta/local-cluster-service 0.14.1 → 0.14.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.14.2](https://github.com/kapetacom/local-cluster-service/compare/v0.14.1...v0.14.2) (2023-08-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Use kapeta std lib for child process ([#58](https://github.com/kapetacom/local-cluster-service/issues/58)) ([43254ce](https://github.com/kapetacom/local-cluster-service/commit/43254cef67c86f8260150073d44b5803cd20e527))
7
+
1
8
  ## [0.14.1](https://github.com/kapetacom/local-cluster-service/compare/v0.14.0...v0.14.1) (2023-08-07)
2
9
 
3
10
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.progressListener = void 0;
4
- const child_process_1 = require("child_process");
4
+ const nodejs_process_1 = require("@kapeta/nodejs-process");
5
5
  const socketManager_1 = require("./socketManager");
6
6
  class ProgressListener {
7
7
  socketManager;
@@ -14,18 +14,15 @@ class ProgressListener {
14
14
  message: `Running command "${command}"`,
15
15
  });
16
16
  return new Promise((resolve, reject) => {
17
- const child = (0, child_process_1.spawn)(command, {
17
+ const child = (0, nodejs_process_1.spawn)(command, [], {
18
18
  cwd: directory ? directory : process.cwd(),
19
19
  detached: true,
20
20
  shell: true,
21
21
  });
22
- child.stdout.on('data', (data) => {
23
- this.socketManager.emit(`install`, 'install:log', { type: 'info', message: data.toString() });
22
+ child.onData((data) => {
23
+ this.socketManager.emit(`install`, 'install:log', { type: 'info', message: data.line });
24
24
  });
25
- child.stderr.on('data', (data) => {
26
- this.socketManager.emit(`install`, 'install:log', { type: 'info', message: data.toString() });
27
- });
28
- child.on('exit', (exit, signal) => {
25
+ child.process.on('exit', (exit, signal) => {
29
26
  if (exit !== 0) {
30
27
  this.socketManager.emit(`install`, 'install:log', {
31
28
  type: 'info',
@@ -41,7 +38,7 @@ class ProgressListener {
41
38
  resolve({ exit, signal });
42
39
  }
43
40
  });
44
- child.on('error', (err) => {
41
+ child.process.on('error', (err) => {
45
42
  this.socketManager.emit(`install`, 'install:log', {
46
43
  type: 'info',
47
44
  message: `"${command}" failed: "${err.message}"`,
@@ -1,4 +1,4 @@
1
- import { spawn } from 'child_process';
1
+ import { spawn } from '@kapeta/nodejs-process';
2
2
  import { socketManager } from './socketManager';
3
3
  class ProgressListener {
4
4
  socketManager;
@@ -11,18 +11,15 @@ class ProgressListener {
11
11
  message: `Running command "${command}"`,
12
12
  });
13
13
  return new Promise((resolve, reject) => {
14
- const child = spawn(command, {
14
+ const child = spawn(command, [], {
15
15
  cwd: directory ? directory : process.cwd(),
16
16
  detached: true,
17
17
  shell: true,
18
18
  });
19
- child.stdout.on('data', (data) => {
20
- this.socketManager.emit(`install`, 'install:log', { type: 'info', message: data.toString() });
19
+ child.onData((data) => {
20
+ this.socketManager.emit(`install`, 'install:log', { type: 'info', message: data.line });
21
21
  });
22
- child.stderr.on('data', (data) => {
23
- this.socketManager.emit(`install`, 'install:log', { type: 'info', message: data.toString() });
24
- });
25
- child.on('exit', (exit, signal) => {
22
+ child.process.on('exit', (exit, signal) => {
26
23
  if (exit !== 0) {
27
24
  this.socketManager.emit(`install`, 'install:log', {
28
25
  type: 'info',
@@ -38,7 +35,7 @@ class ProgressListener {
38
35
  resolve({ exit, signal });
39
36
  }
40
37
  });
41
- child.on('error', (err) => {
38
+ child.process.on('error', (err) => {
42
39
  this.socketManager.emit(`install`, 'install:log', {
43
40
  type: 'info',
44
41
  message: `"${command}" failed: "${err.message}"`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -46,6 +46,7 @@
46
46
  "@kapeta/codegen": "<2",
47
47
  "@kapeta/local-cluster-config": ">= 0.2.3 <2",
48
48
  "@kapeta/nodejs-api-client": "<2",
49
+ "@kapeta/nodejs-process": "^1.1.0",
49
50
  "@kapeta/nodejs-registry-utils": "<2",
50
51
  "@kapeta/nodejs-utils": "<2",
51
52
  "@kapeta/schemas": "^0.0.58",
@@ -1,4 +1,4 @@
1
- import { spawn } from 'child_process';
1
+ import { spawn } from '@kapeta/nodejs-process';
2
2
  import { SocketManager, socketManager } from './socketManager';
3
3
  class ProgressListener {
4
4
  private socketManager: SocketManager;
@@ -14,21 +14,17 @@ class ProgressListener {
14
14
  });
15
15
 
16
16
  return new Promise((resolve, reject) => {
17
- const child = spawn(command, {
17
+ const child = spawn(command, [],{
18
18
  cwd: directory ? directory : process.cwd(),
19
19
  detached: true,
20
20
  shell: true,
21
21
  });
22
22
 
23
- child.stdout.on('data', (data) => {
24
- this.socketManager.emit(`install`, 'install:log', { type: 'info', message: data.toString() });
23
+ child.onData((data) => {
24
+ this.socketManager.emit(`install`, 'install:log', { type: 'info', message: data.line });
25
25
  });
26
26
 
27
- child.stderr.on('data', (data) => {
28
- this.socketManager.emit(`install`, 'install:log', { type: 'info', message: data.toString() });
29
- });
30
-
31
- child.on('exit', (exit, signal) => {
27
+ child.process.on('exit', (exit, signal) => {
32
28
  if (exit !== 0) {
33
29
  this.socketManager.emit(`install`, 'install:log', {
34
30
  type: 'info',
@@ -44,7 +40,7 @@ class ProgressListener {
44
40
  }
45
41
  });
46
42
 
47
- child.on('error', (err) => {
43
+ child.process.on('error', (err) => {
48
44
  this.socketManager.emit(`install`, 'install:log', {
49
45
  type: 'info',
50
46
  message: `"${command}" failed: "${err.message}"`,