Skip to content

Commit

Permalink
277th Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyam-Chen committed Feb 29, 2024
1 parent 8f20d9c commit b5cdb0a
Show file tree
Hide file tree
Showing 77 changed files with 518 additions and 405 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
run: docker compose exec --no-TTY ci pnpm build
- name: pnpm preview
run: docker compose exec --detach --no-TTY ci pnpm preview
- name: pnpm lint
run: docker compose exec --no-TTY ci pnpm lint
- name: pnpm check
run: docker compose exec --no-TTY ci pnpm check
- name: pnpm test
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:20.11-bullseye-slim

ENV HOME /fastify-starter
ENV HOME /app

WORKDIR ${HOME}
ADD . $HOME
ADD ./app $HOME

RUN npm install -g pnpm
RUN pnpm install

RUN apt-get update && \
apt-get install -y libcurl4
apt-get install -y libcurl4
48 changes: 27 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,17 @@ $ pnpm preview

### Lints and fixes files

Files: `src/**/*.ts`
Biome CLI

```sh
$ pnpm lint
# format
$ pnpm biome format ./app ./db ./mock ./e2e --write

# lint
$ pnpm biome lint ./app ./mock ./e2e

# format, lint & sort
$ pnpm biome check --apply ./app ./mock ./e2e
```

### Check types
Expand Down Expand Up @@ -217,24 +224,24 @@ The structure follows the LIFT Guidelines.
```coffee
.
├── .github/workflows/ci.yml
├── app
│ ├── public -> not handled by vite, copy it to dist
│ └── src
│ ├── assets -> wasm, onnx
│ ├── components -> shared module
│ ├── composables -> shared module
│ ├── locales -> core module
│ ├── middleware -> core module
│ ├── plugins -> root module
│ ├── routes -> feature modules
│ ├── templates -> email templates with nunjucks
│ ├── utilities -> shared module
│ ├── app.ts
│ ├── main.ts
│ └── shims.d.ts
├── db -> set up local data for testing and initializing the database
├── e2e
├── e2e -> api end-to-end testing
├── mock -> mock a third-party/private api calls
├── public -> not handled by vite, copy it to dist
├── src
│ ├── assets -> wasm
│ ├── components -> shared module
│ ├── composables -> shared module
│ ├── locales -> core module
│ ├── middleware -> core module
│ ├── plugins -> root module
│ ├── routes -> feature modules
│ ├── templates -> email templates with nunjucks
│ ├── utilities -> shared module
│ ├── app.ts
│ ├── error.ts
│ ├── main.ts
│ └── shims.d.ts
├── .editorconfig
├── .gitignore
├── biome.json
Expand All @@ -243,8 +250,7 @@ The structure follows the LIFT Guidelines.
├── Dockerfile
├── package.json
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
├── README.md
├── render.yaml
├── tsconfig.json
└── vite.config.ts
└── render.yaml
```
59 changes: 59 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"private": true,
"type": "module",
"scripts": {
"dev": "vite-node -w src/main.ts",
"build": "vite build",
"preview": "vite preview",
"check": "tsc --noEmit",
"test": "vitest --dir src --coverage --run"
},
"dependencies": {
"@fastify/cors": "^9.0.1",
"@fastify/helmet": "^11.1.1",
"@fastify/jwt": "^8.0.0",
"@fastify/mongodb": "^8.0.0",
"@fastify/multipart": "^8.1.0",
"@fastify/one-line-logger": "^1.2.0",
"@fastify/rate-limit": "^9.1.0",
"@fastify/redis": "^6.1.1",
"@fastify/sensible": "^5.5.0",
"@fastify/type-provider-typebox": "^4.0.0",
"@fastify/under-pressure": "^8.3.0",
"@fastify/websocket": "^9.0.0",
"@sinclair/typebox": "^0.32.14",
"@tirke/node-cache-manager-ioredis": "^3.6.0",
"async-cache-dedupe": "^2.1.0",
"bullmq": "^5.3.2",
"cache-manager": "^5.4.0",
"exceljs": "^4.4.0",
"fastify": "^4.26.1",
"fastify-cloudinary": "^1.2.0",
"fastify-i18n": "^1.2.0",
"fastify-plugin": "^4.5.1",
"fastify-sse-v2": "^3.1.2",
"generate-password": "^1.7.1",
"ioredis": "^5.3.2",
"nodemailer": "^6.9.10",
"nunjucks": "^3.2.4",
"ofetch": "^1.3.3",
"otplib": "^12.0.1",
"pbkdf2-passworder": "^1.0.1"
},
"devDependencies": {
"@types/ioredis-mock": "^8.2.5",
"@types/nodemailer": "^6.4.14",
"@types/nunjucks": "^3.2.6",
"@vitest/coverage-v8": "^1.3.1",
"concurrently": "^8.2.2",
"ioredis-mock": "^8.9.0",
"mongodb-memory-server": "^9.1.6",
"process-envify": "^2.0.0",
"typescript": "^5.3.3",
"vite": "^5.1.4",
"vite-node": "^1.3.1",
"vite-plugin-fastify": "^1.2.5",
"vite-plugin-fastify-routes": "^1.1.1",
"vitest": "^1.3.1"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MongoMemoryServer } from 'mongodb-memory-server';
import fastify from 'fastify';
import mongodb from '@fastify/mongodb';
import fastify from 'fastify';
import { MongoMemoryServer } from 'mongodb-memory-server';

