Skip to content

Commit ef81241

Browse files
committed
feat: major environment overhaul
- deleted go backend - hoisted env files - added debugging - renamed frontend folder - renamed backend folder
1 parent 4f690b0 commit ef81241

File tree

16 files changed

+18863
-122
lines changed

16 files changed

+18863
-122
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GRAPHQL_TOKEN="<YOUR TOKEN HERE>"
2+
NEXT_TELEMETRY_DISABLED=1

.github/workflows/nextjs.yml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# Sample workflow for building and deploying a Next.js site to GitHub Pages
2-
#
3-
# To get started with Next.js see: https://nextjs.org/docs/getting-started
4-
#
51
name: Deploy Next.js site to Pages
62

73
on:
@@ -34,26 +30,26 @@ jobs:
3430
steps:
3531
- name: Checkout
3632
uses: actions/checkout@v4
37-
- name: Setup Node for metrics backend
33+
- name: Setup Node
3834
uses: actions/setup-node@v4
3935
with:
4036
node-version: "20.x"
4137
- name: Collect metrics and save output
4238
id: metrics
4339
run: |
44-
cd ts-backend
40+
cd backend
4541
npm i
46-
npm start
42+
npm run dev
4743
- name: Detect package manager
4844
id: detect-package-manager
4945
run: |
50-
if [ -f "${{ github.workspace }}/who-metrics-ui/yarn.lock" ]; then
46+
if [ -f "${{ github.workspace }}/app/yarn.lock" ]; then
5147
echo "manager=yarn" >> $GITHUB_OUTPUT
5248
echo "command=install" >> $GITHUB_OUTPUT
5349
echo "runner=yarn" >> $GITHUB_OUTPUT
5450
echo "cache-dependency-path=**/yarn.lock" >> $GITHUB_OUTPUT
5551
exit 0
56-
elif [ -f "${{ github.workspace }}/who-metrics-ui/package.json" ]; then
52+
elif [ -f "${{ github.workspace }}/app/package.json" ]; then
5753
echo "manager=npm" >> $GITHUB_OUTPUT
5854
echo "command=ci" >> $GITHUB_OUTPUT
5955
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
@@ -63,12 +59,6 @@ jobs:
6359
echo "Unable to determine package manager"
6460
exit 1
6561
fi
66-
- name: Setup Node
67-
uses: actions/setup-node@v4
68-
with:
69-
node-version: "20.x"
70-
cache: ${{ steps.detect-package-manager.outputs.manager }}
71-
cache-dependency-path: ${{ steps.detect-package-manager.outputs.cache-dependency-path }}
7262
- name: Setup Pages
7363
uses: actions/configure-pages@v4
7464
with:
@@ -81,22 +71,22 @@ jobs:
8171
uses: actions/cache@v3
8272
with:
8373
path: |
84-
"${{ github.workspace }}/who-metrics-ui/.next/cache"
74+
"${{ github.workspace }}/app/.next/cache"
8575
# Generate a new cache whenever packages or source files change.
8676
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
8777
# If source files changed but packages didn't, rebuild from a prior cache.
8878
restore-keys: |
8979
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
9080
- name: Install dependencies
91-
run: cd "${{ github.workspace }}/who-metrics-ui" && ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
81+
run: cd "${{ github.workspace }}/app" && ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
9282
- name: Build with Next.js
93-
run: cd "${{ github.workspace }}/who-metrics-ui" && ${{ steps.detect-package-manager.outputs.runner }} next build
83+
run: cd "${{ github.workspace }}/app" && ${{ steps.detect-package-manager.outputs.runner }} next build
9484
- name: Static HTML export with Next.js
95-
run: cd "${{ github.workspace }}/who-metrics-ui" && ${{ steps.detect-package-manager.outputs.runner }} next export
85+
run: cd "${{ github.workspace }}/app" && ${{ steps.detect-package-manager.outputs.runner }} next export
9686
- name: Upload artifact
9787
uses: actions/upload-pages-artifact@v3
9888
with:
99-
path: "${{ github.workspace }}/who-metrics-ui/out"
89+
path: "${{ github.workspace }}/app/out"
10090

10191
# Deployment job
10292
deploy:

.gitignore

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1-
*.env
2-
tmp/*
3-
sbv-world-health-org-metrics.code-workspace
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
.pnpm-debug.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts
37+
38+
# Data files - these get generated at buildtime. The README includes instructions for generating these.
39+
/src/data/data.json
40+
41+
.env*
42+
!.env.example

.vscode/extensions.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
52
"version": "0.2.0",
63
"configurations": [
74
{
8-
"name": "Launch metrics (local)",
9-
"type": "go",
5+
"name": "App: debug server-side",
6+
"type": "node-terminal",
7+
"request": "launch",
8+
"command": "cd app && npm run dev"
9+
},
10+
{
11+
"name": "App: debug client-side",
12+
"type": "chrome",
13+
"request": "launch",
14+
"url": "http://localhost:3000"
15+
},
16+
{
17+
"name": "App: debug full stack",
18+
"type": "node-terminal",
1019
"request": "launch",
11-
"mode": "debug",
12-
"program": "${workspaceFolder}/backend/cmd/main.go",
13-
"envFile": "${workspaceFolder}/dev.vscode.env"
20+
"command": "cd app && npm run dev",
21+
"serverReadyAction": {
22+
"pattern": "- Local:.+(https?://.+)",
23+
"uriFormat": "%s",
24+
"action": "debugWithChrome"
25+
}
1426
},
1527
{
16-
"name": "Next.js: debug metrics",
28+
"name": "Backend: Debug",
1729
"type": "node-terminal",
1830
"request": "launch",
19-
"cwd": "${workspaceFolder}/ts-backend",
20-
"command": "npm run start",
21-
"envFile": "${workspaceFolder}/ts-backend/.env"
31+
"command": "cd backend && npm run dev",
32+
"envFile": "${workspaceFolder}/.env"
2233
}
2334
]
2435
}

.vscode/settings.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/.vscode/launch.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

app/.vscode/settings.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "who-metrics-ui",
3-
"version": "0.1.0",
2+
"name": "app",
3+
"version": "0.0.0",
44
"private": true,
55
"scripts": {
66
"dev": "next dev",

backend/.env.example

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)