@jxa13/pm2ui 1.17.0 → 1.18.0

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
@@ -37,7 +37,7 @@ Node WebUI provides a clean browser-based interface for viewing running services
37
37
  - Node.js 18+
38
38
  - One or more PM2-managed processes
39
39
 
40
- Install PM2 globally if you want to use the `pm2` command directly:
40
+ The package includes PM2 as a runtime dependency for the dashboard. Install PM2 globally only if you want to use the `pm2` command directly from your terminal:
41
41
 
42
42
  ```bash
43
43
  npm install -g pm2
@@ -47,6 +47,8 @@ npm install -g pm2
47
47
 
48
48
  ## Installation
49
49
 
50
+ ### Install Or Update
51
+
50
52
  Install the CLI globally from npm:
51
53
 
52
54
  ```bash
@@ -62,19 +64,27 @@ pm2ui
62
64
  By default, the dashboard runs locally on:
63
65
 
64
66
  ```text
65
- http://127.0.0.1:3000
67
+ http://127.0.0.1:3210
66
68
  ```
67
69
 
68
- Install a specific version:
70
+ Upgrade to the latest published version:
69
71
 
70
72
  ```bash
71
- npm install -g @jxa13/pm2ui@1.17.0
73
+ npm install -g @jxa13/pm2ui@latest
72
74
  ```
73
75
 
74
- Update to the latest version:
76
+ Check the installed version:
75
77
 
76
78
  ```bash
77
- npm install -g @jxa13/pm2ui@latest
79
+ npm list -g @jxa13/pm2ui --depth=0
80
+ ```
81
+
82
+ ### Install A Specific Version
83
+
84
+ Install a specific version:
85
+
86
+ ```bash
87
+ npm install -g @jxa13/pm2ui@1.17.0
78
88
  ```
79
89
 
80
90
  Roll back to a previous version:
@@ -83,6 +93,12 @@ Roll back to a previous version:
83
93
  npm install -g @jxa13/pm2ui@1.16.4
84
94
  ```
85
95
 
96
+ View all published versions:
97
+
98
+ ```bash
99
+ npm view @jxa13/pm2ui versions --json
100
+ ```
101
+
86
102
  ### Install From Source
87
103
 
88
104
  Clone the repository:
@@ -98,6 +114,8 @@ Install dependencies:
98
114
  npm install
99
115
  ```
100
116
 
117
+ This installs runtime and development dependencies so the React frontend can be rebuilt from source. Global npm installs use the prebuilt frontend bundle shipped in the package.
118
+
101
119
  Start the app:
102
120
 
