Skip to content

Commit 113f94c

Browse files
medyoidebenone
andauthored
Version 1.19.0 (#176)
* Feature to share news/posts/articles (#162) * feature to share news/posts/articles * added title and source to share model * added title, removed redundancy of props * colorful icons & title prop added to button * css updated * css changes * fixed block-action-btns * Merge branch 'shareFeature' of github.com:idebenone/hackertab.dev * fix yarn.lock * persist fetched queries in localstorage * improve the share modal UI * track copy and share events * tag hackertabdev twitter account * add missing api url --------- Co-authored-by: Vineeth <[email protected]>
1 parent b158a40 commit 113f94c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1782
-9335
lines changed

.github/workflows/deploy.yml

+33-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,40 @@
1-
name: Deploy to production
1+
name: Deploy Web Version to hackertab.dev
22

33
on:
4+
workflow_dispatch:
45
push:
5-
branches: [ master ]
6-
jobs:
7-
deploy:
6+
branches:
7+
- feat/cp-build
8+
env:
9+
VITE_BUILD_TARGET: 'web'
10+
VITE_AMPLITUDE_KEY: ${{ secrets.REACT_APP_AMPLITUDE_KEY }}
11+
VITE_AMPLITUDE_URL: ${{ secrets.REACT_APP_AMPLITUDE_URL }}
12+
VITE_API_URL: ${{ secrets.API_URL }}
813

14+
jobs:
15+
build_and_deploy:
916
runs-on: ubuntu-latest
1017

1118
steps:
12-
- name: SSH and deploy node app
13-
uses: fifsky/ssh-action@master
14-
with:
15-
host: ${{ secrets.SSH_HOST }}
16-
user: ${{ secrets.SSH_USERNAME }}
17-
key: ${{ secrets.SSH_KEY }}
18-
command: |
19-
cd ~/hackertab.dev
20-
git pull origin master
21-
yarn
22-
yarn build-web
19+
- name: Checkout code
20+
uses: actions/checkout@v2
21+
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '16'
26+
27+
- name: Install dependencies
28+
run: yarn
29+
30+
- name: Build project
31+
run: yarn build:web
32+
33+
- name: Copy build to remote host
34+
uses: appleboy/[email protected]
35+
with:
36+
host: ${{ secrets.DEPLOY_SSH_HOST }}
37+
username: ${{ secrets.DEPLOY_SSH_USERNAME }}
38+
key: ${{ secrets.DEPLOY_SSH_KEY }}
39+
source: 'dist/'
40+
target: '~/hackertab.dev'

.github/workflows/distribute.yml

+6-10
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ on:
2323
default: false
2424
type: boolean
2525
env:
26-
REACT_APP_BUILD_TARGET: 'extension'
27-
REACT_APP_AMPLITUDE_KEY: ${{ secrets.REACT_APP_AMPLITUDE_KEY }}
28-
REACT_APP_AMPLITUDE_URL: ${{ secrets.REACT_APP_AMPLITUDE_URL }}
26+
VITE_BUILD_TARGET: 'extension'
27+
VITE_AMPLITUDE_KEY: ${{ secrets.REACT_APP_AMPLITUDE_KEY }}
28+
VITE_AMPLITUDE_URL: ${{ secrets.REACT_APP_AMPLITUDE_URL }}
29+
VITE_API_URL: ${{ secrets.API_URL }}
2930

3031
jobs:
3132
tag_version:
@@ -73,9 +74,7 @@ jobs:
7374
run: yarn
7475

7576
- name: Build and zip the extension
76-
env:
77-
NODE_OPTIONS: --openssl-legacy-provider
78-
run: yarn build-chrome
77+
run: yarn build:chrome
7978

8079
- name: Install chrome dependencies
8180
run: yarn global add chrome-webstore-upload-cli
@@ -105,10 +104,7 @@ jobs:
105104
run: yarn
106105

107106
- name: Build and zip the extension
108-
env:
109-
NODE_OPTIONS: --openssl-legacy-provider
110-
run: yarn build-firefox
111-
107+
run: yarn build:firefox
112108
- name: Upload the package to Firefox web store
113109
if: ${{ github.event.inputs.testMode == 'false' }}
114110
uses: yayuyokitano/[email protected]

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# production
1616
/build
17-
17+
/dist
1818
# misc
1919
.DS_Store
2020
.env.local

craco.config.js

-62
This file was deleted.

public/index.html index.html

+9-7
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
5+
<link rel="icon" href="/favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
77
<meta name="theme-color" content="#000000" />
8-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
8+
<link rel="apple-touch-icon" href="/logo192.png" />
99
<link rel="preconnect" href="https://hackertab.dev" />
10-
<script src="./startup.js"></script>
10+
<script src="/startup.js"></script>
1111

12-
<% if (process.env.REACT_APP_BUILD_TARGET==='web' ) { %>
12+
<% if (isWebBuild) { %>
1313
<title>Hackertab</title>
14-
<link rel="manifest" href="%PUBLIC_URL%/web_manifest.json" />
15-
<% } else { %>
14+
<link rel="manifest" href="/web_manifest.json" />
15+
<% } else { %>
1616
<title>New Tab</title>
17-
<% } %>
17+
<%}%>
1818
</head>
1919
<body class="preload">
2020
<noscript>You need to enable JavaScript to run this app.</noscript>
2121
<div id="root"></div>
22+
<script type="module" src="/src/index.tsx"></script>
23+
2224
</body>
2325
</html>

package.json

+23-24
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
"private": false,
55
"dependencies": {
66
"@amplitude/analytics-browser": "^1.5.5",
7-
"@craco/craco": "^6.4.5",
7+
"@tanstack/query-async-storage-persister": "^5.8.3",
88
"@tanstack/react-query": "^4.13.0",
9+
"@tanstack/react-query-persist-client": "^5.8.4",
910
"@types/dompurify": "^2.3.4",
1011
"@types/jspath": "^0.4.0",
1112
"axios": "^0.21.2",
@@ -27,8 +28,9 @@
2728
"react-markdown": "^7.0.1",
2829
"react-modal": "^3.12.1",
2930
"react-pro-sidebar": "^0.6.0",
30-
"react-scripts": "4.0.1",
3131
"react-select": "^5.0.1",
32+
"react-share": "^4.4.1",
33+
"react-simple-toasts": "^5.10.0",
3234
"react-spinners": "^0.10.4",
3335
"react-spring-bottom-sheet": "^3.4.1",
3436
"react-toggle": "^4.1.1",
@@ -37,53 +39,46 @@
3739
"styled-components": "2",
3840
"timeago.js": "^4.0.2",
3941
"type-fest": "^1.2.0",
42+
"vite-plugin-ejs": "^1.6.4",
4043
"web-vitals": "^0.2.4",
4144
"zustand": "^4.3.3"
4245
},
43-
"proxy": "https://api.hackertab.dev/",
4446
"scripts": {
45-
"start": "craco start",
46-
"build-web": "./script/build-web.sh",
47-
"build": "./script/build.sh",
48-
"build-firefox": "./script/build-firefox.sh",
49-
"build-chrome": "./script/build-chrome.sh",
50-
"eject": "react-scripts eject"
47+
"start": "vite",
48+
"build:web": "VITE_BUILD_TARGET=web ./script/build.sh",
49+
"build:ext": "VITE_BUILD_TARGET=extension ./script/build.sh",
50+
"build:firefox": "./script/build-firefox.sh",
51+
"build:chrome": "./script/build-chrome.sh"
5152
},
5253
"eslintConfig": {
5354
"extends": [
5455
"react-app",
5556
"react-app/jest"
5657
]
5758
},
58-
"browserslist": {
59-
"production": [
60-
">0.2%",
61-
"not dead",
62-
"not op_mini all"
63-
],
64-
"development": [
65-
"last 1 chrome version",
66-
"last 1 firefox version",
67-
"last 1 safari version"
68-
]
69-
},
59+
"browserslist": [
60+
">0.2%",
61+
"not dead",
62+
"not op_mini all"
63+
],
7064
"resolutions": {
7165
"react-error-overlay": "6.0.9"
7266
},
7367
"devDependencies": {
7468
"@testing-library/jest-dom": "^5.11.4",
7569
"@testing-library/react": "^11.1.0",
7670
"@testing-library/user-event": "^12.1.10",
77-
"@types/chrome": "^0.0.198",
71+
"@types/chrome": "^0.0.241",
7872
"@types/jest": "^29.1.2",
7973
"@types/jsonpath": "^0.2.0",
80-
"@types/node": "^18.11.0",
74+
"@types/node": "^20.4.2",
8175
"@types/react": "^18.0.21",
8276
"@types/react-dom": "^18.0.6",
8377
"@types/react-modal": "^3.13.1",
8478
"@types/react-toggle": "^4.0.3",
8579
"@typescript-eslint/eslint-plugin": "^5.45.0",
8680
"@typescript-eslint/parser": "^5.40.1",
81+
"@vitejs/plugin-react": "^4.0.3",
8782
"eslint-config-airbnb": "19.0.4",
8883
"eslint-config-airbnb-typescript": "^17.0.0",
8984
"eslint-config-prettier": "^8.5.0",
@@ -96,6 +91,10 @@
9691
"eslint-plugin-react": "^7.28.0",
9792
"eslint-plugin-react-hooks": "^4.3.0",
9893
"prettier": "^2.7.1",
99-
"typescript": "^4.8.4"
94+
"terser": "^5.19.2",
95+
"typescript": "^5.1.6",
96+
"vite": "^4.4.5",
97+
"vite-plugin-svgr": "^3.2.0",
98+
"vite-tsconfig-paths": "^4.2.0"
10099
}
101100
}

script/build-chrome.sh

+1-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ rm -f chrome_extension.zip
1818

1919
# Install dependencies
2020
echo 'Install dependencies'
21-
yarn build
22-
23-
# Copy generated build to distrubution folder
24-
echo 'Copy generated build to distrubution folder'
25-
mkdir -p dist
26-
cp -r build/* dist
21+
yarn build:ext
2722

2823
# Zip the distribution folder
2924
echo 'Zip the extension'

script/build-firefox.sh

+2-7
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,12 @@ jq -s '.[0] * .[1]' ./public/base.manifest.json ./public/firefox.manifest.json >
2323

2424
# Install dependencies
2525
echo 'Install dependencies'
26-
yarn build
27-
28-
# Copy generated build to distrubution folder
29-
echo 'Copy generated build to distrubution folder'
30-
mkdir -p dist
31-
cp -r build/* dist
26+
yarn build:ext
3227

3328
# Zip the distribution folder
3429
echo 'Zip the extension'
3530
cd dist/ && zip -r ../firefox_extension.zip * -x "*.DS_Store" && cd ..
3631

3732
#
3833
echo 'Zip the source code'
39-
zip -r source_code.zip 'public/' 'script/' 'src' 'LICENSE' 'package.json' 'yarn.lock' 'README.md' 'craco.config.js' '.env' 'tsconfig.json' -x "*.DS_Store"
34+
zip -r source_code.zip 'public/' 'script/' 'src' 'LICENSE' 'package.json' 'yarn.lock' 'README.md' 'vite.config.js' '.env' 'tsconfig.json' -x "*.DS_Store"

script/build.sh

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
#!/bin/bash
22

33
build() {
4-
echo 'building react'
5-
4+
echo 'Building Hackertab...'
65
rm -rf dist
7-
8-
export INLINE_RUNTIME_CHUNK=false
9-
export GENERATE_SOURCEMAP=false
10-
11-
react-scripts build
12-
13-
mkdir -p dist
14-
cp -r build/* dist/
6+
tsc
7+
vite build
158
}
169

1710
build

0 commit comments

Comments
 (0)