Skip to content

Commit fa6866e

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/controller-rework
2 parents e77b14b + 1d920d5 commit fa6866e

File tree

25 files changed

+211
-99
lines changed

25 files changed

+211
-99
lines changed

.changeset/moody-squids-count.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Init command will now correctly install v4-beta packages

.changeset/pre.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@
2020
"breezy-turtles-talk",
2121
"four-needles-add",
2222
"honest-files-decide",
23+
"late-chairs-ring",
24+
"moody-squids-count",
2325
"nice-colts-boil",
26+
"polite-lies-fix",
2427
"red-wasps-cover",
28+
"shiny-kiwis-beam",
2529
"smart-coins-hammer",
2630
"weak-jobs-hide"
2731
]

docs/docs.json

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,16 @@
2323
"quick-start",
2424
"video-walkthrough",
2525
"how-it-works",
26-
"limits"
26+
"limits",
27+
"upgrade-to-v4"
2728
]
2829
},
2930
{
3031
"group": "Fundamentals",
3132
"pages": [
3233
{
3334
"group": "Tasks",
34-
"pages": [
35-
"tasks/overview",
36-
"tasks/schemaTask",
37-
"tasks/scheduled"
38-
]
35+
"pages": ["tasks/overview", "tasks/schemaTask", "tasks/scheduled"]
3936
},
4037
"triggering",
4138
"runs",
@@ -50,12 +47,7 @@
5047
"errors-retrying",
5148
{
5249
"group": "Wait",
53-
"pages": [
54-
"wait",
55-
"wait-for",
56-
"wait-until",
57-
"wait-for-token"
58-
]
50+
"pages": ["wait", "wait-for", "wait-until", "wait-for-token"]
5951
},
6052
"queue-concurrency",
6153
"versioning",
@@ -99,9 +91,7 @@
9991
},
10092
{
10193
"group": "Development",
102-
"pages": [
103-
"cli-dev"
104-
]
94+
"pages": ["cli-dev"]
10595
},
10696
{
10797
"group": "Deployment",
@@ -112,9 +102,7 @@
112102
"deployment/atomic-deployment",
113103
{
114104
"group": "Deployment integrations",
115-
"pages": [
116-
"vercel-integration"
117-
]
105+
"pages": ["vercel-integration"]
118106
}
119107
]
120108
},
@@ -165,20 +153,15 @@
165153
},
166154
{
167155
"group": "Using the Dashboard",
168-
"pages": [
169-
"run-tests",
170-
"troubleshooting-alerts",
171-
"replaying",
172-
"bulk-actions"
173-
]
156+
"pages": ["run-tests", "troubleshooting-alerts", "replaying", "bulk-actions"]
174157
},
175158
{
176159
"group": "Troubleshooting",
177160
"pages": [
178161
"troubleshooting",
179162
"troubleshooting-debugging-in-vscode",
180163
"upgrading-packages",
181-
"upgrade-to-v4",
164+
182165
"troubleshooting-uptime-status",
183166
"troubleshooting-github-issues",
184167
"request-feature"
@@ -196,11 +179,7 @@
196179
},
197180
{
198181
"group": "Help",
199-
"pages": [
200-
"community",
201-
"help-slack",
202-
"help-email"
203-
]
182+
"pages": ["community", "help-slack", "help-email"]
204183
}
205184
]
206185
},
@@ -221,10 +200,7 @@
221200
},
222201
{
223202
"group": "Tasks API",
224-
"pages": [
225-
"management/tasks/trigger",
226-
"management/tasks/batch-trigger"
227-
]
203+
"pages": ["management/tasks/trigger", "management/tasks/batch-trigger"]
228204
},
229205
{
230206
"group": "Runs API",
@@ -270,9 +246,7 @@
270246
"groups": [
271247
{
272248
"group": "Introduction",
273-
"pages": [
274-
"guides/introduction"
275-
]
249+
"pages": ["guides/introduction"]
276250
},
277251
{
278252
"group": "Frameworks",
@@ -397,10 +371,7 @@
397371
"href": "https://trigger.dev"
398372
},
399373
"api": {
400-
"openapi": [
401-
"openapi.yml",
402-
"v3-openapi.yaml"
403-
],
374+
"openapi": ["openapi.yml", "v3-openapi.yaml"],
404375
"playground": {
405376
"display": "simple"
406377
}
@@ -575,4 +546,4 @@
575546
"destination": "/management/overview"
576547
}
577548
]
578-
}
549+
}

docs/guides/examples/react-email.mdx

