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

init: Monorepo for Frontend and Backend #222

Open
wants to merge 17 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 4 additions & 12 deletions .github/workflows/cloudflare-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,20 @@ on:
tags:
- "v*"
paths:
- "src/**"
- "public/**"
- "packages/frontend/**"

jobs:
publish:
name: Publish to Cloudflare Pages
if: ${{ github.repository_owner == 'amattu2' }}
runs-on: ubuntu-latest
environment: better-vinwiki (Production)
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Dependencies
run: npm ci

- name: Test (Jest)
run: npm run test:ci

- name: Lint (EsLint)
run: npm run lint:ci

- name: Build
env:
REACT_APP_NAME: ${{ vars.REACT_APP_NAME }}
Expand All @@ -42,7 +34,7 @@ jobs:
REACT_APP_MEDIA_API_URL: ${{ vars.REACT_APP_MEDIA_API_URL }}
REACT_APP_MEDIA_CDN_URL: ${{ vars.REACT_APP_MEDIA_CDN_URL }}
REACT_APP_API_CLIENT: ${{ vars.REACT_APP_API_CLIENT }}
run: npm run build
run: npx lerna run build --scope=@better-vinwiki/frontend

- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
Expand All @@ -51,5 +43,5 @@ jobs:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: better-vinwiki
directory: ./build
directory: ./packages/frontend/build
branch: main
35 changes: 35 additions & 0 deletions .github/workflows/cloudflare-worker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Cloudflare Worker

concurrency:
group: "cloudflare-worker"
cancel-in-progress: false

on:
workflow_dispatch:
push:
tags:
- "v*"
paths:
- "packages/backend/**"

jobs:
publish:
name: Publish to Cloudflare Workers
runs-on: ubuntu-latest
environment: better-vinwiki (Production)
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Dependencies
run: npm ci

- name: Build
run: npx lerna run build --scope=@better-vinwiki/backend

- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: ./packages/backend
1 change: 0 additions & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ permissions:

jobs:
dependency-review:
if: ${{ github.repository_owner == 'amattu2' }}
runs-on: ubuntu-latest
steps:
# Clone repository
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,25 @@ on:
- development
- dev
paths:
- "src/**"
- "public/**"
- "packages/frontend/**"

jobs:
publish:
name: Publish to GitHub Pages
if: ${{ github.repository_owner == 'amattu2' }}
runs-on: ubuntu-latest
environment: better-vinwiki (Development)
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Dependencies
run: npm ci
run: npx lerna run install --scope=@better-vinwiki/frontend

- name: Test (Jest)
run: npm run test:ci
run: npx lerna run test:ci --scope=@better-vinwiki/frontend

- name: Lint (EsLint)
run: npm run lint:ci
run: npx lerna run lint:ci --scope=@better-vinwiki/frontend

- name: Build
env:
Expand All @@ -50,15 +48,15 @@ jobs:
REACT_APP_MEDIA_API_URL: ${{ vars.REACT_APP_MEDIA_API_URL }}
REACT_APP_MEDIA_CDN_URL: ${{ vars.REACT_APP_MEDIA_CDN_URL }}
REACT_APP_API_CLIENT: ${{ vars.REACT_APP_API_CLIENT }}
run: npm run build
run: npx lerna run build --scope=@better-vinwiki/frontend

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: './build'
path: "./packages/frontend/build"

- uses: chrnorm/deployment-action@v2
name: Create Deployment
Expand All @@ -80,7 +78,7 @@ jobs:
token: ${{ github.token }}
environment-url: ${{ steps.deployment_create.outputs.environment_url }}
deployment-id: ${{ steps.deployment_create.outputs.deployment_id }}
state: 'success'
state: "success"

- name: Deployment - Failed
if: failure()
Expand All @@ -89,4 +87,4 @@ jobs:
token: ${{ github.token }}
environment-url: ${{ steps.deployment_create.outputs.environment_url }}
deployment-id: ${{ steps.deployment_create.outputs.deployment_id }}
state: 'failure'
state: "failure"
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
Expand All @@ -37,4 +37,4 @@ jobs:
run: npm install

- name: Run ESLint
run: npm run lint:ci
run: npx lerna run lint:ci
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Jest
name: Test

on:
workflow_dispatch:
Expand All @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
Expand All @@ -36,8 +36,8 @@ jobs:
- name: Install Dependencies
run: npm install

- name: Run Jest
run: npm run test:ci
- name: Run Test Suite
run: npx lerna run test:ci

- name: Coveralls GitHub Action
uses: coverallsapp/[email protected]
4 changes: 2 additions & 2 deletions .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
Expand All @@ -37,4 +37,4 @@ jobs:
run: npm install

- name: Run Typecheck
run: npm run typecheck
run: npx lerna run typecheck
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"jest.jestCommandLine": "npm run test --"
"jest.jestCommandLine": "npm run test --",
"eslint.workingDirectories": [
"./packages/backend",
"./packages/frontend"
]
}
4 changes: 4 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "0.0.0"
}
Loading
Loading