@emailens/cli 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +186 -165
- package/dist/chunk-KZ7WXQVF.js +645 -0
- package/dist/chunk-KZ7WXQVF.js.map +1 -0
- package/dist/index.js +39 -626
- package/dist/index.js.map +1 -1
- package/dist/test.d.ts +34 -0
- package/dist/test.js +35 -0
- package/dist/test.js.map +1 -0
- package/package.json +78 -74
package/README.md
CHANGED
|
@@ -1,165 +1,186 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<picture>
|
|
4
|
-
<source media="(prefers-color-scheme: dark)" srcset="./docs/wordmark-dark.svg">
|
|
5
|
-
<img src="./docs/wordmark-light.svg" alt="emailens / cli" width="444">
|
|
6
|
-
</picture>
|
|
7
|
-
|
|
8
|
-
**The email rendering linter for terminal and CI**
|
|
9
|
-
|
|
10
|
-
[](https://github.com/emailens/cli/actions/workflows/ci.yml)
|
|
11
|
-
[](https://www.npmjs.com/package/@emailens/cli)
|
|
12
|
-
[](https://github.com/emailens/mcp)
|
|
13
|
-
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
```text
|
|
17
|
-
$ emailens lint emails/welcome.html --fail-on-warning
|
|
18
|
-
emails/welcome.html
|
|
19
|
-
warn 6:17 outlook-windows-legacy display:flex Outlook Classic receives this flex box. The MSO branch needs a table.
|
|
20
|
-
warn 6:30 outlook-windows-legacy,yahoo-mail,yahoo-mail-android+2 gap Outlook Classic does not support "gap".
|
|
21
|
-
warn 6:39 outlook-windows-legacy,outlook-windows-legacy padding Outlook Classic drops this padding. Put it on a table cell, or set mso-padding-alt on one.
|
|
22
|
-
warn inboxPreview preheader-too-short Preheader is only 22 characters, so email clients may backfill with body text (recommended: 30+).
|
|
23
|
-
9 info: safe fallbacks, not problems. --info lists them.
|
|
24
|
-
|
|
25
|
-
1 file | 4 warnings
|
|
26
|
-
|
|
27
|
-
Failed: 4 warnings found (--failOnWarning)
|
|
28
|
-
See it rendered in Gmail, Outlook and Apple Mail, no signup: https://app.emailens.dev/try?utm_source=cli&utm_medium=lint
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
That is a flex row with a rounded button, checked against 21 email clients.
|
|
32
|
-
Each finding has its line:column, and the exit code (here 2) fails the build.
|
|
33
|
-
The rounded corners are among the 9 info findings: Outlook Classic draws them
|
|
34
|
-
square, a safe fallback rather than a problem. The last line appears only when
|
|
35
|
-
the check fails; `--quiet` drops it, and `--json` never has it.
|
|
36
|
-
|
|
37
|
-
## Install
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm install -g @emailens/cli
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Run
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
emailens lint 'emails/*.html'
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Or without installing: `npx @emailens/cli lint email.html`. HTML, React Email
|
|
50
|
-
(`.tsx`/`.jsx`), MJML and Maizzle are detected from the extension and compiled
|
|
51
|
-
first, so the check runs on the HTML that would be sent. No account and no
|
|
52
|
-
network: the analysis runs locally.
|
|
53
|
-
|
|
54
|
-
Exit codes: `0` clean, `1` errors, `2` warnings with `--fail-on-warning`, or
|
|
55
|
-
more than `--max-warnings`.
|
|
56
|
-
|
|
57
|
-
## Why not caniemail, or React Email's own checker?
|
|
58
|
-
|
|
59
|
-
[Can I email](https://www.caniemail.com) is the support table: one feature,
|
|
60
|
-
every client. It does not read your email. This CLI's support data is generated
|
|
61
|
-
from caniemail's (synced 2026-10-27), plus the cells a real-device screenshot
|
|
62
|
-
contradicted, each marked "Observed" with its date. What the CLI adds is the
|
|
63
|
-
reading: it finds the features your file uses, points at the line, scores each
|
|
64
|
-
client, and exits non-zero.
|
|
65
|
-
|
|
66
|
-
[React Email 4](https://resend.com/blog/react-email-4) added a compatibility
|
|
67
|
-
checker, also powered by Can I email, to its preview. Its CLI (`email dev`,
|
|
68
|
-
`build`, `start`, `export`) has no check command and no exit code for CI, per
|
|
69
|
-
[its docs](https://react.email/docs/cli). This CLI reads React Email files as
|
|
70
|
-
well as MJML, Maizzle and plain HTML, and fails the build.
|
|
71
|
-
|
|
72
|
-
Beyond CSS support, `lint` checks what neither covers: spam signals, links,
|
|
73
|
-
accessibility, images, the inbox preview text, size, template variables,
|
|
74
|
-
overflow, dark-mode and mobile contrast, Outlook VML, styles a client drops, and
|
|
75
|
-
client-targeting hacks.
|
|
76
|
-
|
|
77
|
-
## Extras
|
|
78
|
-
|
|
79
|
-
### `lint` options
|
|
80
|
-
|
|
81
|
-
| Flag | Alias | Description |
|
|
82
|
-
|------|-------|-------------|
|
|
83
|
-
| `--format` | `-f` | Input format: `html`, `jsx`, `mjml`, `maizzle`. `.vue` is `maizzle`. A pasted Vue file with no flag is detected. |
|
|
84
|
-
| `--json` | | Output as JSON, one line, every finding including info |
|
|
85
|
-
| `--info` | | List info findings too. By default they are counted, not listed: they are safe fallbacks, not problems |
|
|
86
|
-
| `--fail-on-warning` | | Exit 2 if warnings found |
|
|
87
|
-
| `--max-warnings` | | Fail if more than n warnings |
|
|
88
|
-
| `--
|
|
89
|
-
| `--
|
|
90
|
-
| `--
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
emailens analyze email.html
|
|
103
|
-
emailens
|
|
104
|
-
emailens
|
|
105
|
-
emailens preview email.html --
|
|
106
|
-
emailens
|
|
107
|
-
emailens
|
|
108
|
-
emailens
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="./docs/wordmark-dark.svg">
|
|
5
|
+
<img src="./docs/wordmark-light.svg" alt="emailens / cli" width="444">
|
|
6
|
+
</picture>
|
|
7
|
+
|
|
8
|
+
**The email rendering linter for terminal and CI**
|
|
9
|
+
|
|
10
|
+
[](https://github.com/emailens/cli/actions/workflows/ci.yml)
|
|
11
|
+
[](https://www.npmjs.com/package/@emailens/cli)
|
|
12
|
+
[](https://github.com/emailens/mcp)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
$ emailens lint emails/welcome.html --fail-on-warning
|
|
18
|
+
emails/welcome.html
|
|
19
|
+
warn 6:17 outlook-windows-legacy display:flex Outlook Classic receives this flex box. The MSO branch needs a table.
|
|
20
|
+
warn 6:30 outlook-windows-legacy,yahoo-mail,yahoo-mail-android+2 gap Outlook Classic does not support "gap".
|
|
21
|
+
warn 6:39 outlook-windows-legacy,outlook-windows-legacy padding Outlook Classic drops this padding. Put it on a table cell, or set mso-padding-alt on one.
|
|
22
|
+
warn inboxPreview preheader-too-short Preheader is only 22 characters, so email clients may backfill with body text (recommended: 30+).
|
|
23
|
+
9 info: safe fallbacks, not problems. --info lists them.
|
|
24
|
+
|
|
25
|
+
1 file | 4 warnings
|
|
26
|
+
|
|
27
|
+
Failed: 4 warnings found (--failOnWarning)
|
|
28
|
+
See it rendered in Gmail, Outlook and Apple Mail, no signup: https://app.emailens.dev/try?utm_source=cli&utm_medium=lint
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
That is a flex row with a rounded button, checked against 21 email clients.
|
|
32
|
+
Each finding has its line:column, and the exit code (here 2) fails the build.
|
|
33
|
+
The rounded corners are among the 9 info findings: Outlook Classic draws them
|
|
34
|
+
square, a safe fallback rather than a problem. The last line appears only when
|
|
35
|
+
the check fails; `--quiet` drops it, and `--json` never has it.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g @emailens/cli
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Run
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
emailens lint 'emails/*.html'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Or without installing: `npx @emailens/cli lint email.html`. HTML, React Email
|
|
50
|
+
(`.tsx`/`.jsx`), MJML and Maizzle are detected from the extension and compiled
|
|
51
|
+
first, so the check runs on the HTML that would be sent. No account and no
|
|
52
|
+
network: the analysis runs locally.
|
|
53
|
+
|
|
54
|
+
Exit codes: `0` clean, `1` errors, `2` warnings with `--fail-on-warning`, or
|
|
55
|
+
more than `--max-warnings`.
|
|
56
|
+
|
|
57
|
+
## Why not caniemail, or React Email's own checker?
|
|
58
|
+
|
|
59
|
+
[Can I email](https://www.caniemail.com) is the support table: one feature,
|
|
60
|
+
every client. It does not read your email. This CLI's support data is generated
|
|
61
|
+
from caniemail's (synced 2026-10-27), plus the cells a real-device screenshot
|
|
62
|
+
contradicted, each marked "Observed" with its date. What the CLI adds is the
|
|
63
|
+
reading: it finds the features your file uses, points at the line, scores each
|
|
64
|
+
client, and exits non-zero.
|
|
65
|
+
|
|
66
|
+
[React Email 4](https://resend.com/blog/react-email-4) added a compatibility
|
|
67
|
+
checker, also powered by Can I email, to its preview. Its CLI (`email dev`,
|
|
68
|
+
`build`, `start`, `export`) has no check command and no exit code for CI, per
|
|
69
|
+
[its docs](https://react.email/docs/cli). This CLI reads React Email files as
|
|
70
|
+
well as MJML, Maizzle and plain HTML, and fails the build.
|
|
71
|
+
|
|
72
|
+
Beyond CSS support, `lint` checks what neither covers: spam signals, links,
|
|
73
|
+
accessibility, images, the inbox preview text, size, template variables,
|
|
74
|
+
overflow, dark-mode and mobile contrast, Outlook VML, styles a client drops, and
|
|
75
|
+
client-targeting hacks.
|
|
76
|
+
|
|
77
|
+
## Extras
|
|
78
|
+
|
|
79
|
+
### `lint` options
|
|
80
|
+
|
|
81
|
+
| Flag | Alias | Description |
|
|
82
|
+
|------|-------|-------------|
|
|
83
|
+
| `--format` | `-f` | Input format: `html`, `jsx`, `mjml`, `maizzle`. `.vue` is `maizzle`. A pasted Vue file with no flag is detected. |
|
|
84
|
+
| `--json` | | Output as JSON, one line, every finding including info |
|
|
85
|
+
| `--info` | | List info findings too. By default they are counted, not listed: they are safe fallbacks, not problems |
|
|
86
|
+
| `--fail-on-warning` | | Exit 2 if warnings found |
|
|
87
|
+
| `--max-warnings` | | Fail if more than n warnings |
|
|
88
|
+
| `--reporter github` | | Also print GitHub Actions annotations, so each finding shows on its line in the pull request. Not with `--json` |
|
|
89
|
+
| `--quiet` | `-q` | No line about the hosted preview after a failure |
|
|
90
|
+
| `--skip` | | Comma-separated checks to skip: `spam,links,accessibility,images,compatibility,inboxPreview,size,templateVariables,overflow,visual,darkContrast,mobileContrast,design,vml,styleSurvival,targeting` |
|
|
91
|
+
| `--targeting-policy` | | `progressive` (default), `strict`, or `lenient` |
|
|
92
|
+
|
|
93
|
+
A `.emailensrc` in the project, the file the VS Code extension reads, can set
|
|
94
|
+
rule severities and skips; `--skip` on the command line wins.
|
|
95
|
+
|
|
96
|
+
Maizzle HTML needs `@maizzle/framework@5` installed beside the CLI. A `.vue`
|
|
97
|
+
file needs `@maizzle/framework@6`. One install is one major.
|
|
98
|
+
|
|
99
|
+
### Other commands
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
emailens analyze email.html # score per client, findings by client
|
|
103
|
+
emailens analyze email.html --clients gmail-web,outlook-windows --json
|
|
104
|
+
emailens audit email.html # compatibility plus every other check
|
|
105
|
+
emailens preview email.html --dark-mode # transforms, analysis, dark mode simulation
|
|
106
|
+
emailens preview email.html --screenshots --out ./shots # needs BROWSERLESS_URL and playwright-core
|
|
107
|
+
emailens export email.html -o ./report # self-contained HTML report (--json for JSON)
|
|
108
|
+
emailens fix email.html -o fixed.html # AI fix, needs ANTHROPIC_API_KEY (--estimate: tokens only)
|
|
109
|
+
emailens clients # the 21 clients
|
|
110
|
+
cat email.html | emailens analyze - # stdin
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### `emailens inbox wait`
|
|
114
|
+
|
|
115
|
+
The CI step for what your app actually sends. Make your app send a real email
|
|
116
|
+
(sign-up, reset, receipt) to your Emailens test inbox, then wait for it. It
|
|
117
|
+
fails when the email is no longer the one you checked in Emailens, or changed
|
|
118
|
+
since it last arrived: a link moved to staging, an emptied variable, a new
|
|
119
|
+
line, an image gone, a size jump, signing that stopped passing. Codes, tokens
|
|
120
|
+
and tracking ids differ on every send and do not count. It needs an API key.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
export EMAILENS_API_KEY=... # app.emailens.dev/dashboard/api
|
|
124
|
+
SINCE=$(date +%s000) # before the send
|
|
125
|
+
npm run send-signup-email # your app sends it
|
|
126
|
+
emailens inbox wait --subject "Welcome" --since "$SINCE"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Options: `--subject`, `--sender`, `--inbox <id>`, `--since` (ISO time, epoch
|
|
130
|
+
ms, or a duration such as `5m`; default 2 minutes back), `--timeout` (seconds,
|
|
131
|
+
default 60, at most 600), `--fail-on all|check|drift|none` (default `all`),
|
|
132
|
+
`--json`. Exit codes: `0` pass, `1` changed, `2` nothing arrived or Emailens
|
|
133
|
+
could not be reached.
|
|
134
|
+
|
|
135
|
+
### In your tests
|
|
136
|
+
|
|
137
|
+
The same check as `lint`, as an assertion. It throws with every failing
|
|
138
|
+
finding and its line, reads your `.emailensrc`, and works in Vitest, Jest and
|
|
139
|
+
bun:test.
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
import { render } from "@react-email/render";
|
|
143
|
+
import { expectEmailToPass } from "@emailens/cli/test";
|
|
144
|
+
|
|
145
|
+
test("welcome email passes", async () => {
|
|
146
|
+
expectEmailToPass(await render(<Welcome name="Ada" />));
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Options: `failOnWarning`, `skip` (the `--skip` names), `framework`.
|
|
151
|
+
|
|
152
|
+
### In GitHub Actions
|
|
153
|
+
|
|
154
|
+
```yaml
|
|
155
|
+
- uses: actions/setup-node@v4
|
|
156
|
+
with:
|
|
157
|
+
node-version: 22
|
|
158
|
+
- run: npx -y @emailens/cli lint 'emails/*.html' --fail-on-warning --reporter github
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
`--reporter github` puts each finding on its line in the pull request's
|
|
162
|
+
changed files.
|
|
163
|
+
|
|
164
|
+
`**` globs are not supported: use a single-level wildcard or list the files.
|
|
165
|
+
For scores per client in a pull request comment, use the
|
|
166
|
+
[Action](https://github.com/emailens/action).
|
|
167
|
+
|
|
168
|
+
### Hosted
|
|
169
|
+
|
|
170
|
+
[app.emailens.dev/try](https://app.emailens.dev/try?utm_source=cli&utm_medium=readme)
|
|
171
|
+
renders the email per client: five clients with no account, all 21 with a free
|
|
172
|
+
one. The + Real plans add real-device screenshots: Outlook on Windows and Mac,
|
|
173
|
+
Apple Mail on Mac and iPad, and Gmail, Yahoo and Proton on the web.
|
|
174
|
+
|
|
175
|
+
## Ecosystem
|
|
176
|
+
|
|
177
|
+
| Project | What it is |
|
|
178
|
+
|---|---|
|
|
179
|
+
| [@emailens/engine](https://github.com/emailens/engine) | The analysis engine this CLI runs, as a library |
|
|
180
|
+
| [@emailens/mcp](https://github.com/emailens/mcp) | The same checks for coding agents: `claude mcp add emailens -- npx -y @emailens/mcp` |
|
|
181
|
+
| [emailens/action](https://github.com/emailens/action) | GitHub Action: fails the build, and can comment the scores per client on the pull request |
|
|
182
|
+
| [emailens/vscode](https://github.com/emailens/vscode) | VS Code extension: findings and preview in the editor |
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT
|