Skip to content

Conversation

@bcotrim
Copy link
Contributor

@bcotrim bcotrim commented Dec 22, 2025

Related issues

Proposed Changes

  1. Add bundled Node.js binary - The CLI now uses a bundled Node.js binary instead of relying on the Electron run as Node.

  2. Fix Windows terminal popup - Patched the ps-man package to add windowsHide: true to spawn calls. This prevents a brief console window popup (showing C:\WINDOWS\system32\tasklist) when running CLI commands on Windows.

Testing Instructions

Windows

  1. Build the CLI: npm run cli:build
  2. Run node dist/cli/main.js site create --name=test-site
  3. Verify no popup windows appear during site creation
  4. Verify the site is created successfully
  5. Create a site using Studio and confirm operation times are similar

macOS

  1. Build the CLI: npm run cli:build
  2. Run node dist/cli/main.js site create --name=test-site
  3. Verify the site is created successfully
  4. Create a site using Studio and confirm operation times are similar

Pre-merge Checklist

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

@bcotrim bcotrim self-assigned this Dec 22, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

To make this more portable, let's do it in JS instead.

@bcotrim bcotrim force-pushed the stu-1148-investigate-site-create-performance branch from 75bccac to dd6bce1 Compare December 22, 2025 16:33
@bcotrim bcotrim changed the title add bundled node Studio: Add node binary Dec 24, 2025
@bcotrim bcotrim changed the title Studio: Add node binary Studio CLI: Add bundled Node binary and fix Windows popup Dec 24, 2025
@bcotrim bcotrim marked this pull request as ready for review December 24, 2025 11:55
@bcotrim bcotrim requested a review from a team December 24, 2025 12:06
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.

The code looks great and works as expected:

  1. I don't see popup on windows anymore.
  2. But, I encounter x2 difference in time between CLI and Studio, is it expected?

macOS:
CLI: 6 sec
Studio: 14 sec

Windows:
CLI: 1:40
Studio: 2:50

const nvmrcPath = path.join( __dirname, '..', '.nvmrc' );
if ( fs.existsSync( nvmrcPath ) ) {
const version = fs.readFileSync( nvmrcPath, 'utf-8' ).trim();
// Ensure version starts with 'v'
Copy link
Contributor

Choose a reason for hiding this comment

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

The code looks self-explanatory

Suggested change
// Ensure version starts with 'v'

export function getBundledNodeBinaryPath(): string {
const nodeBinaryName = process.platform === 'win32' ? 'node.exe' : 'node';

if ( process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test' ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I am thinking - should we keep it only for tests? To have it used in development, to work with the same as in prod, to avoid if in prod something will be unexpectedly broken?

Suggested change
if ( process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test' ) {
if ( process.env.NODE_ENV === 'test' ) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants