-
Notifications
You must be signed in to change notification settings - Fork 0
Local development environment
There are multiple ways to install Node.js. Homebrew is nice and easy, and allows you to update over time. There is also an official installer provided from the Node.js website.
# Install the latest version of Node.js
brew install node
- Go to https://nodejs.org/ and click the 'Download Node.js' button
- Double-click the downloaded file and follow the installer instructions
# Verify Node.js
node -v
# Verify npm
npm -v
Use npm to install the dependencies listed in ./package.json.
This step is only needed:
- when spinning up the project for the first time
- when dependencies change
# Install dependencies
# Ran from project root
npm install
Use npm to run the site locally in development mode, so that changes to the code are reflected immediately in the browser.
# Run the development server at http://localhost:4321/
# Ran from project root
npm run start
The start
script is defined in the scripts
section of ./package.json.
Build the site into a set of static files that can be easily hosted on any static file server.
Cloudflare is the current host for relaymaryland.com, and is configured to run the following command on every push to the main
branch. As such there's not very much need to run this command locally, but it's good to know about it.
# Build the site which is written to ./dist/
# Ran from project root
npm run build
The build
script is defined in the scripts
section of ./package.json.