Skip to content

Commit 9fbbf75

Browse files
Switch to pnpm (#11)
1 parent 6a7b720 commit 9fbbf75

File tree

250 files changed

+16386
-13517
lines changed

Some content is hidden

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

250 files changed

+16386
-13517
lines changed

Diff for: .dockerignore

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
**/dist
44

55
# Environment files
6-
client/.env
7-
server/.env
6+
**/.env
7+
.env
88

99
# Build artifacts
10-
client/build
11-
client/dist
12-
server/dist
10+
apps/client/build
11+
apps/client/dist
12+
apps/server/dist
1313

1414
# Logs
1515
**/*.log
@@ -26,5 +26,5 @@ docker-compose.yml
2626
Thumbs.db
2727

2828
# Prisma directory - make sure to exclude specific files if necessary, not the directory itself
29-
!server/prisma/
30-
!server/prisma/schema.prisma
29+
!packages/prisma/prisma/
30+
!packages/prisma/prisma/schema.prisma

Diff for: .gitignore

+34-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
11
.DS_Store
22
.vscode
3-
.env
3+
.env
4+
node_modules
5+
dist
6+
build
7+
8+
# Logs
9+
logs
10+
*.log
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
pnpm-debug.log*
15+
lerna-debug.log*
16+
17+
node_modules
18+
dist
19+
dist-ssr
20+
*.local
21+
22+
# Editor directories and files
23+
.vscode/*
24+
!.vscode/extensions.json
25+
.idea
26+
.DS_Store
27+
*.suo
28+
*.ntvs*
29+
*.njsproj
30+
*.sln
31+
*.sw?
32+
.vite
33+
34+
tsconfig.tsbuildinfo
35+
36+
packages/prisma/src/generated

Diff for: .npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sync-injected-deps-after-scripts[]=build
2+
inject-workspace-packages=true

Diff for: .prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"tabWidth": 4,
5+
"printWidth": 120,
6+
"semi": true
7+
}

Diff for: Dockerfile

+51-34
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,63 @@
1-
# Stage 1: Build the React app
2-
FROM node:20-alpine3.20 AS client-builder
3-
WORKDIR /app
4-
COPY client/package.json client/yarn.lock ./
5-
COPY client ./
6-
RUN yarn install
7-
RUN yarn build
8-
9-
# Copy sourcemaps to a separate directory
10-
RUN mkdir -p /sourcemaps
11-
RUN cp -R dist/assets/ /sourcemaps
12-
RUN rm dist/assets/*.map
13-
14-
# Stage 2: Build the NestJS server
15-
FROM node:20-alpine3.20 AS server-builder
16-
WORKDIR /app
17-
COPY server/package.json server/yarn.lock ./
18-
COPY server ./
19-
RUN yarn install
20-
RUN npx prisma generate
21-
RUN yarn build
22-
RUN mkdir -p /sourcemaps
23-
RUN cp -R dist/ /sourcemaps
24-
25-
# Stage 3: Production container
26-
FROM node:20-alpine3.20
27-
WORKDIR /app
1+
# Base image with pnpm installed
2+
FROM node:20-alpine3.20 AS base
3+
#RUN apt-get update -y && apt-get install -y openssl
4+
RUN npm install -g pnpm@latest
5+
6+
# Set environment variables for pnpm
7+
ENV PNPM_HOME="/pnpm"
8+
ENV PATH="$PNPM_HOME:$PATH"
9+
10+
# Build stage
11+
FROM base AS build
12+
WORKDIR /usr/src/app
13+
14+
# Copy all files to the container
15+
COPY . .
16+
17+
# Install dependencies and build all apps/packages
18+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
19+
RUN pnpm build
20+
21+
# Deploy production builds for client and server
22+
RUN pnpm deploy --filter=client --prod /prod/client
23+
RUN pnpm deploy --filter=server --prod /prod/server
24+
RUN pnpm deploy --filter=@boilerplate/prisma --prod /prod/database
25+
26+
# Extract sourcemaps for client
27+
RUN mkdir -p /sourcemaps-client
28+
RUN cp -R /prod/client/dist/assets/*.map /sourcemaps-client
29+
RUN rm /prod/client/dist/assets/*.map
30+
31+
# Extract sourcemaps for server
32+
RUN mkdir -p /sourcemaps-server
33+
RUN cp -R /prod/server/dist/*.map /sourcemaps-server
34+
RUN rm /prod/server/dist/*.map
35+
36+
# Production stage
37+
FROM node:20-alpine3.20 AS production
38+
#RUN apt-get update -y && apt-get install -y openssl
39+
WORKDIR /apps
2840

2941
# Copy server build
30-
COPY --from=server-builder /app/dist ./server
31-
COPY --from=server-builder /app/node_modules ./node_modules
32-
COPY --from=server-builder /app/prisma ./prisma
42+
COPY --from=build /prod/server ./server
3343

3444
# Copy client build for static file serving
35-
COPY --from=client-builder /app/dist ./server/public
45+
COPY --from=build /prod/client/dist ./server/dist/public
46+
47+
# Copy the @boilerplate/database package (for Prisma CLI and schema)
48+
COPY --from=build /prod/database ./database
3649

3750
# Expose sourcemaps as a build artifact
38-
COPY --from=client-builder /sourcemaps /sourcemaps-client
39-
COPY --from=server-builder /sourcemaps/dist /sourcemaps-server
51+
COPY --from=build /sourcemaps-client /sourcemaps-client
52+
COPY --from=build /sourcemaps-server /sourcemaps-server
4053

4154
# Set environment variables
4255
ENV PORT=3000
4356
EXPOSE 3000
4457

58+
# Set the Prisma schema path explicitly
59+
ENV PRISMA_SCHEMA_PATH=/apps/database/prisma/schema.prisma
60+
4561
# Start the NestJS server
46-
CMD ["sh", "-c", "npx prisma migrate deploy && node server/src/main.js"]
62+
CMD ["sh", "-c", "cd /apps/database && npx prisma migrate deploy --schema $PRISMA_SCHEMA_PATH && cd ../server && node dist/main.js"]
63+
#CMD ["sh", "-c", "tail -f /dev/null"]

Diff for: apps/client/.eslintrc.cjs

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended'],
5+
ignorePatterns: ['dist', '.eslintrc.cjs'],
6+
parser: '@typescript-eslint/parser',
7+
plugins: ['react-refresh', 'simple-import-sort'],
8+
rules: {
9+
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
10+
'no-restricted-imports': [
11+
'error',
12+
{
13+
patterns: ['.*'],
14+
},
15+
],
16+
'simple-import-sort/imports': [
17+
'error',
18+
{
19+
groups: [
20+
// 1. Node.js builtins and external packages from node_modules
21+
['^(node:)?\\w', '^@(?!server|client|boilerplate)\\w'],
22+
23+
// 2. Local imports (from the current app/package)
24+
// This depends on which package you're in
25+
// For @client package:
26+
['^@server'],
27+
28+
// 3. Imports from other apps/packages in your monorepo
29+
['^@client', '^@boilerplate'],
30+
31+
// 4. Side effect imports
32+
['^\\u0000'],
33+
34+
// 5. Parent imports. Put `..` last.
35+
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
36+
37+
// 6. Other relative imports. Put same-folder imports and `.` last.
38+
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
39+
],
40+
},
41+
],
42+
},
43+
};
File renamed without changes.

Diff for: client/README.md renamed to apps/client/README.md

Diff for: apps/client/components.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "default",
4+
"rsc": false,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "tailwind.config.js",
8+
"css": "src/assets/global.css",
9+
"baseColor": "slate",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"aliases": {
14+
"components": "@/components",
15+
"utils": "@/lib/utils"
16+
}
17+
}
File renamed without changes.

Diff for: client/package.json renamed to apps/client/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
2-
"name": "website",
3-
"version": "0.2.1",
2+
"name": "client",
3+
"version": "0.3",
44
"type": "module",
55
"license": "MIT",
66
"author": "Jonathan Schad",
77
"scripts": {
88
"dev": "vite",
99
"build": "yarn generate-license-attribution && tsc && vite build",
1010
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
11+
"lint:fix": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix",
1112
"preview": "vite preview",
1213
"generate-license-attribution": "license-checker-rseidelsohn --relativeLicensePath --relativeModulePath --json --out src/assets/licenses.json"
1314
},
File renamed without changes.
File renamed without changes.

Diff for: client/src/Analytics.tsx renamed to apps/client/src/Analytics.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import * as Sentry from '@sentry/react';
21
import Plausible from 'plausible-tracker';
32
import { useEffect, useRef } from 'react';
43
import { createRoutesFromChildren, matchRoutes, useLocation, useNavigationType } from 'react-router-dom';
5-
6-
import { config } from '@/config';
4+
import * as Sentry from '@sentry/react';
75

86
// eslint-disable-next-line no-restricted-imports
97
import packageJson from '../package.json';
108

9+
import { config } from '@/config';
10+
1111
export const Analytics = () => {
1212
const plausible = useRef<ReturnType<typeof Plausible> | null>(null);
1313
const sentryClient = useRef<ReturnType<typeof Sentry.init> | null>(null);

Diff for: client/src/App.tsx renamed to apps/client/src/App.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import { QueryClient, QueryClientProvider } from 'react-query';
2+
13
import '@/i18n/i18n';
24
import '/node_modules/flag-icons/css/flag-icons.min.css';
35

4-
import { QueryClient, QueryClientProvider } from 'react-query';
5-
66
import { Analytics } from '@/Analytics';
77
import LoadingApplication from '@/pages/LoadingApplication';
88
import { Routes } from '@/Routes';
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.

Diff for: client/src/components/google-oauth-button/GoogleOAuthButton.tsx renamed to apps/client/src/components/google-oauth-button/GoogleOAuthButton.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/* eslint-disable no-restricted-imports */
2-
import './google-oauth-button.css';
3-
42
import { useTranslation } from 'react-i18next';
53
import { useMutation, useQueryClient } from 'react-query';
64

7-
import { startGoogleOAuthFlow } from '@/repository/login';
5+
import './google-oauth-button.css';
86

97
import GoogleSVG from './google.svg?react';
108

9+
import { startGoogleOAuthFlow } from '@/repository/login';
10+
1111
export const GoogleOAuthButton = () => {
1212
const { t } = useTranslation('common');
1313
const queryClient = useQueryClient();
File renamed without changes.

Diff for: client/src/components/ui/avatar.tsx renamed to apps/client/src/components/ui/avatar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as AvatarPrimitive from '@radix-ui/react-avatar';
21
import * as React from 'react';
2+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
33

44
import { cn } from '@/lib/utils';
55

Diff for: client/src/components/ui/button.tsx renamed to apps/client/src/components/ui/button.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Slot } from '@radix-ui/react-slot';
21
import { cva, type VariantProps } from 'class-variance-authority';
32
import * as React from 'react';
3+
import { Slot } from '@radix-ui/react-slot';
44

55
import { cn } from '@/lib/utils';
66

@@ -44,4 +44,5 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
4444
);
4545
Button.displayName = 'Button';
4646

