Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework directory structure #114

Merged
merged 24 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4f690b0
feat: remove all unused files and rename various directories
ajhenry Mar 20, 2024
ef81241
feat: major environment overhaul
ajhenry Mar 20, 2024
ab9a7f9
fix: codeql scanning
ajhenry Mar 20, 2024
f2c8263
Merge branch 'main' of https://github.com/sbv-world-health-org-metric…
ajhenry Mar 21, 2024
e32f693
feat: cleanup after merge
ajhenry Mar 21, 2024
180653d
feat: add prettier to root
ajhenry Mar 21, 2024
0911edb
feat: more cleanup and eslint rules
ajhenry Mar 21, 2024
efe8873
chore: update package versions and eslint rules
ajhenry Mar 22, 2024
6997dd1
Merge branch 'main' of https://github.com/sbv-world-health-org-metric…
ajhenry Mar 22, 2024
a385675
fix: next output build step
ajhenry Mar 25, 2024
955076b
chore: prettier output all files
ajhenry Mar 25, 2024
8364d6f
fix: revert commented collaborator counts
ajhenry Mar 25, 2024
8910f8e
feat: add better developer experience
ajhenry Mar 25, 2024
b70c33a
fix: don't use optimized images
ajhenry Mar 25, 2024
9540984
fix: no export
ajhenry Mar 25, 2024
05513f0
feat: add glob as a dev dep
ajhenry Mar 25, 2024
0172869
fix: broken eslint rule
ajhenry Mar 25, 2024
2c1d2d2
docs: update env name
ajhenry Mar 26, 2024
29b511e
docs: clarify collaborator count note
ajhenry Mar 26, 2024
5122eef
chore: remove unused icons
ajhenry Mar 26, 2024
d6c06f6
fix: spacing on layout
ajhenry Mar 26, 2024
6069d5e
chore: remove unused image
ajhenry Mar 26, 2024
8717291
docs: remove default app readme
ajhenry Mar 26, 2024
7a10099
fix: config since date
ajhenry Mar 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 24 additions & 29 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
{
"name": "Go",
"build": {
"dockerfile": "Dockerfile"
},
"name": "Typescript",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"docker-in-docker": {
"version": "latest",
"moby": true
},
"azure-cli": "latest",
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/node:1": {}
},

"remoteUser": "vscode",
"customizations": {
"vscode": {
"settings": {
"go.toolsManagement.checkForUpdates": "local",
"go.useLanguageServer": true,
"go.gopath": "/go",
"gopls": { "ui.semanticTokens": true }
}
},
"extensions": [
"github.copilot",
"golang.go"
]
},
"postCreateCommand": "./script/install-tools.sh"
"docker-in-docker": {
"version": "latest",
"moby": true
},
"azure-cli": "latest",
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/node:1": {}
},

"remoteUser": "vscode",
"customizations": {
"vscode": {
"settings": {}
},
"extensions": [
"github.copilot",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll need to test this after merging, as I'm not sure how to create a Codespace using the file from this branch. I think it should work though.

FWIW Co-pilot was not installed in my new Codespace by default, but golang.go was, so I'm not sure what happened there 🤷

"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
}
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GRAPHQL_TOKEN="<YOUR TOKEN HERE>"
NEXT_TELEMETRY_DISABLED=1
30 changes: 15 additions & 15 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ registries:
type: docker-registry
url: ghcr.io
username: PAT
password: "${{secrets.CONTAINER_BUILDER_TOKEN}}"
password: '${{secrets.CONTAINER_BUILDER_TOKEN}}'
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: weekly
- package-ecosystem: docker
registries:
- ghcr
directory: "/"
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
- package-ecosystem: 'gomod'
directory: '/'
schedule:
interval: weekly
- package-ecosystem: docker
registries:
- ghcr
directory: '/'
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: weekly
34 changes: 17 additions & 17 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ "main" ]
branches: ['main']
pull_request:
branches: [ "main" ]
branches: ['main']

jobs:
analyze:
Expand All @@ -17,18 +17,18 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'go' ]
language: ['javascript']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: '/language:${{matrix.language}}'
36 changes: 12 additions & 24 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# Sample workflow for building and deploying a Next.js site to GitHub Pages
#
# To get started with Next.js see: https://nextjs.org/docs/getting-started
#
name: Deploy Next.js site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
branches: ['main']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -27,7 +23,7 @@ env:
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
group: 'pages'
cancel-in-progress: false

jobs:
Expand All @@ -37,26 +33,26 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node for metrics backend
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.x"
node-version: '20.x'
- name: Collect metrics and save output
id: metrics
run: |
cd ts-backend
cd backend
npm i
npm start
npm run dev
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/who-metrics-ui/yarn.lock" ]; then
if [ -f "${{ github.workspace }}/app/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
echo "cache-dependency-path=**/yarn.lock" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/who-metrics-ui/package.json" ]; then
elif [ -f "${{ github.workspace }}/app/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
Expand All @@ -66,12 +62,6 @@ jobs:
echo "Unable to determine package manager"
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: ${{ steps.detect-package-manager.outputs.manager }}
cache-dependency-path: ${{ steps.detect-package-manager.outputs.cache-dependency-path }}
- name: Setup Pages
uses: actions/configure-pages@v4
with:
Expand All @@ -84,22 +74,20 @@ jobs:
uses: actions/cache@v3
with:
path: |
"${{ github.workspace }}/who-metrics-ui/.next/cache"
"${{ github.workspace }}/app/.next/cache"
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
- name: Install dependencies
run: cd "${{ github.workspace }}/who-metrics-ui" && ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
run: cd "${{ github.workspace }}/app" && ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Build with Next.js
run: cd "${{ github.workspace }}/who-metrics-ui" && ${{ steps.detect-package-manager.outputs.runner }} next build
- name: Static HTML export with Next.js
run: cd "${{ github.workspace }}/who-metrics-ui" && ${{ steps.detect-package-manager.outputs.runner }} next export
run: cd "${{ github.workspace }}/app" && ${{ steps.detect-package-manager.outputs.runner }} next build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "${{ github.workspace }}/who-metrics-ui/out"
path: '${{ github.workspace }}/app/out'

# Deployment job
deploy:
Expand Down
45 changes: 42 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
*.env
tmp/*
sbv-world-health-org-metrics.code-workspace
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# Data files - these get generated at buildtime. The README includes instructions for generating these.
/src/data/data.json

.env*
!.env.example
File renamed without changes.
6 changes: 0 additions & 6 deletions .vscode/extensions.json

This file was deleted.

35 changes: 23 additions & 12 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch metrics (local)",
"type": "go",
"name": "App: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "cd app && npm run dev"
},
{
"name": "App: debug client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000"
},
{
"name": "App: debug full stack",
"type": "node-terminal",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/backend/cmd/main.go",
"envFile": "${workspaceFolder}/dev.vscode.env"
"command": "cd app && npm run dev",
"serverReadyAction": {
"pattern": "- Local:.+(https?://.+)",
"uriFormat": "%s",
"action": "debugWithChrome"
}
},
{
"name": "Next.js: debug metrics",
"name": "Backend: Debug",
"type": "node-terminal",
"request": "launch",
"cwd": "${workspaceFolder}/ts-backend",
"command": "npm run start",
"envFile": "${workspaceFolder}/ts-backend/.env"
"command": "cd backend && npm run dev",
"envFile": "${workspaceFolder}/.env"
}
]
}
17 changes: 0 additions & 17 deletions .vscode/settings.json

This file was deleted.

Loading
Loading