feat: improving developer experience

This commit is contained in:
Puru D
2024-05-15 01:31:02 -05:00
parent 754ebb1f3b
commit 9d413ebe7b
13 changed files with 12188 additions and 80 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ NEXT_TELEMETRY_DISABLED=1
# Prisma
# https://www.prisma.io/docs/reference/database-reference/connection-urls#env
DATABASE_URL="postgres://captable:password@127.0.0.1:54321/captable"
DATABASE_URL="postgres://captable:password@pg:5432/captable"
# Next Auth
# You can generate a new secret on the command line with:
+1 -1
View File
@@ -9,6 +9,6 @@ runs:
- name: 🏗 Build
shell: bash
run: npx prisma generate && npm run build
run: npx prisma generate && pnpm build
env:
SKIP_ENV_VALIDATION: 1
+27 -15
View File
@@ -7,23 +7,35 @@ inputs:
runs:
using: "composite"
steps:
- name: ⎔ Setup node ${{ inputs.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_version }}
cache: npm
- name: Checkout
uses: actions/checkout@v4
- name: 📥 Cache deps
uses: actions/cache@v4
id: cache-node-modules
with:
path: node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- name: ❇️ Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: 📥 Install deps
if: steps.cache-node-modules.outputs.cache-hit != 'true'
shell: bash
run: npm ci --no-audit
- uses: pnpm/action-setup@v4
name: 🗃️ Install pnpm
with:
version: 8
run_install: false
- name: 📦 Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: ⛅ Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: ✅ Install dependencies
run: pnpm install
env:
HUSKY: "0"
-1
View File
@@ -42,7 +42,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
yarn.lock
pnpm-lock.yaml
#local
/local
+6 -6
View File
@@ -62,7 +62,7 @@ Follow the steps below to stand the app up locally.
**1. Install dependencies.**
```sh
npm i
pnpm i
```
**2. Copy `.env.example`**
@@ -79,7 +79,7 @@ cp .env.example .env
* SMTP server
```sh
npm run dx
pnpm dx
```
Generate tables and the Prisma client.
@@ -91,20 +91,20 @@ npx prisma migrate dev
To see what's in your database, run Prisma Studio:
```sh
npm run db:studio
pnpm db:studio
```
**4. Seed some data (For dev environment)**
```sh
npm run db:seed
pnpm db:seed
```
**5. Run the web app**
```sh
npm run dev
pnpm dev
```
**6. Install and run SMTP server**
@@ -114,7 +114,7 @@ npm run dev
> [Mailpit](https://github.com/axllent/mailpit) or something similar can be used intercept emails in development.
```sh
npm run email:dev
pnpm email:dev
```
Open your browser to the URLs given by the web app and studio processes. You're up and running, good job! 🎉
+21 -23
View File
@@ -10,7 +10,7 @@ services:
ports:
- 54321:5432
volumes:
- postgres_raw:/var/lib/postgresql/data
- postgres:/var/lib/postgresql/data
smtp:
image: axllent/mailpit
@@ -32,25 +32,25 @@ services:
entrypoint: sh
command: -c 'minio server /data --console-address ":9001" --address ":9002"'
# app:
# build:
# context: .
# dockerfile: ./docker/Dockerfile.dev
# container_name: captable-app
# ports:
# - 3000:3000
# env_file:
# - ".env.example"
# - ".env"
# volumes:
# - ./:/opt/captable
# - node_modules:/opt/captable/node_modules
# - dist:/opt/captable/dist
# depends_on:
# - pg
# - smtp
# - minio
app:
build:
context: .
dockerfile: ./docker/Dockerfile.dev
container_name: captable-app
restart: always
ports:
- 3000:3000
env_file:
- ".env.example"
- ".env"
volumes:
- .:/app
- /app/node_modules
- /app/.next
depends_on:
- pg
- smtp
- minio
# minio client - is expected to be run once to setup minio buckets. It'll exit 0 after setup
mc:
@@ -69,6 +69,4 @@ services:
volumes:
minio:
postgres_raw:
node_modules:
dist:
postgres:
+3 -15
View File
@@ -13,13 +13,7 @@ ENV HUSKY 0
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \
fi
RUN corepack enable pnpm && pnpm i --frozen-lockfile
##### BUILDER
@@ -35,13 +29,7 @@ COPY . .
ENV NEXT_TELEMETRY_DISABLED 1
ENV DOCKER_OUTPUT 1
ENV SKIP_ENV_VALIDATION 1
RUN \
if [ -f yarn.lock ]; then yarn run build; \
elif [ -f package-lock.json ]; then npm run build; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
else echo "Lockfile not found." && exit 1; \
fi
RUN corepack enable pnpm && pnpm run build
##### RUNNER
@@ -76,4 +64,4 @@ ENV PORT 3000
# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD HOSTNAME="0.0.0.0" node server.js
CMD HOSTNAME="0.0.0.0" node server.js
+12 -6
View File
@@ -1,11 +1,17 @@
FROM node:20-alpine
ARG NODE_VERSION=20
# Alpine image
FROM node:${NODE_VERSION}-alpine AS alpine
FROM alpine AS dependencies
WORKDIR /app
COPY ../package.json ./
RUN npm install
# Copy dependencies
COPY . .
CMD ["npm", "run", "dev"]
# Install dependencies
RUN npm i -g pnpm
RUN pnpm install
# Run the dev server
EXPOSE 3000
CMD [ "pnpm", "dev" ]
+14 -7
View File
@@ -4,23 +4,30 @@
"private": true,
"type": "module",
"scripts": {
"prepare": "husky install",
"build": "next build",
"dx": "docker-compose -f compose.yml up -d",
"dx:down": "docker-compose -f compose.yml down",
"dx:build": "docker-compose -f compose.yml build",
"dx:logs": "docker-compose -f compose.yml logs -f",
"dx:restart": "docker-compose -f compose.yml restart",
"dx:migrate": "docker compose run app pnpm db:migrate",
"dx:seed": "docker compose run app pnpm db:seed",
"db:push": "npx prisma db push",
"db:studio": "npx prisma studio",
"db:migrate": "npx prisma migrate dev",
"db:generate": "npx prisma generate",
"db:seed": "NODE_ENV='test' npx tsx prisma/seeds/index.ts",
"dev": "next dev",
"postinstall": "prisma generate",
"lint": "biome check --apply ./src",
"build": "next build",
"start": "next start",
"format": "biome format --write ./src && npx prisma format",
"postinstall": "prisma generate",
"prepare": "husky install",
"lint": "biome check --apply ./src",
"email:dev": "mailpit",
"format": "biome format --write ./src && npx prisma format",
"email:preview": "email preview ./src/emails",
"copy:pdfjs": "node scripts/copy-pdfjs-worker.cjs",
"trigger": "npx @trigger.dev/cli@latest dev",
"deploy:fly": "fly deploy"
"trigger": "npx @trigger.dev/cli@latest dev"
},
"dependencies": {
"@ark-ui/react": "^2.2.3",
+12098
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -18,12 +18,12 @@ export const CaptableLogo = ({ className }: { className?: string }) => {
<path
d="M901.072 863.211C962.672 792.771 1000 700.53 1000 599.561C1000 544.38 988.848 491.806 968.683 443.973L773.611 530.767C782.037 552.058 786.667 575.268 786.667 599.561C786.667 641.535 772.843 680.277 749.504 711.473L901.072 863.211Z"
fill="white"
fill-opacity="0.75"
fillOpacity="0.75"
/>
<path
d="M626.667 414.583V200C762.219 208.932 879.323 285.46 944.672 396.23L746.885 484.23C717.9 447.286 675.308 421.548 626.667 414.583Z"
fill="white"
fill-opacity="0.5"
fillOpacity="0.5"
/>
</svg>
);
+1 -1
View File
@@ -63,7 +63,7 @@ const Modal = ({
<div className="">
<DialogHeader>
<div className="flex justify-center">
<CaptableLogo className="mb-3 h-10 w-10" />
<CaptableLogo className="mb-3 h-10 w-10 rounded" />
</div>
<DialogTitle className="mb-4 text-center">{title}</DialogTitle>
{subtitle && (
@@ -7,8 +7,8 @@ interface LoginFormHeaderProps {
export function AuthFormHeader({ page }: LoginFormHeaderProps) {
return (
<div className="flex flex-col gap-y-2 text-center">
<div className="center">
<CaptableLogo className="mb-3 h-10 w-10 rounded-md" />
<div className="flex justify-center">
<CaptableLogo className="mb-3 h-10 w-auto" />
</div>
<h1 className="mb-2 text-2xl font-semibold tracking-tight">