From 423c8563ea2e93665d6692442f355d28cbdb9d85 Mon Sep 17 00:00:00 2001 From: Pheem49 Date: Sat, 20 Jun 2026 21:50:41 +0700 Subject: [PATCH 1/3] feat: improve project root discovery for CLI, configure npm publishing, and add ignore rules for build artifacts --- .gitignore | 1 + .npmignore | 29 +++++++++++++++++++++++++++++ BUILD_AND_RELEASE.md | 16 ++++++++++++++++ crates/mint-cli/src/main.rs | 34 +++++++++++++++++++++++++++++----- package.json | 18 +++++++++++------- 5 files changed, 86 insertions(+), 12 deletions(-) create mode 100644 .npmignore diff --git a/.gitignore b/.gitignore index fffe48f..4bca63a 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ coverage/ target/ release/ build/ +bin/ # ========================== # Logs diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..8c7c2ae --- /dev/null +++ b/.npmignore @@ -0,0 +1,29 @@ +# Ignore Rust backend files +crates/ +src-tauri/ +target/ +Cargo.toml +Cargo.lock +rustc_checker.py + +# Ignore local configuration and developer tools +.agents/ +.antigravitycli/ +.cargo_home/ +.codex/ +.rustup/ +.rustup_copy/ +.rustup_home/ +.vite-web/ +.env* +logs/ + +# Ignore documentation and guidelines +docs/ +BUILD_AND_RELEASE.md +CONTRIBUTING.md +TAURI_MIGRATION.md + +# Ignore installer scripts +install.sh +install.ps1 diff --git a/BUILD_AND_RELEASE.md b/BUILD_AND_RELEASE.md index bc18a0d..c879fd6 100644 --- a/BUILD_AND_RELEASE.md +++ b/BUILD_AND_RELEASE.md @@ -43,3 +43,19 @@ runs publish a GitHub Release. The updater requires a configured release endpoint, a public key in the Tauri config, and signed release artifacts. Exercise update installation against the published endpoint before promoting a release. + +## Publish to npm + +To publish the repository package to the npm registry as a public scoped package: + +1. **Log in to npm** (if not already logged in): + ```bash + npm login + ``` + +2. **Publish the package** (since `@pheem49/mint` is a scoped package, you must specify public access): + ```bash + npm publish --access public + ``` + +*Note: You must bump the version number in `package.json` before publishing a new version.* diff --git a/crates/mint-cli/src/main.rs b/crates/mint-cli/src/main.rs index 8b31376..75c1897 100644 --- a/crates/mint-cli/src/main.rs +++ b/crates/mint-cli/src/main.rs @@ -947,12 +947,36 @@ async fn launch_mint_target(target: String) -> Result<()> { println!( "{MINT}Launching Web App (vite) in background...{RESET} {DIM}(Vite Dev UI at http://localhost:9000){RESET}" ); - let project_root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) - .parent() - .and_then(|p| p.parent()) - .ok_or_else(|| anyhow::anyhow!("Failed to find project root directory"))?; + let project_root = { + let mut found = None; + if let Ok(exe_path) = std::env::current_exe() { + let mut path = exe_path.parent(); + while let Some(p) = path { + if p.join("package.json").exists() { + found = Some(p.to_path_buf()); + break; + } + path = p.parent(); + } + } + if found.is_none() { + if let Ok(cwd) = std::env::current_dir() { + let mut path = Some(cwd.as_path()); + while let Some(p) = path { + if p.join("package.json").exists() { + found = Some(p.to_path_buf()); + break; + } + path = p.parent(); + } + } + } + found.ok_or_else(|| { + anyhow::anyhow!("Failed to find project root directory containing package.json") + })? + }; std::process::Command::new("npm") - .current_dir(project_root) + .current_dir(&project_root) .args(&["run", "dev:web"]) .stdout(std::process::Stdio::null()) .stderr(std::process::Stdio::null()) diff --git a/package.json b/package.json index 32fabe5..136b056 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "preview": "vite preview", "start": "tauri dev", "test": "cargo test -p mint-core -p mint-cli", - "cli": "cargo run -p mint-cli --" + "cli": "cargo run -p mint-cli --", + "prepublishOnly": "npm run build:cli && mkdir -p bin && cp target/release/mint bin/mint" }, "keywords": [], "author": { @@ -33,20 +34,23 @@ }, "license": "AGPL-3.0-only", "type": "commonjs", + "bin": { + "mint": "./bin/mint" + }, "dependencies": { "@tauri-apps/api": "^2.0.0", - "pixi-live2d-display": "^0.4.0", - "pixi.js": "^6.5.10", - "react": "^19.2.5" - }, - "devDependencies": { - "@tauri-apps/cli": "^2.0.0", "@vitejs/plugin-react": "^6.0.1", "material-icon-theme": "^5.35.0", + "pixi-live2d-display": "^0.4.0", + "pixi.js": "^6.5.10", + "react": "^19.2.5", "react-dom": "^19.2.5", "typescript": "^6.0.3", "vite": "^8.0.10" }, + "devDependencies": { + "@tauri-apps/cli": "^2.0.0" + }, "overrides": { "gh-pages": "^5.0.0" } From e07019c16eecd951b59426c2624095766c8e366f Mon Sep 17 00:00:00 2001 From: Pheem49 Date: Sat, 20 Jun 2026 22:03:20 +0700 Subject: [PATCH 2/3] chore: bump version to 1.6.1 and refactor CLI binary distribution to use node entry point --- .gitignore | 2 +- .npmignore | 6 ++---- Cargo.toml | 2 +- package.json | 6 +++--- src-tauri/tauri.conf.json | 2 +- src/bin/index.js | 16 ++++++++++++++++ 6 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 src/bin/index.js diff --git a/.gitignore b/.gitignore index 4bca63a..afcb5a4 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,7 @@ coverage/ target/ release/ build/ -bin/ +/bin/ # ========================== # Logs diff --git a/.npmignore b/.npmignore index 8c7c2ae..c3c31be 100644 --- a/.npmignore +++ b/.npmignore @@ -1,9 +1,7 @@ -# Ignore Rust backend files -crates/ +# Ignore Rust backend and build files src-tauri/ target/ -Cargo.toml -Cargo.lock +out/ rustc_checker.py # Ignore local configuration and developer tools diff --git a/Cargo.toml b/Cargo.toml index 241a845..5c58831 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ members = [ resolver = "2" [workspace.package] -version = "1.6.0" +version = "1.6.1" edition = "2024" license = "AGPL-3.0-only" diff --git a/package.json b/package.json index 136b056..65014e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pheem49/mint", - "version": "1.6.0", + "version": "1.6.1", "description": "A native Tauri desktop AI assistant with a Rust backend and React UI.", "scripts": { "dev:web": "vite --config vite.config.web.ts", @@ -25,7 +25,7 @@ "start": "tauri dev", "test": "cargo test -p mint-core -p mint-cli", "cli": "cargo run -p mint-cli --", - "prepublishOnly": "npm run build:cli && mkdir -p bin && cp target/release/mint bin/mint" + "postinstall": "cargo build -p mint-cli --release && mkdir -p bin && cp target/release/mint bin/mint" }, "keywords": [], "author": { @@ -35,7 +35,7 @@ "license": "AGPL-3.0-only", "type": "commonjs", "bin": { - "mint": "./bin/mint" + "mint": "src/bin/index.js" }, "dependencies": { "@tauri-apps/api": "^2.0.0", diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 676a406..d385c60 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Mint", - "version": "1.6.0", + "version": "1.6.1", "identifier": "com.pheem49.mint", "build": { "beforeDevCommand": "npm run dev:desktop", diff --git a/src/bin/index.js b/src/bin/index.js new file mode 100644 index 0000000..add9e51 --- /dev/null +++ b/src/bin/index.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node + +const { spawn } = require('child_process'); +const path = require('path'); + +// ชี้ไปยังไฟล์ Rust Binary ที่คอมไพล์สำเร็จแล้วในเครื่องผู้ใช้ +const binaryPath = path.join(__dirname, '..', '..', 'bin', 'mint'); + +// สั่งทำงานไฟล์ Binary โดยส่งอาร์กิวเมนต์ทั้งหมดต่อเข้าไป +const child = spawn(binaryPath, process.argv.slice(2), { + stdio: 'inherit' +}); + +child.on('close', (code) => { + process.exit(code); +}); From fe4d8bde2f71a14b7d3562dc2ffd6b279e4cc692 Mon Sep 17 00:00:00 2001 From: Pheem49 Date: Sat, 20 Jun 2026 22:09:10 +0700 Subject: [PATCH 3/3] chore: bump version to 1.6.2 and add repository metadata to package.json --- Cargo.toml | 2 +- package.json | 10 +++++++++- src-tauri/tauri.conf.json | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5c58831..a8f02c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ members = [ resolver = "2" [workspace.package] -version = "1.6.1" +version = "1.6.2" edition = "2024" license = "AGPL-3.0-only" diff --git a/package.json b/package.json index 65014e1..3e32ccd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pheem49/mint", - "version": "1.6.1", + "version": "1.6.2", "description": "A native Tauri desktop AI assistant with a Rust backend and React UI.", "scripts": { "dev:web": "vite --config vite.config.web.ts", @@ -28,6 +28,14 @@ "postinstall": "cargo build -p mint-cli --release && mkdir -p bin && cp target/release/mint bin/mint" }, "keywords": [], + "repository": { + "type": "git", + "url": "git+https://github.com/Pheem49/Mint.git" + }, + "bugs": { + "url": "https://github.com/Pheem49/Mint/issues" + }, + "homepage": "https://github.com/Pheem49/Mint#readme", "author": { "name": "Pheem49", "email": "killerpheem13@gmail.com" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index d385c60..eb7d19c 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Mint", - "version": "1.6.1", + "version": "1.6.2", "identifier": "com.pheem49.mint", "build": { "beforeDevCommand": "npm run dev:desktop",