import todos from '../+handler';

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions vite.config.ts → app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { resolve } from 'path';
import nodemailer from 'nodemailer';
import envify from 'process-envify';
import { defineConfig } from 'vite';
import fastify from 'vite-plugin-fastify';
import fastifyRoutes from 'vite-plugin-fastify-routes';
import envify from 'process-envify';
import nodemailer from 'nodemailer';

const { user, pass } = await nodemailer.createTestAccount();

Expand Down
3 changes: 3 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"ignore": ["dist", "coverage"]
},
"formatter": {
"indentStyle": "space",
"lineWidth": 100
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/hello-world.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from '@playwright/test';
import { expect, test } from '@playwright/test';

test('GET /api/hello-world', async ({ request }) => {
const response = await request.get('/api/hello-world');
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/todos.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from '@playwright/test';
import { expect, test } from '@playwright/test';

test('POST /api/todos', async ({ request }) => {
const response = await request.post('/api/todos', { data: {} });
Expand Down
2 changes: 1 addition & 1 deletion mock/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { resolve } from 'path';
import envify from 'process-envify';
import { defineConfig } from 'vite';
import fastify from 'vite-plugin-fastify';
import fastifyRoutes from 'vite-plugin-fastify-routes';
import envify from 'process-envify';

export default defineConfig({
define: envify({
Expand Down
63 changes: 8 additions & 55 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,15 @@
"private": true,
"type": "module",
"scripts": {
"dev": "vite-node -w src/main.ts",
"mock": "cd mock && pnpm mock",
"build": "vite build",
"preview": "vite preview",
"lint": "biome check --apply ./src",
"check": "tsc --noEmit",
"test": "vitest --dir src --coverage --run",
"e2e": "cd e2e && pnpm e2e"
},
"dependencies": {
"@fastify/cors": "^9.0.1",
"@fastify/helmet": "^11.1.1",
"@fastify/jwt": "^8.0.0",
"@fastify/mongodb": "^8.0.0",
"@fastify/multipart": "^8.1.0",
"@fastify/one-line-logger": "^1.2.0",
"@fastify/rate-limit": "^9.1.0",
"@fastify/redis": "^6.1.1",
"@fastify/sensible": "^5.5.0",
"@fastify/type-provider-typebox": "^4.0.0",
"@fastify/under-pressure": "^8.3.0",
"@fastify/websocket": "^9.0.0",
"@sinclair/typebox": "^0.32.14",
"@tirke/node-cache-manager-ioredis": "^3.6.0",
"async-cache-dedupe": "^2.1.0",
"bullmq": "^5.3.2",
"cache-manager": "^5.4.0",
"exceljs": "^4.4.0",
"fastify": "^4.26.1",
"fastify-cloudinary": "^1.2.0",
"fastify-i18n": "^1.2.0",
"fastify-plugin": "^4.5.1",
"fastify-sse-v2": "^3.1.2",
"generate-password": "^1.7.1",
"ioredis": "^5.3.2",
"nodemailer": "^6.9.10",
"nunjucks": "^3.2.4",
"ofetch": "^1.3.3",
"otplib": "^12.0.1",
"pbkdf2-passworder": "^1.0.1"
"dev": "pnpm -C app dev",
"mock": "pnpm -C mock mock",
"build": "pnpm -C app build",
"preview": "pnpm -C app preview",
"check": "pnpm -C app check",
"test": "pnpm -C app test",
"e2e": "pnpm -C e2e e2e"
},
"devDependencies": {
"@biomejs/biome": "^1.5.3",
"@types/ioredis-mock": "^8.2.5",
"@types/nodemailer": "^6.4.14",
"@types/nunjucks": "^3.2.6",
"@vitest/coverage-v8": "^1.3.1",
"concurrently": "^8.2.2",
"ioredis-mock": "^8.9.0",
"mongodb-memory-server": "^9.1.6",
"process-envify": "^2.0.0",
"typescript": "^5.3.3",
"vite": "^5.1.4",
"vite-node": "^1.3.1",
"vite-plugin-fastify": "^1.2.5",
"vite-plugin-fastify-routes": "^1.1.1",
"vitest": "^1.3.1"
"@biomejs/biome": "^1.5.3"
}
}
Loading

0 comments on commit b5cdb0a

Please sign in to comment.