Go to file
T-Hax 1fadb4f915 init
Signed-off-by: T-Hax <>
2023-04-28 17:40:24 +00:00
env.example init 2023-04-28 17:40:24 +00:00
gitignore init 2023-04-28 17:40:24 +00:00
README.md init 2023-04-28 17:40:24 +00:00
TLDR.md init 2023-04-28 17:40:24 +00:00
yarnrc.yml init 2023-04-28 17:40:24 +00:00

Setting up yarn v3 to work with Gitea

Instead of using Yarn Classic (V1), we are using V3 for working with new projects. This is for the reason that Yarn Classic is annoying when working with Gitea repositories and shouldn't really be bothered with.

The guide to installing and configuring Yarn V3 follows.

Install guide

Checkout tl;dr if you are about to fall asleep.

You should first deinstall the current version of yarn which you are using. If you have legacy repositories with aliased package names (e.g. "my-package": "npm:@scope/my-package"), then you should look into use corepack on using an older Yarn version on that specific repository.

If you have Node 16.10 or higher, you should already have a program called Corepack. If you don't, read the section "Node.js <16.10" below. Otherwise, enable as stated in the section after it.

Node.js <16.10

Corepack isn't included with Node.js in versions before the 16.10; to address that, run:

npm i -g corepack
corepack prepare yarn@<version> --activate
yarn --version

Node.js >=16.10

Corepack is included by default with all Node.js installs, but is currently opt-in. To enable it, run the following command:

corepack enable
corepack prepare yarn@stable --activate
yarn --version

Configuration

Yarn V3 doesn't support global options and instead has project (dir) specific options which write for any non-defaults a new .yarnrc.yml file in your current dir.

This is similar to python packaging (pip and venvs) and is preferable for working with projects.

In any case check out the sample config for this gitea, it will be kept updated..

Tip

Yarn V1 renaming a package:

{
    "dependencies": {
        "some-package": "npm:@scope/some-package"
    }
}

Yarn V2/3 doing the same:

{
    "dependencies": {
        "some-package": "npm:@scope/some-package@<version statement>"
    }
}

The range is necessary for installing the package.