Ginhing/matters-web

Codebase of Matters' website

★ 0Forks 0TypeScriptGitHub ↗Compare

Project website ↗

README

matters-web

Deployment Status Test Status Commitizen friendly

Getting Started

Start local dev

  • Install dependencies: npm i
  • Environment variables: cp .env.local.example .env.local
  • Run npm run gen:type or npm run gen:watch
  • Run npm run dev, then go to http://localhost:3000/

Build and run production server

npm run build && npm run start

Start local dev with Docker

  • Environment variables: cp .env.local.example .env.local
  • Set command alias: source bin/dc-alias
  • Build docker image: dc build
  • Run:
    • dc up or dc run --service-ports web npm run dev
    • then go to http://localhost:3000/

NOTE: If new packages are added to package.json, dc up will use npm i to install those packages. But if you are using dc run --service-ports web npm run dev, you need to run dc run web npm i manually to make sure that new packages are installed.

Build with docker

  • Set command alias: source bin/dc-alias
  • dc run web npm run build

Push and pull docker image

  • Set command alias: source bin/dc-alias
  • Build docker image: dc build
  • aws configure, then input your access key and secret
  • Login AWS ECR with $(aws ecr get-login --no-include-email --region ap-southeast-1)
  • Push:
    • docker push 903380195283.dkr.ecr.ap-southeast-1.amazonaws.com/matters-web:latest
    • docker tag matters-web:latest 903380195283.dkr.ecr.ap-southeast-1.amazonaws.com/matters-web:latest
  • Pull:
    • docker pull 903380195283.dkr.ecr.ap-southeast-1.amazonaws.com/matters-web:latest
    • docker tag 903380195283.dkr.ecr.ap-southeast-1.amazonaws.com/matters-web:latest matters-web:latest

Conventions

Matters Design System

Matters 3.0: Design System

Naming

React Component/Page

foldername: PascalCase

filename: camelCase

├── pages
│   └── ArticleDetail
│       ├── styles.css
│       └── index.tsx
└── components
    └── Layout
        ├── styles.css
        └── index.tsx

Tools

VS Code

Settings

See .vscode/settings.json

Extensions

Recommdation
Optional

Vim

Settings

For vim users, you might want to see .vim/.vimrc (using vim-plug).

Troubleshooting

  1. If styled-jsx is installed in both next and our own package.json, the built-in styled-jsx SSR of Next.js will fail. See #533.

Contributors

robertu7devformattersdependabot-preview[bot]guoliudependabot[bot]CarolusianGinhingbwjia-pennproformatters

Issues