Skip to content

Commit

Permalink
Merge pull request #138 from CE61-KMITL/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
TeetouchQQ authored Apr 6, 2023
2 parents 276d375 + 1f46b92 commit c63c308
Show file tree
Hide file tree
Showing 57 changed files with 5,890 additions and 854 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API_URL=
13 changes: 12 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
"extends": "next/core-web-vitals"
"extends": ["next/core-web-vitals", "prettier"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": [
"warn",
{
"endOfLine": "auto"
}
],
"no-unused-vars": "warn",
"no-console": "warn"
}
}
27 changes: 27 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Run TODO to Issue"
on:
pull_request:
workflow_dispatch:
inputs:
MANUAL_COMMIT_REF:
description: "The SHA of the commit to get the diff for"
required: true
MANUAL_BASE_REF:
description: "By default, the commit entered above is compared to the one directly before it; to go back further, enter an earlier SHA here"
required: false
push:
branches:
- "main"
- "dev"
jobs:
build:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- name: "TODO to Issue"
uses: "alstr/todo-to-issue-action@master"
with:
AUTO_P: true
env:
MANUAL_COMMIT_REF: ${{ inputs.MANUAL_COMMIT_REF }}
MANUAL_BASE_REF: ${{ inputs.MANUAL_BASE_REF }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
next-env.d.ts
6 changes: 6 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx commitlint --edit $1 || (echo "⛔ Commit Message Failed" && exit 1)

echo "✅ Commit Message Passed"
11 changes: 11 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm run format || (echo "⛔ Format Failed" && exit 1)
pnpm run lint || (echo "⛔ Lint Failed" && exit 1)
pnpm run build || (echo "⛔ Build Failed" && exit 1)

git add .

echo "✅ Format, Lint, Build Passed"

5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"plugins": ["prettier-plugin-tailwindcss"],
"singleQuote": true,
"trailingComma": "all"
}
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
59 changes: 59 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM node:18-alpine AS base

# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# 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 yarn global add pnpm && pnpm i --lockfile=false; \
else echo "Lockfile not found." && exit 1; \
fi


# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED 1

RUN yarn build

# If using npm comment out above and use below instead
#RUN npm run build

# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT 3000

CMD ["node", "server.js"]
22 changes: 18 additions & 4 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}
/** @type {import('next').NextConfig} */
module.exports = () => {
const rewrites = () => {
return [
{
source: '/api/:path*',
destination: `${process.env.API_URL}:path*`,
},
];
};
return {
rewrites,
reactStrictMode: true,

//uncomment if production build docker
//output: 'standalone',

module.exports = nextConfig
};
};
37 changes: 30 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,44 @@
"version": "0.1.0",
"private": true,
"scripts": {
"prepare": "husky install",
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"format": "prettier --write \"src/**/*.{ts,tsx,css}\""
},
"dependencies": {
"@next/font": "13.1.2",
"@types/node": "18.11.18",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.10",
"@hookform/resolvers": "^3.0.0",
"axios": "1.3.5",
"eslint": "8.32.0",
"eslint-config-next": "13.1.2",
"next": "13.1.2",
"eslint-config-next": "13.2.4",
"fuse.js": "^6.6.2",
"js-cookie": "^3.0.1",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.43.8",
"react-hot-toast": "^2.4.0",
"react-syntax-highlighter": "^15.5.0",
"zod": "^3.21.4"
},
"devDependencies": {
"@commitlint/cli": "^17.5.0",
"@commitlint/config-conventional": "^17.4.4",
"@types/js-cookie": "^3.0.3",
"@types/node": "18.11.18",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.10",
"@types/react-syntax-highlighter": "^15.5.6",
"autoprefixer": "^10.4.14",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.3",
"postcss": "^8.4.21",
"prettier": "^2.8.6",
"prettier-plugin-tailwindcss": "^0.2.5",
"tailwindcss": "^3.2.7",
"typescript": "4.9.4"
}
}
Empty file added pnpm
Empty file.
Loading

0 comments on commit c63c308

Please sign in to comment.