Skip to content

Conversation

@fredrikekelund
Copy link
Contributor

@fredrikekelund fredrikekelund commented Dec 3, 2025

Related issues

Proposed Changes

This PR changes how we import pm2. pm2 exports two members: default (an instantiated API) and custom (the original API class). By importing custom and passing the pm2_home config prop, we can remove the resolvePm2 logic.

The only problem is that the custom member isn't accounted for in the pm2 type definitions. I've submitted a PR Unitech/pm2#6064 to pm2 to fix this. Until that's merged, I've updated our pm2 patch to include my changes from that PR.

Tip

View the upstream PR diff with whitespace changes hidden to see that I haven't actually changed all that much in types/index.d.ts

Testing Instructions

  1. Lint CI should pass
  2. Run npm run cli:build
  3. Run node dist/cli/main.js site list
  4. Ensure that it finishes successfully

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@fredrikekelund fredrikekelund requested review from a team, bcotrim and nightnei December 3, 2025 09:12
@fredrikekelund fredrikekelund self-assigned this Dec 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

📊 Performance Test Results

Comparing 40fc12d vs trunk

site-editor

Metric trunk 40fc12d Diff Change
load 11148.00 ms 10117.00 ms -1031.00 ms 🟢 -9.2%

site-startup

Metric trunk 40fc12d Diff Change
siteCreation 25714.00 ms 25550.00 ms -164.00 ms 🟢 -0.6%
siteStartup 11066.00 ms 10082.00 ms -984.00 ms 🟢 -8.9%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

Copy link
Contributor

@nightnei nightnei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change and works as expected 👍

Only one NIT thing - I would avoid formatting changes in Studio's diff and in proposed PR to PM2 (or create a separate follow-up PR with formating), so that it's much easier to review and to see exact changes at a glance and maybe it will speed up review of the PR in PM2.

Screenshot 2025-12-03 at 13 50 33

const processDescriptions = ( processes || [] ).map( ( p ) => ( {
name: p.name || '',
pmId: p.pm_id || -1,
pmId: p.pm_id ?? -1,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated to the core purpose of this PR, but it's an issue I ran into recently: if p.pm_id is 0, we would assign it a value of -1, which is incorrect.

Copy link
Contributor

@katinthehatsite katinthehatsite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work as expected:

Image

I have not looked in detail into this project so apologies if this question is obvious - should the status Offline be set to the sites that are not running and Online for those that are? Because I am seeing now Offline for everything.

@fredrikekelund
Copy link
Contributor Author

should the status Offline be set to the sites that are not running and Online for those that are?

The online status isn't yet shared between the CLI and Studio, so studio site list will only show Online for sites that were started through the CLI. @bcotrim is working on this in STU-1019

@fredrikekelund fredrikekelund merged commit bd3b723 into trunk Dec 4, 2025
8 of 9 checks passed
@fredrikekelund fredrikekelund deleted the f26d/fix-pm2-resolver branch December 4, 2025 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants