Skip to content

feat(build): add lightweight libreoffice build extension#3164

Closed
CuboYe wants to merge 1 commit intotriggerdotdev:mainfrom
CuboYe:bounty/fix-1361-libreoffice-extension
Closed

feat(build): add lightweight libreoffice build extension#3164
CuboYe wants to merge 1 commit intotriggerdotdev:mainfrom
CuboYe:bounty/fix-1361-libreoffice-extension

Conversation

@CuboYe
Copy link

@CuboYe CuboYe commented Mar 3, 2026

Fixes #1361

/claim #1361

What changed

  • Added new libreoffice() build extension at @trigger.dev/build/extensions/libreoffice
  • Installs lightweight LibreOffice packages with --no-install-recommends (headless-oriented, no X11)
  • Includes practical default fonts and optional extra font packages
  • Added LIBREOFFICE_PATH deploy env var
  • Added references/libreoffice reference project showing docx/pptx -> pdf conversion
  • Updated docs example to use the new extension
  • Added changeset for @trigger.dev/build

Validation

  • Claude Code run completed and committed changes in one commit
  • Scope constrained to build extension, docs, and reference project

…iggerdotdev#1361)

- Add `packages/build/src/extensions/libreoffice.ts`: installs libreoffice-writer
  and libreoffice-impress (configurable) via apt with --no-install-recommends so
  no X11/desktop packages are pulled in. Includes fonts-liberation and
  fonts-dejavu-core for accurate document rendering. Sets LIBREOFFICE_PATH env var.
- Register `@trigger.dev/build/extensions/libreoffice` export in package.json.
- Add `references/libreoffice/` reference project demonstrating headless docx/pptx
  to PDF conversion using execFile + LibreOffice --headless --norestore.
- Update docs to reference the dedicated extension instead of the generic aptGet.
- Add patch changeset for @trigger.dev/build.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Mar 3, 2026

🦋 Changeset detected

Latest commit: a0a263a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 28 packages
Name Type
@trigger.dev/build Patch
trigger.dev Patch
@trigger.dev/python Patch
d3-chat Patch
references-d3-openai-agents Patch
references-nextjs-realtime Patch
references-realtime-hooks-test Patch
references-realtime-streams Patch
references-telemetry Patch
@trigger.dev/core Patch
@trigger.dev/react-hooks Patch
@trigger.dev/redis-worker Patch
@trigger.dev/rsc Patch
@trigger.dev/schema-to-json Patch
@trigger.dev/sdk Patch
@trigger.dev/database Patch
@trigger.dev/otlp-importer Patch
@internal/cache Patch
@internal/clickhouse Patch
@internal/redis Patch
@internal/replication Patch
@internal/run-engine Patch
@internal/schedule-engine Patch
@internal/testcontainers Patch
@internal/tracing Patch
@internal/tsql Patch
@internal/zod-worker Patch
@internal/sdk-compat-tests Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Hi @CuboYe, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions bot closed this Mar 3, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b192b71 and a0a263a.

⛔ Files ignored due to path filters (4)
  • references/libreoffice/package.json is excluded by !references/**
  • references/libreoffice/src/trigger/libreoffice-convert.ts is excluded by !references/**
  • references/libreoffice/trigger.config.ts is excluded by !references/**
  • references/libreoffice/tsconfig.json is excluded by !references/**
📒 Files selected for processing (4)
  • .changeset/libreoffice-build-extension.md
  • docs/guides/examples/libreoffice-pdf-conversion.mdx
  • packages/build/package.json
  • packages/build/src/extensions/libreoffice.ts

Walkthrough

This pull request introduces a new LibreOffice build extension for the Trigger.dev build system. The changes include: a changeset file declaring the patch release, a new TypeScript extension implementation that handles automated LibreOffice installation with customizable components and fonts, updates to the package.json to export the new extension with proper type declarations, and documentation updates demonstrating how to use the extension for DOCX/PPTX to PDF conversion in headless environments.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~23 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

View 4 additional findings in Devin Review.

Open in Devin Review


// Derive a safe input filename from the URL.
const urlPath = new URL(documentUrl).pathname;
const ext = urlPath.split(".").pop() ?? "docx";
Copy link
Contributor

Choose a reason for hiding this comment

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

🔴 URL extension extraction produces invalid file path when URL has no file extension

When the documentUrl has no dot-separated file extension in its pathname (e.g., https://api.example.com/documents/report or a signed URL like https://storage.example.com/abc123), the extension extraction at line 33 produces a broken path that causes a runtime crash.

Root Cause

The expression urlPath.split(".").pop() always returns a non-empty string (the last element of the split array), so the ?? "docx" fallback never triggers for URLs without a file extension.

For example, given documentUrl = "https://api.example.com/documents/report":

  • urlPath = "/documents/report"
  • urlPath.split(".") = ["/documents/report"]
  • .pop() = "/documents/report" — a truthy string, not null/undefined
  • ext = "/documents/report"
  • inputPath = join(workDir, "input./documents/report") → e.g. /tmp/lo-123/input./documents/report

The resulting inputPath contains intermediate directory components (/documents/) that don't exist, so writeFileSync(inputPath, ...) at line 45 throws ENOENT. Even URLs with dots in non-extension positions (e.g. https://api.v2.example.com/file) would extract garbage like "com/file" containing a /.

Impact: The task crashes for any URL whose pathname doesn't end with a recognizable .ext suffix. Since many document-serving APIs and signed URLs lack file extensions, this is a common real-world scenario. Users are likely to copy this reference project as a template.

Suggested change
const ext = urlPath.split(".").pop() ?? "docx";
const lastSegment = urlPath.split("/").pop() ?? "";
const ext = lastSegment.includes(".") ? lastSegment.split(".").pop()! : "docx";
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@@ -0,0 +1,13 @@
import { defineConfig } from "@trigger.dev/sdk/v3";
Copy link
Contributor

Choose a reason for hiding this comment

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

🚩 Reference config uses deprecated @trigger.dev/sdk/v3 import path

At references/libreoffice/trigger.config.ts:1, the import uses @trigger.dev/sdk/v3 which is noted as a deprecated path alias in CLAUDE.md and packages/trigger-sdk/CLAUDE.md ("Never use @trigger.dev/sdk/v3"). While this still works as an alias, other reference projects and the docs example (docs/guides/examples/libreoffice-pdf-conversion.mdx:21) correctly use @trigger.dev/sdk. This inconsistency could confuse users who use this reference as a template.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a libreoffice build extension to allow docx/pptx to PDF conversion

2 participants