feat: generate default env file

This commit is contained in:
TinsFox 2024-05-06 16:13:50 +08:00
parent 50e4ac33ef
commit e108617182
No known key found for this signature in database
GPG Key ID: DB55C660F0F1055D
3 changed files with 7199 additions and 10289 deletions

View File

@ -1,3 +1,4 @@
@@ -1,71 +1,73 @@
# Dify Frontend # Dify Frontend
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
@ -8,7 +9,9 @@ To start the web frontend service, you will need [Node.js v18.x (LTS)](https://n
First, install the dependencies: First, install the dependencies:
```bash ```bash
yarn install npm install
# or
yarn install --frozen-lockfile
``` ```
Then, configure the environment variables. Create a file named `.env.local` in the current directory and copy the contents from `.env.example`. Modify the values of these environment variables according to your requirements: Then, configure the environment variables. Create a file named `.env.local` in the current directory and copy the contents from `.env.example`. Modify the values of these environment variables according to your requirements:
@ -29,15 +32,15 @@ NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api
# SENTRY # SENTRY
NEXT_PUBLIC_SENTRY_DSN= NEXT_PUBLIC_SENTRY_DSN=
# optional
NEXT_PUBLIC_SITE_ABOUT=
NEXT_PUBLIC_MAINTENANCE_NOTICE=
``` ```
Finally, run the development server: Finally, run the development server:
```bash ```bash
run dev npm run dev
# or # or
yarn dev yarn dev
``` ```
@ -50,17 +53,17 @@ You can start editing the file under folder `app`. The page auto-updates as you
### Deploy on server ### Deploy on server
First, build the app for production: First, build the app for production:
```bash ```bash
yarn run build npm run build
``` ```
Then, start the server: Then, start the server:
```bash ```bash
yarn run start npm run start
``` ```
If you want to customize the host and port: If you want to customize the host and port:
```bash ```bash
yarn run start --port=3001 --host=0.0.0.0 npm run start --port=3001 --host=0.0.0.0
``` ```
## Lint Code ## Lint Code

View File

@ -9,7 +9,7 @@
"lint": "next lint", "lint": "next lint",
"fix": "next lint --fix", "fix": "next lint --fix",
"eslint-fix": "eslint --fix", "eslint-fix": "eslint --fix",
"prepare": "npx only-allow yarn && cd ../ && node -e \"if (process.env.NODE_ENV !== 'production'){process.exit(1)} \" || husky install ./web/.husky", "prepare": "cp .env.example .env && cd ../ && node -e \"if (process.env.NODE_ENV !== 'production'){process.exit(1)} \" || husky install ./web/.husky",
"gen-icons": "node ./app/components/base/icons/script.js", "gen-icons": "node ./app/components/base/icons/script.js",
"uglify-embed": "node ./bin/uglify-embed", "uglify-embed": "node ./bin/uglify-embed",
"check-i18n": "node ./i18n/script.js" "check-i18n": "node ./i18n/script.js"
@ -132,6 +132,5 @@
}, },
"engines": { "engines": {
"node": ">=18.17.0" "node": ">=18.17.0"
}, }
"packageManager": "yarn@4.2.1" }
}

File diff suppressed because it is too large Load Diff