@tatara/cli 0.11.0 → 0.11.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tatara/cli",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Create and grow opinionated Hono backends",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,4 +1,4 @@
1
- import { createMailer, renderEmail } from "@tatara/email";
1
+ import { createMailer, type EmailDefinition, renderEmail } from "@tatara/email";
2
2
  import { env } from "#core/config/env";
3
3
  import { logger } from "#core/logging/logger";
4
4
  import type { emails } from "#generated/emails";
@@ -27,7 +27,8 @@ export async function sendTemplate<N extends keyof Templates & string>(
27
27
  ): Promise<void> {
28
28
  // loaded on first use: core doesn't import module code until it's needed
29
29
  const { emails: all } = await import("#generated/emails");
30
- const template = all.find((e) => e.name === name);
30
+ // read as any template: an app without templates has an empty list
31
+ const template = (all as readonly EmailDefinition[]).find((e) => e.name === name);
31
32
  if (!template) throw new Error(`No email template named "${name}"`);
32
33
  await sendEmail({ to, ...renderEmail(template, data, language) });
33
34
  }