These are my development notes for this website.
They include instructions on how to build the project, run tests, and so on.
Clone the repository with
$ git clone [email protected]:awwsmm/awwsmm.com.git
If not already installed, get npm
using Homebrew
$ if ! command -v npm &> /dev/null; then; brew install node; fi
Move to the awwsmm.com.git/
project root directory and install all the dependencies listed in package.json
with
$ npm install
Set up the git hooks in git-hooks/
by running
$ npm run hook
Check out the available "scripts"
in package.json
:
"scripts": {
"build": "next build",
"deplock": "rm package-lock.json && rm -rf node_modules && npm install",
"dev": "next dev",
"hook": "npm run unhook && find git-hooks -maxdepth 1 -type f -exec chmod +x {} \\; -exec ln -sf $(pwd)/{} .git/hooks \\;",
"lint": "eslint . --ext .ts --ext .tsx",
"lint-and-fix": "eslint . --ext .ts --ext .tsx --fix",
"sandbox": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha -r ts-node/register 'sandbox.ts'",
"tests": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha -r ts-node/register 'tests/**/*.ts'",
"unhook": "find .git/hooks -type l -exec unlink {} \\;"
},
Run the website locally by moving to the development
git branch and running npm run dev
(runs the dev
script above).
$ git switch development
$ npm run dev
To create a new production deployment, push to the master
branch. Or, merge development
into master
and push.
$ npm run deplock
- Do not put any non-page files in
/pages
, Vercel will fail to build. Instead, keep all class definitions, etc. in/lib
. getStaticProps
must always return a "JSON serializable data type". Do not try to return a class. See: vercel/next.js#11993 / https://stackoverflow.com/a/62671059/2925434.