-
Notifications
You must be signed in to change notification settings - Fork 53
Studio CLI: Add bundled Node binary and fix Windows popup #2303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev/studio-cli-i2
Are you sure you want to change the base?
Studio CLI: Add bundled Node binary and fix Windows popup #2303
Conversation
scripts/download-node-binary.sh
Outdated
There was a problem hiding this comment.
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.
75bccac to
dd6bce1
Compare
nightnei
left a comment
There was a problem hiding this 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:
- I don't see popup on windows anymore.
- 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' |
There was a problem hiding this comment.
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
| // 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' ) { |
There was a problem hiding this comment.
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?
| if ( process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test' ) { | |
| if ( process.env.NODE_ENV === 'test' ) { |
Related issues
Proposed Changes
Add bundled Node.js binary - The CLI now uses a bundled Node.js binary instead of relying on the Electron run as Node.
Fix Windows terminal popup - Patched the
ps-manpackage to addwindowsHide: trueto spawn calls. This prevents a brief console window popup (showingC:\WINDOWS\system32\tasklist) when running CLI commands on Windows.Testing Instructions
Windows
npm run cli:buildnode dist/cli/main.js site create --name=test-sitemacOS
npm run cli:buildnode dist/cli/main.js site create --name=test-sitePre-merge Checklist