2022-01-31 09:09:37 -08:00
---
2022-11-04 10:06:45 -07:00
id: local-dev
title: Serving Docs Locally for Development
sidebar_label: Local Development
2022-01-31 09:09:37 -08:00
---
2022-03-08 23:51:46 -08:00
2022-01-31 09:09:37 -08:00
## Prerequisites
2022-03-08 23:51:46 -08:00
2022-01-31 09:09:37 -08:00
In order to set up your local environment, you will need to install:
2022-10-31 02:07:44 -07:00
- [Node.js Runtime](https://nodejs.org)
- [PNPM Package Manager](https://pnpm.io)
2022-01-31 09:09:37 -08:00
2022-02-08 05:33:51 -08:00
## Getting Started
2022-03-08 23:51:46 -08:00
2022-01-31 09:09:37 -08:00
### Fork the Meshtastic Repository
2022-10-31 02:07:44 -07:00
Log into GitHub and create a fork of the [meshtastic/meshtastic](https://github.com/meshtastic/meshtastic) repository.
2022-01-31 09:09:37 -08:00
### Clone your Meshtastic Repository fork
:::note
2024-09-11 16:00:11 -07:00
Replace `YOUR_GITHUB_USERNAME` with your GitHub username.
2022-01-31 09:09:37 -08:00
:::
2024-09-11 16:00:11 -07:00
```shell title="Clone your Fork of the Documentation Repository"
git clone https://github.com/YOUR_GITHUB_USERNAME/meshtastic.git
2022-01-31 09:09:37 -08:00
```
2024-09-11 16:00:11 -07:00
### Change directory into your Local Copy
2022-03-08 23:51:46 -08:00
2022-04-01 06:34:49 -07:00
```shell title="Change Directory"
2024-09-11 16:00:11 -07:00
cd ./meshtastic
```
### Install Submodules
```shell title="Install Submodules"
git submodule update --init --recursive
2022-01-31 09:09:37 -08:00
```
### Install Dependencies
2022-03-08 23:51:46 -08:00
2024-02-18 20:47:01 -08:00
```shell title="Install dependencies using pnpm"
2022-10-31 02:07:44 -07:00
pnpm i
2022-01-31 09:09:37 -08:00
```
### Run Development Server
2022-03-08 23:51:46 -08:00
2022-04-01 06:34:49 -07:00
```shell title="Run node.js server"
2022-10-31 02:07:44 -07:00
pnpm start
2022-01-31 09:09:37 -08:00
```
2022-02-08 05:33:51 -08:00
:::tip
Before submitting a pull request, it's helpful to run the following command to ensure there are no broken links or errors:
2022-04-01 06:34:49 -07:00
```shell title="Build Project"
2022-10-31 02:07:44 -07:00
pnpm build
2022-02-08 05:33:51 -08:00
```
2022-03-08 23:51:46 -08:00
2022-02-08 05:33:51 -08:00
:::
2022-02-22 12:35:03 -08:00
## Update Local Repository
### Verify Upstream Remote is Set
2022-04-01 06:34:49 -07:00
```shell title="Check Remote and Upstream Repositories"
2022-02-22 12:35:03 -08:00
git remote -v
```
2022-04-01 06:34:49 -07:00
2022-10-31 01:53:15 -07:00
If it's set, skip to [Align with meshtastic/meshtastic Master branch](#align-with-meshtasticmeshtastic-master-branch)
2022-04-01 06:34:49 -07:00
2022-02-22 12:35:03 -08:00
#### Update/Set Upstream if it isn't configured properly
2022-04-01 06:34:49 -07:00
2022-10-31 02:07:44 -07:00
If upstream exists, set the URL:
2022-04-01 06:34:49 -07:00
```shell title="Update Upstream Repository"
2022-10-31 01:53:15 -07:00
git remote set-url upstream https://github.com/meshtastic/meshtastic.git
2022-02-22 12:35:03 -08:00
```
2022-10-31 02:07:44 -07:00
If upstream doesn't exist, add the URL:
2022-04-01 06:34:49 -07:00
```shell title="Add Upstream Repository"
2022-10-31 01:53:15 -07:00
git remote add upstream https://github.com/meshtastic/meshtastic.git
2022-02-22 12:35:03 -08:00
```
2022-04-01 06:34:49 -07:00
2022-10-31 01:53:15 -07:00
### Align with meshtastic/meshtastic Master branch
2022-02-22 12:35:03 -08:00
:::caution
This will delete any unfinished work. Make sure that you've saved and committed any work you wish to push up to your fork.
:::
:::info
2022-10-31 01:53:15 -07:00
The following command assumes the clone of your Meshtastic fork is in the home directory (`~/meshtastic`). Adjust the path to the correct path on your machine.
2022-02-22 12:35:03 -08:00
:::
2022-04-01 06:34:49 -07:00
```shell title="Rebase local Meshtastic to remote Meshtastic"
2022-10-31 01:53:15 -07:00
cd ~/meshtastic ; git fetch upstream ; git checkout master ; git rebase upstream/master
2022-02-22 12:35:03 -08:00
```