Lines changed: 62 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,13 @@ We recommend using our [Cursor rules](https://trigger.dev/changelog/cursor-rules
144144

145145
#### The generated code
146146

147-
```tsx trigger/welcome.tsx
147+
```tsx emails/trigger-welcome-email.tsx
148148
import {
149149
Body,
150-
Button,reac
150+
Button,
151151
Container,
152152
Head,
153+
Heading,
153154
Hr,
154155
Html,
155156
Img,
@@ -159,11 +160,13 @@ import {
159160
Text,
160161
} from "@react-email/components";
161162

162-
const baseUrl = process.env.VERCEL_URL
163-
? `https://${process.env.VERCEL_URL}`
164-
: "";
163+
const baseUrl = process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : "";
165164

166-
export const TriggerDevWelcomeEmail = () => (
165+
export interface TriggerWelcomeEmailProps {
166+
name: string;
167+
}
168+
169+
export const TriggerWelcomeEmail = ({ name }: TriggerWelcomeEmailProps) => (
167170
<Html>
168171
<Head />
169172
<Preview>Welcome to Trigger.dev - Your background jobs platform!</Preview>
@@ -177,13 +180,14 @@ export const TriggerDevWelcomeEmail = () => (
177180
alt="Trigger.dev"
178181
/>
179182
<Hr style={hr} />
183+
<Heading>Welcome, {name}!</Heading>
180184
<Text style={paragraph}>
181-
Thanks for signing up for Trigger.dev! You're now ready to start
182-
creating powerful background jobs and workflows.
185+
Thanks for signing up for Trigger.dev! You're now ready to start creating powerful
186+
background jobs and workflows.
183187
</Text>
184188
<Text style={paragraph}>
185-
You can monitor your jobs, view runs, and manage your projects right
186-
from your dashboard.
189+
You can monitor your jobs, view runs, and manage your projects right from your
190+
dashboard.
187191
</Text>
188192
<Button style={button} href="https://cloud.trigger.dev/dashboard">
189193
View your Trigger.dev Dashboard
@@ -201,9 +205,8 @@ export const TriggerDevWelcomeEmail = () => (
201205
.
202206
</Text>
203207
<Text style={paragraph}>
204-
You can create your first job using our SDK, set up integrations,
205-
and configure triggers to automate your workflows. Take a look at
206-
our{" "}
208+
You can create your first job using our SDK, set up integrations, and configure triggers
209+
to automate your workflows. Take a look at our{" "}
207210
<Link style={anchor} href="https://trigger.dev/docs/examples">
208211
examples
209212
</Link>{" "}
@@ -217,8 +220,7 @@ export const TriggerDevWelcomeEmail = () => (
217220
to connect with other developers and get help when you need it.
218221
</Text>
219222
<Text style={paragraph}>
220-
We're here to help you build amazing things. If you have any
221-
questions, check out our{" "}
223+
We're here to help you build amazing things. If you have any questions, check out our{" "}
222224
<Link style={anchor} href="https://trigger.dev/docs">
223225
documentation
224226
</Link>{" "}
@@ -233,7 +235,7 @@ export const TriggerDevWelcomeEmail = () => (
233235
</Html>
234236
);
235237

236-
export default TriggerDevWelcomeEmail;
238+
export default TriggerWelcomeEmail;
237239

238240
const main = {
239241
backgroundColor: "#0E0C15",
@@ -288,6 +290,50 @@ const footer = {
288290
};
289291
```
290292

293+
And then to trigger the email, you can use the following task:
294+
295+
```tsx trigger/triggerWelcomeEmail.tsx
296+
import { logger, task } from "@trigger.dev/sdk/v3";
297+
import { Resend } from "resend";
298+
import TriggerWelcomeEmail from "emails/trigger-welcome-email";
299+
300+
// Initialize Resend client
301+
const resend = new Resend(process.env.RESEND_API_KEY);
302+
303+
export const sendEmail = task({
304+
id: "trigger-welcome-email",
305+
run: async (payload: { to: string; name: string; subject: string; from?: string }) => {
306+
try {
307+
to: payload.to,
308+
});
309+
310+
const { data, error } = await resend.emails.send({
311+
// The from address needs to be a verified email address
312+
from: payload.from || "email@acmeinc.com", // Default from address
313+
to: payload.to,
314+
subject: payload.subject,
315+
react: <TriggerWelcomeEmail name={payload.name} />,
316+
});
317+
318+
if (error) {
319+
logger.error("Failed to send email", { error });
320+
throw new Error(`Failed to send email: ${error.message}`);
321+
}
322+
323+
logger.info("Email sent successfully", { emailId: data?.id });
324+
325+
return {
326+
id: data?.id,
327+
status: "sent",
328+
};
329+
} catch (error) {
330+
logger.error("Unexpected error sending email", { error });
331+
throw error;
332+
}
333+
},
334+
});
335+
```
336+
291337
## Learn more
292338

293339
### React Email docs

docs/guides/examples/sentry-error-tracking.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export default defineConfig({
4949
},
5050
init: async () => {
5151
Sentry.init({
52+
defaultIntegrations: false,
5253
// The Data Source Name (DSN) is a unique identifier for your Sentry project.
5354
dsn: process.env.SENTRY_DSN,
5455
// Update this to match the environment you want to track errors for

docs/guides/examples/vercel-sync-env-vars.mdx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,21 @@ export default defineConfig({
2828
// Your other config settings...
2929
build: {
3030
// Add the syncVercelEnvVars build extension
31-
extensions: [syncVercelEnvVars()],
31+
extensions: [
32+
syncVercelEnvVars({
33+
// A personal access token created in your Vercel account settings
34+
// Used to authenticate API requests to Vercel
35+
// Generate at: https://vercel.com/account/tokens
36+
vercelAccessToken: process.env.VERCEL_ACCESS_TOKEN,
37+
// The unique identifier of your Vercel project
38+
// Found in Project Settings > General > Project ID
39+
projectId: process.env.VERCEL_PROJECT_ID,
40+
// Optional: The ID of your Vercel team
41+
// Only required for team projects
42+
// Found in Team Settings > General > Team ID
43+
vercelTeamId: process.env.VERCEL_TEAM_ID,
44+
}),
45+
],
3246
},
3347
});
3448
```

docs/guides/introduction.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ Task code you can copy and paste to use in your project. They can all be extende
6868
| [PDF to image](/guides/examples/pdf-to-image) | Use `MuPDF` to turn a PDF into images and save them to Cloudflare R2. |
6969
| [React to PDF](/guides/examples/react-pdf) | Use `react-pdf` to generate a PDF and save it to Cloudflare R2. |
7070
| [Puppeteer](/guides/examples/puppeteer) | Use Puppeteer to generate a PDF or scrape a webpage. |
71+
| [React email](/guides/examples/react-email) | Send an email using React Email. |
7172
| [Resend email sequence](/guides/examples/resend-email-sequence) | Send a sequence of emails over several days using Resend with Trigger.dev. |
73+
| [Satori](/guides/examples/satori) | Generate OG images using React Satori. |
7274
| [Scrape Hacker News](/guides/examples/scrape-hacker-news) | Scrape Hacker News using BrowserBase and Puppeteer, summarize the articles with ChatGPT and send an email of the summary every weekday using Resend. |
7375
| [Sentry error tracking](/guides/examples/sentry-error-tracking) | Automatically send errors to Sentry from your tasks. |
7476
| [Sharp image processing](/guides/examples/sharp-image-processing) | Use Sharp to process an image and save it to Cloudflare R2. |

packages/build/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @trigger.dev/build
22

3+
## 4.0.0-v4-beta.1
4+
5+
### Patch Changes
6+
7+
- Updated dependencies:
8+
- `@trigger.dev/core@4.0.0-v4-beta.1`
9+
310
## 4.0.0-v4-beta.0
411

512
### Major Changes

packages/build/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@trigger.dev/build",
3-
"version": "4.0.0-v4-beta.0",
3+
"version": "4.0.0-v4-beta.1",
44
"description": "trigger.dev build extensions",
55
"license": "MIT",
66
"publishConfig": {
@@ -69,7 +69,7 @@
6969
"check-exports": "attw --pack ."
7070
},
7171
"dependencies": {
72-
"@trigger.dev/core": "workspace:4.0.0-v4-beta.0",
72+
"@trigger.dev/core": "workspace:4.0.0-v4-beta.1",
7373
"pkg-types": "^1.1.3",
7474
"tinyglobby": "^0.2.2",
7575
"tsconfck": "3.1.3"

packages/cli-v3/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# trigger.dev
22

3+
## 4.0.0-v4-beta.1
4+
5+
### Patch Changes
6+
7+
- Fix init.ts in custom trigger dirs ([#1914](https://github.com/triggerdotdev/trigger.dev/pull/1914))
8+
- Init command will now correctly install v4-beta packages ([#1914](https://github.com/triggerdotdev/trigger.dev/pull/1914))
9+
- Update nypm package to support test-based bun.lock files ([#1914](https://github.com/triggerdotdev/trigger.dev/pull/1914))
10+
- Handle flush errors gracefully in dev ([#1914](https://github.com/triggerdotdev/trigger.dev/pull/1914))
11+
- Updated dependencies:
12+
- `@trigger.dev/build@4.0.0-v4-beta.1`
13+
- `@trigger.dev/core@4.0.0-v4-beta.1`
14+
315
## 4.0.0-v4-beta.0
416

517
### Major Changes

0 commit comments

Comments
 (0)