-
Notifications
You must be signed in to change notification settings - Fork 31
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
0 parents
commit 7d78c7a
Showing
578 changed files
with
49,700 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,8 @@ | ||
Dockerfile | ||
.dockerignore | ||
node_modules | ||
npm-debug.log | ||
README.md | ||
.next | ||
.git | ||
manual |
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,12 @@ | ||
NEXT_PUBLIC_API_BASE_URL=https://test-api.openbuild.xyz/ | ||
NEXT_PUBLIC_APP_URL=http://localhost:3000 | ||
|
||
NEXT_PUBLIC_GA_ID= | ||
NEXT_PUBLIC_GA_KEY= | ||
|
||
NEXTAUTH_URL=http://localhost:3000 | ||
NEXTAUTH_SECRET= | ||
|
||
NEXT_PUBLIC_GITHUB_ID= | ||
NEXT_PUBLIC_GOOGLE_ID= | ||
NEXT_PUBLIC_ASPECTA_ID= |
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,28 @@ | ||
{ | ||
"extends": [ | ||
"next", | ||
"react-app", | ||
"plugin:react/recommended", | ||
"plugin:react-hooks/recommended", | ||
"eslint:recommended" | ||
], | ||
"rules": { | ||
"unused-imports/no-unused-imports": "error", | ||
"no-empty-function": "off", | ||
"@next/next/no-img-element": "off", | ||
"react/react-in-jsx-scope": "off", | ||
"no-script-url": "off", | ||
"object-shorthand": ["error", "always"], | ||
"no-unused-expressions": "off", | ||
"react/display-name": "off", | ||
"react/no-unknown-property": "off", | ||
"react/prop-types": "off", | ||
"quotes": ["error", "single"] | ||
}, | ||
"plugins": ["unused-imports"], | ||
"settings": { | ||
"next": { | ||
"rootDir": true | ||
} | ||
} | ||
} |
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,38 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
.editorconfig | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
pnpm-lock.yaml | ||
|
||
# testing | ||
/coverage | ||
#vscode | ||
/.vscode/ | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env* | ||
!.env.example | ||
|
||
# vercel | ||
.vercel |
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,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 --frozen-lockfile; \ | ||
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"] |
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 @@ | ||
# OpenBuild Front-end Project | ||
|
||
若要加入开发,请先阅读《[开发规范](manual/spec.md)》,然后确保本地 Node.js 版本号 >= 20.0.0。 |
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,29 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"#/*": ["./src/*"], | ||
"@/*": ["./src/shared/*"] | ||
}, | ||
"plugins": [ | ||
{ | ||
"name": "next" | ||
} | ||
] | ||
}, | ||
"exclude": ["node_modules"] | ||
} |
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,55 @@ | ||
# 开发规范 | ||
|
||
为保证项目质量和可维护性,需严格遵守。 | ||
|
||
## 目录结构 | ||
|
||
源码相关的以《[聊聊中后台前端应用:目录结构划分模式](https://ourai.ws/posts/patterns-of-directory-structure-in-frontend-projects/)》中提到的「模块化」模式为基础,根据 Next.js 的限制进行些许兼容适配: | ||
|
||
``` | ||
project/src | ||
├── app | ||
│ └── ... | ||
├── domain | ||
│ └── [domain-specific-module] | ||
│ ├── views | ||
│ │ ├── [detail-view] | ||
│ │ │ ├── [DetailViewComponent].tsx | ||
│ │ │ ├── ... | ||
│ │ │ └── style.scss | ||
│ │ ├── [form-view] | ||
│ │ │ ├── [FormViewComponent].tsx | ||
│ │ │ ├── ... | ||
│ │ │ └── style.scss | ||
│ │ └── [list-view] | ||
│ │ ├── [ListViewComponent].tsx | ||
│ │ ├── ... | ||
│ │ └── style.scss | ||
│ ├── widgets | ||
│ │ └── [domain-specific-widget] | ||
│ │ └── ... | ||
│ ├── helper.ts | ||
│ ├── index.ts | ||
│ ├── model.ts | ||
│ ├── repository.ts | ||
│ └── ... | ||
├── shared | ||
│ └── ... | ||
└── ... | ||
``` | ||
|
||
其中,`app` 取代了 `entry` 文件夹作为页面渲染的入口。 | ||
|
||
## 文件引用 | ||
|
||
在文件引用层面有所限制: | ||
|
||
- `shared` 文件夹下的文件不可引用除 `public` 之外的任何其他外部文件夹下的文件; | ||
- `domain` 文件夹下的文件仅可引用 `public`、`shared` 和其他 `domain` 文件夹下的文件; | ||
- `app` 文件夹下的文件可引用 `public`、`shared`、`domain` 及同文件夹下的文件。 | ||
|
||
使用 `@/*` 引用 `shared` 下的文件。 | ||
|
||
## 扩展阅读 | ||
|
||
- [「反混沌」前端工程](https://ntks.ourai.ws/) |
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,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
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,41 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const withBundleAnalyzer = require('@next/bundle-analyzer')({ | ||
enabled: process.env.ANALYZE === 'true' | ||
}) | ||
|
||
module.exports = withBundleAnalyzer({ | ||
// env: { | ||
// NEXT_PUBLIC_ENV: 'PRODUCTION', //your next configs goes here | ||
// }, | ||
output: 'standalone', | ||
reactStrictMode: true, | ||
swcMinify: true, | ||
staticPageGenerationTimeout: 180, | ||
experimental: { | ||
appDir: true, | ||
serverActions: true | ||
}, | ||
env: { | ||
NEXT_PUBLIC_DOMAIN_ENV: process.env.NEXT_PUBLIC_DOMAIN_ENV, | ||
}, | ||
images: { | ||
domains: [ | ||
'openbuild.xyz', | ||
'assets.website-files.com', | ||
'images.unsplash.com', | ||
'img.foresightnews.pro', | ||
'statics.ambcrypto.com', | ||
's1.ax1x.com', | ||
'imgse.com', | ||
's3.us-west-1.amazonaws.com', | ||
'file-cdn.openbuild.xyz' | ||
], | ||
}, | ||
webpack: config => { | ||
config.externals.push('pino-pretty', 'lokijs', 'encoding') | ||
return config | ||
}, | ||
compiler: { | ||
styledComponents: true, | ||
}, | ||
}) |
Oops, something went wrong.