Skip to content

charlie: fix next/v3 email check command (caniemail) + add --use-preview-props #383

@charliecreates

Description

@charliecreates

Target branch
All PRs must branch from next/v3 and target base next/v3 (not main).

Context
Per #379, next/v3 intentionally uses caniemail for email check (this must remain), but the current implementation has clear formatting/debug placeholders and is missing some useful behavior that exists on main (like --use-preview-props).

This issue is specifically about making email check production-ready on next/v3 without regressing the caniemail choice.

Scope (files/areas)

  • packages/jsx-email/src/cli/commands/check.ts
  • packages/jsx-email/src/cli/commands/build.ts (only as needed to plumb usePreviewProps through buildTemplates())
  • packages/jsx-email/package.json (do not swap to @jsx-email/doiuse-email)
  • test/cli/** (add a small CLI regression test if practical)

Tasks

  1. Remove debug/placeholder output from check.ts:
    • Delete console.log({ noteLines }).
    • Replace the placeholder text in formatNotes() with real formatting.
  2. Add --use-preview-props support (keep using caniemail):
    • Extend the Valibot options schema to accept usePreviewProps.
    • When set, ensure buildTemplates() is invoked with usePreviewProps: true so templates can export previewProps.
    • Update the help text.
  3. Ensure output formatting remains stable and readable:
    • Show grouped issues with clients, include notes (when present), and keep counts at the end.
  4. (Optional but recommended) Add a CLI test that runs email check against a fixture template and asserts:
    • Command exits successfully.
    • Output does not include placeholder/debug strings.

Acceptance criteria (done when)

  • email check produces clean output (no debug objects, no placeholder language).
  • email check --use-preview-props uses the template’s exported previewProps when present.
  • caniemail remains the engine behind the check (do not introduce or depend on @jsx-email/doiuse-email).

Verification

# Unit tests
$ FORCE_COLOR=1 moon jsx-email:test

# CLI tests
$ FORCE_COLOR=1 moon test-cli:test.run

Refs #379.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions