Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Vite #273

Merged
merged 4 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and test
name: Build and Test

on: [pull_request]

Expand Down
3 changes: 3 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions Releasable.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions jendeley-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions jendeley-backend/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
2 changes: 1 addition & 1 deletion jendeley-frontend/.env.development
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REACT_APP_API_URL=http://localhost:5001
VITE_API_URL=http://localhost:5001
2 changes: 1 addition & 1 deletion jendeley-frontend/.env.production
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REACT_APP_API_URL=
VITE_API_URL=
46 changes: 0 additions & 46 deletions jendeley-frontend/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,21 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="apple-touch-icon" href="/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link rel="manifest" href="/manifest.json" />
<title>jendeley</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="src/index.tsx"></script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
Loading
Loading