d3ployer 0.0.8 → 0.0.9
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/defaultTasks.js +6 -2
- package/package.json +1 -1
package/dist/defaultTasks.js
CHANGED
|
@@ -195,12 +195,16 @@ const streamLogsTask = async (ctx) => {
|
|
|
195
195
|
...ctx.config.logs,
|
|
196
196
|
};
|
|
197
197
|
const time = logsConfig.time;
|
|
198
|
-
const hasPm2 = ctx.config.pm2 !== false
|
|
198
|
+
const hasPm2 = ctx.config.pm2 !== false
|
|
199
|
+
&& await ctx.test('test -f pm2.config.*');
|
|
199
200
|
const hasDocker = ctx.config.dockerCompose !== false
|
|
200
201
|
&& await ctx.test('test -f docker-compose.yml -o -f docker-compose.yaml -o -f compose.yml -o -f compose.yaml');
|
|
201
202
|
if (hasPm2) {
|
|
203
|
+
const pm2ConfigRaw = await ctx.run('cat pm2.config.*', { printOutput: false });
|
|
204
|
+
const nameMatch = pm2ConfigRaw.stdout.match(/name: ['"](?<name>.+?)['"]/);
|
|
205
|
+
const name = nameMatch.groups?.name ?? 'all';
|
|
202
206
|
console.log(chalk.cyan(`Streaming PM2 logs for ${time}s...`));
|
|
203
|
-
await ctx.run(`timeout ${time} pm2 logs || true`, { printOutput: true, ignoreError: true });
|
|
207
|
+
await ctx.run(`timeout ${time} pm2 logs "${name}" || true`, { printOutput: true, ignoreError: true });
|
|
204
208
|
}
|
|
205
209
|
else if (hasDocker) {
|
|
206
210
|
console.log(chalk.cyan(`Streaming Docker Compose logs for ${time}s...`));
|