-
Notifications
You must be signed in to change notification settings - Fork 0
feat(node-runtime): Deno에서 Node.js 런타임으로 전환 #27
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
Conversation
- Deno Core 대신 Node.js 서브프로세스로 JavaScript 실행 - Node.js 바이너리 자동 다운로드 스크립트 추가 - lint_code 기능 제거 - deno-runtime 크레이트 제거 - hello-world 크레이트 제거
GitHub Actions의 Linux 환경에서 postinstall 스크립트 실행 시 에러가 발생하지 않도록 지원하지 않는 플랫폼에서 조용히 종료하도록 수정
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.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| /// OS별 Node.js 바이너리 경로 찾기 | ||
| fn find_node_binary() -> Result<PathBuf> { | ||
| let (os_name, binary_name) = if cfg!(target_os = "windows") { | ||
| ("win-arm64", "node.exe") |
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.
Bug: Windows always uses arm64 binary ignoring actual architecture
The find_node_binary function hardcodes "win-arm64" for all Windows systems without checking target_arch. Unlike the macOS and Linux branches that have conditional logic for arm64 vs x64 architectures, Windows always returns arm64. This means Windows x64 users (the vast majority of Windows users) won't be able to run the application since it will look for a non-existent arm64 binary.
| "resources": [ | ||
| "resources/node-runtime/node-v24.12.0-darwin-arm64/node", | ||
| "resources/node-runtime/node-v24.12.0-win-arm64/node.exe" | ||
| ], |
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.
Bug: Bundled resources missing x64 and Linux platform binaries
The resources array in tauri.conf.json only includes darwin-arm64 and win-arm64 binaries. The Rust code in find_node_binary references additional platform combinations (darwin-x64, win-x64, linux-arm64, linux-x64), but these are not bundled. Production builds for Intel macOS, x64 Windows, or any Linux platform will fail to find the Node.js binary at runtime.
- 리다이렉트 및 에러 발생 시 파일 스트림이 닫히지 않는 문제 해결 - cleanup 헬퍼 함수 추가하여 파일 스트림 안전하게 정리 - 모든 early return 경로에서 파일 스트림 닫기 및 임시 파일 삭제 보장
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.
Pull request overview
This PR migrates the JavaScript execution engine from Deno Core (embedded V8) to Node.js subprocess execution. The migration simplifies the architecture by removing the embedded runtime in favor of external Node.js processes, while also removing the lint_code functionality and cleaning up unused crates.
Key Changes:
- Replaced
deno-runtimecrate with newnode-runtimecrate that executes JavaScript via Node.js subprocess - Added automated Node.js binary download script that runs on postinstall
- Removed lint_code Tauri command and all associated oxlint integration from the code editor
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/download-node-binaries.js | New script to automatically download platform-specific Node.js v24.12.0 binaries |
| package.json | Added download-node script and postinstall hook to auto-fetch Node.js binaries |
| crates/node-runtime/src/lib.rs | New runtime implementation using tokio subprocess to execute JavaScript via Node.js |
| crates/node-runtime/Cargo.toml | Minimal dependencies (anyhow, tokio, tracing) for subprocess-based runtime |
| apps/executeJS/src-tauri/tauri.conf.json | Updated resource bundling to include Node.js binaries for darwin-arm64 and win-arm64 |
| apps/executeJS/src-tauri/src/lib.rs | Removed lint_code from invoke_handler and cleaned up DevTools initialization |
| apps/executeJS/src-tauri/src/js_executor.rs | Updated to use NodeExecutor instead of DenoExecutor |
| apps/executeJS/src-tauri/src/commands.rs | Commented out entire lint_code command and related structures |
| apps/executeJS/src-tauri/Cargo.toml | Replaced deno-runtime dependency with node-runtime, removed unused network dependencies |
| apps/executeJS/src/widgets/code-editor/code-editor.tsx | Commented out all oxlint validation logic and removed LintResult imports |
| .gitignore | Added patterns to ignore downloaded Node.js binaries and temp download directory |
| .cursorrules | Updated documentation to reflect Node.js runtime instead of Deno Core |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if app_handle.get_webview_window("main").is_some() { | ||
| // DevTools는 플러그인을 통해 자동으로 관리됨 | ||
| eprintln!("DevTools 토글 (플러그인 사용)"); | ||
| } |
Copilot
AI
Dec 12, 2025
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 comment says "DevTools는 플러그인을 통해 자동으로 관리됨" (DevTools are automatically managed through plugins) but the implementation is empty. This is misleading - either implement the DevTools toggle functionality or update the comment to clarify that this is intentionally a no-op.
| if app_handle.get_webview_window("main").is_some() { | |
| // DevTools는 플러그인을 통해 자동으로 관리됨 | |
| eprintln!("DevTools 토글 (플러그인 사용)"); | |
| } | |
| // Intentionally left empty: DevTools are automatically managed by the plugin. | |
| // (No action required here.) |
| // 파일 스트림 정리 헬퍼 함수 | ||
| const cleanup = (callback) => { | ||
| file.close(() => { |
Copilot
AI
Dec 12, 2025
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.
Security concern: The redirect handling doesn't validate the redirect location URL. A malicious server could redirect to an arbitrary URL. Consider validating that the redirect location is still within the nodejs.org domain or implementing a maximum redirect count to prevent redirect loops.
| } | ||
|
|
||
| /// JavaScript 코드 실행 | ||
| pub async fn execute_script(&self, _filename: &str, code: &str) -> Result<String> { |
Copilot
AI
Dec 12, 2025
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 _filename parameter is unused in the execute_script method. If it's not needed, it should be removed from the function signature to avoid confusion. If it's planned for future use, document its intended purpose.
| pub async fn execute_script(&self, _filename: &str, code: &str) -> Result<String> { | |
| pub async fn execute_script(&self, code: &str) -> Result<String> { |
| "icon": [], | ||
| "resources": [ | ||
| "resources/node-runtime/node-v24.12.0-darwin-arm64/node", | ||
| "resources/node-runtime/node-v24.12.0-win-arm64/node.exe" |
Copilot
AI
Dec 12, 2025
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 tauri.conf.json specifies only 'darwin-arm64' and 'win-arm64' in the resources array, but the download script and runtime code support x64 architectures as well. This means x64 builds will fail because the binaries won't be bundled. Add entries for 'darwin-x64', 'win-x64', 'linux-arm64', and 'linux-x64' to support all platforms.
| "resources/node-runtime/node-v24.12.0-win-arm64/node.exe" | |
| "resources/node-runtime/node-v24.12.0-darwin-x64/node", | |
| "resources/node-runtime/node-v24.12.0-win-arm64/node.exe", | |
| "resources/node-runtime/node-v24.12.0-win-x64/node.exe", | |
| "resources/node-runtime/node-v24.12.0-linux-arm64/node", | |
| "resources/node-runtime/node-v24.12.0-linux-x64/node" |
| } | ||
| }; |
Copilot
AI
Dec 12, 2025
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.
Missing checksum verification: The download script doesn't verify the integrity of the downloaded Node.js binary. Node.js provides SHASUMS256.txt files for each release. Consider downloading and verifying the checksum to ensure the binary hasn't been tampered with during download.
| use serde::{Deserialize, Serialize}; | ||
| use std::process::Command; | ||
| // 비활성화: Command import (lint_code가 주석 처리되어 사용 안 함) | ||
| // use std::process::Command; |
Copilot
AI
Dec 12, 2025
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 commented-out import use std::process::Command should be removed entirely rather than left as a comment. Commented-out code adds noise and should be removed since version control can retrieve it if needed.
| // use std::process::Command; |
| }); | ||
| }); | ||
| }); | ||
| }) | ||
| .on('error', (err) => { | ||
| // HTTP 요청 에러 - 파일 스트림 정리 후 reject | ||
| cleanup(() => { | ||
| reject(err); | ||
| }); | ||
| }); | ||
| }); | ||
| }; | ||
|
|
Copilot
AI
Dec 12, 2025
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.
Security concern: The execSync calls use template literals with user-controlled paths (archivePath, extractDir) that could potentially contain shell metacharacters. While unlikely in this context, it's safer to pass these as array arguments to child_process.spawn or properly escape the paths to prevent command injection. Consider using child_process.spawn with argument arrays instead of shell string interpolation.
| arch: arch === 'arm64' ? 'arm64' : 'x64', | ||
| extension: 'zip', | ||
| binaryName: 'node.exe', | ||
| }; |
Copilot
AI
Dec 12, 2025
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 error message states "Only macOS and Windows are supported" but the node-runtime/src/lib.rs (lines 63-71) includes Linux platform support. This inconsistency could confuse users on Linux systems. Either add Linux support to the download script or remove it from the runtime code.
| }; | |
| }; | |
| } else if (platform === 'linux') { | |
| return { | |
| os: 'linux', | |
| arch: arch === 'arm64' ? 'arm64' : 'x64', | |
| extension: 'tar.xz', | |
| binaryName: 'node', | |
| }; |
| /// OS별 Node.js 바이너리 경로 찾기 | ||
| fn find_node_binary() -> Result<PathBuf> { | ||
| let (os_name, binary_name) = if cfg!(target_os = "windows") { | ||
| ("win-arm64", "node.exe") |
Copilot
AI
Dec 12, 2025
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.
Windows architecture detection is hardcoded to 'win-arm64' regardless of the actual architecture. This should use conditional compilation to detect x64 vs arm64, similar to how it's done for macOS and Linux. Use cfg!(target_arch = "x86_64") to differentiate between x64 and arm64 on Windows.
| ("win-arm64", "node.exe") | |
| if cfg!(target_arch = "aarch64") { | |
| ("win-arm64", "node.exe") | |
| } else { | |
| ("win-x64", "node.exe") | |
| } |
| file.on('finish', () => { | ||
| file.close(); | ||
| console.log('\n다운로드 완료!'); | ||
| resolve(); |
Copilot
AI
Dec 12, 2025
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.
Unused variable platform.
Note
Replaces the Deno-based JS engine with a Node.js subprocess runtime, bundles platform binaries, and removes oxlint-driven linting.
crates/node-runtimewithNodeExecutorexecuting code viatokio::process::Command, stdout/stderr capture, permission handling, and tests.apps/executeJS/src-tauri/src/js_executor.rsto usenode_runtime::NodeExecutor; remove Deno usage.lint_codeand related structures incommands.rs; update invoke handler accordingly.apps/executeJS/src-tauri/capabilities/main.json) to includehttp,opener,fs,clipboard-manager,store.node-runtimeinCargo.tomlandCargo.lockupdates.apps/executeJS/src-tauri/tauri.conf.jsonresourcesand extend security capabilities..gitignore: ignore bundled Node binaries and temp download dir.package.json: addscripts/download-node-binaries.js,download-node, andpostinstallto fetch binaries.apps/executeJS/src/widgets/code-editor/code-editor.tsx: remove oxlint integration (commented out); keep Prettier formatting and shortcuts..cursorrulesto document Node.js runtime architecture and troubleshooting.Written by Cursor Bugbot for commit aec8f3e. This will update automatically on new commits. Configure here.