103
121
  ```bash
@@ -106,6 +124,45 @@ npm start
106
124
 
107
125
  `npm start` builds the React frontend and starts the local Express server.
108
126
 
127
+ ### Publish A New Version
128
+
129
+ Only maintainers with npm publish access can release new versions.
130
+
131
+ Run the checks:
132
+
133
+ ```bash
134
+ npm run react:build
135
+ npm run react:smoke
136
+ npm pack --dry-run
137
+ ```
138
+
139
+ The package metadata includes public npm access. Publish from a supported CI environment with `npm publish --provenance` when you want npm provenance attached to the release.
140
+
141
+ Bump the package version:
142
+
143
+ ```bash
144
+ npm version patch
145
+ ```
146
+
147
+ Use `minor` for backward-compatible feature releases and `major` for breaking changes:
148
+
149
+ ```bash
150
+ npm version minor
151
+ npm version major
152
+ ```
153
+
154
+ Publish the release:
155
+
156
+ ```bash
157
+ npm publish
158
+ ```
159
+
160
+ After publishing, users can upgrade with:
161
+
162
+ ```bash
163
+ npm install -g @jxa13/pm2ui@latest
164
+ ```
165
+
109
166
  ---
110
167
 
111
168
  ## PM2 Setup
@@ -166,6 +223,8 @@ The logs viewer supports:
166
223
  - Download logs
167
224
  - Toggle line wrapping
168
225
 
226
+ Recent log history is read from the selected PM2 process log files. Live updates use PM2's Node API event bus instead of shelling out to `pm2 logs`.
227
+
169
228
  ---
170
229
 
171
230
  ## Security
@@ -178,18 +237,19 @@ Recommended:
178
237
  - Do not expose it directly to the internet
179
238
  - If remote access is needed, place it behind authentication and a reverse proxy
180
239
 
240
+ Unsafe local API methods such as process actions, PM2 save, log clearing, create, delete, and Finder reveal require a same-origin browser session token. This helps block drive-by POST or DELETE requests from unrelated websites, but it is not a substitute for authentication if the app is exposed beyond localhost.
241
+
181
242
  ---
182
243
 
183
244
  ## Future Ideas
184
245
 
185
246
  Potential future improvements:
186
247
 
187
- - Real-time log streaming with WebSockets
188
- - Process details modal
189
- - Create new PM2 processes from the UI
190
- - Historical CPU and RAM charts
191
248
  - Authentication for LAN access
192
- - Saved dashboard layouts
249
+ - Automated backend route coverage
250
+ - Split backend routes and frontend modules
251
+ - Import/export for operator preference profiles
252
+ - Process grouping and tags
193
253
 
194
254
  ---
195
255
 
@@ -31,60 +31,85 @@ async function withPm2(callback) {
31
31
  }
32
32
  }
33
33
 
34
- async function listProcesses() {
35
- return withPm2(() => new Promise((resolve, reject) => {
36
- pm2.list((error, list) => {
34
+ function pm2Callback(method, ...args) {
35
+ return new Promise((resolve, reject) => {
36
+ pm2[method](...args, (error, result) => {
37
37
  if (error) {
38
38
  reject(error);
39
39
  return;
40
40
  }
41
41
 
42
- resolve(list);
42
+ resolve(result);
43
43
  });
44
- }));
44
+ });
45
45
  }
46
46
 
47
- async function startProcess(target) {
48
- return withPm2(() => new Promise((resolve, reject) => {
49
- pm2.start(target, (error, result) => {
50
- if (error) {
51
- reject(error);
52
- return;
53
- }
47
+ async function listProcesses() {
48
+ return withPm2(() => pm2Callback('list'));
49
+ }
54
50
 
55
- resolve(result);
56
- });
57
- }));
51
+ async function startProcess(target) {
52
+ return withPm2(() => pm2Callback('start', target));
58
53
  }
59
54
 
60
55
  async function stopProcess(target) {
61
- return withPm2(() => new Promise((resolve, reject) => {
62
- pm2.stop(target, (error, result) => {
63
- if (error) {
64
- reject(error);
65
- return;
66
- }
67
-
68
- resolve(result);
69
- });
70
- }));
56
+ return withPm2(() => pm2Callback('stop', target));
71
57
  }
72
58
 
73
59
  async function restartProcess(target) {
74
- return withPm2(() => new Promise((resolve, reject) => {
75
- pm2.restart(target, (error, result) => {
60
+ return withPm2(() => pm2Callback('restart', target));
61
+ }
62
+
63
+ async function deleteProcess(target) {
64
+ return withPm2(() => pm2Callback('delete', target));
65
+ }
66
+
67
+ async function createProcess(options) {
68
+ return withPm2(() => pm2Callback('start', options));
69
+ }
70
+
71
+ async function savePm2State() {
72
+ return withPm2(() => pm2Callback('dump'));
73
+ }
74
+
75
+ async function flushProcessLogs(target) {
76
+ return withPm2(() => pm2Callback('flush', target));
77
+ }
78
+
79
+ async function connectLogBus() {
80
+ await connectPm2();
81
+
82
+ return new Promise((resolve, reject) => {
83
+ pm2.launchBus((error, bus, socket) => {
76
84
  if (error) {
85
+ disconnectPm2();
77
86
  reject(error);
78
87
  return;
79
88
  }
80
89
 
81
- resolve(result);
90
+ resolve({
91
+ bus,
92
+ close: () => {
93
+ try {
94
+ socket?.close?.();
95
+ } catch (socketError) {
96
+ console.error('PM2 log socket close error:', socketError);
97
+ }
98
+
99
+ disconnectPm2();
100
+ }
101
+ });
82
102
  });
83
- }));
103
+ });
84
104
  }
85
105
 
86
106
  module.exports = {
107
+ connectLogBus,
108
+ createProcess,
109
+ deleteProcess,
110
+ flushProcessLogs,
87
111
  listProcesses,
112
+ savePm2State,
88
113
  startProcess,
89
114
  stopProcess,
90
115
  restartProcess
package/changelog.md CHANGED
@@ -8,6 +8,33 @@ Version numbers should be updated with each commit that changes app behavior, us
8
8
  - Minor versions, such as `1.1.0`, for user-visible improvements that do not break existing behavior.
9
9
  - Major versions, such as `2.0.0`, for breaking changes.
10
10
 
11
+ ## 1.18.0 - 2026-06-08
12
+
13
+ ### Added
14
+
15
+ - Added npm package trust metadata, including repository, issue tracker, homepage, author, keywords, and public access settings.
16
+ - Added a same-origin API session token for unsafe local API methods such as PM2 process actions, create, delete, save, log clearing, and Finder reveal.
17
+
18
+ ### Changed
19
+
20
+ - Moved React, Vite, and icon packages from runtime dependencies to development dependencies because the published package serves the prebuilt frontend.
21
+ - Moved PM2 save, create, delete, flush, process actions, and live log streaming from PM2 CLI subprocesses to PM2's Node API.
22
+ - Changed recent log history loading to read the selected PM2 process stdout and stderr log files directly.
23
+ - Updated compatible transitive dependency versions in the lockfile through non-breaking audit fixes.
24
+ - Updated documentation for PM2 CLI requirements, optional npm provenance publishing, local API hardening, and current PM2 log behavior.
25
+
26
+ ### Security
27
+
28
+ - Reduced drive-by localhost request risk by requiring a server-generated token on unsafe API requests from the React UI.
29
+ - Resolved non-breaking runtime audit advisories while leaving the PM2 major-version advisory for a future breaking-change review.
30
+
31
+ ## 1.17.1 - 2026-06-07
32
+
33
+ ### Changed
34
+
35
+ - Changed the default local app port from `3000` to `3210`.
36
+ - Updated Vite development and preview API proxies plus user documentation for the new default port.
37
+
11
38
  ## 1.17.0 - 2026-06-07
12
39
 
13
40
  ### Changed