diff --git a/.github/workflows/build.yml b/.github/workflows/build_and_test.yml similarity index 96% rename from .github/workflows/build.yml rename to .github/workflows/build_and_test.yml index f665e78..137f7b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build_and_test.yml @@ -1,4 +1,4 @@ -name: Build and test +name: Build and Test on: [pull_request] diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index e11d864..8e1f11f 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -12,6 +12,9 @@ npm run build cp -r ./build ../jendeley-backend/built-frontend ``` +[!NOTE] +When your machines which the browser running and the backend server running are different, you must change the `VITE_API_URL` in `jendeley-frontend/.env.development` to the backend server's URL. For example, `VITE_API_URL=http://192.168.11.70:5001`. + Run backend server ``` cd jendeley-backend diff --git a/Dockerfile b/Dockerfile index 3d4a846..e76c567 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN diff /jendeley/jendeley-backend/src/constants.ts /jendeley/jendeley-frontend WORKDIR /jendeley/jendeley-backend RUN ./check-version.sh RUN npm install -RUN npm run check:prettier +RUN npm run lint RUN npm run build RUN npm run test RUN npm run scan_test_pdfs @@ -18,6 +18,6 @@ RUN [ -f "edit_and_run.sh" ] && cat edit_and_run.sh && exit 1 || echo "Build DB WORKDIR /jendeley/jendeley-frontend RUN npm install -RUN npm run check:prettier +RUN npm run lint RUN npm run build # RUN npm run jest diff --git a/Releasable.Dockerfile b/Releasable.Dockerfile index 35601ae..19ca5b4 100644 --- a/Releasable.Dockerfile +++ b/Releasable.Dockerfile @@ -4,12 +4,12 @@ COPY . /jendeley WORKDIR /jendeley/jendeley-frontend RUN npm install -RUN npm run check:prettier +RUN npm run lint RUN npm run build WORKDIR /jendeley/jendeley-backend RUN npm install -RUN npm run check:prettier +RUN npm run lint RUN npm run build RUN npm install . -g diff --git a/jendeley-backend/package.json b/jendeley-backend/package.json index 56d9ddc..468b221 100644 --- a/jendeley-backend/package.json +++ b/jendeley-backend/package.json @@ -15,8 +15,8 @@ "scan_test_pdfs": "npm run build && node --require source-map-support/register dist/index.js scan --papers_dir test_pdfs --book_dirs test_pdfs/dummyTapl", "profile_scan_test_pdfs": "npm run build && node --require source-map-support/register --prof dist/index.js scan --papers_dir test_pdfs", "scan_test_pdfs_and_launch": "npm run build && node --require source-map-support/register dist/index.js scan --papers_dir test_pdfs --book_dirs test_pdfs/dummyTapl && node --require source-map-support/register dist/index.js launch --db test_pdfs/jendeley_db.json --port 5001 --allow_cors", - "fix:prettier": "prettier --write src", - "check:prettier": "prettier --check src" + "format": "prettier --write src", + "lint": "prettier --check src" }, "repository": { "type": "git", diff --git a/jendeley-backend/src/server.ts b/jendeley-backend/src/server.ts index d25bfb7..60192ab 100644 --- a/jendeley-backend/src/server.ts +++ b/jendeley-backend/src/server.ts @@ -29,6 +29,7 @@ function startServer(dbPath: string[], allowCors: boolean, port: number) { const app = express(); app.use(bodyParser.json({ limit: "1gb" })); if (allowCors) { + logger.info("Allowing CORS"); app.use(cors()); } diff --git a/jendeley-frontend/.env.development b/jendeley-frontend/.env.development index a971ec9..22c39d9 100644 --- a/jendeley-frontend/.env.development +++ b/jendeley-frontend/.env.development @@ -1 +1 @@ -REACT_APP_API_URL=http://localhost:5001 +VITE_API_URL=http://localhost:5001 diff --git a/jendeley-frontend/.env.production b/jendeley-frontend/.env.production index b665b38..292a14c 100644 --- a/jendeley-frontend/.env.production +++ b/jendeley-frontend/.env.production @@ -1 +1 @@ -REACT_APP_API_URL= +VITE_API_URL= diff --git a/jendeley-frontend/README.md b/jendeley-frontend/README.md deleted file mode 100644 index b87cb00..0000000 --- a/jendeley-frontend/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# Getting Started with Create React App - -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). - -## Available Scripts - -In the project directory, you can run: - -### `npm start` - -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. - -The page will reload if you make edits.\ -You will also see any lint errors in the console. - -### `npm test` - -Launches the test runner in the interactive watch mode.\ -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. - -### `npm run build` - -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. - -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! - -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. - -### `npm run eject` - -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** - -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. - -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). diff --git a/jendeley-frontend/public/index.html b/jendeley-frontend/index.html similarity index 56% rename from jendeley-frontend/public/index.html rename to jendeley-frontend/index.html index bf34999..eccd90b 100644 --- a/jendeley-frontend/public/index.html +++ b/jendeley-frontend/index.html @@ -2,33 +2,21 @@ - + - - + - - + jendeley
+