@hackmd/spm 0.1.2 → 0.1.4
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 +36 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@hackmd/spm)
|
|
5
5
|
[](https://www.npmjs.com/package/@hackmd/spm)
|
|
6
6
|
|
|
7
|
-
A minimal process manager implementing a lean subset of [pm2](https://pm2.keymetrics.io/) features, with some extensions, designed for better development script setup. Lightweight, zero daemon, and ecosystem config
|
|
7
|
+
A minimal process manager implementing a lean subset of [pm2](https://pm2.keymetrics.io/) features, with some extensions, designed for better development script setup. Lightweight, zero daemon, and PM2-inspired ecosystem config support.
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
@@ -71,6 +71,15 @@ spm logs api -t # Tail logs
|
|
|
71
71
|
| `instances` | Number of instances (default: 1) |
|
|
72
72
|
| `env` | Environment variables |
|
|
73
73
|
| `increment_vars` | Env vars to increment per instance (e.g. `PORT`) |
|
|
74
|
+
| `increment_var` | Legacy alias for increment vars (comma-separated string, e.g. `PORT,WS_PORT`) |
|
|
75
|
+
|
|
76
|
+
### Ecosystem File Field Support
|
|
77
|
+
|
|
78
|
+
SPM supports PM2-inspired ecosystem files and deeper app objects without failing on extra fields.
|
|
79
|
+
|
|
80
|
+
- SPM **actively uses**: `name`, `script`, `args`, `instances`, `env`, `increment_vars`, `increment_var`
|
|
81
|
+
- SPM **ignores unsupported fields safely** so you can keep partially shared configs across tools
|
|
82
|
+
- `increment_vars` is the preferred form; `increment_var` is kept as a compatibility alias in SPM
|
|
74
83
|
|
|
75
84
|
Config file is resolved from `./ecosystem.custom.config.js` by default. Override with `--config`:
|
|
76
85
|
|
|
@@ -78,6 +87,32 @@ Config file is resolved from `./ecosystem.custom.config.js` by default. Override
|
|
|
78
87
|
spm --config ./my-ecosystem.config.js start
|
|
79
88
|
```
|
|
80
89
|
|
|
90
|
+
## PM2-Inspired Scope
|
|
91
|
+
|
|
92
|
+
SPM focuses on a small, practical subset of PM2-like workflows for development.
|
|
93
|
+
|
|
94
|
+
- No daemon model in SPM: processes are started detached and tracked with pid files under `~/.spm2/pids/`
|
|
95
|
+
- No PM2-style metadata store in SPM: runtime state comes from pid files plus OS process checks
|
|
96
|
+
- `increment_vars` is supported directly; `increment_var` is also accepted and split by comma
|
|
97
|
+
- Additional ecosystem fields can exist in app objects, but SPM only interprets its documented fields
|
|
98
|
+
|
|
99
|
+
Example for split increment vars:
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
export default {
|
|
103
|
+
apps: [
|
|
104
|
+
{
|
|
105
|
+
name: 'api',
|
|
106
|
+
script: 'node',
|
|
107
|
+
args: 'server.js',
|
|
108
|
+
instances: 2,
|
|
109
|
+
env: { PORT: '3000', WS_PORT: '4000' },
|
|
110
|
+
increment_var: 'PORT,WS_PORT',
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
81
116
|
## Commands
|
|
82
117
|
|
|
83
118
|
| Command | Description |
|
package/dist/index.js
CHANGED
|
@@ -2316,7 +2316,7 @@ program2.command("logs [service]").option("-t, --tail", "Tail log files in real
|
|
|
2316
2316
|
}
|
|
2317
2317
|
if (follow) {
|
|
2318
2318
|
const logPaths = logFiles.map((file) => path.join(LOG_DIR, file));
|
|
2319
|
-
const tailArgs = ["-
|
|
2319
|
+
const tailArgs = ["-F"];
|
|
2320
2320
|
if (lines) {
|
|
2321
2321
|
tailArgs.push("-n", lines);
|
|
2322
2322
|
}
|