feat(deps): remove pdfme — Phase 1 PDF stack overhaul complete

Phase 1 / commit 14 of 14 — final cleanup.

Removed:
  package.json:
    - @pdfme/common      6.1.2
    - @pdfme/generator   6.1.2
    - @pdfme/schemas     6.1.2
  src/lib/pdf/generate.ts (24 LOC — the pdfme thin wrapper)
  tests/integration/document-templates-generate-and-sign.test.ts:
    - the vi.mock() entry for '@/lib/pdf/generate' (module deleted)
    - the assertion `pdfModule.generatePdf).not.toHaveBeenCalled()`
      (rephrased as a positive assertion on the EOI source-PDF path)

Three engines remain, each with a single clear job:
  pdf-lib          AcroForm read/fill for berth-PDF parser tier-1 and
                   the in-app EOI source-PDF pathway
  pdfkit           streaming engine for the photo-heavy expense PDF
  @react-pdf       brand-kit-based JSX rendering for every internal
                   report / record export / parent-company export

Plus unpdf for berth-PDF parser tier-2 text extraction (replaces the
broken tesseract-on-PDF-buffer path).

Phase 1 totals:
  14 commits
  +X LOC react-pdf brand kit + templates + logo upload
  -1500+ LOC pdfme bridge + templates + invoice generator + html seed
  3 deps removed (@pdfme/common, /generator, /schemas)
  4 deps added (@react-pdf/renderer, unpdf, react-image-crop, svgo)

1298/1298 vitest green throughout.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 21:15:05 +02:00
parent e8a852856e
commit e386c8d83f
4 changed files with 1 additions and 149 deletions

View File

@@ -41,10 +41,6 @@ vi.mock('@/lib/socket/server', () => ({
emitToRoom: vi.fn(),
}));
vi.mock('@/lib/pdf/generate', () => ({
generatePdf: vi.fn().mockResolvedValue(new Uint8Array(Buffer.from('fake-pdf'))),
}));
vi.mock('@/lib/pdf/fill-eoi-form', () => ({
generateEoiPdfFromTemplate: vi
.fn()
@@ -278,9 +274,8 @@ describe('generateAndSign — inapp pathway', () => {
).rejects.toThrow(ValidationError);
});
it('uses the EOI source-PDF path (not pdfme HTML) for templateType=eoi', async () => {
it('uses the EOI source-PDF path for templateType=eoi', async () => {
const fillModule = await import('@/lib/pdf/fill-eoi-form');
const pdfModule = await import('@/lib/pdf/generate');
const client = await import('@/lib/services/documenso-client');
vi.mocked(client.createDocument).mockResolvedValue({
id: 'doc-eoi-pdf',
@@ -303,7 +298,6 @@ describe('generateAndSign — inapp pathway', () => {
);
expect(fillModule.generateEoiPdfFromTemplate).toHaveBeenCalled();
expect(pdfModule.generatePdf).not.toHaveBeenCalled();
});
it('rejects non-EOI template types on the inapp pathway', async () => {