Skip to content

Development ja

kudryavskiy_rv edited this page Jul 5, 2026 · 1 revision

開発

セットアップ

git clone https://github.com/devpilgrin/office-print.git
cd office-print
cargo build
cargo test --workspace

Rust ≥ 1.89 が必要(2024エディション)。

ワークスペース

crates/
├── office-print/       # コアライブラリ(wasm, pdf-ops, typescript)
└── office-print-cli/   # CLI(server)

ビルド

cargo build                    # デバッグ
cargo build --release          # リリース
cargo build --features wasm    # WASM 含む

テスト

cargo test --workspace                           # 全テスト
cargo test -p office-print --test docx_fixtures  # DOCX
cargo test -p office-print --test xlsx_fixtures  # XLSX
cargo test -p office-print --test pptx_fixtures  # PPTX

PDF 検証には qpdf が必要:

sudo apt install qpdf   # Linux
brew install qpdf       # macOS

検証付き実行:

office_print_VALIDATE_PDF=1 cargo test --workspace

リント

cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings

フィクスチャ

テストフィクスチャは tests/fixtures/{docx,pptx,xlsx}/ にあります。実際の Office 文書です。libreoffice/ と poi/ 内のフィクスチャは非公開です。

CI

main へのプッシュと PR で実行: check、test、clippy、fmt — すべて ubuntu-latest。

リリース

cargo build --release -p office-print-cli
# バイナリ: target/release/office-print[.exe]

プロジェクト構造

office-print/
├── crates/
│   ├── office-print/src/
│   │   ├── config.rs        # ConvertOptions, Format, OutputFormat
│   │   ├── error.rs         # ConvertError, ConvertWarning, OutputData
│   │   ├── ir/              # 中間表現
│   │   ├── parser/          # DOCX, PPTX, XLSX パーサー
│   │   ├── pdf.rs           # Typst コンパイルと PDF レンダリング
│   │   ├── render/          # PNG/JPEG ラスタライズ
│   │   └── wasm.rs          # WASM バインディング
│   └── office-print-cli/src/
│       └── main.rs          # CLI エントリポイント
├── tests/fixtures/          # テストフィクスチャ
├── build/                   # リリースビルド(gitignore)
├── doc/                     # プロジェクト文書
└── README.md

Home-ja

Clone this wiki locally