From 5b9bd3f6118a78fde765a23676e9613fd43e9974 Mon Sep 17 00:00:00 2001 From: Rub21 Date: Wed, 16 Aug 2023 16:38:52 -0500 Subject: [PATCH] Update deploy for prod and staging --- package.json | 6 ++++-- src/components/map/ProjectLayer.js | 2 +- src/config/index.js | 5 ++++- src/index.js | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index e92be32..70b6dda 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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", @@ -87,4 +89,4 @@ "node_modules/@uiw/react-md-editor/" ] } -} +} \ No newline at end of file diff --git a/src/components/map/ProjectLayer.js b/src/components/map/ProjectLayer.js index 023384e..4dc1119 100644 --- a/src/components/map/ProjectLayer.js +++ b/src/components/map/ProjectLayer.js @@ -76,7 +76,7 @@ export const ProjectLayer = ({ project, items, highlightedItem }) => { useEffect(() => { if (!map) return; - if (!highlightedItem) highlightedItem =[]; + if (!highlightedItem) highlightedItem = []; const segDataSource = new VectorSource({ features: Object.keys(highlightedItem).length !== 0 ? [highlightedItem] : [], diff --git a/src/config/index.js b/src/config/index.js index 58a4855..c2870c3 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -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"; diff --git a/src/index.js b/src/index.js index 042397f..c2115e9 100644 --- a/src/index.js +++ b/src/index.js @@ -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( - + } /> } />