Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
4005a5b
feat: Implement orders and products endpoint
chanbakjsd Mar 13, 2023
6cb831d
task: Port home page (product listing) (#77)
YoNG-Zaii Mar 21, 2023
a37a603
feat(merch): Add CORS
chanbakjsd Mar 27, 2023
5e856e0
fix: Add CORS types
chanbakjsd Apr 3, 2023
4a15e74
feat: Add pricing calculator
chanbakjsd May 19, 2023
36e8840
feat(merch): Implement product page
nicolelst Mar 27, 2023
7c78c06
chore: Run prettier on all merch files
chanbakjsd May 25, 2023
cefa476
cleanup: Merge Cart and CartItem
chanbakjsd May 25, 2023
85797e4
fix: Use state.cart.items instead of state.items
chanbakjsd May 29, 2023
ce5aa0b
update CODEOWNERS
RealDyllon May 29, 2023
68dd27e
update CODEOWNERS
RealDyllon May 29, 2023
a43a14c
feat(cart): Add cart button component (#95)
YoNG-Zaii May 21, 2023
4f52a32
Port thank you page (#99)
meisterisk Jun 5, 2023
f9b2435
fix: Handle 404 in orders
chanbakjsd Jun 9, 2023
1e7765a
feat: Init checkout feature (#102)
ykcyberarts May 22, 2023
3619d57
cleanup: Rework merch backend
chanbakjsd Jun 12, 2023
b34d137
chore: Move swiper dependency to web
chanbakjsd Jun 12, 2023
a0a003d
fix: Add key to grid item
chanbakjsd Jun 12, 2023
71ccac4
chore: Rename JSONResponse to Response
chanbakjsd Jun 12, 2023
7029629
feat: Add name and image to quotation
chanbakjsd Jun 12, 2023
5e7d1e8
fix: Merch top padding
YoNG-Zaii Jun 15, 2023
2182d0d
feat: add cart page (#96)
nicolelst Jun 11, 2023
57c71a4
cleanup: Remove quotation HTTP request
chanbakjsd Jun 19, 2023
672d80a
feat: Add merch payment
RealDyllon Jun 19, 2023
288e6e6
fix: Enable product selection by default
chanbakjsd Jun 28, 2023
2926dc5
chore: Fix yarn.lock
chanbakjsd Jun 28, 2023
970951b
fix web build
RealDyllon Jul 7, 2023
81e53c2
update ci to use build:ci scripts for inter-app builds
RealDyllon Jul 8, 2023
d896673
fix lint
RealDyllon Jul 8, 2023
085326a
fix ci
RealDyllon Jul 8, 2023
20dcd56
add missing env var for web#build
RealDyllon Jul 8, 2023
2c72dc2
disable vercel auto preview deployment
RealDyllon Jul 8, 2023
8d5f592
add manual vercel preview deployments
RealDyllon Jul 8, 2023
559d6e8
update turbo.json
RealDyllon Jul 8, 2023
eaf8ae1
update ci.yml
RealDyllon Jul 8, 2023
053cca6
update ci.yml
RealDyllon Jul 8, 2023
980ac34
update ci.yml
RealDyllon Jul 8, 2023
0907569
update ci.yml
RealDyllon Jul 8, 2023
9f50e3a
update ci.yml
RealDyllon Jul 8, 2023
eec74ce
update ci.yml
RealDyllon Jul 8, 2023
986a196
update ci.yml
RealDyllon Jul 8, 2023
ab90e97
update ci.yml
RealDyllon Jul 8, 2023
6a98b40
bump next.js to latest
RealDyllon Jul 8, 2023
1a3de6f
update ci.yml
RealDyllon Jul 9, 2023
28f8b95
update ci.yml
RealDyllon Jul 9, 2023
ce7a43c
update ci.yml
RealDyllon Jul 9, 2023
6234f44
update ci.yml
RealDyllon Jul 9, 2023
4882cf1
update ci.yml
RealDyllon Jul 9, 2023
5f8be29
update ci.yml
RealDyllon Jul 9, 2023
784e8b1
update ci.yml
RealDyllon Jul 9, 2023
10a540f
update ci.yml
RealDyllon Jul 9, 2023
3eabeeb
update ci.yml
RealDyllon Jul 9, 2023
a3c2fc8
update ci.yml
RealDyllon Jul 9, 2023
3c3c9bc
update ci.yml
RealDyllon Jul 9, 2023
8333051
update ci.yml
RealDyllon Jul 9, 2023
ca23624
update cd-staging.yml
RealDyllon Jul 9, 2023
0a8c816
task: Port home page (product listing) (#77)
YoNG-Zaii Mar 21, 2023
0738058
feat(merch): Implement product page
nicolelst Mar 27, 2023
c6d59c7
refactored ordernumber and qrcode
kingsmil Jul 10, 2023
42317b8
fixed bugs, send only id as props
kingsmil Jul 12, 2023
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
57 changes: 57 additions & 0 deletions .github/workflows/cd-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,39 @@ jobs:
ghcr.io/${{ github.repository_owner }}/website/merch:${{ github.sha }}
ghcr.io/${{ github.repository_owner }}/website/merch:latest


build-web:
name: Build Web next.js app
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 16
cache: "yarn"

- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile

- name: Build web
run: yarn turbo run build --filter=web

- name: Cache CD Staging workflow for dependent jobs
uses: actions/cache/save@v3
with:
path: .
key: CD-Staging-${{ runner.os }}-${{ github.ref }}-${{ github.run_id }}

deploy-to-staging:
name: Deploy To Staging
runs-on: ubuntu-22.04
needs:
- build-cms
- build-merch
- build-web
steps:
- name: Checkout repo
uses: actions/checkout@v3
Expand All @@ -81,3 +108,33 @@ jobs:
docker compose pull &&
docker compose up -d
'

deploy-to-vercel:
name: Deploy To Staging
runs-on: ubuntu-22.04
needs:
- build-cms
- build-merch
- build-web
steps:
- name: Get build cache
uses: actions/cache/restore@v3
with:
path: .
key: CD-Staging-${{ runner.os }}-${{ github.ref }}-${{ github.run_id }}
fail-on-cache-miss: true

- name: Install Vercel CLI
run: npm install --global vercel@latest

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

- name: Copy Build Artifacts to .vercel dir
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
id: deploy-to-vercel
run: |
DEPLOYMENT_URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})
vercel alias --token=${{ secrets.VERCEL_TOKEN }} set "$DEPLOYMENT_URL" dev.ntuscse.com
133 changes: 128 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,26 @@ on:
pull_request:
types: [opened, synchronize]

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} # remote caching
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} # remote caching

jobs:
build:
name: Lint, Build and Test
timeout-minutes: 15
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} # remote caching
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} # remote caching
WORDPRESS_API_URL: ${{ secrets.WORDPRESS_API_URL }} # for web

