♻️ Switch to turborepo (#532)

This commit is contained in:
Luke Vella 2023-03-01 14:10:06 +00:00 committed by GitHub
parent 41ef81aa75
commit 0a836aeec7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
419 changed files with 2300 additions and 2504 deletions

View file

@ -2,10 +2,12 @@ node_modules
.git .git
.github .github
.vscode .vscode
tsconfig.tsbuildinfo
.env .env
.sentryclirc .sentryclirc
sentry.properties sentry.properties
Dockerfile Dockerfile
docker-compose.yml docker-compose.yml
docs /docs
README.md README.md
node_modules

View file

@ -1,5 +1,5 @@
{ {
"extends": ["next/core-web-vitals"], "extends": ["next/core-web-vitals", "turbo"],
"plugins": ["simple-import-sort", "@typescript-eslint"], "plugins": ["simple-import-sort", "@typescript-eslint"],
"overrides": [ "overrides": [
{ {

View file

@ -11,6 +11,9 @@ jobs:
linting: linting:
name: Linting name: Linting
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -35,7 +38,9 @@ jobs:
name: Run tests name: Run tests
# Containers must run in Linux based operating systems # Containers must run in Linux based operating systems
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
steps: steps:
# Downloads a copy of the code in your repository before running CI tests # Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code - name: Check out repository code
@ -66,7 +71,7 @@ jobs:
yarn wait-on --timeout 60000 tcp:localhost:5432 yarn wait-on --timeout 60000 tcp:localhost:5432
- name: Deploy migrations - name: Deploy migrations
run: yarn prisma migrate deploy run: yarn db:deploy
- name: Install playwright dependencies - name: Install playwright dependencies
run: yarn playwright install --with-deps chromium run: yarn playwright install --with-deps chromium

View file

@ -39,6 +39,7 @@ jobs:
- name: Build and publish image - name: Build and publish image
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
file: /apps/web/Dockerfile
platforms: linux/arm64,linux/amd64 platforms: linux/arm64,linux/amd64
push: true push: true
cache-from: type=gha cache-from: type=gha

15
.gitignore vendored
View file

@ -31,15 +31,8 @@ yarn-error.log*
.env.test.local .env.test.local
.env.production.local .env.production.local
# vercel
.vercel
# Sentry
.sentryclirc
# playwright
/playwright-report
/test-results
# ts # ts
tsconfig.tsbuildinfo tsconfig.tsbuildinfo
# Turbo
.turbo

View file

@ -1,25 +0,0 @@
FROM node:lts as build
WORKDIR /app
COPY package.json .
COPY yarn.lock .
COPY prisma/schema.prisma .
RUN yarn --frozen-lockfile --no-cache --production --network-timeout 1000000
COPY . .
RUN yarn build
FROM node:lts
ENV PORT 3000
EXPOSE 3000
WORKDIR /usr/src/app
COPY --from=build /app .
COPY ./scripts/docker-start.sh .
ENTRYPOINT ["./scripts/docker-start.sh"]

8
apps/web/.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
node_modules
# Sentry
.sentryclirc
# playwright
/playwright-report
/test-results

47
apps/web/Dockerfile Normal file
View file

@ -0,0 +1,47 @@
FROM node:lts AS builder
WORKDIR /app
RUN yarn global add turbo
COPY . .
RUN turbo prune --scope=app --docker
FROM node:lts AS installer
WORKDIR /app
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/yarn.lock ./yarn.lock
RUN yarn --network-timeout 1000000
# Build the project
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json
RUN yarn turbo run generate
RUN yarn turbo run build --filter=app...
FROM node:lts AS runner
WORKDIR /app
RUN yarn global add prisma
# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs
COPY --from=builder --chown=nextjs:nodejs /app/scripts/docker-start.sh ./
COPY --from=builder --chown=nextjs:nodejs /app/packages/database/prisma ./prisma
COPY --from=installer /app/apps/web/next.config.js .
COPY --from=installer /app/apps/web/package.json .
ENV PORT 3000
EXPOSE 3000
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public
CMD ["./docker-start.sh"]

View file

@ -12,6 +12,7 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
const nextConfig = { const nextConfig = {
i18n: i18n, i18n: i18n,
productionBrowserSourceMaps: true, productionBrowserSourceMaps: true,
output: "standalone",
webpack(config) { webpack(config) {
config.module.rules.push({ config.module.rules.push({
test: /\.svg$/, test: /\.svg$/,

93
apps/web/package.json Normal file
View file

@ -0,0 +1,93 @@
{
"name": "app",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "TAILWIND_MODE=watch next dev",
"build": "next build",
"analyze": "ANALYZE=true next build",
"start": "next start",
"lint": "eslint .",
"lint:tsc": "tsc --noEmit",
"lint:i18n": "i18n-unused remove-unused",
"test": "PORT=3001 playwright test",
"test:codegen": "playwright codegen http://localhost:3000",
"docker:start": "./scripts/docker-start.sh"
},
"dependencies": {
"@floating-ui/react-dom-interactions": "^0.13.3",
"@headlessui/react": "^1.7.7",
"@next/bundle-analyzer": "^12.3.4",
"@radix-ui/react-popover": "^1.0.3",
"@rallly/database": "*",
"@sentry/nextjs": "^7.33.0",
"@svgr/webpack": "^6.5.1",
"@tailwindcss/typography": "^0.5.9",
"@tanstack/react-query": "^4.22.0",
"@trpc/client": "^10.13.0",
"@trpc/next": "^10.13.0",
"@trpc/react-query": "^10.13.0",
"@trpc/server": "^10.13.0",
"@vercel/analytics": "^0.1.8",
"accept-language-parser": "^1.5.0",
"autoprefixer": "^10.4.13",
"clsx": "^1.1.1",
"dayjs": "^1.11.7",
"eta": "^2.0.0",
"framer-motion": "^6.5.1",
"i18next": "^22.4.9",
"iron-session": "^6.3.1",
"js-cookie": "^3.0.1",
"lodash": "^4.17.21",
"nanoid": "^4.0.0",
"next": "^13.2.1",
"next-i18next": "^13.0.3",
"next-seo": "^5.15.0",
"nodemailer": "^6.9.0",
"postcss": "^8.4.21",
"posthog-js": "^1.42.3",
"react": "^18.2.0",
"react-big-calendar": "^1.5.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.42.1",
"react-hot-toast": "^2.4.0",
"react-i18next": "^12.1.4",
"react-linkify": "^1.0.0-alpha",
"react-use": "^17.4.0",
"smoothscroll-polyfill": "^0.4.4",
"spacetime": "^7.1.4",
"superjson": "^1.12.2",
"tailwindcss": "^3.2.4",
"tailwindcss-animate": "^1.0.5",
"timezone-soft": "^1.3.1",
"typescript": "^4.9.4",
"zod": "^3.20.2"
},
"devDependencies": {
"@playwright/test": "^1.31.1",
"@rallly/tsconfig": "*",
"@types/accept-language-parser": "^1.5.3",
"@types/lodash": "^4.14.178",
"@types/nodemailer": "^6.4.4",
"@types/react": "^18.0.28",
"@types/react-big-calendar": "^0.31.0",
"@types/react-dom": "^18.0.11",
"@types/react-linkify": "^1.0.1",
"@types/smoothscroll-polyfill": "^0.3.1",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.50.0",
"cheerio": "^1.0.0-rc.12",
"eslint": "^7.26.0",
"eslint-config-next": "^13.0.1",
"eslint-config-turbo": "^0.0.9",
"eslint-import-resolver-typescript": "^2.7.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"i18n-unused": "^0.12.0",
"prettier-plugin-tailwindcss": "^0.1.8",
"smtp-tester": "^2.0.1",
"wait-on": "^6.0.1"
}
}

View file

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 386 B

After

Width:  |  Height:  |  Size: 386 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 707 B

After

Width:  |  Height:  |  Size: 707 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

Some files were not shown because too many files have changed in this diff Show more