-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yusing
committed
Jan 19, 2025
0 parents
commit 5aff07d
Showing
103 changed files
with
10,833 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Dockerfile | ||
dev.Dockerfile | ||
Makefile | ||
.dockerignore | ||
.env | ||
next-env.d.ts | ||
node_modules | ||
npm-debug.log | ||
README.md | ||
.next | ||
.git | ||
.gitlab-ci.yml | ||
compose.yml | ||
|
||
.vscode | ||
.github | ||
.trunk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** @type {import("eslint").Linter.Config} */ | ||
const config = { | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": true | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"extends": [ | ||
"next/core-web-vitals", | ||
"plugin:@typescript-eslint/recommended-type-checked", | ||
"plugin:@typescript-eslint/stylistic-type-checked" | ||
], | ||
"rules": { | ||
"@typescript-eslint/array-type": "off", | ||
"@typescript-eslint/consistent-type-definitions": "off", | ||
"@typescript-eslint/consistent-type-imports": [ | ||
"warn", | ||
{ | ||
"prefer": "type-imports", | ||
"fixStyle": "inline-type-imports" | ||
} | ||
], | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", | ||
{ | ||
"argsIgnorePattern": "^_" | ||
} | ||
], | ||
"@typescript-eslint/require-await": "off", | ||
"@typescript-eslint/no-misused-promises": [ | ||
"error", | ||
{ | ||
"checksVoidReturn": { | ||
"attributes": false | ||
} | ||
} | ||
] | ||
} | ||
} | ||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# database | ||
/prisma/db.sqlite | ||
/prisma/db.sqlite-journal | ||
db.sqlite | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
next-env.d.ts | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
# do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables | ||
.env | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
|
||
# idea files | ||
.idea | ||
|
||
config_ui_gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
FROM node:lts-alpine AS base | ||
|
||
HEALTHCHECK NONE | ||
|
||
# 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 pnpm-lock.yaml ./ | ||
RUN corepack enable pnpm && \ | ||
pnpm i --frozen-lockfile --ignore-scripts | ||
|
||
# Rebuild the source code only when needed | ||
FROM base AS builder | ||
WORKDIR /app | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
RUN sed -i 's/config = {/config = { typescript: { ignoreBuildErrors: true }, eslint: { ignoreDuringBuilds: true },/' next.config.js | ||
|
||
# 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 corepack enable pnpm && pnpm run build | ||
|
||
# Production image, copy all the files and run next | ||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
ENV NODE_ENV=production | ||
ENV NEXT_TELEMETRY_DISABLED=1 | ||
|
||
RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs | ||
|
||
COPY --from=builder /app/public ./public | ||
|
||
# Set the correct permission for prerender cache | ||
RUN mkdir .next && chown nextjs:nodejs .next | ||
|
||
# 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 | ||
ENV NODE_ENV=production | ||
ENV HOSTNAME="0.0.0.0" | ||
|
||
CMD ["node", "server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.PHONY: build dev | ||
|
||
dev: | ||
docker compose up --build | ||
|
||
push-docker-io: | ||
BUILDER=build docker buildx build --platform linux/arm64,linux/amd64 -t docker.io/yusing/godoxy-frontend-nightly --push . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# GoDoxy Frontend | ||
|
||
This is the frontend for [GoDoxy](https://github.com/yusing/go-proxy). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# this docker compose file is for development only | ||
services: | ||
frontend: | ||
container_name: godoxy-frontend-next | ||
restart: no | ||
network_mode: host | ||
image: godoxy-frontend | ||
build: | ||
context: . | ||
dockerfile: dev.Dockerfile | ||
volumes: # for hot reloading | ||
- ./src:/app/src:ro | ||
- ./public:/app/public:ro | ||
- ./node_modules:/app/node_modules:ro | ||
- ./next.config.js:/app/next.config.js:ro | ||
- ./package.json:/app/package.json:ro | ||
- ./tsconfig.json:/app/tsconfig.json:ro | ||
labels: | ||
proxy.aliases: godoxy-dev | ||
proxy.*: | | ||
port: 3002 | ||
healthcheck: | ||
disabled: true | ||
homepage: | ||
show: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM node:lts-alpine | ||
|
||
HEALTHCHECK NONE | ||
|
||
# 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 | ||
|
||
COPY next.config.js tailwind.config.ts postcss.config.js tsconfig.json .eslintrc.cjs ./ | ||
|
||
COPY package.json pnpm-lock.yaml ./ | ||
RUN corepack enable pnpm | ||
|
||
ENV NEXT_TELEMETRY_DISABLED=1 | ||
ENV NODE_ENV=development | ||
|
||
RUN chown -R 1000:1000 /app | ||
|
||
USER 1000:1000 | ||
|
||
RUN mkdir .next | ||
|
||
CMD ["pnpm", "run", "dev_docker"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful | ||
* for Docker builds. | ||
*/ | ||
import "./src/env.js"; | ||
|
||
/** @type {import("next").NextConfig} */ | ||
const config = { | ||
experimental: { | ||
optimizePackageImports: ["@chakra-ui/react"], | ||
}, | ||
output: "standalone", | ||
async rewrites() { | ||
return [ | ||
{ | ||
source: "/api/:path*", | ||
destination: `http://127.0.0.1:8888/v1/:path*`, // Proxy to Backend apiBaseURL, | ||
}, | ||
]; | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "godoxy-frontend", | ||
"version": "0.8.2", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"build": "next build", | ||
"check": "next lint && tsc --noEmit", | ||
"dev": "next dev --turbo", | ||
"lint": "next lint", | ||
"lint:fix": "next lint --fix", | ||
"preview": "next build && next start", | ||
"start": "next start", | ||
"typecheck": "tsc --noEmit", | ||
"format:write": "prettier --write \"**/*.{ts,tsx,js,jsx,mdx}\" --cache", | ||
"format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,mdx}\" --cache", | ||
"dev_docker": "pnpm i --frozen-lockfile --ignore-scripts && pnpm dev -H 0.0.0.0 -p 3002", | ||
"gen_ui": "bun ./config_ui_gen/main.ts" | ||
}, | ||
"dependencies": { | ||
"@chakra-ui/react": "^3.3.3", | ||
"@codemirror/lang-yaml": "^6.1.2", | ||
"@codemirror/lint": "^6.8.4", | ||
"@emotion/react": "^11.14.0", | ||
"@react-stately/data": "^3.12.1", | ||
"@t3-oss/env-nextjs": "^0.11.1", | ||
"@uidotdev/usehooks": "^2.4.1", | ||
"@uiw/react-codemirror": "^4.23.7", | ||
"ajv": "^8.17.1", | ||
"ajv-formats": "^3.0.1", | ||
"ansi-to-html": "^0.7.2", | ||
"geist": "^1.3.1", | ||
"http-status-codes": "^2.3.0", | ||
"loglevel": "^1.9.2", | ||
"next": "^15.1.5", | ||
"next-themes": "^0.4.4", | ||
"react": "^19.0.0", | ||
"react-dom": "^19.0.0", | ||
"react-icons": "^5.4.0", | ||
"thememirror": "^2.0.1", | ||
"yaml": "^2.7.0", | ||
"zod": "^3.24.1" | ||
}, | ||
"devDependencies": { | ||
"@react-types/shared": "^3.27.0", | ||
"@types/eslint": "^9.6.1", | ||
"@types/node": "^22.10.7", | ||
"@types/react": "^19.0.7", | ||
"@types/react-dom": "^19.0.3", | ||
"@typescript-eslint/eslint-plugin": "^8.20.0", | ||
"@typescript-eslint/parser": "^8.20.0", | ||
"eslint": "^9.18.0", | ||
"eslint-config-next": "^15.1.5", | ||
"postcss": "^8.5.1", | ||
"prettier": "^3.4.2", | ||
"prettier-plugin-tailwindcss": "^0.6.10", | ||
"tailwindcss": "^3.4.17", | ||
"typescript": "^5.7.3" | ||
}, | ||
"ct3aMetadata": { | ||
"initVersion": "7.38.1" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
Oops, something went wrong.