Skip to content

Commit 0a836ae

Browse files
authored
♻️ Switch to turborepo (#532)
1 parent 41ef81a commit 0a836ae

File tree

419 files changed

+2293
-2497
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

419 files changed

+2293
-2497
lines changed

.dockerignore

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ node_modules
22
.git
33
.github
44
.vscode
5+
tsconfig.tsbuildinfo
56
.env
67
.sentryclirc
78
sentry.properties
89
Dockerfile
910
docker-compose.yml
10-
docs
11-
README.md
11+
/docs
12+
README.md
13+
node_modules

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": ["next/core-web-vitals"],
2+
"extends": ["next/core-web-vitals", "turbo"],
33
"plugins": ["simple-import-sort", "@typescript-eslint"],
44
"overrides": [
55
{

.github/workflows/ci.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ jobs:
1111
linting:
1212
name: Linting
1313
runs-on: ubuntu-latest
14+
env:
15+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
16+
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
1417
steps:
1518
- name: Check out repository code
1619
uses: actions/checkout@v3
@@ -35,7 +38,9 @@ jobs:
3538
name: Run tests
3639
# Containers must run in Linux based operating systems
3740
runs-on: ubuntu-latest
38-
41+
env:
42+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
43+
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
3944
steps:
4045
# Downloads a copy of the code in your repository before running CI tests
4146
- name: Check out repository code
@@ -66,7 +71,7 @@ jobs:
6671
yarn wait-on --timeout 60000 tcp:localhost:5432
6772
6873
- name: Deploy migrations
69-
run: yarn prisma migrate deploy
74+
run: yarn db:deploy
7075

7176
- name: Install playwright dependencies
7277
run: yarn playwright install --with-deps chromium

.github/workflows/docker-image.yml

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
- name: Build and publish image
4040
uses: docker/build-push-action@v4
4141
with:
42+
file: /apps/web/Dockerfile
4243
platforms: linux/arm64,linux/amd64
4344
push: true
4445
cache-from: type=gha

.gitignore

+4-11
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,8 @@ yarn-error.log*
3131
.env.test.local
3232
.env.production.local
3333

34-
# vercel
35-
.vercel
36-
37-
# Sentry
38-
.sentryclirc
39-
40-
# playwright
41-
/playwright-report
42-
/test-results
43-
4434
# ts
45-
tsconfig.tsbuildinfo
35+
tsconfig.tsbuildinfo
36+
37+
# Turbo
38+
.turbo

Dockerfile

-25
This file was deleted.

apps/web/.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
3+
# Sentry
4+
.sentryclirc
5+
6+
# playwright
7+
/playwright-report
8+
/test-results

apps/web/Dockerfile

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM node:lts AS builder
2+
3+
WORKDIR /app
4+
RUN yarn global add turbo
5+
COPY . .
6+
RUN turbo prune --scope=app --docker
7+
8+
FROM node:lts AS installer
9+
10+
WORKDIR /app
11+
COPY .gitignore .gitignore
12+
COPY --from=builder /app/out/json/ .
13+
COPY --from=builder /app/out/yarn.lock ./yarn.lock
14+
RUN yarn --network-timeout 1000000
15+
16+
# Build the project
17+
COPY --from=builder /app/out/full/ .
18+
COPY turbo.json turbo.json
19+
RUN yarn turbo run generate
20+
RUN yarn turbo run build --filter=app...
21+
22+
FROM node:lts AS runner
23+
24+
WORKDIR /app
25+
26+
RUN yarn global add prisma
27+
# Don't run production as root
28+
RUN addgroup --system --gid 1001 nodejs
29+
RUN adduser --system --uid 1001 nextjs
30+
USER nextjs
31+
32+
COPY --from=builder --chown=nextjs:nodejs /app/scripts/docker-start.sh ./
33+
COPY --from=builder --chown=nextjs:nodejs /app/packages/database/prisma ./prisma
34+
35+
COPY --from=installer /app/apps/web/next.config.js .
36+
COPY --from=installer /app/apps/web/package.json .
37+
38+
ENV PORT 3000
39+
EXPOSE 3000
40+
41+
# Automatically leverage output traces to reduce image size
42+
# https://nextjs.org/docs/advanced-features/output-file-tracing
43+
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
44+
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static
45+
COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public
46+
47+
CMD ["./docker-start.sh"]
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.

next.config.js apps/web/next.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
1212
const nextConfig = {
1313
i18n: i18n,
1414
productionBrowserSourceMaps: true,
15+
output: "standalone",
1516
webpack(config) {
1617
config.module.rules.push({
1718
test: /\.svg$/,

apps/web/package.json

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"name": "app",
3+
"version": "0.0.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "TAILWIND_MODE=watch next dev",
7+
"build": "next build",
8+
"analyze": "ANALYZE=true next build",
9+
"start": "next start",
10+
"lint": "eslint .",
11+
"lint:tsc": "tsc --noEmit",
12+
"lint:i18n": "i18n-unused remove-unused",
13+
"test": "PORT=3001 playwright test",
14+
"test:codegen": "playwright codegen http://localhost:3000",
15+
"docker:start": "./scripts/docker-start.sh"
16+
},
17+
"dependencies": {
18+
"@floating-ui/react-dom-interactions": "^0.13.3",
19+
"@headlessui/react": "^1.7.7",
20+
"@next/bundle-analyzer": "^12.3.4",
21+
"@radix-ui/react-popover": "^1.0.3",
22+
"@rallly/database": "*",
23+
"@sentry/nextjs": "^7.33.0",
24+
"@svgr/webpack": "^6.5.1",
25+
"@tailwindcss/typography": "^0.5.9",
26+
"@tanstack/react-query": "^4.22.0",
27+
"@trpc/client": "^10.13.0",
28+
"@trpc/next": "^10.13.0",
29+
"@trpc/react-query": "^10.13.0",
30+
"@trpc/server": "^10.13.0",
31+
"@vercel/analytics": "^0.1.8",
32+
"accept-language-parser": "^1.5.0",
33+
"autoprefixer": "^10.4.13",
34+
"clsx": "^1.1.1",
35+
"dayjs": "^1.11.7",
36+
"eta": "^2.0.0",
37+
"framer-motion": "^6.5.1",
38+
"i18next": "^22.4.9",
39+
"iron-session": "^6.3.1",
40+
"js-cookie": "^3.0.1",
41+
"lodash": "^4.17.21",
42+
"nanoid": "^4.0.0",
43+
"next": "^13.2.1",
44+
"next-i18next": "^13.0.3",
45+
"next-seo": "^5.15.0",
46+
"nodemailer": "^6.9.0",
47+
"postcss": "^8.4.21",
48+
"posthog-js": "^1.42.3",
49+
"react": "^18.2.0",
50+
"react-big-calendar": "^1.5.0",
51+
"react-dom": "^18.2.0",
52+
"react-hook-form": "^7.42.1",
53+
"react-hot-toast": "^2.4.0",
54+
"react-i18next": "^12.1.4",
55+
"react-linkify": "^1.0.0-alpha",
56+
"react-use": "^17.4.0",
57+
"smoothscroll-polyfill": "^0.4.4",
58+
"spacetime": "^7.1.4",
59+
"superjson": "^1.12.2",
60+
"tailwindcss": "^3.2.4",
61+
"tailwindcss-animate": "^1.0.5",
62+
"timezone-soft": "^1.3.1",
63+
"typescript": "^4.9.4",
64+
"zod": "^3.20.2"
65+
},
66+
"devDependencies": {
67+
"@playwright/test": "^1.31.1",
68+
"@rallly/tsconfig": "*",
69+
"@types/accept-language-parser": "^1.5.3",
70+
"@types/lodash": "^4.14.178",
71+
"@types/nodemailer": "^6.4.4",
72+
"@types/react": "^18.0.28",
73+
"@types/react-big-calendar": "^0.31.0",
74+
"@types/react-dom": "^18.0.11",
75+
"@types/react-linkify": "^1.0.1",
76+
"@types/smoothscroll-polyfill": "^0.3.1",
77+
"@typescript-eslint/eslint-plugin": "^5.21.0",
78+
"@typescript-eslint/parser": "^5.50.0",
79+
"cheerio": "^1.0.0-rc.12",
80+
"eslint": "^7.26.0",
81+
"eslint-config-next": "^13.0.1",
82+
"eslint-config-turbo": "^0.0.9",
83+
"eslint-import-resolver-typescript": "^2.7.0",
84+
"eslint-plugin-import": "^2.22.1",
85+
"eslint-plugin-react": "^7.23.2",
86+
"eslint-plugin-react-hooks": "^4.2.0",
87+
"eslint-plugin-simple-import-sort": "^7.0.0",
88+
"i18n-unused": "^0.12.0",
89+
"prettier-plugin-tailwindcss": "^0.1.8",
90+
"smtp-tester": "^2.0.1",
91+
"wait-on": "^6.0.1"
92+
}
93+
}
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.
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.
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.

sample.env apps/web/sample.env

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/components/auth/login-form.tsx apps/web/src/components/auth/login-form.tsx

+12-9
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ import { trpc } from "../../utils/trpc";
99
import { Button } from "../button";
1010
import { TextInput } from "../text-input";
1111

12-
const VerifyCode: React.VoidFunctionComponent<{
12+
const VerifyCode: React.FunctionComponent<{
1313
email: string;
1414
onSubmit: (code: string) => Promise<void>;
1515
onResend: () => Promise<void>;
1616
onChange: () => void;
1717
}> = ({ onChange, onSubmit, email, onResend }) => {
18-
const { register, handleSubmit, setError, formState } =
19-
useForm<{ code: string }>();
18+
const { register, handleSubmit, setError, formState } = useForm<{
19+
code: string;
20+
}>();
2021
const { t } = useTranslation("app");
21-
const [resendStatus, setResendStatus] =
22-
React.useState<"ok" | "busy" | "disabled">("ok");
22+
const [resendStatus, setResendStatus] = React.useState<
23+
"ok" | "busy" | "disabled"
24+
>("ok");
2325

2426
const handleResend = async () => {
2527
setResendStatus("busy");
@@ -123,7 +125,7 @@ type RegisterFormData = {
123125
email: string;
124126
};
125127

126-
export const RegisterForm: React.VoidFunctionComponent<{
128+
export const RegisterForm: React.FunctionComponent<{
127129
onClickLogin?: React.MouseEventHandler;
128130
onRegistered: () => void;
129131
defaultValues?: Partial<RegisterFormData>;
@@ -263,16 +265,17 @@ export const RegisterForm: React.VoidFunctionComponent<{
263265
);
264266
};
265267

266-
export const LoginForm: React.VoidFunctionComponent<{
268+
export const LoginForm: React.FunctionComponent<{
267269
onClickRegister?: (
268270
e: React.MouseEvent<HTMLAnchorElement>,
269271
email: string,
270272
) => void;
271273
onAuthenticated: () => void;
272274
}> = ({ onAuthenticated, onClickRegister }) => {
273275
const { t } = useTranslation("app");
274-
const { register, handleSubmit, getValues, formState, setError } =
275-
useForm<{ email: string }>();
276+
const { register, handleSubmit, getValues, formState, setError } = useForm<{
277+
email: string;
278+
}>();
276279
const requestLogin = trpc.auth.requestLogin.useMutation();
277280
const authenticateLogin = trpc.auth.authenticateLogin.useMutation();
278281

src/components/auth/login-modal.tsx apps/web/src/components/auth/login-modal.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import { useModalContext } from "../modal/modal-provider";
66
import { useUser } from "../user-provider";
77
import { LoginForm, RegisterForm } from "./login-form";
88

9-
export const LoginModal: React.VoidFunctionComponent<{
9+
export const LoginModal: React.FunctionComponent<{
1010
onDone: () => void;
1111
}> = ({ onDone }) => {
1212
const [hasAccount, setHasAccount] = React.useState(false);
1313
const [defaultEmail, setDefaultEmail] = React.useState("");
1414

1515
return (
1616
<div className="w-[420px] max-w-full overflow-hidden bg-white shadow-sm">
17-
<div className="bg-pattern border-b border-t-4 border-t-primary-500 bg-slate-500/5 p-4 text-center sm:p-8">
17+
<div className="bg-pattern border-t-primary-500 border-b border-t-4 bg-slate-500/5 p-4 text-center sm:p-8">
1818
<Logo className="text-2xl" />
1919
</div>
2020
<div className="p-4 sm:p-6">

src/components/badge.tsx apps/web/src/components/badge.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import clsx from "clsx";
22
import React from "react";
33

4-
const Badge: React.VoidFunctionComponent<{
4+
const Badge: React.FunctionComponent<{
55
children?: React.ReactNode;
66
color?: "gray" | "amber" | "green" | "red" | "blue";
77
className?: string;
File renamed without changes.

src/components/compact-button.tsx apps/web/src/components/compact-button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface CompactButtonProps {
99
onClick?: () => void;
1010
}
1111

12-
const CompactButton: React.VoidFunctionComponent<CompactButtonProps> = ({
12+
const CompactButton: React.FunctionComponent<CompactButtonProps> = ({
1313
icon: Icon,
1414
children,
1515
onClick,
File renamed without changes.

src/components/cookie-consent.tsx apps/web/src/components/cookie-consent.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { getPortal } from "@/utils/selectors";
88

99
import CookiesIllustration from "./cookie-consent/cookies.svg";
1010

11-
const CookieConsentPopover: React.VoidFunctionComponent = () => {
11+
const CookieConsentPopover: React.FunctionComponent = () => {
1212
const [visible, setVisible] = React.useState(true);
1313

1414
return ReactDOM.createPortal(
@@ -40,7 +40,7 @@ const CookieConsentPopover: React.VoidFunctionComponent = () => {
4040
<div className="flex items-center space-x-6">
4141
<Link
4242
href="/privacy-policy"
43-
className="text-slate-400 hover:text-primary-500"
43+
className="hover:text-primary-500 text-slate-400"
4444
>
4545
Privacy Policy
4646
</Link>
@@ -49,7 +49,7 @@ const CookieConsentPopover: React.VoidFunctionComponent = () => {
4949
Cookies.set("rallly_cookie_consent", "1", { expires: 365 });
5050
setVisible(false);
5151
}}
52-
className="grow rounded-md bg-primary-500 px-5 py-1 font-semibold text-white shadow-sm transition-all hover:bg-primary-500/90 focus:ring-2 focus:ring-primary-200 active:bg-primary-600/90"
52+
className="bg-primary-500 hover:bg-primary-500/90 focus:ring-primary-200 active:bg-primary-600/90 grow rounded-md px-5 py-1 font-semibold text-white shadow-sm transition-all focus:ring-2"
5353
>
5454
OK
5555
</button>

0 commit comments

Comments
 (0)