@nmakarov/cli-toolkit 0.76.0 → 0.77.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/dist/deploy.cjs +16 -2
- package/dist/deploy.cjs.map +1 -1
- package/dist/deploy.js +15 -2
- package/dist/deploy.js.map +1 -1
- package/dist/index.cjs +16 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5903,16 +5903,28 @@ function isPidAlive(pid) {
|
|
|
5903
5903
|
return false;
|
|
5904
5904
|
}
|
|
5905
5905
|
}
|
|
5906
|
+
function parsePm2Jlist(stdout) {
|
|
5907
|
+
const raw = String(stdout ?? "");
|
|
5908
|
+
const text = raw.split("\n").filter((line) => !line.startsWith("[PM2]")).join("\n").trim();
|
|
5909
|
+
if (!text) return [];
|
|
5910
|
+
try {
|
|
5911
|
+
const parsed = JSON.parse(text);
|
|
5912
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
5913
|
+
} catch (err) {
|
|
5914
|
+
throw new Error(`pm2 jlist: invalid JSON (${err?.message ?? err})`);
|
|
5915
|
+
}
|
|
5916
|
+
}
|
|
5906
5917
|
async function getPm2Process(appName, options = {}) {
|
|
5907
5918
|
const { logger } = options;
|
|
5919
|
+
await runCapture("bash", ["-lc", "pm2 ping >/dev/null 2>&1 || true"], { logger }).catch(() => {
|
|
5920
|
+
});
|
|
5908
5921
|
const { stdout } = await runCapture("bash", ["-lc", "pm2 jlist"], { logger });
|
|
5909
5922
|
let list;
|
|
5910
5923
|
try {
|
|
5911
|
-
list =
|
|
5924
|
+
list = parsePm2Jlist(stdout);
|
|
5912
5925
|
} catch (err) {
|
|
5913
5926
|
throw new Error(`pm2 jlist: invalid JSON (${err?.message ?? err})`);
|
|
5914
5927
|
}
|
|
5915
|
-
if (!Array.isArray(list)) return null;
|
|
5916
5928
|
return list.find((p) => p?.name === appName) ?? null;
|
|
5917
5929
|
}
|
|
5918
5930
|
async function waitPm2(appName, predicate, options = {}) {
|
|
@@ -10107,6 +10119,7 @@ export {
|
|
|
10107
10119
|
npmInstallEnv,
|
|
10108
10120
|
organizeFooterMessages,
|
|
10109
10121
|
parseGitHost,
|
|
10122
|
+
parsePm2Jlist,
|
|
10110
10123
|
prepareGitHost,
|
|
10111
10124
|
provisionService,
|
|
10112
10125
|
pruneReleases,
|