Skip to content

Commit 5900ef6

Browse files
committed
chore: fix CONTRIBUTING.md setup steps and scope db:seed to webapp
- Fix wrong path 'cd packages/database' -> 'cd internal-packages/database' in the migration walkthrough. - Renumber duplicate '4.' steps in Adding migrations and the skipped step in the hello-world Running section. - Combine three sequential builds into one (turbo parallelizes filters): pnpm run build --filter webapp --filter trigger.dev --filter @trigger.dev/sdk - Add a 'pnpm run db:seed' step after migrate. The seed creates a stable local user, References org, and reference projects (including hello-world with proj_rrkpdguyagvsoktglnod) so contributors no longer have to manually edit the externalRef column in Postgres. - Mention ClickHouse and the ClickHouse migrator alongside Postgres/Redis. - Remove the V1-era 'Add sample jobs' section — references/job-catalog no longer exists; the hello-world flow above replaces it. Scope db:seed in turbo.json to 'webapp#db:seed' depending on 'webapp#build'. The previous root-level entry queued 'build' for every workspace package (reference projects, docs, kubernetes-provider, etc.), and a single broken reference build (e.g. references-realtime-hooks-test failing under Turbopack) would kill the entire seed pipeline. Scoping cuts the dry-run plan from 27 tasks to 20 — only webapp's actual transitive workspace deps.
1 parent 41434b5 commit 5900ef6

2 files changed

Lines changed: 29 additions & 63 deletions

File tree

CONTRIBUTING.md

Lines changed: 27 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ branch are tagged into a release periodically.
7171

7272
Feel free to update `SESSION_SECRET` and `MAGIC_LINK_SECRET` as well using the same method.
7373

74-
8. Start Docker. This starts the required services like Postgres & Redis. If this is your first time using Docker, consider going through this [guide](DOCKER_INSTALLATION.md)
74+
8. Start Docker. This starts the required services: Postgres, Redis, Electric, and ClickHouse (the ClickHouse migrator runs once on first start). If this is your first time using Docker, consider going through this [guide](DOCKER_INSTALLATION.md).
7575

