Files
James Ritchie 65fa8300ad Support for more frameworks (#446)
* Removed next references in the ReadMe

* FAQ improvements to update Next.js references

* Added a new Frameworks page with logos to link to the quick start guides

* Renamed the mdx file so the link works

* Added basic platform guides

* Introduction doesn’t reference next.js only

* Added a note about serverless and restructured the side menu

* Added more frameworks pages to the manual install section

* Fixed SVG error

* Coming soon guides now using snippets so they can be in 2 places while we work on them

* Removed redirects

* Added a new named icon

* increased fireworks particle count slightly

* Creating a route for the onboarding and link to access it anytime from the side menu

* Moved the onboarding into new components

* Updated the routes for the onboarding page

* Onboarding is now Setup and the frameworks overview page now links to different framework page in the onboarding side nav

* URLs and pages renamed to ‘setup’

* URLs and pages renamed to ‘setup’

* Fixed some old named component imports

* WIP on a new less hacked-in background image

* Added svg logos for all the frameworks

* New paths for the new framework pages

* Side menu collapses once you selected a framework

* Temporary Nuxt page

* New routes for the new frameworks

* New ‘framework coming soon’ component - now used in the coming soon framework pages

* Moved/removed files

* Moved all svg framework logos into a new folder and file

* balanced the logo sizes

* Framework coming soon pages take a name and url

* New express svg logo

* New component for a Framework item in the grid

* Added information and design for the coming soon frameworks

* Change the grid to 1 row if jobs === 0

* Updated the framework coming soon snippet and added it to the relevant pages

* Express now 2nd in all lists

* Added link to long running server support discussion

* New logo to include next.js + supabase quick start

* roadmap now links to homepage with page anchor to roadmap section

* changelog now links to Github releases page

* Removed reference to Next.js

* Docs pages with coming soon info all share the same framework snippets

* Fixed issue of missing props

* Moved the fireworks effect into a separate file to make it easier for adding more framework onboarding pages

* Info callouts have a more muted style

* Added a callout to the top of the next onboarding to reference Serverless-only support

* Moved the callout explaining scheduled triggers not working in dev to the bottom of the test panel

This is to resolve eric’s UX ticket: https://github.com/triggerdotdev/trigger.dev/issues/416

* Added groundwork for Nest.js framework

* Using framer motion for the menu transition instead of css - now has a slight spring and is snappier

* redirect the manual setup page to the new nextjs setup page

* Fixed broken docs link

* Added a readme.md to next.js package

* Capital I for integration

* Renamed component: NextDevCommand to RunDevCommand

* Made required props non-optional

* CLI now points at manual install guides if no Next project detected

* Explicitly made supported default to false (it was working but a bit hard to read)

* Added links to all github issues for the frameworks coming soon component

---------

Co-authored-by: Matt Aitken <matt@mattaitken.com>
2023-09-08 17:26:08 +01:00

172 lines
4.7 KiB
Plaintext

---
title: "Using the CLI"
description: "How to use the CLI"
---
## Introduction
If you're setting up your project for the first time, we recommend using the CLI by following the [Quickstart guide](/documentation/quickstart).
## init Command
The `init` command incorporates Trigger.dev into your project. It performs the following functions:
- Adds Trigger.dev to the project.
- Creates a new route.
- Generates an example file.
During execution, this command requires some configuration parameters. Detailed information on these parameters can be found in the next section.
![Your first Job](/images/cli-init.gif)
Run this `init` command in a terminal window to setup your project with Trigger.dev
<CodeGroup>
```bash npm
npx @trigger.dev/cli@latest init
```
```bash pnpm
pnpm dlx @trigger.dev/cli@latest init
```
```bash yarn
yarn dlx @trigger.dev/cli@latest init
```
</CodeGroup>
### CLI steps explained
<AccordionGroup>
<Accordion title="Are you using the Trigger.dev cloud or self-hosted?">
<ResponseField name="Option 1: Trigger.dev Cloud">
Trigger.dev Cloud is a fully hosted service that provides the easiest and quickest way to use Trigger.dev.
</ResponseField>
<ResponseField name="Option 2: Self-hosted">
Instead of using the Trigger.dev Cloud service which we host for you, you
can host the Trigger.dev platform yourself. We provide an official
Trigger.dev Docker image you can use to easily self-host on your preferred
platform. More information on self-hosting can be found in the
self-hosting section of the docs
[here](/documentation/guides/self-hosting).
<Accordion title="Enter the URL of your self-hosted Trigger.dev instance">
When following the [self-hosting guide](/documentation/guides/self-hosting) you will deploy your Docker image to a platform of your choice. After completing this step, enter the URL of your self-hosted instance in this CLI step.
</Accordion>
</ResponseField>
</Accordion>
<Accordion title="Enter your development API key">
To locate your development API key, login to the [Trigger.dev
dashboard](https://cloud.trigger.dev) and select the Project you want to connect to. Then click on
the Environments & API Keys tab in the left menu. You can copy your development API Key from the
field at the top of this page. (Your development key will start with `tr_dev_`).
</Accordion>
<Accordion title="Enter a unique ID for your endpoint">
Enter a custom ID or use the default by hitting enter. You can learn more about endpoints
[here](/documentation/concepts/environments-endpoints#endpoints).
</Accordion>
</AccordionGroup>
## dev Command
Once you're running your project locally, you can then execute the `dev` CLI command to run Trigger.dev locally. You should run this command every time you want to use Trigger.dev locally.
![Your first Job](/images/cli-dev.gif)
<Warning>
Make sure your site is running locally before continuing. You must also leave this `dev` terminal
command running while you develop.
</Warning>
In a **new terminal window or tab** run:
<CodeGroup>
```bash npm
npx @trigger.dev/cli@latest dev
```
```bash pnpm
pnpm dlx @trigger.dev/cli@latest dev
```
```bash yarn
yarn dlx @trigger.dev/cli@latest dev
```
</CodeGroup>
<br />
<Note>
You can optionally pass the port if you're not running on 3000 by adding
`--port 3001` to the end
</Note>
<Note>
You can optionally pass the hostname if you're not running on localhost by adding
`--hostname <host>`. For example, in case your app is running on 0.0.0.0: `--hostname 0.0.0.0`.
</Note>
## update Command
The `update` command will update all Trigger.dev packages to the latest version.
<CodeGroup>
```bash npm
npx @trigger.dev/cli@latest update
```
```bash pnpm
pnpm dlx @trigger.dev/cli@latest update
```
```bash yarn
yarn dlx @trigger.dev/cli@latest update
```
</CodeGroup>
## whoami Command
The `whoami` command will print out information about your current Trigger.dev project and environment, based on the API key found in your `.env` or `.env.local` file
<CodeGroup>
```bash npm
npx @trigger.dev/cli@latest whoami
```
```bash pnpm
pnpm dlx @trigger.dev/cli@latest whoami
```
```bash yarn
yarn dlx @trigger.dev/cli@latest whoami
```
</CodeGroup>
## send-event Command
The `send-event` command will send an event to your Trigger.dev project. This is useful for testing your Trigger.dev project locally.
<CodeGroup>
```bash npm
npx @trigger.dev/cli@latest send-event -n "event.name" -p "{ \"key\": \"value\" }"
```
```bash pnpm
pnpm dlx @trigger.dev/cli@latest send-event -n "event.name" -p "{ \"key\": \"value\" }"
```
```bash yarn
yarn dlx @trigger.dev/cli@latest send-event -n "event.name" -p "{ \"key\": \"value\" }"
```
</CodeGroup>