Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit c133a96

Browse files
authored
Merge pull request #10 from vim/frontend-theme
Frontend theme
2 parents 279eb59 + e1fe27d commit c133a96

31 files changed

+1380
-263
lines changed

.development.docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
version: "3"
22
services:
3-
app:
3+
web:
44
container_name: app
55
environment:
66
- CMS_API=http://cms:1337/api
77
build:
8-
context: ./app
9-
dockerfile: Dockerfile
8+
context: ./web
9+
dockerfile: Dockerfile.dev
1010
volumes:
11-
- ./app/src/app:/opt/app/src/app
11+
- ./web/src:/app/src
1212
ports:
1313
- 3000:3000
1414
networks:

cms/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:18-alpine
1+
FROM node:18.18-alpine3.17
22
# Installing libvips-dev for sharp Compatibility
33
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev git
44
ARG NODE_ENV=development

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "website_next_generation",
3+
"version": "1.0.0",
4+
"description": "Next generation of Vim Landing Page",
5+
"scripts": {
6+
"dev": "docker compose -f .development.docker-compose.yml up -d --build",
7+
"setup": "node ./cms/init-env.js"
8+
},
9+
"author": "",
10+
"license": "ISC"
11+
}

web/.eslintrc.json

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
11
{
2-
"extends": "next/core-web-vitals"
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"project": "**/tsconfig.json",
5+
"tsconfigRootDir": "__dirname",
6+
"sourceType": "module"
7+
},
8+
"plugins": ["@typescript-eslint", "eslint-plugin-import-helpers"],
9+
"extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended", "prettier"],
10+
"rules": {
11+
"@typescript-eslint/no-unused-vars": "error",
12+
"@typescript-eslint/no-explicit-any": "error",
13+
"react/no-unescaped-entities": "off",
14+
"no-console": "warn",
15+
"@typescript-eslint/ban-ts-comment": "off",
16+
"import-helpers/order-imports": [
17+
"error",
18+
{
19+
"newlinesBetween": "never",
20+
"groups": [
21+
"/^react$/",
22+
"/next/",
23+
"module",
24+
"/@components/",
25+
"/@helpers/",
26+
"/@hooks/",
27+
"/types/",
28+
"/module.scss/",
29+
"/public/",
30+
["parent", "sibling", "index"]
31+
],
32+
"alphabetize": { "order": "desc", "ignoreCase": true }
33+
}
34+
]
35+
}
336
}

web/.prettierrc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
2-
"trailingComma": "es5",
3-
"tabWidth": 2,
4-
"semi": false,
5-
"singleQuote": true
2+
"semi": true,
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"tabWidth": 4,
6+
"printWidth": 120,
7+
"useTabs": false
68
}

web/Dockerfile

Lines changed: 0 additions & 16 deletions
This file was deleted.

web/Dockerfile.dev

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM node:18-alpine
2+
3+
WORKDIR /app
4+
5+
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
6+
RUN \
7+
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
8+
elif [ -f package-lock.json ]; then npm ci; \
9+
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i; \
10+
# Allow install without lockfile, so example works even without Node.js installed locally
11+
else echo "Warning: Lockfile not found. It is recommended to commit lockfiles to version control." && yarn install; \
12+
fi
13+
14+
COPY src ./src
15+
COPY public ./public
16+
COPY next.config.js .
17+
COPY tsconfig.json .
18+
COPY postcss.config.js .
19+
COPY tailwind.config.ts .
20+
21+
ENV NEXT_TELEMETRY_DISABLED 1
22+
23+
CMD \
24+
if [ -f yarn.lock ]; then yarn dev; \
25+
elif [ -f package-lock.json ]; then npm run dev; \
26+
elif [ -f pnpm-lock.yaml ]; then pnpm dev; \
27+
else yarn dev; \
28+
fi

web/Dockerfile.prod

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
FROM node:18-alpine AS base
2+
3+
# Step 1. Rebuild the source code only when needed
4+
FROM base AS builder
5+
6+
WORKDIR /app
7+
8+
# Install dependencies based on the preferred package manager
9+
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
10+
# Omit --production flag for TypeScript devDependencies
11+
RUN \
12+
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
13+
elif [ -f package-lock.json ]; then npm ci; \
14+
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i; \
15+
# Allow install without lockfile, so example works even without Node.js installed locally
16+
else echo "Warning: Lockfile not found. It is recommended to commit lockfiles to version control." && yarn install; \
17+
fi
18+
19+
COPY src ./src
20+
COPY public ./public
21+
COPY next.config.js .
22+
COPY tsconfig.json .
23+
24+
# Environment variables must be present at build time
25+
# https://github.com/vercel/next.js/discussions/14030
26+
ARG ENV_VARIABLE
27+
ENV ENV_VARIABLE=${ENV_VARIABLE}
28+
ARG NEXT_PUBLIC_ENV_VARIABLE
29+
ENV NEXT_PUBLIC_ENV_VARIABLE=${NEXT_PUBLIC_ENV_VARIABLE}
30+
31+
ENV NEXT_TELEMETRY_DISABLED 1
32+
33+
# Build Next.js based on the preferred package manager
34+
RUN \
35+
if [ -f yarn.lock ]; then yarn build; \
36+
elif [ -f package-lock.json ]; then npm run build; \
37+
elif [ -f pnpm-lock.yaml ]; then pnpm build; \
38+
else yarn build; \
39+
fi
40+
41+
42+
# Step 2. Production image, copy all the files and run next
43+
FROM base AS runner
44+
45+
WORKDIR /app
46+
47+
RUN addgroup --system --gid 1001 nodejs
48+
RUN adduser --system --uid 1001 nextjs
49+
USER nextjs
50+
51+
COPY --from=builder /app/public ./public
52+
53+
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
54+
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
55+
56+
# Environment variables must be redefined at run time
57+
ARG ENV_VARIABLE
58+
ENV ENV_VARIABLE=${ENV_VARIABLE}
59+
ARG NEXT_PUBLIC_ENV_VARIABLE
60+
ENV NEXT_PUBLIC_ENV_VARIABLE=${NEXT_PUBLIC_ENV_VARIABLE}
61+
62+
# Uncomment the following line to disable telemetry at run time
63+
ENV NEXT_TELEMETRY_DISABLED 1
64+
65+
66+
CMD ["node", "server.js"]

web/next.config.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {}
2+
const nextConfig = {
3+
webpackDevMiddleware: (config) => {
4+
config.watchOptions = {
5+
poll: 1000,
6+
aggregateTimeout: 300,
7+
};
8+
return config;
9+
},
10+
};
311

4-
module.exports = nextConfig
12+
module.exports = nextConfig;

0 commit comments

Comments
 (0)