pomitu 1.1.0 → 1.1.1

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 CHANGED
@@ -98,7 +98,7 @@ If you want to contribute to Pomitu or run it in development mode:
98
98
  Dev installation test:
99
99
 
100
100
  ```sh
101
- npm run build && npm pack && npm install -g pomitu-1.1.0.tgz && rm pomitu-1.1.0.tgz
101
+ npm run build && npm pack && npm install -g pomitu-1.1.1.tgz && rm pomitu-1.1.1.tgz
102
102
  ```
103
103
 
104
104
  ### Linting
@@ -120,7 +120,7 @@ export function ProcessTUI({ configPath, clearLogs }) {
120
120
  setMessageColor('green');
121
121
  }
122
122
  else if (action === 'stop') {
123
- const success = await processManager.stopApp(appName);
123
+ const success = await processManager.stopApp(appName, { quiet: true });
124
124
  if (success) {
125
125
  setMessage(`Stopped ${appName}`);
126
126
  setMessageColor('green');
@@ -131,7 +131,7 @@ export function ProcessTUI({ configPath, clearLogs }) {
131
131
  }
132
132
  }
133
133
  else if (action === 'restart') {
134
- const success = await processManager.stopApp(appName);
134
+ const success = await processManager.stopApp(appName, { quiet: true });
135
135
  if (success) {
136
136
  // Wait a bit before restarting
137
137
  await new Promise(resolve => setTimeout(resolve, 500));
@@ -198,15 +198,15 @@ export function ProcessTUI({ configPath, clearLogs }) {
198
198
  handleSelect(item);
199
199
  }
200
200
  }, [handleSelect]);
201
+ const notificationText = isProcessing ? 'Processing...' : message;
202
+ const notificationColor = isProcessing ? 'yellow' : message ? messageColor : undefined;
201
203
  return (React.createElement(Box, { flexDirection: "column" },
202
204
  React.createElement(Box, { borderStyle: "round", borderColor: "cyan", padding: 1, marginBottom: 1 },
203
205
  React.createElement(Text, { bold: true, color: "cyan" }, "Pomitu Process Manager - Interactive Mode")),
204
- isProcessing && (React.createElement(Box, { marginBottom: 1 },
205
- React.createElement(Text, { color: "yellow" }, "Processing..."))),
206
- message && !isProcessing && (React.createElement(Box, { marginBottom: 1 },
207
- React.createElement(Text, { color: messageColor }, message))),
208
206
  processes.length > 0 ? (React.createElement(React.Fragment, null,
209
207
  React.createElement(Box, { marginBottom: 1 },
210
208
  React.createElement(Text, { dimColor: true }, "Use arrow keys to navigate, Enter to select, 'q' or Ctrl+C to quit")),
211
- React.createElement(SelectInput, { items: items, onSelect: handleMenuSelect, isFocused: !isProcessing }))) : (React.createElement(Text, null, "Loading processes..."))));
209
+ React.createElement(SelectInput, { items: items, onSelect: handleMenuSelect, isFocused: !isProcessing }))) : (React.createElement(Text, null, "Loading processes...")),
210
+ React.createElement(Box, { marginTop: 1 },
211
+ React.createElement(Text, { color: notificationColor ?? 'gray' }, notificationText ?? ' '))));
212
212
  }
@@ -34,7 +34,8 @@ export class ProcessManager {
34
34
  console.log(`Started: ${app.name} with pid ${process.pid}`);
35
35
  }
36
36
  }
37
- async stopApp(name) {
37
+ async stopApp(name, options = {}) {
38
+ const quiet = options.quiet ?? false;
38
39
  const fileNameFriendlyName = getFileNameFriendlyName(name);
39
40
  const pid = this.pidManager.getPid(fileNameFriendlyName);
40
41
  if (!pid) {
@@ -45,11 +46,15 @@ export class ProcessManager {
45
46
  this.pidManager.removePid(fileNameFriendlyName);
46
47
  return false;
47
48
  }
48
- console.log(`Stopping ${name} with pid ${pid}`);
49
+ if (!quiet) {
50
+ console.log(`Stopping ${name} with pid ${pid}`);
51
+ }
49
52
  try {
50
53
  process.kill(pid);
51
54
  this.pidManager.removePid(fileNameFriendlyName);
52
- console.log(`${name} with pid ${pid} stopped`);
55
+ if (!quiet) {
56
+ console.log(`${name} with pid ${pid} stopped`);
57
+ }
53
58
  return true;
54
59
  }
55
60
  catch (error) {
@@ -58,11 +63,11 @@ export class ProcessManager {
58
63
  return false;
59
64
  }
60
65
  }
61
- async stopAllApps() {
66
+ async stopAllApps(options = {}) {
62
67
  const runningProcesses = this.listRunningProcesses();
63
68
  let stoppedCount = 0;
64
69
  for (const processInfo of runningProcesses) {
65
- const success = await this.stopApp(processInfo.name);
70
+ const success = await this.stopApp(processInfo.name, options);
66
71
  if (success) {
67
72
  stoppedCount++;
68
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pomitu",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Pomitu is a process manager inspired by PM2",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "main": "dist/app.js",
27
27
  "bin": {
28
- "pomitu": "./dist/app.js"
28
+ "pomitu": "dist/app.js"
29
29
  },
30
30
  "author": "flawiddsouza",
31
31
  "license": "ISC",