Changing yarn to pnpm

This commit is contained in:
Dessalines 2024-03-04 09:00:09 -05:00
parent 2c5c2053bb
commit 768da4a8bc
2 changed files with 22 additions and 18 deletions

View file

@ -222,13 +222,9 @@ If you did everything right, the Lemmy logs from `sudo journalctl -u lemmy` shou
#### Install dependencies #### Install dependencies
Nodejs and yarn in Ubuntu 20.04 / Ubuntu 22.04 repos are too old, so let's install Node 20. Nodejs in Ubuntu 20.04 / Ubuntu 22.04 repos are too old, so let's install Node 20.
``` ```
# yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# nodejs # nodejs
sudo apt install -y ca-certificates curl gnupg sudo apt install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings sudo mkdir -p /etc/apt/keyrings
@ -236,7 +232,11 @@ curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt update sudo apt update
sudo apt install nodejs yarn sudo apt install nodejs
# pnpm
npm i -g pnpm
``` ```
#### Build the front-end #### Build the front-end
@ -250,8 +250,8 @@ sudo -u lemmy bash
git clone https://github.com/LemmyNet/lemmy-ui.git --recursive git clone https://github.com/LemmyNet/lemmy-ui.git --recursive
cd lemmy-ui cd lemmy-ui
git checkout 0.18.5 # replace with the version you want to install git checkout 0.18.5 # replace with the version you want to install
yarn install --pure-lockfile pnpm i
yarn build:prod pnpm build:prod
exit exit
``` ```
@ -454,8 +454,8 @@ git checkout main
git pull --tags git pull --tags
git checkout 0.18.5 # replace with the version you are updating to git checkout 0.18.5 # replace with the version you are updating to
git submodule update git submodule update
yarn install --pure-lockfile pnpm install
yarn build:prod pnpm build:prod
exit exit
sudo systemctl restart lemmy-ui sudo systemctl restart lemmy-ui
``` ```

View file

@ -8,24 +8,28 @@ Debian-based distro:
```bash ```bash
sudo apt install git cargo libssl-dev pkg-config libpq-dev curl sudo apt install git cargo libssl-dev pkg-config libpq-dev curl
# install yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install yarn
``` ```
Arch-based distro: Arch-based distro:
```bash ```bash
sudo pacman -S git cargo openssl pkg-config postgresql-libs curl yarn sudo pacman -S git cargo openssl pkg-config postgresql-libs curl
``` ```
macOS: macOS:
Install [Homebrew](https://brew.sh/) if you don't already have it installed. Then install Node and Yarn. Install [Homebrew](https://brew.sh/) if you don't already have it installed. Then install Node and pnpm.
```bash ```bash
brew install node yarn brew install node
```
### Install pnpm
The install instructions are [here](https://pnpm.io/installation), or you can run
```bash
npm install -g pnpm
``` ```
### Setup PostgreSQL database ### Setup PostgreSQL database
@ -82,7 +86,7 @@ After making changes, you need to format the code with `cargo +nightly fmt --all
### Frontend development ### Frontend development
Install dependencies by running `yarn`. Then run `yarn dev` to launch lemmy-ui locally. It automatically connects to the Lemmy backend on `localhost:8536`. Open [localhost:1234](http://localhost:1234) in your browser. The project is rebuilt automatically when you change any files. Install dependencies by running `pnpm i`. Then run `pnpm dev` to launch lemmy-ui locally. It automatically connects to the Lemmy backend on `localhost:8536`. Open [localhost:1234](http://localhost:1234) in your browser. The project is rebuilt automatically when you change any files.
Note that this setup doesn't support image uploads. If you want to test those, you need to use the Note that this setup doesn't support image uploads. If you want to test those, you need to use the
[Docker development](03-docker-development.md). [Docker development](03-docker-development.md).