Renamed the examples dir to references (true examples are in another repo and this was confusing)
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"@trigger.dev/testing": patch
|
||||||
|
"@trigger.dev/cli": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Moved examples to references in the monorepo
|
||||||
@@ -1,35 +1,43 @@
|
|||||||
*.log
|
\*.log
|
||||||
.git
|
.git
|
||||||
.github
|
.github
|
||||||
|
|
||||||
# editor
|
# editor
|
||||||
|
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
.pnp
|
.pnp
|
||||||
.pnp.js
|
.pnp.js
|
||||||
|
|
||||||
# testing
|
# testing
|
||||||
|
|
||||||
coverage
|
coverage
|
||||||
|
|
||||||
# next.js
|
# next.js
|
||||||
|
|
||||||
.next/
|
.next/
|
||||||
build
|
build
|
||||||
|
|
||||||
# packages
|
# packages
|
||||||
|
|
||||||
build
|
build
|
||||||
dist
|
dist
|
||||||
packages/**/dist
|
packages/\*\*/dist
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.pem
|
\*.pem
|
||||||
|
|
||||||
.turbo
|
.turbo
|
||||||
.vercel
|
.vercel
|
||||||
.cache
|
.cache
|
||||||
.output
|
.output
|
||||||
apps/**/public/build
|
apps/\*\*/public/build
|
||||||
|
|
||||||
cypress/screenshots
|
cypress/screenshots
|
||||||
cypress/videos
|
cypress/videos
|
||||||
@@ -38,6 +46,7 @@ apps/**/styles/tailwind.css
|
|||||||
packages/**/styles/tailwind.css
|
packages/**/styles/tailwind.css
|
||||||
|
|
||||||
.changeset
|
.changeset
|
||||||
|
references
|
||||||
examples
|
examples
|
||||||
CHANGESETS.md
|
CHANGESETS.md
|
||||||
CONTRIBUTING.md
|
CONTRIBUTING.md
|
||||||
|
|||||||
@@ -129,10 +129,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
# Setup environment variables
|
# Setup environment variables
|
||||||
cp ./.env.example ./.env
|
cp ./.env.example ./.env
|
||||||
cp ./examples/nextjs-test/.env.example ./examples/nextjs-test/.env.local
|
cp ./references/nextjs-test/.env.example ./references/nextjs-test/.env.local
|
||||||
|
|
||||||
# Build packages
|
# Build packages
|
||||||
pnpm run build --filter @examples/nextjs-test^...
|
pnpm run build --filter @references/nextjs-test^...
|
||||||
pnpm --filter @trigger.dev/database generate
|
pnpm --filter @trigger.dev/database generate
|
||||||
|
|
||||||
# Move trigger-cli bin to correct place
|
# Move trigger-cli bin to correct place
|
||||||
|
|||||||
@@ -133,10 +133,10 @@ pnpm run dev
|
|||||||
|
|
||||||
2. Open a new Terminal window and run the webapp locally and then create a new project in the dashboard. Copy out the dev API key.
|
2. Open a new Terminal window and run the webapp locally and then create a new project in the dashboard. Copy out the dev API key.
|
||||||
|
|
||||||
3. Create a new temporary Next.js app in examples directory
|
3. Create a new temporary Next.js app in references directory
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd ./examples
|
cd ./references
|
||||||
pnpm create next-app@latest test-cli --ts --no-eslint --tailwind --app --src-dir --import-alias "@/*"
|
pnpm create next-app@latest test-cli --ts --no-eslint --tailwind --app --src-dir --import-alias "@/*"
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ pnpm create next-app@latest test-cli --ts --no-eslint --tailwind --app --src-dir
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
5. Back in the terminal, navigate into the example, and initialize the CLI. When prompted, select `self-hosted` and enter `localhost:3030` if you are testing against the local instance of Trigger.dev, or you can just use the Trigger.dev cloud. When asked for an API key, use the key you copied earlier.
|
5. Back in the terminal, navigate into the reference, and initialize the CLI. When prompted, select `self-hosted` and enter `localhost:3030` if you are testing against the local instance of Trigger.dev, or you can just use the Trigger.dev cloud. When asked for an API key, use the key you copied earlier.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd ./test-cli
|
cd ./test-cli
|
||||||
@@ -179,14 +179,14 @@ To run the end-to-end tests, follow the steps below:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
cp ./.env.example ./.env
|
cp ./.env.example ./.env
|
||||||
cp ./examples/nextjs-test/.env.example ./examples/nextjs-test/.env.local
|
cp ./references/nextjs-test/.env.example ./references/nextjs-test/.env.local
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Set up dependencies
|
2. Set up dependencies
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Build packages
|
# Build packages
|
||||||
pnpm run build --filter @examples/nextjs-test^...
|
pnpm run build --filter @references/nextjs-test^...
|
||||||
pnpm --filter @trigger.dev/database generate
|
pnpm --filter @trigger.dev/database generate
|
||||||
|
|
||||||
# Move trigger-cli bin to correct place
|
# Move trigger-cli bin to correct place
|
||||||
@@ -221,11 +221,11 @@ pnpm run db:studio
|
|||||||
|
|
||||||
## Add sample jobs
|
## Add sample jobs
|
||||||
|
|
||||||
The [examples/jobs-starter](./examples/jobs-starter/) project defines simple jobs you can get started with.
|
The [references/job-catalog](./references/job-catalog/) project defines simple jobs you can get started with.
|
||||||
|
|
||||||
1. `cd` into `examples/jobs-starter`
|
1. `cd` into `references/job-catalog`
|
||||||
2. Create a `.env.local` file with the following content,
|
2. Create a `.env` file with the following content,
|
||||||
replacing `[TRIGGER_DEV_API_KEY]` with an actual key:
|
replacing `<TRIGGER_DEV_API_KEY>` with an actual key:
|
||||||
|
|
||||||
```env
|
```env
|
||||||
TRIGGER_API_KEY=[TRIGGER_DEV_API_KEY]
|
TRIGGER_API_KEY=[TRIGGER_DEV_API_KEY]
|
||||||
@@ -235,12 +235,20 @@ TRIGGER_API_URL=http://localhost:3030
|
|||||||
`TRIGGER_API_URL` is used to configure the URL for your Trigger.dev instance,
|
`TRIGGER_API_URL` is used to configure the URL for your Trigger.dev instance,
|
||||||
where the jobs will be registered.
|
where the jobs will be registered.
|
||||||
|
|
||||||
3. Run the `jobs-starter` app:
|
3. Run one of the the `job-catalog` files:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
pnpm dev
|
pnpm run events
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This will open up a local server using `express` on port 8080. Then in a new terminal window you can run the trigger-cli dev command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pnpm run dev:trigger
|
||||||
|
```
|
||||||
|
|
||||||
|
See the [Job Catalog](./references/job-catalog/README.md) file for more.
|
||||||
|
|
||||||
4. Navigate to your trigger.dev instance ([http://localhost:3030](http://localhost:3030/)), to see the jobs.
|
4. Navigate to your trigger.dev instance ([http://localhost:3030](http://localhost:3030/)), to see the jobs.
|
||||||
You can use the test feature to trigger them.
|
You can use the test feature to trigger them.
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ description: "Publishing an official integration package to the public registry.
|
|||||||
Ensure that you have done the following:
|
Ensure that you have done the following:
|
||||||
|
|
||||||
- [ ] Create the integrations in the `integrations` folder.
|
- [ ] Create the integrations in the `integrations` folder.
|
||||||
- [ ] Created a file in the `examples/job-catalog` folder with some example jobs.
|
- [ ] Created a file in the `references/job-catalog` folder with some example jobs.
|
||||||
- [ ] Have exported types.
|
- [ ] Have exported types.
|
||||||
- [ ] Avoid using `any` types and `@ts-ignore` comments. If there are any, please explain them in the PR.
|
- [ ] Avoid using `any` types and `@ts-ignore` comments. If there are any, please explain them in the PR.
|
||||||
|
|
||||||
|
|||||||
@@ -3,17 +3,17 @@ title: Testing
|
|||||||
description: "To test your integration you should create some example Jobs where you test all the functionality."
|
description: "To test your integration you should create some example Jobs where you test all the functionality."
|
||||||
---
|
---
|
||||||
|
|
||||||
# examples/job-catalog
|
# references/job-catalog
|
||||||
|
|
||||||
When building an official integration (in the Trigger.dev monorepo) you should use the job-catalog to test your integration. This collection of examples is useful for creating docs as well as testing.
|
When building an official integration (in the Trigger.dev monorepo) you should use the job-catalog to test your integration. This collection of reference jobs is useful for creating docs as well as testing.
|
||||||
|
|
||||||
## 1. Getting setup
|
## 1. Getting setup
|
||||||
|
|
||||||
You can follow [the README](https://github.com/triggerdotdev/trigger.dev/tree/main/examples/job-catalog) to get setup. It explains how to add a new Job as well.
|
You can follow [the README](https://github.com/triggerdotdev/trigger.dev/tree/main/references/job-catalog) to get setup. It explains how to add a new Job as well.
|
||||||
|
|
||||||
## 2. Adding your package
|
## 2. Adding your package
|
||||||
|
|
||||||
You'll need to add your integration to [the package.json file](https://github.com/triggerdotdev/trigger.dev/blob/main/examples/job-catalog/package.json):
|
You'll need to add your integration to [the package.json file](https://github.com/triggerdotdev/trigger.dev/blob/main/references/job-catalog/package.json):
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@@ -25,7 +25,7 @@ You'll need to add your integration to [the package.json file](https://github.co
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
And to [the tsconfig.json file](https://github.com/triggerdotdev/trigger.dev/blob/main/examples/job-catalog/tsconfig.json):
|
And to [the tsconfig.json file](https://github.com/triggerdotdev/trigger.dev/blob/main/references/job-catalog/tsconfig.json):
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@@ -47,4 +47,4 @@ And to [the tsconfig.json file](https://github.com/triggerdotdev/trigger.dev/blo
|
|||||||
|
|
||||||
## 3. Adding your Jobs
|
## 3. Adding your Jobs
|
||||||
|
|
||||||
Create a new file in `src` that uses all the features of your integration. [The Typeform one](https://github.com/triggerdotdev/trigger.dev/blob/main/examples/job-catalog/src/typeform.ts) is a useful reference that has Tasks and Triggers.
|
Create a new file in `src` that uses all the features of your integration. [The Typeform one](https://github.com/triggerdotdev/trigger.dev/blob/main/references/job-catalog/src/typeform.ts) is a useful reference that has Tasks and Triggers.
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
First, run the development server:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run dev
|
|
||||||
# or
|
|
||||||
yarn dev
|
|
||||||
# or
|
|
||||||
pnpm dev
|
|
||||||
```
|
|
||||||
|
|
||||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
||||||
|
|
||||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
|
||||||
|
|
||||||
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
|
|
||||||
|
|
||||||
## Learn More
|
|
||||||
|
|
||||||
To learn more about Next.js, take a look at the following resources:
|
|
||||||
|
|
||||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
||||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
||||||
|
|
||||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
|
||||||
|
|
||||||
## Deploy on Vercel
|
|
||||||
|
|
||||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
||||||
|
|
||||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { createAppRoute } from "@trigger.dev/nextjs";
|
|
||||||
import { client } from "@/trigger";
|
|
||||||
|
|
||||||
import "@/jobs/starter";
|
|
||||||
|
|
||||||
//this route is used to send and receive data with Trigger.dev
|
|
||||||
export const { POST, dynamic } = createAppRoute(client);
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import "./globals.css";
|
|
||||||
import type { Metadata } from "next";
|
|
||||||
import { Inter } from "next/font/google";
|
|
||||||
|
|
||||||
const inter = Inter({ subsets: ["latin"] });
|
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
|
||||||
title: "Create Next App",
|
|
||||||
description: "Generated by create next app",
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
||||||
return (
|
|
||||||
<html lang="en">
|
|
||||||
<body className={inter.className}>{children}</body>
|
|
||||||
</html>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
import Image from "next/image";
|
|
||||||
|
|
||||||
export default function Home() {
|
|
||||||
return (
|
|
||||||
<main className="flex min-h-screen flex-col items-center justify-between p-24">
|
|
||||||
<div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
|
|
||||||
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
|
|
||||||
Get started by editing
|
|
||||||
<code className="font-mono font-bold">app/page.tsx</code>
|
|
||||||
</p>
|
|
||||||
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
|
|
||||||
<a
|
|
||||||
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
|
|
||||||
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>
|
|
||||||
By{" "}
|
|
||||||
<Image
|
|
||||||
src="/vercel.svg"
|
|
||||||
alt="Vercel Logo"
|
|
||||||
className="dark:invert"
|
|
||||||
width={100}
|
|
||||||
height={24}
|
|
||||||
priority
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="relative flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 before:lg:h-[360px] z-[-1]">
|
|
||||||
<Image
|
|
||||||
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
|
|
||||||
src="/next.svg"
|
|
||||||
alt="Next.js Logo"
|
|
||||||
width={180}
|
|
||||||
height={37}
|
|
||||||
priority
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="mb-32 grid text-center lg:mb-0 lg:grid-cols-4 lg:text-left">
|
|
||||||
<a
|
|
||||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
|
||||||
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>
|
|
||||||
<h2 className={`mb-3 text-2xl font-semibold`}>
|
|
||||||
Docs{" "}
|
|
||||||
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
|
|
||||||
->
|
|
||||||
</span>
|
|
||||||
</h2>
|
|
||||||
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
|
|
||||||
Find in-depth information about Next.js features and API.
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a
|
|
||||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
|
||||||
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>
|
|
||||||
<h2 className={`mb-3 text-2xl font-semibold`}>
|
|
||||||
Learn{" "}
|
|
||||||
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
|
|
||||||
->
|
|
||||||
</span>
|
|
||||||
</h2>
|
|
||||||
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
|
|
||||||
Learn about Next.js in an interactive course with quizzes!
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a
|
|
||||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
|
||||||
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>
|
|
||||||
<h2 className={`mb-3 text-2xl font-semibold`}>
|
|
||||||
Templates{" "}
|
|
||||||
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
|
|
||||||
->
|
|
||||||
</span>
|
|
||||||
</h2>
|
|
||||||
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
|
|
||||||
Explore the Next.js 13 playground.
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a
|
|
||||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
|
||||||
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>
|
|
||||||
<h2 className={`mb-3 text-2xl font-semibold`}>
|
|
||||||
Deploy{" "}
|
|
||||||
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
|
|
||||||
->
|
|
||||||
</span>
|
|
||||||
</h2>
|
|
||||||
<p className={`m-0 max-w-[30ch] text-sm opacity-50`}>
|
|
||||||
Instantly deploy your Next.js site to a shareable URL with Vercel.
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
import { eventTrigger, intervalTrigger } from "@trigger.dev/sdk";
|
|
||||||
import { client } from "@/trigger";
|
|
||||||
|
|
||||||
const QUOTES = [
|
|
||||||
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand. – Martin Fowler",
|
|
||||||
"First, solve the problem. Then, write the code. – John Johnson",
|
|
||||||
"Experience is the name everyone gives to their mistakes. – Oscar Wilde",
|
|
||||||
"In order to be irreplaceable, one must always be different – Coco Chanel",
|
|
||||||
"Knowledge is power. – Francis Bacon",
|
|
||||||
"Sometimes it pays to stay in bed on Monday, rather than spending the rest of the week debugging Monday’s code. – Dan Salomon",
|
|
||||||
"Perfection is achieved not when there is nothing more to add, but rather when there is nothing more to take away. – Antoine de Saint-Exupery",
|
|
||||||
"Rust is the most loved programming language. – Stack Overflow",
|
|
||||||
"Code is like humor. When you have to explain it, it’s bad. – Cory House",
|
|
||||||
"Fix the cause, not the symptom. – Steve Maguire",
|
|
||||||
];
|
|
||||||
|
|
||||||
client.defineJob({
|
|
||||||
id: "hello-world",
|
|
||||||
name: "Hello World",
|
|
||||||
version: "0.0.1",
|
|
||||||
trigger: eventTrigger({
|
|
||||||
name: "starter.hello-world",
|
|
||||||
}),
|
|
||||||
run: async (_payload, io, _ctx) => {
|
|
||||||
await io.logger.info("Hello world!");
|
|
||||||
|
|
||||||
return {
|
|
||||||
message: "Hello world!",
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
client.defineJob({
|
|
||||||
id: "quote",
|
|
||||||
name: "Random Quote",
|
|
||||||
version: "0.0.1",
|
|
||||||
trigger: eventTrigger({
|
|
||||||
name: "starter.quote",
|
|
||||||
}),
|
|
||||||
run: async (_payload, _io, _ctx) => {
|
|
||||||
return {
|
|
||||||
quote: QUOTES[Math.floor(Math.random() * QUOTES.length)],
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
client.defineJob({
|
|
||||||
id: "usd-eur-change-rate",
|
|
||||||
name: "USD-EUR Change Rate",
|
|
||||||
version: "0.0.1",
|
|
||||||
trigger: intervalTrigger({
|
|
||||||
seconds: 60,
|
|
||||||
}),
|
|
||||||
run: async (_payload, io, _ctx) => {
|
|
||||||
// This is just a dummy example, we can actually use an API to pull the actual rate
|
|
||||||
await io.logger.info("Fetching USD-EUR rate...");
|
|
||||||
|
|
||||||
return {
|
|
||||||
rate: 0.85,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
client.defineJob({
|
|
||||||
id: "stars-count",
|
|
||||||
name: "Number of stars for Trigger.dev repo",
|
|
||||||
version: "0.0.1",
|
|
||||||
trigger: intervalTrigger({
|
|
||||||
seconds: 60 * 60,
|
|
||||||
}),
|
|
||||||
run: async (_payload, io, _ctx) => {
|
|
||||||
return await io.runTask(
|
|
||||||
"get-stars-count",
|
|
||||||
|
|
||||||
async () => {
|
|
||||||
try {
|
|
||||||
const response = await fetch("https://api.github.com/repos/triggerdotdev/trigger.dev");
|
|
||||||
const { stargazers_count } = await response.json();
|
|
||||||
|
|
||||||
return { success: true, stargazers_count };
|
|
||||||
} catch (error) {
|
|
||||||
await io.logger.error("Failed to fetch stars count", { error });
|
|
||||||
|
|
||||||
return { success: false };
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ name: "Get Trigger.dev stars count" }
|
|
||||||
);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
|
||||||
const nextConfig = {};
|
|
||||||
|
|
||||||
module.exports = nextConfig;
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@examples/jobs-starter",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"dev": "concurrently --kill-others npm:dev:*",
|
|
||||||
"dev:next": "next dev",
|
|
||||||
"dev:trigger": "npx @trigger.dev/cli dev",
|
|
||||||
"build": "next build",
|
|
||||||
"start": "next start",
|
|
||||||
"lint": "next lint"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@trigger.dev/nextjs": "workspace:*",
|
|
||||||
"@trigger.dev/sdk": "workspace:*",
|
|
||||||
"@types/node": "20.4.2",
|
|
||||||
"@types/react": "18.2.17",
|
|
||||||
"@types/react-dom": "18.2.7",
|
|
||||||
"autoprefixer": "10.4.14",
|
|
||||||
"eslint": "8.45.0",
|
|
||||||
"eslint-config-next": "13.4.10",
|
|
||||||
"next": "13.4.10",
|
|
||||||
"postcss": "8.4.26",
|
|
||||||
"react": "^18.2.0",
|
|
||||||
"react-dom": "^18.2.0",
|
|
||||||
"tailwindcss": "3.3.3",
|
|
||||||
"typescript": "5.1.6"
|
|
||||||
},
|
|
||||||
"trigger.dev": {
|
|
||||||
"endpointId": "jobs-starter"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"concurrently": "^8.2.0",
|
|
||||||
"@trigger.dev/cli": "workspace:*"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { TriggerClient } from "@trigger.dev/sdk";
|
|
||||||
|
|
||||||
export const client = new TriggerClient({
|
|
||||||
id: "jobs-starter",
|
|
||||||
apiKey: process.env.TRIGGER_API_KEY,
|
|
||||||
apiUrl: process.env.TRIGGER_API_URL,
|
|
||||||
});
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "ES2015",
|
|
||||||
"lib": ["dom", "dom.iterable", "ES2015"],
|
|
||||||
"allowJs": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"strict": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"noEmit": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"module": "esnext",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"isolatedModules": true,
|
|
||||||
"jsx": "preserve",
|
|
||||||
"incremental": true,
|
|
||||||
"paths": {
|
|
||||||
"@/*": ["./*"],
|
|
||||||
"@trigger.dev/sdk": ["../../packages/trigger-sdk/src/index"],
|
|
||||||
"@trigger.dev/sdk/*": ["../../packages/trigger-sdk/src/*"],
|
|
||||||
"@trigger.dev/nextjs": ["../../packages/nextjs/src/index"],
|
|
||||||
"@trigger.dev/nextjs/*": ["../../packages/nextjs/src/*"]
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
{
|
|
||||||
"name": "next"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
||||||
"exclude": ["node_modules"]
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
/.pnp
|
|
||||||
.pnp.js
|
|
||||||
|
|
||||||
# testing
|
|
||||||
/coverage
|
|
||||||
|
|
||||||
# next.js
|
|
||||||
/.next/
|
|
||||||
/out/
|
|
||||||
|
|
||||||
# production
|
|
||||||
/build
|
|
||||||
|
|
||||||
# misc
|
|
||||||
.DS_Store
|
|
||||||
*.pem
|
|
||||||
|
|
||||||
# debug
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
.pnpm-debug.log*
|
|
||||||
|
|
||||||
# local env files
|
|
||||||
.env*.local
|
|
||||||
|
|
||||||
# vercel
|
|
||||||
.vercel
|
|
||||||
|
|
||||||
# typescript
|
|
||||||
*.tsbuildinfo
|
|
||||||
next-env.d.ts
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
First, run the development server:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run dev
|
|
||||||
# or
|
|
||||||
yarn dev
|
|
||||||
```
|
|
||||||
|
|
||||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
||||||
|
|
||||||
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
|
|
||||||
|
|
||||||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
|
|
||||||
|
|
||||||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
|
|
||||||
|
|
||||||
## Learn More
|
|
||||||
|
|
||||||
To learn more about Next.js, take a look at the following resources:
|
|
||||||
|
|
||||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
||||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
||||||
|
|
||||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
|
||||||
|
|
||||||
## Deploy on Vercel
|
|
||||||
|
|
||||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
||||||
|
|
||||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
|
||||||
const nextConfig = {
|
|
||||||
reactStrictMode: true,
|
|
||||||
swcMinify: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = nextConfig;
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "nextjs-12",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"dev": "next dev",
|
|
||||||
"build": "next build",
|
|
||||||
"start": "next start",
|
|
||||||
"lint": "next lint"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"next": "12.3.4",
|
|
||||||
"react": "^18.2.0",
|
|
||||||
"react-dom": "^18.2.0",
|
|
||||||
"@trigger.dev/nextjs": "workspace:*",
|
|
||||||
"@trigger.dev/sdk": "workspace:*"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"eslint": "8.44.0",
|
|
||||||
"eslint-config-next": "12.3.4",
|
|
||||||
"@trigger.dev/cli": "workspace:*"
|
|
||||||
},
|
|
||||||
"trigger.dev": {
|
|
||||||
"endpointId": "nextjs-12"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import "../styles/globals.css";
|
|
||||||
|
|
||||||
function MyApp({ Component, pageProps }) {
|
|
||||||
return <Component {...pageProps} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default MyApp;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
|
||||||
|
|
||||||
export default function handler(req, res) {
|
|
||||||
res.status(200).json({ name: "John Doe" });
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import { TriggerClient } from "@trigger.dev/sdk";
|
|
||||||
import { createPagesRoute } from "@trigger.dev/nextjs";
|
|
||||||
|
|
||||||
export const client = new TriggerClient({
|
|
||||||
id: "nextjs-12",
|
|
||||||
apiKey: process.env.TRIGGER_API_KEY,
|
|
||||||
apiUrl: process.env.TRIGGER_API_URL,
|
|
||||||
verbose: false,
|
|
||||||
ioLogLocalEnabled: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
const { handler, config } = createPagesRoute(client);
|
|
||||||
|
|
||||||
export { config };
|
|
||||||
|
|
||||||
export default handler;
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
import Head from "next/head";
|
|
||||||
import Image from "next/image";
|
|
||||||
import styles from "../styles/Home.module.css";
|
|
||||||
|
|
||||||
export default function Home() {
|
|
||||||
return (
|
|
||||||
<div className={styles.container}>
|
|
||||||
<Head>
|
|
||||||
<title>Create Next App</title>
|
|
||||||
<meta name="description" content="Generated by create next app" />
|
|
||||||
<link rel="icon" href="/favicon.ico" />
|
|
||||||
</Head>
|
|
||||||
|
|
||||||
<main className={styles.main}>
|
|
||||||
<h1 className={styles.title}>
|
|
||||||
Welcome to <a href="https://nextjs.org">Next.js!</a>
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<p className={styles.description}>
|
|
||||||
Get started by editing <code className={styles.code}>pages/index.js</code>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div className={styles.grid}>
|
|
||||||
<a href="https://nextjs.org/docs" className={styles.card}>
|
|
||||||
<h2>Documentation →</h2>
|
|
||||||
<p>Find in-depth information about Next.js features and API.</p>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a href="https://nextjs.org/learn" className={styles.card}>
|
|
||||||
<h2>Learn →</h2>
|
|
||||||
<p>Learn about Next.js in an interactive course with quizzes!</p>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a href="https://github.com/vercel/next.js/tree/canary/examples" className={styles.card}>
|
|
||||||
<h2>Examples →</h2>
|
|
||||||
<p>Discover and deploy boilerplate example Next.js projects.</p>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a
|
|
||||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
|
||||||
className={styles.card}
|
|
||||||
>
|
|
||||||
<h2>Deploy →</h2>
|
|
||||||
<p>Instantly deploy your Next.js site to a public URL with Vercel.</p>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<footer className={styles.footer}>
|
|
||||||
<a
|
|
||||||
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
>
|
|
||||||
Powered by{" "}
|
|
||||||
<span className={styles.logo}>
|
|
||||||
<Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,138 +0,0 @@
|
|||||||
.container {
|
|
||||||
padding: 0 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main {
|
|
||||||
min-height: 100vh;
|
|
||||||
padding: 4rem 0;
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer {
|
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
padding: 2rem 0;
|
|
||||||
border-top: 1px solid #eaeaea;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer a {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-grow: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title a {
|
|
||||||
color: #0070f3;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title a:hover,
|
|
||||||
.title a:focus,
|
|
||||||
.title a:active {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
margin: 0;
|
|
||||||
line-height: 1.15;
|
|
||||||
font-size: 4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title,
|
|
||||||
.description {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.description {
|
|
||||||
margin: 4rem 0;
|
|
||||||
line-height: 1.5;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.code {
|
|
||||||
background: #fafafa;
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 0.75rem;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
font-family:
|
|
||||||
Menlo,
|
|
||||||
Monaco,
|
|
||||||
Lucida Console,
|
|
||||||
Liberation Mono,
|
|
||||||
DejaVu Sans Mono,
|
|
||||||
Bitstream Vera Sans Mono,
|
|
||||||
Courier New,
|
|
||||||
monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.grid {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
max-width: 800px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
margin: 1rem;
|
|
||||||
padding: 1.5rem;
|
|
||||||
text-align: left;
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: none;
|
|
||||||
border: 1px solid #eaeaea;
|
|
||||||
border-radius: 10px;
|
|
||||||
transition:
|
|
||||||
color 0.15s ease,
|
|
||||||
border-color 0.15s ease;
|
|
||||||
max-width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card:hover,
|
|
||||||
.card:focus,
|
|
||||||
.card:active {
|
|
||||||
color: #0070f3;
|
|
||||||
border-color: #0070f3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card h2 {
|
|
||||||
margin: 0 0 1rem 0;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card p {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 1.25rem;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
height: 1em;
|
|
||||||
margin-left: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
|
||||||
.grid {
|
|
||||||
width: 100%;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
.card,
|
|
||||||
.footer {
|
|
||||||
border-color: #222;
|
|
||||||
}
|
|
||||||
.code {
|
|
||||||
background: #111;
|
|
||||||
}
|
|
||||||
.logo img {
|
|
||||||
filter: invert(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
html,
|
|
||||||
body {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
font-family:
|
|
||||||
-apple-system,
|
|
||||||
BlinkMacSystemFont,
|
|
||||||
Segoe UI,
|
|
||||||
Roboto,
|
|
||||||
Oxygen,
|
|
||||||
Ubuntu,
|
|
||||||
Cantarell,
|
|
||||||
Fira Sans,
|
|
||||||
Droid Sans,
|
|
||||||
Helvetica Neue,
|
|
||||||
sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
html {
|
|
||||||
color-scheme: dark;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
color: white;
|
|
||||||
background: black;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "next/core-web-vitals"
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 25 KiB |
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "next/core-web-vitals"
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
/.pnp
|
|
||||||
.pnp.js
|
|
||||||
|
|
||||||
# testing
|
|
||||||
/coverage
|
|
||||||
|
|
||||||
# next.js
|
|
||||||
/.next/
|
|
||||||
/out/
|
|
||||||
|
|
||||||
# production
|
|
||||||
/build
|
|
||||||
|
|
||||||
# misc
|
|
||||||
.DS_Store
|
|
||||||
*.pem
|
|
||||||
|
|
||||||
# debug
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
|
|
||||||
# local env files
|
|
||||||
.env*.local
|
|
||||||
|
|
||||||
# vercel
|
|
||||||
.vercel
|
|
||||||
|
|
||||||
# typescript
|
|
||||||
*.tsbuildinfo
|
|
||||||
next-env.d.ts
|
|
||||||
|
Before Width: | Height: | Size: 25 KiB |
@@ -1,23 +0,0 @@
|
|||||||
@tailwind base;
|
|
||||||
@tailwind components;
|
|
||||||
@tailwind utilities;
|
|
||||||
|
|
||||||
:root {
|
|
||||||
--foreground-rgb: 0, 0, 0;
|
|
||||||
--background-start-rgb: 214, 219, 220;
|
|
||||||
--background-end-rgb: 255, 255, 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root {
|
|
||||||
--foreground-rgb: 255, 255, 255;
|
|
||||||
--background-start-rgb: 0, 0, 0;
|
|
||||||
--background-end-rgb: 0, 0, 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
color: rgb(var(--foreground-rgb));
|
|
||||||
background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb)))
|
|
||||||
rgb(var(--background-start-rgb));
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
plugins: {
|
|
||||||
tailwindcss: {},
|
|
||||||
autoprefixer: {},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 629 B |
@@ -1,17 +0,0 @@
|
|||||||
/** @type {import('tailwindcss').Config} */
|
|
||||||
module.exports = {
|
|
||||||
content: [
|
|
||||||
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
|
|
||||||
"./components/**/*.{js,ts,jsx,tsx,mdx}",
|
|
||||||
"./app/**/*.{js,ts,jsx,tsx,mdx}",
|
|
||||||
],
|
|
||||||
theme: {
|
|
||||||
extend: {
|
|
||||||
backgroundImage: {
|
|
||||||
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
|
|
||||||
"gradient-conic": "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [],
|
|
||||||
};
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# How to run the CLI locally
|
|
||||||
|
|
||||||
First, cd into the cli directory:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cd packages/cli
|
|
||||||
```
|
|
||||||
|
|
||||||
Then run `pnpm run dev` which will build and re-build on any changes to the CLI package
|
|
||||||
|
|
||||||
Next, head to an example repo (e.g. `examples/nextjs-clerk`) and add the package to `devDependencies` if it's not already:
|
|
||||||
|
|
||||||
```json
|
|
||||||
"devDependencies": {
|
|
||||||
"@trigger.dev/cli": "workspace:*"
|
|
||||||
},
|
|
||||||
```
|
|
||||||
|
|
||||||
After running `pnpm i`, you should be able to cd to the `examples/nextjs-clerk` and then run `pnpm exec cli` to run the `@trigger.dev/cli`. You won't need to keep doing `pnpm i` or anything to pickup changes from `packages/cli`.
|
|
||||||
@@ -215,7 +215,7 @@ export default defineConfig([
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (triggerMonorepoPath) {
|
if (triggerMonorepoPath) {
|
||||||
logger.info(` 3. Write some test jobs in the examples/job-catalog`);
|
logger.info(` 3. Write some test jobs in the references/job-catalog`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,7 +499,7 @@ async function updateJobCatalogWithNewIntegration(
|
|||||||
resolvedOptions: ResolvedCLIOptions
|
resolvedOptions: ResolvedCLIOptions
|
||||||
) {
|
) {
|
||||||
const packageName = getPackageName(resolvedOptions.packageName);
|
const packageName = getPackageName(resolvedOptions.packageName);
|
||||||
const jobCatalogPath = pathModule.join(monorepoPath, "examples", "job-catalog");
|
const jobCatalogPath = pathModule.join(monorepoPath, "references", "job-catalog");
|
||||||
const jobCatalogSrcFolder = pathModule.join(jobCatalogPath, "src");
|
const jobCatalogSrcFolder = pathModule.join(jobCatalogPath, "src");
|
||||||
|
|
||||||
const integrationFile = `export {}`;
|
const integrationFile = `export {}`;
|
||||||
|
|||||||
@@ -31,52 +31,52 @@ const testJob = createJobTester(vi);
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const jobToTest = client.defineJob({
|
const jobToTest = client.defineJob({
|
||||||
id: "test-job",
|
id: "test-job",
|
||||||
name: "Test Job",
|
name: "Test Job",
|
||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
trigger: eventTrigger({
|
trigger: eventTrigger({
|
||||||
name: "test.trigger",
|
name: "test.trigger",
|
||||||
}),
|
}),
|
||||||
integrations: {
|
integrations: {
|
||||||
dummy,
|
dummy,
|
||||||
|
},
|
||||||
|
run: async (payload, io, ctx) => {
|
||||||
|
return await io.dummy.doSomething("test-task", {
|
||||||
|
foo: payload.foo,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const testRun = await testJob(jobToTest, {
|
||||||
|
payload: {
|
||||||
|
foo: "bar",
|
||||||
|
},
|
||||||
|
tasks: {
|
||||||
|
"test-task": {
|
||||||
|
bar: "baz",
|
||||||
},
|
},
|
||||||
run: async (payload, io, ctx) => {
|
},
|
||||||
return await io.dummy.doSomething("test-task", {
|
});
|
||||||
foo: payload.foo,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const testRun = await testJob(jobToTest, {
|
// job run was successful
|
||||||
payload: {
|
expect(testRun).toHaveSucceeded();
|
||||||
foo: "bar",
|
|
||||||
},
|
|
||||||
tasks: {
|
|
||||||
"test-task": {
|
|
||||||
bar: "baz",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// job run was successful
|
// task was called exactly once
|
||||||
expect(testRun).toHaveSucceeded();
|
expect(testRun.tasks["test-task"]).toHaveBeenCalledOnce();
|
||||||
|
|
||||||
// task was called exactly once
|
// task was called with correct params
|
||||||
expect(testRun.tasks["test-task"]).toHaveBeenCalledOnce();
|
expect(testRun.tasks["test-task"]).toHaveBeenCalledWith({ foo: "bar" });
|
||||||
|
|
||||||
// task was called with correct params
|
// mocked task output was correctly returned
|
||||||
expect(testRun.tasks["test-task"]).toHaveBeenCalledWith({ foo: "bar" });
|
expect(testRun.tasks["test-task"]).toHaveReturnedWith({ bar: "baz" });
|
||||||
|
|
||||||
// mocked task output was correctly returned
|
// job run has expected output
|
||||||
expect(testRun.tasks["test-task"]).toHaveReturnedWith({ bar: "baz" });
|
expect(testRun.output).toEqual({ bar: "baz" });
|
||||||
|
|
||||||
// job run has expected output
|
|
||||||
expect(testRun.output).toEqual({ bar: "baz" });
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## More information
|
## More information
|
||||||
|
|
||||||
See the official [Trigger.dev Unit Testing Example](https://github.com/triggerdotdev/trigger.dev/examples/unit-testing/) for a working setup with Vitest.
|
See the official [Trigger.dev Unit Testing Reference](https://github.com/triggerdotdev/trigger.dev/references/unit-testing/) for a working setup with Vitest.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export default defineConfig({
|
|||||||
reuseExistingServer: !process.env.CI,
|
reuseExistingServer: !process.env.CI,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: "pnpm run --filter @examples/nextjs-test dev",
|
command: "pnpm run --filter @references/nextjs-test dev",
|
||||||
url: "http://localhost:3000",
|
url: "http://localhost:3000",
|
||||||
reuseExistingServer: !process.env.CI,
|
reuseExistingServer: !process.env.CI,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ packages:
|
|||||||
- "packages/*"
|
- "packages/*"
|
||||||
- "integrations/*"
|
- "integrations/*"
|
||||||
- "apps/**"
|
- "apps/**"
|
||||||
- "examples/*"
|
- "references/*"
|
||||||
- "docs"
|
- "docs"
|
||||||
- "perf"
|
- "perf"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 749 B After Width: | Height: | Size: 749 B |
@@ -17,14 +17,14 @@ pnpm run build --filter @trigger.dev/cli
|
|||||||
Each file in `src` is a separate set of jobs that can be run separately. For example, the `src/stripe.ts` file can be run with:
|
Each file in `src` is a separate set of jobs that can be run separately. For example, the `src/stripe.ts` file can be run with:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd examples/job-catalog
|
cd references/job-catalog
|
||||||
pnpm run stripe
|
pnpm run stripe
|
||||||
```
|
```
|
||||||
|
|
||||||
This will open up a local server using `express` on port 8080. Then in a new terminal window you can run the trigger-cli dev command:
|
This will open up a local server using `express` on port 8080. Then in a new terminal window you can run the trigger-cli dev command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd examples/job-catalog
|
cd references/job-catalog
|
||||||
pnpm run dev:trigger
|
pnpm run dev:trigger
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@examples/job-catalog",
|
"name": "@references/job-catalog",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -52,4 +52,4 @@
|
|||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"tsconfig-paths": "^3.14.1"
|
"tsconfig-paths": "^3.14.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@examples/nextjs",
|
"name": "@references/nextjs",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -24,7 +24,6 @@
|
|||||||
"@types/react": "18.2.17",
|
"@types/react": "18.2.17",
|
||||||
"@types/react-dom": "18.2.7",
|
"@types/react-dom": "18.2.7",
|
||||||
"next": "13.3.1",
|
"next": "13.3.1",
|
||||||
"node-fetch": "2.6.x",
|
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-query": "^3.39.3",
|
"react-query": "^3.39.3",
|
||||||
@@ -36,7 +35,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@trigger.dev/cli": "workspace:*",
|
"@trigger.dev/cli": "workspace:*",
|
||||||
"@types/node-fetch": "2.6.x",
|
|
||||||
"eslint": "8.42.0",
|
"eslint": "8.42.0",
|
||||||
"eslint-config-next": "13.4.6",
|
"eslint-config-next": "13.4.6",
|
||||||
"msw": "^0.47.0",
|
"msw": "^0.47.0",
|
||||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 629 B After Width: | Height: | Size: 629 B |