Skip to content

Commit 3730de0

Browse files
committed
move to hash router, update homepage config on deployment
1 parent be38efc commit 3730de0

14 files changed

+174
-167
lines changed

.env.github

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PUBLIC_URL=https://weng-lab.github.io/psychscreen

.env.local

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PUBLIC_URL=http://localhost:3000/psychscreen

Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ FROM node:14-alpine AS build
44
RUN mkdir -p /app
55
WORKDIR /app
66

7+
# Set a default value for PUBLIC_URL
8+
ARG PUBLIC_URL="/"
9+
ENV PUBLIC_URL=$PUBLIC_URL
10+
711
# Install app dependencies
812
COPY package.json /app
913
COPY yarn.lock /app

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "psychscreen",
33
"version": "0.4.3",
44
"private": true,
5+
"homepage": "%PUBLIC_URL%",
56
"dependencies": {
67
"@apollo/client": "^3.6.9",
78
"@emotion/react": "^11.10.0",
@@ -43,7 +44,7 @@
4344
},
4445
"scripts": {
4546
"predeploy": "react-scripts build",
46-
"deploy": "gh-pages -d build",
47+
"deploy": "env-cmd -f .env.github yarn build && gh-pages -d build",
4748
"start": "react-scripts start",
4849
"build": "react-scripts build",
4950
"test": "react-scripts test",

scripts/build.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ cd "$(dirname "$(dirname "$0")")"
1313
# import common stuff
1414
source scripts/lib/common.sh
1515

16-
1716
# build the image and tag it with the project version
18-
docker build -t gcr.io/${GCR_PROJECT_ID}/${DOCKER_IMAGE_NAME}:${DOCKER_TAG} .
17+
docker build -t --build-arg PUBLIC_URL=https://psychscreen.wenglab.org/psychscreen gcr.io/${GCR_PROJECT_ID}/${DOCKER_IMAGE_NAME}:${DOCKER_TAG} .

scripts/run-local.sh

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
#!/bin/bash
22
# arg1: environment used to pick config file to use in /config.
33
set -e
4+
source .env.local
45

56
# cd to project root directory
67
cd "$(dirname "$(dirname "$0")")"
78

89
# Set environment variable (used for config) to staging by default
910
[[ ! -z "$1" ]] && ENVIRONMENT="$1" || ENVIRONMENT=staging
1011

11-
echo config/config.${ENVIRONMENT}.json
12-
pwd
1312
#ln -sf config/config.${ENVIRONMENT}.json public/config.json
14-
cp config/config.${ENVIRONMENT}.json public/config.json
15-
yarn start
13+
NODE_OPTIONS="--openssl-legacy-provider" yarn start

src/App.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useMemo } from 'react';
2-
import { BrowserRouter as Router, Route, Routes, Navigate } from 'react-router-dom';
2+
import { HashRouter as Router, Route, Routes, Navigate } from 'react-router-dom';
33
import '@zscreen/psychscreen-ui-components/src/App.css';
44
import { ApolloClient, ApolloProvider, InMemoryCache } from '@apollo/client';
55
import './App.css';

src/assets/brain.png

6 Bytes
Loading

src/assets/disease-trait.png

4 Bytes
Loading

src/assets/gene-bcre.png

6 Bytes
Loading

src/assets/single-cell.png

4 Bytes
Loading

src/assets/snp-qtl.png

3 Bytes
Loading

src/web/HomePage/HomePage.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* HomePage.tsx: the app home page.
33
*/
44

5+
import React from 'react';
56
import { useNavigate } from 'react-router-dom';
67
import { AppBar } from '@zscreen/psychscreen-ui-components';
78

src/web/HomePage/PortalsPanel.tsx

+161-159
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)