diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0f1014c52f..edcc9226cd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -95,6 +95,52 @@ webapp:dev: If you didn't try to log in, you can safely ignore this email. `` 4. Paste the magic link shown in your terminal into your browser to login. +## Testing CLI changes +To test CLI changes, follow the steps below: + +1. Build the CLI and watch for changes + + ``` + cd packages/cli + 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. + +3. Create a new temporary Next.js app in examples directory + + ``` + pnpm create next-app@latest + ``` + + Follow the prompts to create a TypeScript project using the App Directory. + +4. Then once that's finished, add the `@trigger.dev/cli` to the `devDependencies` of the newly created Next.js app's `package.json` file, like so: + + ``` + { + "devDependencies": { "@trigger.dev/cli": "workspace:*" } + } + ``` + +5. Open a new terminal window, navigate into the example, and initialize the CLI: + + ``` + cd examples/your-newly-created-nextjs-project + pnpm i + pnpm exec trigger-cli init + ``` + +6. When prompted, select `self-hosted` and enter `localhost:3030` for your local version of the webapp. When asked for an API key, use the key you copied earlier. + +7. Run the CLI + ``` + pnpm exec trigger-cli dev + ``` + +8. After running the CLI, start your newly created Next.js project. You should now be able to see the changes. + +9. Please remember to delete the temporary project you created after you've tested the changes, and before you raise a PR. ## Add sample jobs The [examples/jobs-starter](./examples/jobs-starter/) project defines simple jobs you can get started with.