Skip to content

Add html-email-formatter package#9

Merged
avigoldman merged 3 commits intomainfrom
html-email-formatter
Sep 18, 2025
Merged

Add html-email-formatter package#9
avigoldman merged 3 commits intomainfrom
html-email-formatter

Conversation

@avigoldman
Copy link
Contributor

@avigoldman avigoldman commented Sep 17, 2025

Summary

  • Migrated email-pretty package from parcel repo to Customer.io monorepo as @ciolabs/html-email-formatter
  • Converted from ranges-apply to magic-string for string manipulation
  • Updated dependencies to use workspace packages for conditional comment handling
  • Converted tests from snapshot-based to explicit assertions
  • Fixed ESLint violations (unicorn/prefer-string-slice)

Changes

New Package: @ciolabs/html-email-formatter

Created new package with monorepo structure:

  • package.json - Package configuration with workspace dependencies
  • src/index.ts - Main email formatter implementation
  • src/index.test.ts - Test suite with explicit assertions
  • tsconfig.json - TypeScript configuration
  • tsup.config.ts - Build configuration

Key Implementation Changes

  • String manipulation: Replaced ranges-apply with magic-string for better performance and workspace consistency
  • Dependencies: Updated to use workspace packages:
    • @ciolabs/html-find-conditional-comments (was find-conditional-comments)
    • @ciolabs/html-preserve-comment-whitespace (was preserve-comment-whitespace)
  • Function name: Renamed from emailPretty to emailFormatter for clarity
  • Logging: Removed internal logger dependency (was @internal/logger)
  • Code style: Fixed ESLint violations for string method preferences

Functionality

The package provides HTML email formatting with special handling for:

  • Conditional comments (MSO/Outlook compatibility)
  • Whitespace preservation within comments
  • Proper indentation alignment of open/close tags
  • Full HTML formatting with configurable options

@changeset-bot
Copy link

changeset-bot bot commented Sep 17, 2025

⚠️ No Changeset found

Latest commit: 917776e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@avigoldman avigoldman changed the title html-email-formatter Add html-email-formatter package Sep 17, 2025
@avigoldman avigoldman merged commit f694145 into main Sep 18, 2025
1 check passed
@avigoldman avigoldman deleted the html-email-formatter branch September 18, 2025 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants