From 3542a0304c18c9aa202bca3ee6a6de4b1555ee54 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sun, 28 May 2023 19:47:15 +0200 Subject: [PATCH] Update setup docs and setup script for Yarn 3 Signed-off-by: David Mehren --- bin/setup | 20 ++++++-------------- docs/content/setup/manual-setup.md | 10 ++++++---- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/bin/setup b/bin/setup index adbb3719c..318695d38 100755 --- a/bin/setup +++ b/bin/setup @@ -14,19 +14,11 @@ if ! type yarn > /dev/null; then cat << EOF FATAL: Yarn could not be found. -Please follow the official installation instructions at -https://classic.yarnpkg.com/en/docs/install -and try again. -EOF - exit 1 -fi +Run 'corepack enable', then try this script again. +If 'corepack' is not available, try 'npm i -g corepack' first. -if version_lt "$(yarn --version)" '1.22.0'; then - cat << EOF -FATAL: Your Yarn version is not supported. - -Please upgrade to version 1.22.0 or higher and try again. -See https://classic.yarnpkg.com/en/docs/install for instructions. +For more information, see the installation instructions at +https://yarnpkg.com/getting-started/install EOF exit 1 fi @@ -47,10 +39,10 @@ if [ ! -f config.json ]; then fi echo "Installing packages..." -yarn install --production=true --frozen-lockfile +yarn workspaces focus --production cat << EOF -If you want to build the frontend yourself, you need to run 'yarn install --frozen-lockfile' before 'yarn build' to install the devDependencies for the build process. +If you want to build the frontend yourself, you need to run 'yarn install --immutable' before 'yarn build' to install the devDependencies for the build process. Edit the following config file to setup HedgeDoc server and client. Read more info at https://docs.hedgedoc.org/configuration/ diff --git a/docs/content/setup/manual-setup.md b/docs/content/setup/manual-setup.md index ee6ff379d..7da9f185f 100644 --- a/docs/content/setup/manual-setup.md +++ b/docs/content/setup/manual-setup.md @@ -10,7 +10,9 @@ This can break if symbols with more bytes are used. You can use `alter database character set utf8mb4 COLLATE utf8mb4_unicode_ci` to be on the safe side. - NPM (and its dependencies, [node-gyp](https://github.com/nodejs/node-gyp#installation)) - - [Yarn Classic](https://classic.yarnpkg.com) 1.22 or higher (Yarn 2 is currently not supported) + - [Yarn 3](https://yarnpkg.com/): Running `corepack enable` once should be sufficient, Node.js will then + automatically use the correct version of Yarn. If `corepack` is not available, try `npm i -g corepack` first. + See [the official docs](https://yarnpkg.com/getting-started/install) for more information and other options. - Bash (for the setup script) - For **building** the HedgeDoc frontend you need a machine with at least **2 GB** RAM. - Starting with release 1.7 the release tarball includes the prebuilt frontend, so building it yourself is not necessary. @@ -35,7 +37,7 @@ It's also possible to use environment variables. For details, have a look at [the configuration documentation](../configuration.md). 5. *:octicons-light-bulb-16: If you use the release tarball for 1.7.0 or newer, this step can be skipped.* - Build the frontend bundle by running `yarn install --frozen-lockfile` and then `yarn build`. The extra `yarn install --frozen-lockfile` is necessary as `bin/setup` does not install the build dependencies. + Build the frontend bundle by running `yarn install --immutable` and then `yarn build`. The extra `yarn install --immutable` is necessary as `bin/setup` does not install the build dependencies. 6. It is recommended to start your server manually once: ```shell NODE_ENV=production yarn start @@ -62,7 +64,7 @@ If you want to upgrade HedgeDoc from an older version, follow these steps: If you use Git, you can check out the new tag with e.g. `git fetch origin && git checkout 1.9.7` 5. Run `bin/setup`. This will take care of installing dependencies. It is safe to run on an existing installation. 6. *:octicons-light-bulb-16: If you used the release tarball for 1.7.0 or newer, this step can be skipped.* - Build the frontend bundle by running `yarn install --frozen-lockfile` and `yarn build`. The extra `yarn install --frozen-lockfile` is necessary as `bin/setup` does not install the build dependencies. + Build the frontend bundle by running `yarn install --immutable` and `yarn build`. The extra `yarn install --immutable` is necessary as `bin/setup` does not install the build dependencies. 7. It is recommended to start your server manually once: ```shell NODE_ENV=production yarn start @@ -102,7 +104,7 @@ Type=exec Environment=NODE_ENV=production Restart=always RestartSec=2s -ExecStart=/usr/bin/yarn start --production +ExecStart=/usr/bin/yarn start CapabilityBoundingSet= NoNewPrivileges=true PrivateDevices=true