7676
```
7777
pnpm run docker
@@ -81,11 +81,15 @@ branch are tagged into a release periodically.
8181
```
8282
pnpm run db:migrate
8383
```
84-
10. Build everything
84+
10. Build the webapp, CLI, and SDK
8585
```
86-
pnpm run build --filter webapp && pnpm run build --filter trigger.dev && pnpm run build --filter @trigger.dev/sdk
86+
pnpm run build --filter webapp --filter trigger.dev --filter @trigger.dev/sdk
8787
```
88-
11. Run the app. See the section below.
88+
11. Seed the database. This creates a local user, a `References` org, and the reference projects (including `hello-world`) with stable IDs.
89+
```
90+
pnpm run db:seed
91+
```
92+
12. Run the app. See the section below.
8993
9094
## Running
9195
@@ -105,22 +109,17 @@ We use the `<root>/references/hello-world` subdirectory as a staging ground for
105109
106110
### First-time setup
107111
108-
First, make sure you are running the webapp according to the instructions above. Then:
109-
110-
1. Visit http://localhost:3030 in your browser and create a new project called "hello-world".
112+
First, make sure you are running the webapp according to the instructions above. The seed step from setup already created a `hello-world` project under the `References` org with the stable ref `proj_rrkpdguyagvsoktglnod` — log in at http://localhost:3030 with any email to access it. Then:
111113
112-
2. In Postgres go to the "Projects" table and for the project you create change the `externalRef` to `proj_rrkpdguyagvsoktglnod`.
113-
114-
3. Build the CLI
114+
1. Build the CLI (skip if you already ran the build step in setup)
115115
116116
```sh
117-
# Build the CLI
118117
pnpm run build --filter trigger.dev
119118
# Make it accessible to `pnpm exec`
120119
pnpm i
121120
```
122121

123-
4. Change into the `<root>/references/hello-world` directory and authorize the CLI to the local server:
122+
2. Change into the `<root>/references/hello-world` directory and authorize the CLI to the local server:
124123

125124
```sh
126125
cd references/hello-world
@@ -168,75 +167,42 @@ If you want additional debug logging, you can use the `--log-level debug` flag:
168167
pnpm exec trigger dev --log-level debug
169168
```
170169

171-
6. If you make any changes in the CLI/Core/SDK, you'll need to `CTRL+C` to exit the `dev` command and restart it to pickup changes. Any changes to the files inside of the `hello-world/src/trigger` dir will automatically be rebuilt by the `dev` command.
170+
5. If you make any changes in the CLI/Core/SDK, you'll need to `CTRL+C` to exit the `dev` command and restart it to pickup changes. Any changes to the files inside of the `hello-world/src/trigger` dir will automatically be rebuilt by the `dev` command.
172171

173-
7. Navigate to the `hello-world` project in your local dashboard at localhost:3030 and you should see the list of tasks.
172+
6. Navigate to the `hello-world` project in your local dashboard at localhost:3030 and you should see the list of tasks.
174173

175-
8. Go to the "Test" page in the sidebar and select a task. Then enter a payload and click "Run test". You can tell what the payloads should be by looking at the relevant task file inside the `/references/hello-world/src/trigger` folder. Many of them accept an empty payload.
174+
7. Go to the "Test" page in the sidebar and select a task. Then enter a payload and click "Run test". You can tell what the payloads should be by looking at the relevant task file inside the `/references/hello-world/src/trigger` folder. Many of them accept an empty payload.
176175

177-
9. Feel free to add additional files in `hello-world/src/trigger` to test out specific aspects of the system, or add in edge cases.
176+
8. Feel free to add additional files in `hello-world/src/trigger` to test out specific aspects of the system, or add in edge cases.
178177

179178
## Adding and running migrations
180179

181-
1. Modify internal-packages/database/prisma/schema.prisma file
182-
2. Change directory to the packages/database folder
180+
1. Modify `internal-packages/database/prisma/schema.prisma`.
181+
2. Change directory to the database package:
183182

184183
```sh
185-
cd packages/database
184+
cd internal-packages/database
186185
```
187186

188-
3. Create a migration
187+
3. Create a migration:
189188

190189
```
191190
pnpm run db:migrate:dev:create
192191
```
193192

194193
This creates a migration file. Check the migration file does only what you want. If you're adding any database indexes they must use `CONCURRENTLY`, otherwise they'll lock the table when executed.
195194

196-
4. Run the migration.
197-
198-
```
199-
pnpm run db:migrate:deploy
200-
pnpm run generate
201-
```
202-
203-
This executes the migrations against your database and applies changes to the database schema(s), and then regenerates the Prisma client.
204-
205-
4. Commit generated migrations as well as changes to the schema.prisma file
206-
5. If you're using VSCode you may need to restart the Typescript server in the webapp to get updated type inference. Open a TypeScript file, then open the Command Palette (View > Command Palette) and run `TypeScript: Restart TS server`.
207-
208-
## Add sample jobs
209-
210-
The [references/job-catalog](./references/job-catalog/) project defines simple jobs you can get started with.
211-
212-
1. `cd` into `references/job-catalog`
213-
2. Create a `.env` file with the following content,
214-
replacing `<TRIGGER_DEV_API_KEY>` with an actual key:
195+
4. Run the migration:
215196

216-
```env
217-
TRIGGER_API_KEY=[TRIGGER_DEV_API_KEY]
218-
TRIGGER_API_URL=http://localhost:3030
219-
```
220-
221-
`TRIGGER_API_URL` is used to configure the URL for your Trigger.dev instance,
222-
where the jobs will be registered.
223-
224-
3. Run one of the the `job-catalog` files:
225-
226-
```sh
227-
pnpm run events
228-
```
229-
230-
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:
231-
232-
```sh
233-
pnpm run dev:trigger
234-
```
197+
```
198+
pnpm run db:migrate:deploy
199+
pnpm run generate
200+
```
235201

236-
See the [Job Catalog](./references/job-catalog/README.md) file for more.
202+
This executes the migrations against your database and applies changes to the database schema(s), and then regenerates the Prisma client.
237203

238-
4. Navigate to your trigger.dev instance ([http://localhost:3030](http://localhost:3030/)), to see the jobs.
239-
You can use the test feature to trigger them.
204+
5. Commit the generated migration files as well as the changes to `schema.prisma`.
205+
6. If you're using VSCode you may need to restart the TypeScript server in the webapp to get updated type inference. Open a TypeScript file, then open the Command Palette (View > Command Palette) and run `TypeScript: Restart TS server`.
240206

241207
## Making a pull request
242208

turbo.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
"db:migrate:deploy": {
3636
"cache": false
3737
},
38-
"db:seed": {
38+
"webapp#db:seed": {
3939
"cache": false,
4040
"dependsOn": [
41-
"build"
41+
"webapp#build"
4242
]
4343
},
4444
"db:studio": {

0 commit comments

Comments
 (0)