steps:
- name: Grab cache
uses: actions/cache/restore@v3
with:
path: .
key: CI-${{ runner.os }}-${{ github.ref }}-${{ github.run_id }}
restore-keys: |
CI-${{ runner.os }}-${{ github.ref }}-
CI-${{ runner.os }}-refs/head/main-

- name: Check out code
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -47,7 +56,121 @@ jobs:
echo "${{steps.prettier-run.outputs.prettier_output}}"
echo "⭐️ You should run `yarn format` in the root of the project directory to fix these files"

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_CI }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_CI }}
aws-region: ap-southeast-1

- name: Lint + Build + Unit Test
run: yarn turbo run lint build test cypress:start-headless --color
run: yarn turbo run lint build:ci --color
env:
#merch
AWS_REGION: 'ap-southeast-1'
PRODUCT_TABLE_NAME: 'be-dev-products'
ORDER_TABLE_NAME: 'be-dev-orders'
ORDER_HOLD_TABLE_NAME: 'be-dev-orders-hold'
# web
WORDPRESS_API_URL: 'https://clubs.ntu.edu.sg/csec/graphql'
NEXT_PUBLIC_MERCH_API_ORIGIN: 'http://127.0.0.1:3002'

- name: Cache CI workflow for dependent jobs
uses: actions/cache/save@v3
with:
path: .
key: CI-${{ runner.os }}-${{ github.ref }}-${{ github.run_id }}

preview:
name: Vercel Preview - web
timeout-minutes: 15
runs-on: ubuntu-latest
needs: build
permissions:
deployments: write
pull-requests: write
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_WEB }}

steps:
- name: Get build cache
uses: actions/cache/restore@v3
with:
path: .
key: CI-${{ runner.os }}-${{ github.ref }}-${{ github.run_id }}
fail-on-cache-miss: true

- name: Install Vercel CLI
run: npm install --global vercel@latest

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

- name: Copy Build Artifacts to .vercel dir
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
id: deploy-to-vercel
run: |
DEPLOYMENT_URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})
echo "deployment-url=$DEPLOYMENT_URL" >> "$GITHUB_OUTPUT"

- name: Print Deployment URL
env:
DEPLOYMENT_URL: ${{ steps.deploy-to-vercel.outputs.deployment-url }}
run: echo $DEPLOYMENT_URL

- uses: chrnorm/deployment-action@v2
name: Create GitHub deployment
id: deployment
with:
token: '${{ github.token }}'
environment-url: '${{ steps.deploy-to-vercel.outputs.deployment-url }}'
environment: Preview - website

- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
environment-url: '${{ steps.deploy-to-vercel.outputs.deployment-url }}'
state: 'success'
deployment-id: ${{ steps.deployment.outputs.deployment_id }}

- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
state: 'failure'
deployment-id: ${{ steps.deployment.outputs.deployment_id }}

- name: Comment PR with preview link if success
if: success()
uses: thollander/actions-comment-pull-request@v2
env:
DEPLOYMENT_URL: ${{ steps.deploy-to-vercel.outputs.deployment-url }}
with:
message: |
Deployment preview link: ${{ env.DEPLOYMENT_URL }}
comment_tag: execution
mode: recreate


- name: Comment PR with preview link if fail
if: failure()
uses: thollander/actions-comment-pull-request@v2
env:
DEPLOYMENT_URL: ${{ steps.deploy-to-vercel.outputs.deployment-url }}
with:
message: |
Deployment preview link: ❌
comment_tag: execution
mode: recreate





9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ node_modules
coverage

# build
**/.next
**/build
**/out
**/dist

# next.js
.next/
out/
build

# misc
.DS_Store
*.pem
Expand All @@ -44,6 +40,9 @@ yarn-error.log*
# turbo
.turbo

# vercel
.vercel

# jetbrains
.idea

Expand Down
3 changes: 3 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/apps/cms/** @jamiegoh
/apps/merch/** @chanbakjsd
/apps/web/** @xJQx
/apps/web/features/merch/** @chanbakjsd
/apps/web/pages/merch/** @chanbakjsd

/packages/eslint-custom-config/** @realdyllon
/packages/nodelogger/** @realdyllon
Expand All @@ -18,4 +20,5 @@
/packages/types/lib/cms.ts @jamiegoh
/packages/types/lib/merch.ts @chanbakjsd
/packages/ui/** @xJQx
/packages/ui/merch/** @chanbakjsd

4 changes: 2 additions & 2 deletions apps/cms/.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MONGODB_URI=mongodb://localhost/cms
PAYLOAD_SECRET=
PAYLOAD_PUBLIC_SERVER_URL=http://localhost:3000
PAYLOAD_PUBLIC_SERVER_PORT=3000
PAYLOAD_PUBLIC_SERVER_URL=http://localhost:3003
PAYLOAD_PUBLIC_SERVER_PORT=3003
FRONTEND_STAGING_DOMAIN=https://dev.ntuscse.com
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=
Expand Down
2 changes: 2 additions & 0 deletions apps/cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"build:payload": "yarn generate:types && PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build",
"build:server": "tsc",
"build": "yarn copyfiles && yarn build:payload && yarn build:server",
"build:ci": "yarn run build",
"clean": "rm -rf dist && rm -rf build",
"serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js BABEL_DISABLE_CACHE=1 NODE_ENV=production node dist/server.js",
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}\" dist/",
"generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:types",
Expand Down
6 changes: 6 additions & 0 deletions apps/merch/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
AWS_REGION=
PRODUCT_TABLE_NAME=
ORDER_TABLE_NAME=
ORDER_HOLD_TABLE_NAME=
CORS_ORIGIN=http://localhost:3001
STRIPE_SECRET_KEY=
25 changes: 19 additions & 6 deletions apps/merch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,42 @@
"license": "Apache-2.0",
"scripts": {
"build": "tsup src/index.ts --format cjs",
"build:ci": "yarn run build",
"start": "node dist/index.js",
"start:ci": "nohup yarn run start > /dev/null 2>&1 &",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
"dev": "tsup src/index.ts --format cjs --watch --onSuccess \"node dist/index.js\"",
"lint": "TIMING=1 eslint \"**/*.ts*\"",
"lint:fix": "TIMING=1 eslint --fix \"**/*.ts*\""
},
"dependencies": {
"express": "^4.17.1",
"nodelogger": "*"
"@aws-sdk/client-dynamodb": "^3.289.0",
"@aws-sdk/util-dynamodb": "^3.289.0",
"@trpc/server": "^10.31.0",
"add": "^2.0.6",
"cors": "^2.8.5",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"nodelogger": "*",
"stripe": "^12.5.0",
"trpc-panel": "^1.3.4",
"uuid": "^9.0.0",
"yarn": "^1.22.19",
"zod": "^3.21.4"
},
"devDependencies": {
"@swc/core": "^1.3.64",
"@types/cookie-parser": "^1.4.3",
"@types/express": "^4.17.9",
"@types/morgan": "^1.9.4",
"@types/cors": "^2.8.13",
"@types/express": "^4.17.17",
"@types/uuid": "^9.0.1",
"cookie-parser": "^1.4.6",
"morgan": "^1.10.0",
"nodemon": "^2.0.6",
"ts-node": "^9.1.1",
"tsconfig": "*",
"tsup": "^6.7.0",
"types": "*",
"typescript": "^4.8.4",
"winston": "^3.8.2"
"typescript": "^4.8.4"
}
}
Loading