From ebbf8e9db572a68c18e8d0c5d0f142135668f84b Mon Sep 17 00:00:00 2001 From: Quanyi Ma Date: Sun, 18 Aug 2024 19:25:31 +0800 Subject: [PATCH] Fix ESlint error when run npm build commandC Signed-off-by: Quanyi Ma --- docker/README.md | 18 +++++++++--------- lunar/package.json | 14 +++++++------- moon/.eslintrc.json | 2 +- moon/package.json | 5 +++-- moon/src/app/page.tsx | 7 ++++++- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/docker/README.md b/docker/README.md index 01b348c7f..85150187b 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,7 +1,6 @@ -# build images +## Build Images ```bash - # cd root of the project # build postgres image @@ -14,10 +13,11 @@ docker buildx build -t mega-mono:1.0 -f ./docker/mega_mono_dockerfile . docker buildx build -t mega-moon:1.0 -f ./docker/mega_moon_dockerfile . ``` -# test mono and moon +## Test mono and moon + +### Test with SQLite -## test without postgres ```bash # create network docker network create mega-network @@ -28,9 +28,9 @@ docker run --rm -it -d --network mega-network -e NEXT_PUBLIC_API_URL=http://mega visit http://localhost:3000 to see the frontend -## test with sqlite +## Test with PostgreSQL -1. start postgres +[1] start postgres ```bash # create network @@ -40,14 +40,14 @@ docker network create mega-network docker run --rm -it -d --network mega-network --name mega-db mega-db:1.0 ``` -2. create default config +[2] create default config ```bash docker run --rm -it -d --network mega-network --name mega-mono -v ./mega_base:/etc/mega mega-mono:1.0 docker stop mega-mono ``` -3. edit `mega_base/config.toml`, change `db_type` to `postgres` and db_url to `postgres://mega:mega@mega-db:5432/mega` +[3] edit `mega_base/config.toml`, change `db_type` to `postgres` and db_url to `postgres://mega:mega@mega-db:5432/mega` ```toml [database] @@ -60,7 +60,7 @@ db_path = "${base_dir}/mega.db" db_url = "postgres://mega:mega@mega-db:5432/mega" ``` -4. Start the mono again, and run the frontend. +[4] Start the mono again, and run the frontend. ```bash docker run --rm -it -d --network mega-network --name mega-mono -v ./mega_base:/etc/mega mega-mono:1.0 diff --git a/lunar/package.json b/lunar/package.json index c23b1ebb9..c12b80011 100644 --- a/lunar/package.json +++ b/lunar/package.json @@ -20,14 +20,13 @@ "clsx": "^2.1.1", "date-fns": "^3.6.0", "framer-motion": "^11.3.2", + "github-markdown-css": "^5.6.1", "next": "14.2.3", + "prism-react-renderer": "^2.3.1", "react": "^18", "react-dom": "^18", - "swr": "^2.2.5", - "github-markdown-css": "^5.6.1", "react-markdown": "^9.0.1", - "prism-react-renderer": "^2.3.1" - + "swr": "^2.2.5" }, "devDependencies": { "@tauri-apps/cli": "^1.6.0", @@ -35,8 +34,9 @@ "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "autoprefixer": "^10.4.19", - "eslint": "^9.8", + "eslint": "^8.57.0", + "eslint-config-next": "^14.2.5", "postcss": "^8.4.40", - "typescript": "^5.5.4" + "typescript": "^5.5.0" } -} \ No newline at end of file +} diff --git a/moon/.eslintrc.json b/moon/.eslintrc.json index bffb357a7..0e81f9b97 100644 --- a/moon/.eslintrc.json +++ b/moon/.eslintrc.json @@ -1,3 +1,3 @@ { "extends": "next/core-web-vitals" -} +} \ No newline at end of file diff --git a/moon/package.json b/moon/package.json index 1b72f1023..0f5d29a57 100644 --- a/moon/package.json +++ b/moon/package.json @@ -33,8 +33,9 @@ "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "autoprefixer": "^10.4.19", - "eslint": "^9.8", + "eslint": "^8.57.0", + "eslint-config-next": "^14.2.5", "postcss": "^8.4.40", - "typescript": "^5.5.4" + "typescript": "^5.5.0" } } diff --git a/moon/src/app/page.tsx b/moon/src/app/page.tsx index a50224ae2..52eb13d65 100644 --- a/moon/src/app/page.tsx +++ b/moon/src/app/page.tsx @@ -11,15 +11,19 @@ export default async function HomePage() { ); } + async function getDirectory() { const res = await fetch(`http://localhost:3000/api/tree/commit-info?path=/`); + const response = await res.json(); const directory = response.data.data; + return directory } async function getReadmeContent(directory) { - var readmeContent = ''; + let readmeContent = ''; + for (const project of directory || []) { if (project.name === 'README.md' && project.content_type === 'file') { const res = await fetch(`http://localhost:3000/api/blob?path=/README.md`); @@ -28,5 +32,6 @@ async function getReadmeContent(directory) { break; } } + return readmeContent }