47+
// eslint-disable-next-line react-refresh/only-export-components
4748
export { Button, buttonVariants };

Diff for: apps/client/src/components/ui/card.tsx

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import * as React from 'react';
2+
3+
import { cn } from '@/lib/utils';
4+
5+
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (
6+
<div ref={ref} className={cn('rounded-lg border bg-card text-card-foreground shadow-sm', className)} {...props} />
7+
));
8+
Card.displayName = 'Card';
9+
10+
const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
11+
({ className, ...props }, ref) => (
12+
<div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />
13+
),
14+
);
15+
CardHeader.displayName = 'CardHeader';
16+
17+
const CardTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
18+
({ className, ...props }, ref) => (
19+
<h3 ref={ref} className={cn('text-2xl font-semibold leading-none tracking-tight', className)} {...props} />
20+
),
21+
);
22+
CardTitle.displayName = 'CardTitle';
23+
24+
const CardDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
25+
({ className, ...props }, ref) => (
26+
<p ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
27+
),
28+
);
29+
CardDescription.displayName = 'CardDescription';
30+
31+
const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
32+
({ className, ...props }, ref) => <div ref={ref} className={cn('p-6 pt-0', className)} {...props} />,
33+
);
34+
CardContent.displayName = 'CardContent';
35+
36+
const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
37+
({ className, ...props }, ref) => (
38+
<div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />
39+
),
40+
);
41+
CardFooter.displayName = 'CardFooter';
42+
43+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };

Diff for: client/src/components/ui/checkbox-input.tsx renamed to apps/client/src/components/ui/checkbox-input.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
21
import * as React from 'react';
2+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
33

44
import { Checkbox, CheckboxProps } from '@/components/ui/checkbox';
55

Diff for: client/src/components/ui/checkbox.tsx renamed to apps/client/src/components/ui/checkbox.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
21
import { Check } from 'lucide-react';
32
import * as React from 'react';
3+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
44

55
import { cn } from '@/lib/utils';
66
export interface CheckboxProps

Diff for: client/src/components/ui/data-table.tsx renamed to apps/client/src/components/ui/data-table.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useState } from 'react';
12
import {
23
ColumnDef,
34
flexRender,
@@ -9,7 +10,6 @@ import {
910
SortingState,
1011
useReactTable,
1112
} from '@tanstack/react-table';
12-
import { useState } from 'react';
1313

1414
import { Button } from '@/components/ui/button';
1515
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';

0 commit comments

Comments
 (0)