Skip to content

Gatsby Cheatsheet#

Setup#

  • Installing
    nodejs upgrade is the same as installing a new nodejs version
    From Powershell elevated prompt:
PowerShell
cinst -y nvm.portable
nvm install 10.16.0
nvm install latest

nvm use 10.16.0 # (or for each nodejs installation bc you globally installed modules arent shared)
npm install -g npm@latest
# !!!!!! IMPORTANT
# CAREFUL WITH THIS ONE: It does unbelievably dumb fucking shit like wreck your user path and then adds python27 directory to that path variable, wrecking existing python installs
npm install -g windows-build-tools
npm install -g gatsby-cli
  • Upgrade Gatsby
Bash
npm outdated         # to identify new releases for all your dependencies
gatsby info
node -v
npm -v
npm update -g gatsby # upgrade gatsby globally
npm update --dev     # update all packages in project
  • Building
Bash
npm run dev
npm run develop # clean & start develop environment
npm run build & npm run serve
  • Misc Commands
Bash
npm run lint
npm run lint:fix
npm run format:js
npm run format:md
npm run format:mdx
npm run formatp:md   # this uses prettier which isnt as configurable
npm run formatp:mdx  # this uses prettier which isnt as configurable

Usage#

Bash
gatsby new gamedevguide https://github.com/ikrima/gamedevguide (or git clone + yarn)
gatsby develop (yarn develop)
gatsby build
gatsby serve
`http://localhost:8000`
`http://localhost:8000/___graphql`

Reference#