Changing yarn to pnpm (#298)

This commit is contained in:
Dessalines 2024-03-04 10:24:31 -05:00 committed by GitHub
parent e8acf39a91
commit c599fa20ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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
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
sudo apt install -y ca-certificates curl gnupg
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
sudo apt update
sudo apt install nodejs yarn
sudo apt install nodejs
# pnpm
npm i -g pnpm
```
#### Build the front-end
@ -250,8 +250,8 @@ sudo -u lemmy bash
git clone https://github.com/LemmyNet/lemmy-ui.git --recursive
cd lemmy-ui
git checkout 0.18.5 # replace with the version you want to install
yarn install --pure-lockfile
yarn build:prod
pnpm i
pnpm build:prod
exit
```
@ -454,8 +454,8 @@ git checkout main
git pull --tags
git checkout 0.18.5 # replace with the version you are updating to
git submodule update
yarn install --pure-lockfile
yarn build:prod
pnpm install
pnpm build:prod
exit
sudo systemctl restart lemmy-ui
```

View file

@ -8,24 +8,28 @@ Debian-based distro:
```bash
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:
```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:
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
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
@ -82,7 +86,7 @@ After making changes, you need to format the code with `cargo +nightly fmt --all
### 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
[Docker development](03-docker-development.md).