🔧 Update to the latest stable versions of node and rust
This commit is contained in:
2
.github/workflows/code-quality.yml
vendored
2
.github/workflows/code-quality.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "22"
|
||||||
cache: "pnpm"
|
cache: "pnpm"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|||||||
2
.github/workflows/pake-cli.yaml
vendored
2
.github/workflows/pake-cli.yaml
vendored
@@ -67,7 +67,7 @@ jobs:
|
|||||||
- name: Install node
|
- name: Install node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 22
|
||||||
|
|
||||||
- name: Install Rust for ubuntu-24.04
|
- name: Install Rust for ubuntu-24.04
|
||||||
if: inputs.platform == 'ubuntu-24.04'
|
if: inputs.platform == 'ubuntu-24.04'
|
||||||
|
|||||||
213
CLAUDE.md
213
CLAUDE.md
@@ -2,145 +2,164 @@
|
|||||||
|
|
||||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||||
|
|
||||||
|
## Philosophy
|
||||||
|
|
||||||
|
- **Incremental progress over big bangs**: Break complex tasks into manageable stages
|
||||||
|
- **Learn from existing code**: Understand patterns before implementing new features
|
||||||
|
- **Clear intent over clever code**: Prioritize readability and maintainability
|
||||||
|
|
||||||
## Project Overview
|
## Project Overview
|
||||||
|
|
||||||
Pake is a tool that turns any webpage into a desktop app with Rust, using Tauri framework. It's much lighter than Electron (~5M vs ~100M+) and provides better performance. The project consists of a CLI tool for packaging web apps and the core Tauri application framework.
|
Pake transforms any webpage into a lightweight desktop app using Rust and Tauri. It's significantly lighter than Electron (~5M vs ~100M+) with better performance.
|
||||||
|
|
||||||
## Commands
|
**Core Architecture:**
|
||||||
|
|
||||||
### Development
|
- **CLI Tool** (`bin/`): TypeScript-based command interface
|
||||||
|
- **Tauri App** (`src-tauri/`): Rust desktop framework
|
||||||
|
- **Injection System**: Custom CSS/JS injection for webpages
|
||||||
|
|
||||||
|
## Development Workflow
|
||||||
|
|
||||||
|
### 1. Planning Phase
|
||||||
|
|
||||||
|
Break complex work into 3-5 stages:
|
||||||
|
|
||||||
|
1. Understand existing patterns in codebase
|
||||||
|
2. Plan implementation approach
|
||||||
|
3. Write tests first (when applicable)
|
||||||
|
4. Implement minimal working solution
|
||||||
|
5. Refactor and optimize
|
||||||
|
|
||||||
|
### 2. Implementation Flow
|
||||||
|
|
||||||
|
**Understanding First:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Explore codebase structure
|
||||||
|
find src-tauri/src -name "*.rs" | head -10
|
||||||
|
grep -r "window_config" src-tauri/src/
|
||||||
|
```
|
||||||
|
|
||||||
|
**Development Commands:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
npm i
|
npm i
|
||||||
|
|
||||||
# Local development (right-click to open debug mode)
|
# Development with hot reload
|
||||||
npm run dev
|
npm run dev
|
||||||
|
|
||||||
# CLI development with hot reload
|
# CLI development
|
||||||
npm run cli:dev
|
npm run cli:dev
|
||||||
|
|
||||||
# Build CLI tools
|
|
||||||
npm run cli:build
|
|
||||||
```
|
|
||||||
|
|
||||||
### Building
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Production build
|
# Production build
|
||||||
npm run build
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
# Debug build
|
### 3. Testing and Validation
|
||||||
|
|
||||||
|
**Key Testing Commands:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Debug build for development
|
||||||
npm run build:debug
|
npm run build:debug
|
||||||
|
|
||||||
# Mac universal build (Intel + M1)
|
# Multi-platform testing
|
||||||
npm run build:mac
|
npm run build:mac # macOS universal build
|
||||||
|
|
||||||
# Generate app configuration
|
|
||||||
npm run build:config
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### CLI Usage
|
**Testing Checklist:**
|
||||||
|
|
||||||
|
- [ ] Test on target platforms
|
||||||
|
- [ ] Verify injection system works
|
||||||
|
- [ ] Check system tray integration
|
||||||
|
- [ ] Validate window behavior
|
||||||
|
|
||||||
|
## Core Components
|
||||||
|
|
||||||
|
### CLI Tool (`bin/`)
|
||||||
|
|
||||||
|
- `bin/cli.ts` - Main entry point
|
||||||
|
- `bin/builders/` - Platform-specific builders
|
||||||
|
- `bin/options/` - Configuration processing
|
||||||
|
|
||||||
|
### Tauri Application (`src-tauri/`)
|
||||||
|
|
||||||
|
- `src/lib.rs` - Application entry point
|
||||||
|
- `src/app/` - Core modules (window, tray, shortcuts)
|
||||||
|
- `src/inject/` - Web page injection logic
|
||||||
|
|
||||||
|
### Key Configuration Files
|
||||||
|
|
||||||
|
- `pake.json` - App configuration
|
||||||
|
- `tauri.conf.json` - Tauri settings
|
||||||
|
- Platform configs: `tauri.{macos,windows,linux}.conf.json`
|
||||||
|
|
||||||
|
## Problem-Solving Approach
|
||||||
|
|
||||||
|
**When stuck:**
|
||||||
|
|
||||||
|
1. **Limit attempts to 3** before stopping to reassess
|
||||||
|
2. **Document what doesn't work** and why
|
||||||
|
3. **Research alternative approaches** in similar projects
|
||||||
|
4. **Question assumptions** - is there a simpler way?
|
||||||
|
|
||||||
|
**Example debugging flow:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Install CLI globally
|
# 1. Check logs
|
||||||
npm install -g pake-cli
|
npm run dev 2>&1 | grep -i error
|
||||||
|
|
||||||
# Package a webpage
|
# 2. Verify dependencies
|
||||||
pake https://example.com --name MyApp --width 1200 --height 800
|
cargo check --manifest-path=src-tauri/Cargo.toml
|
||||||
|
|
||||||
# Also supports names with spaces (cross-platform compatible)
|
# 3. Test minimal reproduction
|
||||||
# pake https://translate.google.com --name "Google Translate" --hide-title-bar
|
# Create simple test case isolating the issue
|
||||||
|
|
||||||
# Development with custom options
|
|
||||||
# Modify DEFAULT_DEV_PAKE_OPTIONS in bin/defaults.ts
|
|
||||||
npm run cli:dev
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Analysis
|
## Platform-Specific Development
|
||||||
|
|
||||||
```bash
|
|
||||||
# Analyze binary size
|
|
||||||
npm run analyze
|
|
||||||
```
|
|
||||||
|
|
||||||
## Architecture
|
|
||||||
|
|
||||||
### Core Components
|
|
||||||
|
|
||||||
1. **CLI Tool** (`bin/`): Node.js/TypeScript-based command-line interface
|
|
||||||
|
|
||||||
- `bin/cli.ts` - Main CLI entry point with Commander.js
|
|
||||||
- `bin/builders/` - Platform-specific builders (Mac, Windows, Linux)
|
|
||||||
- `bin/options/` - CLI option processing and validation
|
|
||||||
- `bin/utils/` - Utility functions for URL validation, platform detection
|
|
||||||
|
|
||||||
2. **Tauri Application** (`src-tauri/`): Rust-based desktop app framework
|
|
||||||
|
|
||||||
- `src-tauri/src/lib.rs` - Main application entry point
|
|
||||||
- `src-tauri/src/app/` - Application modules (config, window, system tray, shortcuts)
|
|
||||||
- `src-tauri/src/inject/` - JavaScript/CSS injection for web pages
|
|
||||||
- `src-tauri/pake.json` - Default app configuration
|
|
||||||
|
|
||||||
3. **Build System**: Uses Rollup for CLI bundling and Tauri for app packaging
|
|
||||||
|
|
||||||
### Configuration System
|
|
||||||
|
|
||||||
- **pake.json**: Main configuration file defining window properties, user agents, system tray settings
|
|
||||||
- **tauri.conf.json**: Tauri-specific configuration
|
|
||||||
- Platform-specific configs: `tauri.macos.conf.json`, `tauri.windows.conf.json`, `tauri.linux.conf.json`
|
|
||||||
|
|
||||||
### Key Features Implementation
|
|
||||||
|
|
||||||
- **Window Management**: `src-tauri/src/app/window.rs` - Window creation, sizing, title bar handling
|
|
||||||
- **System Tray**: `src-tauri/src/app/setup.rs` - Cross-platform system tray integration
|
|
||||||
- **Window Close Behavior**: `src-tauri/src/lib.rs` - Configurable close behavior (hide vs exit)
|
|
||||||
- **Global Shortcuts**: Activation shortcuts for bringing app to foreground
|
|
||||||
- **Web Integration**: Custom user agents, proxy support, CSS/JS injection
|
|
||||||
- **Multi-platform**: Builds for macOS (Intel/M1), Windows, Linux (deb/appimage/rpm)
|
|
||||||
|
|
||||||
## File Injection System
|
|
||||||
|
|
||||||
The project supports injecting custom CSS/JS files into webpages:
|
|
||||||
|
|
||||||
- Files in `src-tauri/src/inject/` contain the injection logic
|
|
||||||
- Use `--inject` CLI option to specify custom files
|
|
||||||
- Supports both local and remote injection files
|
|
||||||
|
|
||||||
## Platform-Specific Notes
|
|
||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
|
|
||||||
- Supports universal builds (Intel + M1) with `--multi-arch`
|
- Universal builds: `--multi-arch` flag
|
||||||
- Hide title bar option available with `--hide-title-bar`
|
|
||||||
- Uses `.icns` icons
|
- Uses `.icns` icons
|
||||||
|
- Title bar customization available
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
- Requires specific build tools and redistributables (see bin/README.md)
|
- Requires Visual Studio Build Tools
|
||||||
- Uses `.ico` icons
|
- Uses `.ico` icons
|
||||||
- Supports installer language configuration
|
- MSI installer support
|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
- Multiple package formats: deb, appimage, rpm
|
- Multiple formats: deb, AppImage, rpm
|
||||||
- Requires specific system dependencies (libwebkit2gtk, etc.)
|
- Requires `libwebkit2gtk` and dependencies
|
||||||
- Uses `.png` icons
|
- Uses `.png` icons
|
||||||
|
|
||||||
## Development Workflow
|
## Quality Standards
|
||||||
|
|
||||||
1. **CLI Development**: Modify `bin/defaults.ts` for default options, use `npm run cli:dev` for hot reload
|
**Code Standards:**
|
||||||
2. **Core App Development**: Work in `src-tauri/src/`, use `npm run dev` for Tauri development
|
|
||||||
3. **Testing**: Build with `--debug` flag for development tools and verbose logging
|
|
||||||
4. **Multi-platform**: Test builds on respective platforms or use GitHub Actions
|
|
||||||
|
|
||||||
## Branch Management
|
- Prefer composition over inheritance
|
||||||
|
- Use explicit types over implicit
|
||||||
|
- Write self-documenting code
|
||||||
|
- Follow existing patterns consistently
|
||||||
|
|
||||||
- `dev` branch: Active development, feature PRs should target this branch
|
**Commit Guidelines:**
|
||||||
- `main` branch: Release branch for tags and publishing
|
|
||||||
|
- Commit working code incrementally
|
||||||
|
- Use clear, descriptive messages
|
||||||
|
- Never bypass commit hooks
|
||||||
|
- Test before committing
|
||||||
|
|
||||||
|
## Branch Strategy
|
||||||
|
|
||||||
|
- `dev` - Active development, target for PRs
|
||||||
|
- `main` - Release branch for stable versions
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- Node.js >=16.0.0
|
- Node.js ≥22.0.0 (recommended LTS, older versions ≥16.0.0 may work)
|
||||||
- Rust >=1.78.0 (installed automatically by CLI if missing)
|
- Rust ≥1.89.0 (recommended stable, older versions ≥1.78.0 may work)
|
||||||
- Platform-specific build tools (see Tauri prerequisites)
|
- Platform build tools (see CONTRIBUTING.md for details)
|
||||||
|
|||||||
@@ -17,6 +17,55 @@ graph LR
|
|||||||
- `main` is the release branch, we will make tag and publish version on this branch.
|
- `main` is the release branch, we will make tag and publish version on this branch.
|
||||||
- If it is a document modification, it can be submitted to this branch.
|
- If it is a document modification, it can be submitted to this branch.
|
||||||
|
|
||||||
|
## Development Setup
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
- Node.js ≥22.0.0 (recommended LTS, older versions ≥16.0.0 may work)
|
||||||
|
- Rust ≥1.89.0 (recommended stable, older versions ≥1.78.0 may work)
|
||||||
|
- Platform-specific build tools:
|
||||||
|
- **macOS**: Xcode Command Line Tools (`xcode-select --install`)
|
||||||
|
- **Windows**: Visual Studio Build Tools with MSVC
|
||||||
|
- **Linux**: `build-essential`, `libwebkit2gtk`, system dependencies
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clone the repository
|
||||||
|
git clone https://github.com/tw93/Pake.git
|
||||||
|
cd Pake
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# Start development
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### macOS 26 Beta Compilation Issues
|
||||||
|
|
||||||
|
If you're running macOS 26 Beta and encounter compilation errors related to `mac-notification-sys` or system frameworks (errors about `CoreFoundation`, `_Builtin_float` modules), create a `src-tauri/.cargo/config.toml` file with:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[env]
|
||||||
|
# Fix for macOS 26 Beta compatibility issues
|
||||||
|
# Forces use of compatible SDK when building on macOS 26 Beta
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = "15.5"
|
||||||
|
SDKROOT = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk"
|
||||||
|
```
|
||||||
|
|
||||||
|
This file is already in `.gitignore` and should not be committed to the repository.
|
||||||
|
|
||||||
|
**Root Cause**: macOS 26 Beta uses newer system frameworks that aren't yet supported by the current Xcode SDK (15.5). This configuration forces the build to use the compatible SDK version.
|
||||||
|
|
||||||
|
### Common Build Issues
|
||||||
|
|
||||||
|
- **Rust compilation errors**: Run `cargo clean` in `src-tauri/` directory
|
||||||
|
- **Node dependency issues**: Delete `node_modules` and run `npm install`
|
||||||
|
- **Permission errors on macOS**: Run `sudo xcode-select --reset`
|
||||||
|
|
||||||
## More
|
## More
|
||||||
|
|
||||||
It is a good habit to create a feature request issue to discuss whether the feature is necessary before you implement it. However, it's unnecessary to create an issue to claim that you found a typo or improved the readability of documentation, just create a pull request.
|
It is a good habit to create a feature request issue to discuss whether the feature is necessary before you implement it. However, it's unnecessary to create an issue to claim that you found a typo or improved the readability of documentation, just create a pull request.
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ If you are new to the command line, you can compile packages online with _GitHub
|
|||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
Prepare your environment before starting. Make sure you have Rust `>=1.63` and Node `>=16` (e.g., `16.18.1`) installed on your computer. For installation guidance, see [Tauri documentation](https://tauri.app/start/prerequisites/).
|
Prepare your environment before starting. Make sure you have Rust `>=1.89` and Node `>=22` (e.g., `22.11.0`) installed on your computer. *Note: Older versions (Rust ≥1.78, Node ≥16) may also work but latest stable versions are recommended.* For installation guidance, see [Tauri documentation](https://tauri.app/start/prerequisites/).
|
||||||
|
|
||||||
If you are unfamiliar with these, it is better to try out the above tool to pack with one click.
|
If you are unfamiliar with these, it is better to try out the above tool to pack with one click.
|
||||||
|
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ pake https://weekly.tw93.fun --name Weekly --hide-title-bar
|
|||||||
|
|
||||||
## 定制开发
|
## 定制开发
|
||||||
|
|
||||||
开始前请确保电脑已经安装了 Rust `>=1.63` 和 Node `>=16 如 16.18.1` 的环境,此外需参考 [Tauri 文档](https://tauri.app/start/prerequisites/) 快速配置好环境才可以开始使用,假如你太不懂,使用上面的命令行打包会更加合适。
|
开始前请确保电脑已经安装了 Rust `>=1.89` 和 Node `>=22 如 22.11.0` 的环境,*注意:较旧的版本(Rust ≥1.78,Node ≥16)也可能可以工作,但推荐使用最新稳定版本。* 此外需参考 [Tauri 文档](https://tauri.app/start/prerequisites/) 快速配置好环境才可以开始使用,假如你太不懂,使用上面的命令行打包会更加合适。
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# 安装依赖
|
# 安装依赖
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ pake https://weekly.tw93.fun --name Weekly --hide-title-bar
|
|||||||
|
|
||||||
## 開発
|
## 開発
|
||||||
|
|
||||||
開始する前に、Rust `>=1.63` と Node `>=16` (例: `16.18.1`) がコンピュータにインストールされていることを確認してください。インストールガイドについては、[Tauri ドキュメント](https://tauri.app/start/prerequisites/)を参照してください。
|
開始する前に、Rust `>=1.89` と Node `>=22` (例: `22.11.0`) がコンピュータにインストールされていることを確認してください。*注意:古いバージョン(Rust ≥1.78、Node ≥16)でも動作する可能性がありますが、最新の安定版の使用をお勧めします。* インストールガイドについては、[Tauri ドキュメント](https://tauri.app/start/prerequisites/)を参照してください。
|
||||||
|
|
||||||
これらに不慣れな場合は、上記のツールを使用してワンクリックでパッケージを作成することをお勧めします。
|
これらに不慣れな場合は、上記のツールを使用してワンクリックでパッケージを作成することをお勧めします。
|
||||||
|
|
||||||
|
|||||||
2
bin/README.md
vendored
2
bin/README.md
vendored
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Ensure that your Node.js version is 18.0 or higher (e.g., 18.20.2). Avoid using `sudo` for the installation. If you encounter permission issues with npm, refer to [How to fix npm throwing error without sudo](https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo).
|
Ensure that your Node.js version is 22.0 or higher (e.g., 22.11.0). *Note: Older versions ≥16.0.0 may also work.* Avoid using `sudo` for the installation. If you encounter permission issues with npm, refer to [How to fix npm throwing error without sudo](https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install pake-cli -g
|
npm install pake-cli -g
|
||||||
|
|||||||
2
bin/README_CN.md
vendored
2
bin/README_CN.md
vendored
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## 安装
|
## 安装
|
||||||
|
|
||||||
请确保您的 Node.js 版本为 18 或更高版本(例如 18.7)。请避免使用 `sudo` 进行安装。如果 npm 报告权限问题,请参考 [如何在不使用 sudo 的情况下修复 npm 报错](https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo)。
|
请确保您的 Node.js 版本为 22 或更高版本(例如 22.11.0)。*注意:较旧的版本 ≥16.0.0 也可能可以工作。* 请避免使用 `sudo` 进行安装。如果 npm 报告权限问题,请参考 [如何在不使用 sudo 的情况下修复 npm 报错](https://stackoverflow.com/questions/16151018/how-to-fix-npm-throwing-error-without-sudo)。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install pake-cli -g
|
npm install pake-cli -g
|
||||||
|
|||||||
Reference in New Issue
Block a user