Skip to content

Commit

Permalink
Update deploy for prod and staging
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Aug 16, 2023
1 parent 27de917 commit 5b9bd3f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"clean": "rimraf build/",
"build": "react-scripts build",
"eject": "react-scripts eject",
"deploy": "yarn build && gh-pages -d build",
"deploy": "yarn clean && PUBLIC_URL=/ds-annotate REACT_APP_ENV=production yarn build && gh-pages -d build",
"deploy_staging": "yarn clean && PUBLIC_URL=/ REACT_APP_ENV=staging yarn build && aws s3 rm s3://ds-annotate-staging/ --recursive && aws s3 sync build/ s3://ds-annotate-staging/",
"lint": "npx eslint . && yarn prettier",
"prettier": "yarn clean && prettier --write 'src/**/*.js'",
"test": "yarn lint && react-scripts test --env=jsdom --watchAll=false --testMatch **/src/**/*.test.js"
Expand Down Expand Up @@ -67,6 +68,7 @@
"babel-jest": "^29.2.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-jest": "^26.6.2",
"cross-env": "^7.0.3",
"eslint": "8.0.0",
"eslint-config-react-app": "7.0.1",
"gh-pages": "^4.0.0",
Expand All @@ -87,4 +89,4 @@
"node_modules/@uiw/react-md-editor/"
]
}
}
}
2 changes: 1 addition & 1 deletion src/components/map/ProjectLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const ProjectLayer = ({ project, items, highlightedItem }) => {

useEffect(() => {
if (!map) return;
if (!highlightedItem) highlightedItem =[];
if (!highlightedItem) highlightedItem = [];

Check warning on line 79 in src/components/map/ProjectLayer.js

View workflow job for this annotation

GitHub Actions / lint

Assignments to the 'highlightedItem' variable from inside React Hook useEffect will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside useEffect

Check warning on line 79 in src/components/map/ProjectLayer.js

View workflow job for this annotation

GitHub Actions / test

Assignments to the 'highlightedItem' variable from inside React Hook useEffect will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside useEffect
const segDataSource = new VectorSource({
features:
Object.keys(highlightedItem).length !== 0 ? [highlightedItem] : [],
Expand Down
5 changes: 4 additions & 1 deletion src/config/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export const gpuEncodeAPI = "https://sas-gpu.ds.io";
export const gpuEncodeAPI =
process.env.REACT_APP_ENV === "production"
? "https://sas-gpu.ds.io"
: "https://gpu-spot.segmentanythingservice.com";
export const cpuDecodeAPI = "https://sas.ds.io";
export const samAPI =
"http://segme-gpuel-ekfao79wi98g-617785108.us-east-1.elb.amazonaws.com";
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import App from "./App";
import MainContextProvider from "./contexts/MainContext";

const root = ReactDOM.createRoot(document.getElementById("root"));

const basename = process.env.PUBLIC_URL;
root.render(
<MainContextProvider>
<BrowserRouter basename="/ds-annotate">
<BrowserRouter basename={basename}>
<Routes>
<Route exact path="/" element={<App />} />
<Route exact path="?project=:slug" element={<App />} />
Expand Down

0 comments on commit 5b9bd3f

Please sign in to comment.