Skip to content

Commit

Permalink
Merge pull request #758 from WildMeOrg/dev10.4
Browse files Browse the repository at this point in the history
10.4 into general development branch
  • Loading branch information
TanyaStere42 authored Sep 13, 2024
2 parents e9eec67 + 99fb5c3 commit 5256d7c
Show file tree
Hide file tree
Showing 74 changed files with 3,573 additions and 10,306 deletions.
7 changes: 7 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
presets: [
"@babel/preset-env",
"@babel/preset-react"
],
};

46 changes: 44 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,59 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js";
import babelParser from "@babel/eslint-parser";
import reactHooks from "eslint-plugin-react-hooks";

export default [
pluginJs.configs.recommended,
pluginReactConfig,
{
files: ["**/*.{js,mjs,cjs,jsx}"],
files: ["**/*.{js,mjs,cjs,jsx}"],
plugins: {
"react-hooks": reactHooks,
},
languageOptions: {
globals: globals.browser,
parser: babelParser,
},
settings: {
react: {
version: "detect"
}
},
rules: {
"react/prop-types": "off",
"semi": 2,
"react/prop-types": 0,
"jsx-no-bind": 0,
"react/jsx-no-bind": 0,
"react/jsx-filename-extension": 0,
"react/jsx-props-no-spreading": 0,
"react/destructuring-assignment": 0,
"react/forbid-prop-types": 0,
"react/jsx-wrap-multilines": 0,
"react/style-prop-object": [2, { "allow": ["FormattedNumber"] }],
"import/prefer-default-export": 0,
"function-paren-newline": 0,
"react/function-component-definition": 0,
"func-names": 0,
"no-underscore-dangle": 0,
"no-console": 1,
"prefer-destructuring": 0,
"operator-linebreak": 0,
"indent": 0,
"camelcase": 0,
"space-before-function-paren": 0,
"implicit-arrow-linebreak": 0,
"nonblock-statement-body-position": 0,
"react/prefer-stateless-function": 0,
"curly": 0,
"object-curly-newline": 0,
"prefer-template": 0,
"arrow-parens": 0,
"no-param-reassign": 0,
"no-mixed-operators": 0,
"no-else-return": 0,

},
},
];
31 changes: 18 additions & 13 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
### 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
#### using npm to build and deploy to your local deployment
If you have your dev environment set up correctly, this will build the React app and copy it into your local deployment directory for you.
1. cd to `REPO/frontend/`
2. run `npm run deploy-dev`
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

#### manually building and deploying
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
Loading

0 comments on commit 5256d7c

Please sign in to comment.