Skip to content

Conversation

@ohah
Copy link
Owner

@ohah ohah commented Dec 12, 2025

  • Deno Core 대신 Node.js 서브프로세스로 JavaScript 실행
  • Node.js 바이너리 자동 다운로드 스크립트 추가
  • lint_code 기능 제거
  • deno-runtime 크레이트 제거
  • hello-world 크레이트 제거

Note

Replaces the Deno-based JS engine with a Node.js subprocess runtime, bundles platform binaries, and removes oxlint-driven linting.

  • Backend (Rust/Tauri)
    • Add crates/node-runtime with NodeExecutor executing code via tokio::process::Command, stdout/stderr capture, permission handling, and tests.
    • Switch apps/executeJS/src-tauri/src/js_executor.rs to use node_runtime::NodeExecutor; remove Deno usage.
    • Disable lint_code and related structures in commands.rs; update invoke handler accordingly.
    • Update capabilities (apps/executeJS/src-tauri/capabilities/main.json) to include http, opener, fs, clipboard-manager, store.
    • Clean dependencies: remove Deno/TLS-related crates; add node-runtime in Cargo.toml and Cargo.lock updates.
  • Packaging/Config
    • Bundle Node binaries via apps/executeJS/src-tauri/tauri.conf.json resources and extend security capabilities.
    • .gitignore: ignore bundled Node binaries and temp download dir.
    • package.json: add scripts/download-node-binaries.js, download-node, and postinstall to fetch binaries.
  • Frontend
    • apps/executeJS/src/widgets/code-editor/code-editor.tsx: remove oxlint integration (commented out); keep Prettier formatting and shortcuts.
  • Docs
    • Update .cursorrules to document Node.js runtime architecture and troubleshooting.

Written by Cursor Bugbot for commit aec8f3e. This will update automatically on new commits. Configure here.

- Deno Core 대신 Node.js 서브프로세스로 JavaScript 실행
- Node.js 바이너리 자동 다운로드 스크립트 추가
- lint_code 기능 제거
- deno-runtime 크레이트 제거
- hello-world 크레이트 제거
@ohah ohah self-assigned this Dec 12, 2025
@ohah ohah added the enhancement New feature or request label Dec 12, 2025
GitHub Actions의 Linux 환경에서 postinstall 스크립트 실행 시
에러가 발생하지 않도록 지원하지 않는 플랫폼에서 조용히 종료하도록 수정
Copy link

@cursor cursor bot left a 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")
Copy link

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.

Fix in Cursor Fix in Web

"resources": [
"resources/node-runtime/node-v24.12.0-darwin-arm64/node",
"resources/node-runtime/node-v24.12.0-win-arm64/node.exe"
],
Copy link

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.

Fix in Cursor Fix in Web

- 리다이렉트 및 에러 발생 시 파일 스트림이 닫히지 않는 문제 해결
- cleanup 헬퍼 함수 추가하여 파일 스트림 안전하게 정리
- 모든 early return 경로에서 파일 스트림 닫기 및 임시 파일 삭제 보장
@ohah ohah merged commit c1999b3 into main Dec 12, 2025
5 checks passed
Copy link
Contributor

Copilot AI left a 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-runtime crate with new node-runtime crate 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.

Comment on lines +135 to 138
if app_handle.get_webview_window("main").is_some() {
// DevTools는 플러그인을 통해 자동으로 관리됨
eprintln!("DevTools 토글 (플러그인 사용)");
}
Copy link

Copilot AI Dec 12, 2025

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.

Suggested change
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.)

Copilot uses AI. Check for mistakes.
Comment on lines +44 to +46
// 파일 스트림 정리 헬퍼 함수
const cleanup = (callback) => {
file.close(() => {
Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
}

/// JavaScript 코드 실행
pub async fn execute_script(&self, _filename: &str, code: &str) -> Result<String> {
Copy link

Copilot AI Dec 12, 2025

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.

Suggested change
pub async fn execute_script(&self, _filename: &str, code: &str) -> Result<String> {
pub async fn execute_script(&self, code: &str) -> Result<String> {

Copilot uses AI. Check for mistakes.
"icon": [],
"resources": [
"resources/node-runtime/node-v24.12.0-darwin-arm64/node",
"resources/node-runtime/node-v24.12.0-win-arm64/node.exe"
Copy link

Copilot AI Dec 12, 2025

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.

Suggested change
"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 uses AI. Check for mistakes.
Comment on lines +164 to +165
}
};
Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
use serde::{Deserialize, Serialize};
use std::process::Command;
// 비활성화: Command import (lint_code가 주석 처리되어 사용 안 함)
// use std::process::Command;
Copy link

Copilot AI Dec 12, 2025

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.

Suggested change
// use std::process::Command;

Copilot uses AI. Check for mistakes.
Comment on lines +94 to +106
});
});
});
})
.on('error', (err) => {
// HTTP 요청 에러 - 파일 스트림 정리 후 reject
cleanup(() => {
reject(err);
});
});
});
};

Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
arch: arch === 'arm64' ? 'arm64' : 'x64',
extension: 'zip',
binaryName: 'node.exe',
};
Copy link

Copilot AI Dec 12, 2025

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.

Suggested change
};
};
} else if (platform === 'linux') {
return {
os: 'linux',
arch: arch === 'arm64' ? 'arm64' : 'x64',
extension: 'tar.xz',
binaryName: 'node',
};

Copilot uses AI. Check for mistakes.
/// OS별 Node.js 바이너리 경로 찾기
fn find_node_binary() -> Result<PathBuf> {
let (os_name, binary_name) = if cfg!(target_os = "windows") {
("win-arm64", "node.exe")
Copy link

Copilot AI Dec 12, 2025

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.

Suggested change
("win-arm64", "node.exe")
if cfg!(target_arch = "aarch64") {
("win-arm64", "node.exe")
} else {
("win-x64", "node.exe")
}

Copilot uses AI. Check for mistakes.
file.on('finish', () => {
file.close();
console.log('\n다운로드 완료!');
resolve();
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

Unused variable platform.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants