Skip to content

Commit 8886bb7

Browse files
committed
Defer migration guide v1
1 parent 4b72726 commit 8886bb7

File tree

9 files changed

+81
-80
lines changed

9 files changed

+81
-80
lines changed

docs/_snippets/v3/step-cli-dev.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Step title="Run the CLI `dev` command">
2+
3+
The CLI `dev` command runs a server for your tasks. It will watches for changes in your `/trigger` directory and communicates with the Trigger.dev platform to register your tasks, perform runs, and send data back and forth.
4+
5+
<CodeGroup>
6+
7+
```bash npm
8+
npx trigger.dev@beta dev
9+
```
10+
11+
```bash pnpm
12+
pnpm dlx trigger.dev@beta dev
13+
```
14+
15+
```bash yarn
16+
yarn dlx trigger.dev@beta dev
17+
```
18+
19+
</CodeGroup>
20+
21+
</Step>

docs/_snippets/v3/step-cli-init.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<Step title="Run the CLI `init` command">
2+
3+
The easiest way to get started it to use the CLI. It will add Trigger.dev to your existing project, create a `/trigger` folder and give you an example task.
4+
5+
Run this command in the root of your project to get started:
6+
7+
<CodeGroup>
8+
9+
```bash npm
10+
npx trigger.dev@beta init
11+
```
12+
13+
```bash pnpm
14+
pnpm dlx trigger.dev@beta init
15+
```
16+
17+
```bash yarn
18+
yarn dlx trigger.dev@beta init
19+
```
20+
21+
</CodeGroup>
22+
23+
It will do a few things:
24+
25+
1. Log you into the CLI if you're not already logged in.
26+
2. Create a `trigger.config.ts` file in the root of your project.
27+
3. Ask where you'd like to create the `/trigger` directory.
28+
4. Create the `/trigger` directory with an example task, `/trigger/example.[ts/js]`.
29+
30+
</Step>

docs/_snippets/v3/step-run-test.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Step title="Perform a test run using the dashboard">
2+
3+
The CLI `dev` command spits out various useful URLs. Right now we want to visit the Test page it provided.
4+
5+
You should see our Example task in the list, select it. Most tasks have a "payload" which you enter in the JSON editor, but our example task doesn't need any input.
6+
7+
Press the "Run test" button.
8+
9+
</Step>

docs/_snippets/v3/step-view-run.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Step title="View your run">
2+
3+
Congratulations, you should see the run page which will live reload showing you the current state of the run.
4+
5+
If you go back to your terminal you'll see that the dev command also shows tasks that are running and links to the run log.
6+
7+
</Step>
59.1 KB
Loading

docs/images/v3/projects-new-v3.png

31.3 KB
Loading

docs/images/v3/sidemenu-projects.png

79.7 KB
Loading

docs/v3/migration-defer.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ This guide highlights the differences and should help you migrate your project.
99

1010
## Features coming very soon
1111

12-
You can view the full [feature matrix](/v3/feature-matrix). Here are some features you might be using in Defer that are coming this month to Trigger.dev:
12+
Here are some features you might be using in Defer that are coming this month to v3:
1313

1414
- [Scheduled tasks (including CRON)](/v3/tasks-scheduled) will be available in mid-April.
1515
- Triggering a task with a delay (like `assignOptions` delay in Defer) will be available soon – there is [an alternative](#delay) you can use for now.
1616

17+
You can view the full feature matrix [here](/v3/feature-matrix).
18+
1719
## Differences
1820

1921
#### Local development
@@ -147,9 +149,7 @@ We will grant you v3 access.
147149

148150
</Step>
149151

150-
<Step>
151-
152-
You need to create a v3 project.
152+
<Step title="Create a v3 project">
153153

154154
1. Go to the Projects page
155155

@@ -183,7 +183,7 @@ You need to create a v3 project.
183183

184184
In Defer you might have a function like this.
185185

186-
<CodeBlock>
186+
<CodeGroup>
187187

188188
```ts /defer/longRunningTask.ts
189189
import { performLongRunningTask } from "@/utils/performLongRunningTask";
@@ -210,11 +210,11 @@ export async function runLongRunningTask() {
210210
}
211211
```
212212

213-
</CodeBlock>
213+
</CodeGroup>
214214

215215
In Trigger.dev it looks like this:
216216

217-
<CodeBlock>
217+
<CodeGroup>
218218

219219
```ts /trigger/someTasks.ts
220220
import { performLongRunningTask } from "@/utils/performLongRunningTask";
@@ -240,14 +240,14 @@ export const longRunningTask = task({
240240
```ts /app/actions/actions.ts
241241
"use server";
242242

243-
import longRunningTask from "@/defer/longRunningTask";
243+
import { longRunningTask } from "@/trigger/longRunningTask";
244244

245245
export async function runLongRunningTask() {
246-
return await longRunningTask();
246+
return await longRunningTask.trigger({ payload: { foo: "bar" } });
247247
}
248248
```
249249

250-
</CodeBlock>
250+
</CodeGroup>
251251

252252
<Warning>
253253
You need to set your `TRIGGER_SECRET_KEY` environment variable in your `.env` or `.env.local` file

docs/v3/quick-start.mdx

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -34,76 +34,10 @@ Once you've created an account, follow the steps in the app to:
3434

3535
</Step>
3636

37-
<Step title="Run the CLI `init` command">
38-
39-
The easiest way to get started it to use the CLI. It will add Trigger.dev to your existing project, create a `/trigger` folder and give you an example task.
40-
41-
Run this command in the root of your project to get started:
42-
43-
<CodeGroup>
44-
45-
```bash npm
46-
npx trigger.dev@beta init
47-
```
48-
49-
```bash pnpm
50-
pnpm dlx trigger.dev@beta init
51-
```
52-
53-
```bash yarn
54-
yarn dlx trigger.dev@beta init
55-
```
56-
57-
</CodeGroup>
58-
59-
It will do a few things:
60-
61-
1. Log you into the CLI if you're not already logged in.
62-
2. Create a `trigger.config.ts` file in the root of your project.
63-
3. Ask where you'd like to create the `/trigger` directory.
64-
4. Create the `/trigger` directory with an example task, `/trigger/example.[ts/js]`.
65-
66-
</Step>
67-
68-
<Step title="Run the CLI `dev` command">
69-
70-
The CLI `dev` command runs a server for your tasks. It will watches for changes in your `/trigger` directory and communicates with the Trigger.dev platform to register your tasks, perform runs, and send data back and forth.
71-
72-
<CodeGroup>
73-
74-
```bash npm
75-
npx trigger.dev@beta dev
76-
```
77-
78-
```bash pnpm
79-
pnpm dlx trigger.dev@beta dev
80-
```
81-
82-
```bash yarn
83-
yarn dlx trigger.dev@beta dev
84-
```
85-
86-
</CodeGroup>
87-
88-
</Step>
89-
90-
<Step title="Perform a run test using the dashboard">
91-
92-
The CLI `dev` command spits out various useful URLs. Right now we want to visit the Test page it provided.
93-
94-
You should see our Example task in the list, select it. Most tasks have a "payload" which you enter in the JSON editor, but our example task doesn't need any input.
95-
96-
Press the "Run test" button.
97-
98-
</Step>
99-
100-
<Step title="View your run">
101-
102-
Congratulations, you should see the run page which will live reload showing you the current state of the run.
103-
104-
If you go back to your terminal you'll see that the dev command also shows tasks that are running and links to the run log.
105-
106-
</Step>
37+
<Snippet file="v3/step-cli-init.mdx" />
38+
<Snippet file="v3/step-cli-dev.mdx" />
39+
<Snippet file="v3/step-run-test.mdx" />
40+
<Snippet file="v3/step-view-run.mdx" />
10741

10842
</Steps>
10943

0 commit comments

Comments
 (0)