Skip to content

Commit

Permalink
282nd Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyam-Chen committed Mar 2, 2024
1 parent f9606b8 commit ffbad95
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ jobs:
- name: pnpm e2e
run: docker compose exec --no-TTY ci pnpm e2e
- name: Trigger deployment
if: ${{ contains(fromJSON('["main", "release", "prod"]'), github.ref) }}
if: ${{ contains(fromJSON('["refs/heads/main", "refs/heads/release", "refs/heads/prod"]'), github.ref) }}
run: curl -k ${{ secrets.DEPLOY_HOOK }}
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,28 @@

Prerequisites:

- Docker v24
- Docker v24 (Optional)
- Node.js v20
- PNPM v8

Get started with Fastify Starter.

```sh
# (optional)
# If you already have the MONGODB_URL and REDIS_URL connections, you can directly replace them.

# mongo server
$ docker compose up -d local-mongo
```

```sh
# redis server
$ docker compose up -d local-redis
```

```sh
# dev server
# install dependencies
$ pnpm install

# dev server
$ pnpm dev
```

Expand Down Expand Up @@ -86,32 +89,29 @@ $ pnpm biome check --apply ./app ./mock ./e2e

### Check types

Files: `src/**/*.ts`
Files: `app/src/**/*.ts`

```sh
$ pnpm check
```

### Runs unit tests

Files: `src/**/*.spec.ts`
Files: `app/src/**/*.spec.ts`

```sh
$ pnpm test
```

### Runs end-to-end tests

Files: `e2e/**/*.spec.ts`
Files: `e2e/src/**/*.spec.ts`

```sh
# Before running the `e2e` command, make sure to run the following commands.
$ pnpm build
$ pnpm preview

# If it's not installed, run it.
$ cd e2e && pnpm install && cd ..

$ pnpm e2e
```

Expand Down Expand Up @@ -176,7 +176,7 @@ Control the environment.
Set your local environment variables.

```ts
// vite.config.ts
// app/vite.config.ts
define: envify({
NODE_ENV: process.env.NODE_ENV || 'development',

Expand Down Expand Up @@ -238,7 +238,8 @@ The structure follows the LIFT Guidelines.
│ │ ├── utilities -> shared module
│ │ ├── app.ts
│ │ ├── main.ts
│ │ └── shims.d.ts
│ │ ├── shims.d.ts
│ │ └── worker.ts
│ ├── package.json
│ ├── tsconfig.json
│ └── vite.config.ts
Expand Down
15 changes: 15 additions & 0 deletions app/src/worker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import useWorker from '~/composables/useWorker';

useWorker(
'Paint',
async (job) => {
console.log('[Paint] Starting job:', job.name);
console.log(job.id, job.name, job.data);
console.log('[Paint] Finished job:', job.name);
return;
},
{
removeOnComplete: { count: 0 },
removeOnFail: { count: 0 },
},
);
5 changes: 5 additions & 0 deletions app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export default defineConfig({
},
build: {
ssrEmitAssets: true,
rollupOptions: {
input: {
worker: './src/worker.ts',
},
},
},
test: {
globals: true,
Expand Down
14 changes: 14 additions & 0 deletions render.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,17 @@ services:
buildCommand: pnpm install; pnpm build
startCommand: node app/dist/main.js
healthCheckPath: /api/healthz

- type: worker
name: fastify-starter-queue
runtime: node
region: oregon
plan: starter
branch: main
envVars:
- key: NODE_VERSION
value: 20.11.1
- key: REDIS_URL
sync: false
buildCommand: pnpm install; pnpm build
startCommand: node app/dist/worker.js

0 comments on commit ffbad95

Please sign in to comment.