Skip to content

Commit

Permalink
[frontend/README] split setup from regular dev loop
Browse files Browse the repository at this point in the history
  • Loading branch information
carllelandtaylor committed Sep 7, 2024
1 parent 77d3543 commit 081a65d
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
### pre-reqs

- node, npm
- `npm install react-app-rewired`


### steps to build and deploy react

1. create a folder `react` under deployed `wildbook/` dir
2. create a `.env` for React environment variables under the root of `REPO/frontend/`. In this file:
1. Add the public URL. For local tomcat development, use `PUBLIC_URL=http://localhost:81/react/` (or whatever port your local server is running on). For public deployment, use the following, where `public.url.example.com` is your deployed URL: `PUBLIC_URL=https://public.url.example.com/react/`
2. Add site name like this: `SITE_NAME=Amphibian Wildbook`
3. cd to `REPO/frontend/` and run `npm run build`
4. copy everything under `frontend/build/` to the `wildbook/react/` created in step 1
5. refresh your browser page by visiting either `http://localhost:81/react/` for local testing or `https://public.url.example.com/react/` for the public-facing deployment


### steps to setup dev environment
1. cd to the root folder of your codebase, for example `/Wildbook`
2. run `npm install`
3. run `chmod +x .husky/pre-commit` to enable husky pre-commit hooks
4. cd to the react folder `Wildbook/frontend/`,
5. also run `npm install` to install all dependencies
6. now you should be able to commit and Husky will check your code for any issues before each commit
7. create a `.env` for React environment variables under the root of `REPO/frontend/`. In this file:
1. Add the public URL. For local tomcat development, use `PUBLIC_URL=http://localhost:81/react/` (or whatever port your local server is running on). For public deployment, use the following, where `public.url.example.com` is your deployed URL: `PUBLIC_URL=https://public.url.example.com/react/`
2. Add site name like this: `SITE_NAME=Amphibian Wildbook`

### steps to set up deploy directory
1. create a folder `react` under deployed `wildbook/` dir

### steps to build and deploy react
1. cd to `REPO/frontend/` and run `npm run build`
2. copy everything under `frontend/build/` to the deployed `wildbook/react/` directory you created during setup
3. refresh your browser page by visiting either `http://localhost:81/react/` for local testing or `https://public.url.example.com/react/` for the public-facing deployment



0 comments on commit 081a65d

Please sign in to comment.