staklink 0.3.51 → 0.3.53
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/proxy-server.cjs +1204 -1185
- package/dist/staklink-cli.cjs +116 -97
- package/package.json +1 -1
package/dist/staklink-cli.cjs
CHANGED
|
@@ -3208,11 +3208,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3208
3208
|
*/
|
|
3209
3209
|
_getOutputContext(contextOptions) {
|
|
3210
3210
|
contextOptions = contextOptions || {};
|
|
3211
|
-
const
|
|
3211
|
+
const error2 = !!contextOptions.error;
|
|
3212
3212
|
let baseWrite;
|
|
3213
3213
|
let hasColors;
|
|
3214
3214
|
let helpWidth;
|
|
3215
|
-
if (
|
|
3215
|
+
if (error2) {
|
|
3216
3216
|
baseWrite = (str) => this._outputConfiguration.writeErr(str);
|
|
3217
3217
|
hasColors = this._outputConfiguration.getErrHasColors();
|
|
3218
3218
|
helpWidth = this._outputConfiguration.getErrHelpWidth();
|
|
@@ -3225,7 +3225,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3225
3225
|
if (!hasColors) str = this._outputConfiguration.stripColor(str);
|
|
3226
3226
|
return baseWrite(str);
|
|
3227
3227
|
};
|
|
3228
|
-
return { error, write, hasColors, helpWidth };
|
|
3228
|
+
return { error: error2, write, hasColors, helpWidth };
|
|
3229
3229
|
}
|
|
3230
3230
|
/**
|
|
3231
3231
|
* Output help information for this command.
|
|
@@ -3684,6 +3684,25 @@ var path4 = __toESM(require("path"), 1);
|
|
|
3684
3684
|
var import_util = require("util");
|
|
3685
3685
|
var proc = __toESM(require("child_process"), 1);
|
|
3686
3686
|
var fs = __toESM(require("fs"), 1);
|
|
3687
|
+
|
|
3688
|
+
// src/proxy/logger.ts
|
|
3689
|
+
function formatTimestamp() {
|
|
3690
|
+
const now = /* @__PURE__ */ new Date();
|
|
3691
|
+
const date = now.toISOString().split("T")[0];
|
|
3692
|
+
const time = now.toTimeString().split(" ")[0];
|
|
3693
|
+
return `[${date} ${time}]`;
|
|
3694
|
+
}
|
|
3695
|
+
function log(...args) {
|
|
3696
|
+
console.log(formatTimestamp(), ...args);
|
|
3697
|
+
}
|
|
3698
|
+
function error(...args) {
|
|
3699
|
+
console.error(formatTimestamp(), ...args);
|
|
3700
|
+
}
|
|
3701
|
+
function warn(...args) {
|
|
3702
|
+
console.warn(formatTimestamp(), ...args);
|
|
3703
|
+
}
|
|
3704
|
+
|
|
3705
|
+
// src/proxy/pm2.ts
|
|
3687
3706
|
var exec2 = (0, import_util.promisify)(proc.exec);
|
|
3688
3707
|
var PM2Manager = class {
|
|
3689
3708
|
cwd;
|
|
@@ -3735,8 +3754,8 @@ var PM2Manager = class {
|
|
|
3735
3754
|
}
|
|
3736
3755
|
}
|
|
3737
3756
|
}
|
|
3738
|
-
} catch (
|
|
3739
|
-
|
|
3757
|
+
} catch (error2) {
|
|
3758
|
+
warn(`Failed to load env file: ${envFilePath}`, error2);
|
|
3740
3759
|
}
|
|
3741
3760
|
return envVars;
|
|
3742
3761
|
}
|
|
@@ -3761,7 +3780,7 @@ var PM2Manager = class {
|
|
|
3761
3780
|
if (processConfig.env) {
|
|
3762
3781
|
allEnvVars = { ...allEnvVars, ...processConfig.env };
|
|
3763
3782
|
}
|
|
3764
|
-
|
|
3783
|
+
log("startProcess cmd:", command);
|
|
3765
3784
|
return this.execCommand(command, allEnvVars);
|
|
3766
3785
|
}
|
|
3767
3786
|
async restart(processName) {
|
|
@@ -3805,8 +3824,8 @@ var PM2Manager = class {
|
|
|
3805
3824
|
});
|
|
3806
3825
|
const processes = JSON.parse(stdout.trim());
|
|
3807
3826
|
return processes;
|
|
3808
|
-
} catch (
|
|
3809
|
-
throw
|
|
3827
|
+
} catch (error2) {
|
|
3828
|
+
throw error2 instanceof Error ? error2 : new Error("Unknown error while getting PM2 process list");
|
|
3810
3829
|
}
|
|
3811
3830
|
}
|
|
3812
3831
|
async status() {
|
|
@@ -3856,8 +3875,8 @@ var PM2Manager = class {
|
|
|
3856
3875
|
throw new Error(`Process '${processName}' not found`);
|
|
3857
3876
|
}
|
|
3858
3877
|
return targetProcess.pm2_env.env || {};
|
|
3859
|
-
} catch (
|
|
3860
|
-
throw
|
|
3878
|
+
} catch (error2) {
|
|
3879
|
+
throw error2 instanceof Error ? error2 : new Error(
|
|
3861
3880
|
`Unknown error while getting environment for process '${processName}'`
|
|
3862
3881
|
);
|
|
3863
3882
|
}
|
|
@@ -3870,8 +3889,8 @@ var PM2Manager = class {
|
|
|
3870
3889
|
(proc4) => proc4.name === processName || proc4.pm_id.toString() === processName
|
|
3871
3890
|
);
|
|
3872
3891
|
return targetProcess || null;
|
|
3873
|
-
} catch (
|
|
3874
|
-
throw
|
|
3892
|
+
} catch (error2) {
|
|
3893
|
+
throw error2 instanceof Error ? error2 : new Error(`Unknown error while getting process '${processName}'`);
|
|
3875
3894
|
}
|
|
3876
3895
|
}
|
|
3877
3896
|
// Check if a process is running
|
|
@@ -3879,7 +3898,7 @@ var PM2Manager = class {
|
|
|
3879
3898
|
try {
|
|
3880
3899
|
const process2 = await this.getProcess(processName);
|
|
3881
3900
|
return process2?.pm2_env.status === "online";
|
|
3882
|
-
} catch (
|
|
3901
|
+
} catch (error2) {
|
|
3883
3902
|
return false;
|
|
3884
3903
|
}
|
|
3885
3904
|
}
|
|
@@ -3888,7 +3907,7 @@ var PM2Manager = class {
|
|
|
3888
3907
|
try {
|
|
3889
3908
|
const process2 = await this.getProcess(processName);
|
|
3890
3909
|
return process2?.pm2_env.status || null;
|
|
3891
|
-
} catch (
|
|
3910
|
+
} catch (error2) {
|
|
3892
3911
|
return null;
|
|
3893
3912
|
}
|
|
3894
3913
|
}
|
|
@@ -3944,8 +3963,8 @@ async function findPm2Config(workspaceRoot2, log_cb) {
|
|
|
3944
3963
|
);
|
|
3945
3964
|
}
|
|
3946
3965
|
}
|
|
3947
|
-
} catch (
|
|
3948
|
-
|
|
3966
|
+
} catch (error2) {
|
|
3967
|
+
log("Error reading workspace directories:", error2);
|
|
3949
3968
|
}
|
|
3950
3969
|
for (const configPath of configPaths) {
|
|
3951
3970
|
try {
|
|
@@ -3974,8 +3993,8 @@ async function loadPm2Config(configPath) {
|
|
|
3974
3993
|
configFunction(moduleContext.module, moduleContext.exports);
|
|
3975
3994
|
const config = moduleContext.module.exports || moduleContext.exports;
|
|
3976
3995
|
return config;
|
|
3977
|
-
} catch (
|
|
3978
|
-
|
|
3996
|
+
} catch (error2) {
|
|
3997
|
+
log("Error loading PM2 config:", error2);
|
|
3979
3998
|
return { apps: [] };
|
|
3980
3999
|
}
|
|
3981
4000
|
}
|
|
@@ -4013,11 +4032,11 @@ function detectProject(cwd) {
|
|
|
4013
4032
|
language: "js",
|
|
4014
4033
|
framework: null
|
|
4015
4034
|
};
|
|
4016
|
-
} catch (
|
|
4035
|
+
} catch (error2) {
|
|
4017
4036
|
return {
|
|
4018
4037
|
language: null,
|
|
4019
4038
|
framework: null,
|
|
4020
|
-
error:
|
|
4039
|
+
error: error2 instanceof Error ? error2.message : "Unknown error"
|
|
4021
4040
|
};
|
|
4022
4041
|
}
|
|
4023
4042
|
}
|
|
@@ -4030,7 +4049,7 @@ var Runner = class {
|
|
|
4030
4049
|
constructor(root, log_cb) {
|
|
4031
4050
|
this.cwd = root;
|
|
4032
4051
|
this.pm2 = new PM2Manager(root);
|
|
4033
|
-
this.log_cb = log_cb ||
|
|
4052
|
+
this.log_cb = log_cb || log;
|
|
4034
4053
|
}
|
|
4035
4054
|
async startEco(ecoPath) {
|
|
4036
4055
|
await this.pm2.startEcosystem(ecoPath);
|
|
@@ -4050,7 +4069,7 @@ var Runner = class {
|
|
|
4050
4069
|
await this.pm2.stop(processName);
|
|
4051
4070
|
await this.pm2.delete(processName);
|
|
4052
4071
|
this.log_cb(`\u2705 Process ${processName} stopped and deleted`);
|
|
4053
|
-
} catch (
|
|
4072
|
+
} catch (error2) {
|
|
4054
4073
|
}
|
|
4055
4074
|
}
|
|
4056
4075
|
/**
|
|
@@ -4111,8 +4130,8 @@ var Runner = class {
|
|
|
4111
4130
|
`Rebuilding ${processConfig.name}`
|
|
4112
4131
|
);
|
|
4113
4132
|
results[processConfig.name] = stdout || stderr;
|
|
4114
|
-
} catch (
|
|
4115
|
-
|
|
4133
|
+
} catch (error2) {
|
|
4134
|
+
log(`\u274C Rebuild failed for ${processConfig.name}: ${error2}`);
|
|
4116
4135
|
}
|
|
4117
4136
|
}
|
|
4118
4137
|
}
|
|
@@ -4137,8 +4156,8 @@ var Runner = class {
|
|
|
4137
4156
|
`Installing ${processConfig.name}`
|
|
4138
4157
|
);
|
|
4139
4158
|
results[processConfig.name] = stdout || stderr;
|
|
4140
|
-
} catch (
|
|
4141
|
-
|
|
4159
|
+
} catch (error2) {
|
|
4160
|
+
log(`\u274C Install failed for ${processConfig.name}: ${error2}`);
|
|
4142
4161
|
}
|
|
4143
4162
|
}
|
|
4144
4163
|
}
|
|
@@ -4158,9 +4177,9 @@ var Runner = class {
|
|
|
4158
4177
|
`Pre-run command for ${processConfig.name}`
|
|
4159
4178
|
);
|
|
4160
4179
|
this.log_cb(`\u2705 Pre-run command completed for ${processConfig.name}`);
|
|
4161
|
-
} catch (
|
|
4162
|
-
|
|
4163
|
-
`\u274C Pre-run command failed for ${processConfig.name}: ${
|
|
4180
|
+
} catch (error2) {
|
|
4181
|
+
log(
|
|
4182
|
+
`\u274C Pre-run command failed for ${processConfig.name}: ${error2}`
|
|
4164
4183
|
);
|
|
4165
4184
|
}
|
|
4166
4185
|
}
|
|
@@ -4182,9 +4201,9 @@ var Runner = class {
|
|
|
4182
4201
|
this.log_cb(
|
|
4183
4202
|
`\u2705 Post-run command completed for ${processConfig.name}`
|
|
4184
4203
|
);
|
|
4185
|
-
} catch (
|
|
4186
|
-
|
|
4187
|
-
`\u274C Post-run command failed for ${processConfig.name}: ${
|
|
4204
|
+
} catch (error2) {
|
|
4205
|
+
log(
|
|
4206
|
+
`\u274C Post-run command failed for ${processConfig.name}: ${error2}`
|
|
4188
4207
|
);
|
|
4189
4208
|
}
|
|
4190
4209
|
}
|
|
@@ -4204,9 +4223,9 @@ var Runner = class {
|
|
|
4204
4223
|
`Reset command for ${processConfig.name}`
|
|
4205
4224
|
);
|
|
4206
4225
|
this.log_cb(`\u2705 Reset command completed for ${processConfig.name}`);
|
|
4207
|
-
} catch (
|
|
4208
|
-
|
|
4209
|
-
`\u274C Reset command failed for ${processConfig.name}: ${
|
|
4226
|
+
} catch (error2) {
|
|
4227
|
+
log(
|
|
4228
|
+
`\u274C Reset command failed for ${processConfig.name}: ${error2}`
|
|
4210
4229
|
);
|
|
4211
4230
|
}
|
|
4212
4231
|
}
|
|
@@ -4223,7 +4242,7 @@ var Runner = class {
|
|
|
4223
4242
|
let is_next = false;
|
|
4224
4243
|
if (processConfig.cwd) {
|
|
4225
4244
|
const proj = detectProject(processConfig.cwd);
|
|
4226
|
-
|
|
4245
|
+
log("PROJECT", proj);
|
|
4227
4246
|
is_next = proj.framework === "next.js";
|
|
4228
4247
|
}
|
|
4229
4248
|
try {
|
|
@@ -4240,12 +4259,12 @@ var Runner = class {
|
|
|
4240
4259
|
if (is_next) {
|
|
4241
4260
|
await this.pm2.start(processConfig.name);
|
|
4242
4261
|
}
|
|
4243
|
-
} catch (
|
|
4244
|
-
|
|
4245
|
-
`\u274C Build command failed for ${processConfig.name}: ${
|
|
4262
|
+
} catch (error2) {
|
|
4263
|
+
log(
|
|
4264
|
+
`\u274C Build command failed for ${processConfig.name}: ${error2}`
|
|
4246
4265
|
);
|
|
4247
4266
|
results[processConfig.name] = {
|
|
4248
|
-
stderr:
|
|
4267
|
+
stderr: error2 instanceof Error ? error2.message : String(error2)
|
|
4249
4268
|
};
|
|
4250
4269
|
}
|
|
4251
4270
|
}
|
|
@@ -4268,12 +4287,12 @@ var Runner = class {
|
|
|
4268
4287
|
);
|
|
4269
4288
|
results[processConfig.name] = { stdout, stderr };
|
|
4270
4289
|
this.log_cb(`\u2705 Test command completed for ${processConfig.name}`);
|
|
4271
|
-
} catch (
|
|
4272
|
-
|
|
4273
|
-
`\u274C Test command failed for ${processConfig.name}: ${
|
|
4290
|
+
} catch (error2) {
|
|
4291
|
+
log(
|
|
4292
|
+
`\u274C Test command failed for ${processConfig.name}: ${error2}`
|
|
4274
4293
|
);
|
|
4275
4294
|
results[processConfig.name] = {
|
|
4276
|
-
stderr:
|
|
4295
|
+
stderr: error2 instanceof Error ? error2.message : String(error2)
|
|
4277
4296
|
};
|
|
4278
4297
|
}
|
|
4279
4298
|
}
|
|
@@ -4300,12 +4319,12 @@ var Runner = class {
|
|
|
4300
4319
|
this.log_cb(
|
|
4301
4320
|
`\u2705 E2E test command completed for ${processConfig.name}`
|
|
4302
4321
|
);
|
|
4303
|
-
} catch (
|
|
4304
|
-
|
|
4305
|
-
`\u274C E2E test command failed for ${processConfig.name}: ${
|
|
4322
|
+
} catch (error2) {
|
|
4323
|
+
log(
|
|
4324
|
+
`\u274C E2E test command failed for ${processConfig.name}: ${error2}`
|
|
4306
4325
|
);
|
|
4307
4326
|
results[processConfig.name] = {
|
|
4308
|
-
stderr:
|
|
4327
|
+
stderr: error2 instanceof Error ? error2.message : String(error2)
|
|
4309
4328
|
};
|
|
4310
4329
|
}
|
|
4311
4330
|
}
|
|
@@ -4332,9 +4351,9 @@ var Runner = class {
|
|
|
4332
4351
|
await this.restartSingleProcess(config);
|
|
4333
4352
|
}
|
|
4334
4353
|
this.log_cb("\u2705 All configured processes restarted");
|
|
4335
|
-
} catch (
|
|
4336
|
-
this.log_cb(`\u274C Restart failed: ${
|
|
4337
|
-
throw
|
|
4354
|
+
} catch (error2) {
|
|
4355
|
+
this.log_cb(`\u274C Restart failed: ${error2}`);
|
|
4356
|
+
throw error2;
|
|
4338
4357
|
}
|
|
4339
4358
|
}
|
|
4340
4359
|
/**
|
|
@@ -4351,24 +4370,24 @@ var Runner = class {
|
|
|
4351
4370
|
config.cwd,
|
|
4352
4371
|
`Rebuilding ${config.name}`
|
|
4353
4372
|
);
|
|
4354
|
-
} catch (
|
|
4373
|
+
} catch (error2) {
|
|
4355
4374
|
this.log_cb(`\u274C Rebuild before Restart failed for ${config.name}`);
|
|
4356
4375
|
}
|
|
4357
4376
|
this.log_cb(`\u2705 Rebuild completed for ${config.name}`);
|
|
4358
4377
|
}
|
|
4359
4378
|
await this.pm2.restart(config.name);
|
|
4360
4379
|
this.log_cb(`\u2705 ${config.name} restarted successfully`);
|
|
4361
|
-
} catch (
|
|
4362
|
-
this.log_cb(`\u274C Failed to restart ${config.name}: ${
|
|
4363
|
-
throw
|
|
4380
|
+
} catch (error2) {
|
|
4381
|
+
this.log_cb(`\u274C Failed to restart ${config.name}: ${error2}`);
|
|
4382
|
+
throw error2;
|
|
4364
4383
|
}
|
|
4365
4384
|
}
|
|
4366
4385
|
async doesProcessExist(processName) {
|
|
4367
4386
|
try {
|
|
4368
4387
|
const processes = await this.pm2.jlist();
|
|
4369
4388
|
return processes.some((p) => p.name === processName);
|
|
4370
|
-
} catch (
|
|
4371
|
-
this.log_cb(`\u274C Error checking process existence: ${
|
|
4389
|
+
} catch (error2) {
|
|
4390
|
+
this.log_cb(`\u274C Error checking process existence: ${error2}`);
|
|
4372
4391
|
return false;
|
|
4373
4392
|
}
|
|
4374
4393
|
}
|
|
@@ -4377,8 +4396,8 @@ var Runner = class {
|
|
|
4377
4396
|
const processes = await this.pm2.jlist();
|
|
4378
4397
|
const filteredProcesses = processes.filter((p) => p.name !== processName);
|
|
4379
4398
|
return filteredProcesses.length;
|
|
4380
|
-
} catch (
|
|
4381
|
-
this.log_cb(`\u274C Error counting processes: ${
|
|
4399
|
+
} catch (error2) {
|
|
4400
|
+
this.log_cb(`\u274C Error counting processes: ${error2}`);
|
|
4382
4401
|
return 0;
|
|
4383
4402
|
}
|
|
4384
4403
|
}
|
|
@@ -4400,9 +4419,9 @@ var Runner = class {
|
|
|
4400
4419
|
return;
|
|
4401
4420
|
}
|
|
4402
4421
|
await this.restartSingleProcess(config);
|
|
4403
|
-
} catch (
|
|
4404
|
-
this.log_cb(`\u274C Failed to restart ${processName}: ${
|
|
4405
|
-
throw
|
|
4422
|
+
} catch (error2) {
|
|
4423
|
+
this.log_cb(`\u274C Failed to restart ${processName}: ${error2}`);
|
|
4424
|
+
throw error2;
|
|
4406
4425
|
}
|
|
4407
4426
|
}
|
|
4408
4427
|
async stopAll() {
|
|
@@ -4415,16 +4434,16 @@ var Runner = class {
|
|
|
4415
4434
|
async list() {
|
|
4416
4435
|
try {
|
|
4417
4436
|
return await this.pm2.list();
|
|
4418
|
-
} catch (
|
|
4419
|
-
this.log_cb(`\u274C Failed to list processes: ${
|
|
4437
|
+
} catch (error2) {
|
|
4438
|
+
this.log_cb(`\u274C Failed to list processes: ${error2}`);
|
|
4420
4439
|
return "";
|
|
4421
4440
|
}
|
|
4422
4441
|
}
|
|
4423
4442
|
async jlist() {
|
|
4424
4443
|
try {
|
|
4425
4444
|
return await this.pm2.jlist();
|
|
4426
|
-
} catch (
|
|
4427
|
-
this.log_cb(`\u274C Failed to jlist processes: ${
|
|
4445
|
+
} catch (error2) {
|
|
4446
|
+
this.log_cb(`\u274C Failed to jlist processes: ${error2}`);
|
|
4428
4447
|
return [];
|
|
4429
4448
|
}
|
|
4430
4449
|
}
|
|
@@ -4432,16 +4451,16 @@ var Runner = class {
|
|
|
4432
4451
|
try {
|
|
4433
4452
|
await this.pm2.flush();
|
|
4434
4453
|
this.log_cb(`\u2705 Flushed PM2 logs`);
|
|
4435
|
-
} catch (
|
|
4436
|
-
this.log_cb(`\u274C Failed to flush logs: ${
|
|
4454
|
+
} catch (error2) {
|
|
4455
|
+
this.log_cb(`\u274C Failed to flush logs: ${error2}`);
|
|
4437
4456
|
}
|
|
4438
4457
|
}
|
|
4439
4458
|
async getConfiguredProcesses() {
|
|
4440
4459
|
try {
|
|
4441
4460
|
const config = await findAndLoadPm2Config(this.cwd);
|
|
4442
4461
|
return config.apps.map((app) => this.parseProcessApp(app));
|
|
4443
|
-
} catch (
|
|
4444
|
-
this.log_cb(`\u274C Failed to load PM2 config: ${
|
|
4462
|
+
} catch (error2) {
|
|
4463
|
+
this.log_cb(`\u274C Failed to load PM2 config: ${error2}`);
|
|
4445
4464
|
return [];
|
|
4446
4465
|
}
|
|
4447
4466
|
}
|
|
@@ -4453,8 +4472,8 @@ var Runner = class {
|
|
|
4453
4472
|
try {
|
|
4454
4473
|
const logs = await this.pm2.logs(processName, lines);
|
|
4455
4474
|
return logs;
|
|
4456
|
-
} catch (
|
|
4457
|
-
this.log_cb(`\u274C Failed to get logs for ${processName}: ${
|
|
4475
|
+
} catch (error2) {
|
|
4476
|
+
this.log_cb(`\u274C Failed to get logs for ${processName}: ${error2}`);
|
|
4458
4477
|
return "";
|
|
4459
4478
|
}
|
|
4460
4479
|
}
|
|
@@ -4465,8 +4484,8 @@ var Runner = class {
|
|
|
4465
4484
|
try {
|
|
4466
4485
|
const processes = await this.pm2.jlist();
|
|
4467
4486
|
return processes.map((p) => this.parseProcessConfig(p)).filter((config) => config.restart);
|
|
4468
|
-
} catch (
|
|
4469
|
-
this.log_cb(`\u274C Failed to get restartable processes: ${
|
|
4487
|
+
} catch (error2) {
|
|
4488
|
+
this.log_cb(`\u274C Failed to get restartable processes: ${error2}`);
|
|
4470
4489
|
return [];
|
|
4471
4490
|
}
|
|
4472
4491
|
}
|
|
@@ -4505,14 +4524,14 @@ var Runner = class {
|
|
|
4505
4524
|
if (code === 0) {
|
|
4506
4525
|
resolve({ stdout, stderr });
|
|
4507
4526
|
} else {
|
|
4508
|
-
const
|
|
4509
|
-
this.log_cb(`\u274C Error: ${
|
|
4510
|
-
reject(`${
|
|
4527
|
+
const error2 = new Error(`Command failed with exit code ${code}`);
|
|
4528
|
+
this.log_cb(`\u274C Error: ${error2.message}`);
|
|
4529
|
+
reject(`${error2.message}
|
|
4511
4530
|
${stderr}`);
|
|
4512
4531
|
}
|
|
4513
4532
|
});
|
|
4514
|
-
child.on("error", (
|
|
4515
|
-
const errorMsg =
|
|
4533
|
+
child.on("error", (error2) => {
|
|
4534
|
+
const errorMsg = error2.message || String(error2);
|
|
4516
4535
|
this.log_cb(`\u274C Error: ${errorMsg}`);
|
|
4517
4536
|
reject(`${errorMsg}
|
|
4518
4537
|
${stderr}`);
|
|
@@ -4535,8 +4554,8 @@ ${stderr}`);
|
|
|
4535
4554
|
const statusIcon = status === "online" ? "\u2705" : "\u274C";
|
|
4536
4555
|
this.log_cb(` ${statusIcon} ${proc4.name}: ${status}`);
|
|
4537
4556
|
});
|
|
4538
|
-
} catch (
|
|
4539
|
-
|
|
4557
|
+
} catch (error2) {
|
|
4558
|
+
error("Error getting PM2 process status:", error2);
|
|
4540
4559
|
this.log_cb("\u26A0\uFE0F Could not retrieve PM2 process status");
|
|
4541
4560
|
}
|
|
4542
4561
|
}
|
|
@@ -4551,7 +4570,7 @@ async function dirExists(dirPath) {
|
|
|
4551
4570
|
try {
|
|
4552
4571
|
const stats = await fs4.stat(dirPath);
|
|
4553
4572
|
return stats.isDirectory();
|
|
4554
|
-
} catch (
|
|
4573
|
+
} catch (error2) {
|
|
4555
4574
|
return false;
|
|
4556
4575
|
}
|
|
4557
4576
|
}
|
|
@@ -10948,7 +10967,7 @@ var glob = Object.assign(glob_, {
|
|
|
10948
10967
|
glob.glob = glob;
|
|
10949
10968
|
|
|
10950
10969
|
// src/proxy/version.ts
|
|
10951
|
-
var VERSION = "0.3.
|
|
10970
|
+
var VERSION = "0.3.53";
|
|
10952
10971
|
|
|
10953
10972
|
// src/cli.ts
|
|
10954
10973
|
var STAKLINK_PROXY = "staklink-proxy";
|
|
@@ -10959,7 +10978,7 @@ async function checkRunningVersion() {
|
|
|
10959
10978
|
return await response.text();
|
|
10960
10979
|
}
|
|
10961
10980
|
return null;
|
|
10962
|
-
} catch (
|
|
10981
|
+
} catch (error2) {
|
|
10963
10982
|
return null;
|
|
10964
10983
|
}
|
|
10965
10984
|
}
|
|
@@ -10982,7 +11001,7 @@ async function findEnvFile(workspaceRoot2) {
|
|
|
10982
11001
|
return path4.join(workspaceRoot2, matches[0]);
|
|
10983
11002
|
}
|
|
10984
11003
|
}
|
|
10985
|
-
} catch (
|
|
11004
|
+
} catch (error2) {
|
|
10986
11005
|
}
|
|
10987
11006
|
return void 0;
|
|
10988
11007
|
}
|
|
@@ -11025,8 +11044,8 @@ program2.command("start").description("Start the staklink proxy server").action(
|
|
|
11025
11044
|
...envFile && { env_file: envFile }
|
|
11026
11045
|
});
|
|
11027
11046
|
console.log("\u2705 Started staklink server!");
|
|
11028
|
-
} catch (
|
|
11029
|
-
console.error("Failed to start staklink:",
|
|
11047
|
+
} catch (error2) {
|
|
11048
|
+
console.error("Failed to start staklink:", error2);
|
|
11030
11049
|
process.exit(1);
|
|
11031
11050
|
}
|
|
11032
11051
|
});
|
|
@@ -11041,8 +11060,8 @@ program2.command("stop").description("Stop the staklink proxy server").action(as
|
|
|
11041
11060
|
}
|
|
11042
11061
|
await runner.stopAndDeleteProcess(STAKLINK_PROXY);
|
|
11043
11062
|
console.log("\u2705 Stopped staklink server");
|
|
11044
|
-
} catch (
|
|
11045
|
-
console.error("Failed to stop staklink:",
|
|
11063
|
+
} catch (error2) {
|
|
11064
|
+
console.error("Failed to stop staklink:", error2);
|
|
11046
11065
|
process.exit(1);
|
|
11047
11066
|
}
|
|
11048
11067
|
});
|
|
@@ -11070,8 +11089,8 @@ program2.command("restart").description("Restart the staklink proxy server").act
|
|
|
11070
11089
|
...envFile && { env_file: envFile }
|
|
11071
11090
|
});
|
|
11072
11091
|
console.log("\u2705 Restarted staklink server");
|
|
11073
|
-
} catch (
|
|
11074
|
-
console.error("Failed to restart staklink:",
|
|
11092
|
+
} catch (error2) {
|
|
11093
|
+
console.error("Failed to restart staklink:", error2);
|
|
11075
11094
|
process.exit(1);
|
|
11076
11095
|
}
|
|
11077
11096
|
});
|
|
@@ -11087,8 +11106,8 @@ program2.command("status").description("Check staklink proxy server status").act
|
|
|
11087
11106
|
} else {
|
|
11088
11107
|
console.log("\u274C Staklink server is not running");
|
|
11089
11108
|
}
|
|
11090
|
-
} catch (
|
|
11091
|
-
console.error("Failed to check status:",
|
|
11109
|
+
} catch (error2) {
|
|
11110
|
+
console.error("Failed to check status:", error2);
|
|
11092
11111
|
process.exit(1);
|
|
11093
11112
|
}
|
|
11094
11113
|
});
|
|
@@ -11098,8 +11117,8 @@ program2.command("logs").description("View staklink proxy server logs").action(a
|
|
|
11098
11117
|
const runner = new Runner(root, console.log);
|
|
11099
11118
|
const logs = await runner.getProcessLogs(STAKLINK_PROXY);
|
|
11100
11119
|
console.log(logs);
|
|
11101
|
-
} catch (
|
|
11102
|
-
console.error("Failed to get logs:",
|
|
11120
|
+
} catch (error2) {
|
|
11121
|
+
console.error("Failed to get logs:", error2);
|
|
11103
11122
|
process.exit(1);
|
|
11104
11123
|
}
|
|
11105
11124
|
});
|
|
@@ -11124,8 +11143,8 @@ program2.command("reload").description("Reload all PM2 apps (stops all except pr
|
|
|
11124
11143
|
);
|
|
11125
11144
|
}
|
|
11126
11145
|
console.log("\u2705 Apps reloaded successfully");
|
|
11127
|
-
} catch (
|
|
11128
|
-
console.error("Failed to reload apps:",
|
|
11146
|
+
} catch (error2) {
|
|
11147
|
+
console.error("Failed to reload apps:", error2);
|
|
11129
11148
|
process.exit(1);
|
|
11130
11149
|
}
|
|
11131
11150
|
});
|