Added pnpm (#6148)

* Added pnpm

* Removed cache for npm.

* Fixed.

* Added pnpm

* Fixed install script.

* Fixed windows script.

* Fixed.

* Fixed.

* Fixed install.

* Only install direct dependencies.

* Only install direct dependencies.

* Only install direct dependencies.

* Fixed windows build.

* fixed.

* fixed deploy.

* Fixed docker build.

* Fixed windows deploy

* Fixed docker build

* Fixed healthcheck.

* fixed.

* Fixed detection of live plugin managers dependencies.

* fixed.

* Remove Node 19 as it is not supported.

* Fixed.

* Fixed installDeps.sh

* Fixed.

* Fixed windows install.

* Fixed cypress path.

* Fixed.

* Run etherpad in background.

* Install cypress.
This commit is contained in:
SamTV12345 2024-02-11 09:51:42 +01:00 committed by GitHub
parent 96c81906cb
commit 361b38ae50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 5804 additions and 10007 deletions

View file

@ -27,10 +27,24 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: ${{ matrix.node }} node-version: ${{ matrix.node }}
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- -
name: Install libreoffice name: Install libreoffice
run: | run: |
@ -42,7 +56,7 @@ jobs:
run: src/bin/installDeps.sh run: src/bin/installDeps.sh
- -
name: Run the backend tests name: Run the backend tests
run: cd src && npm test run: cd src && pnpm test
withpluginsLinux: withpluginsLinux:
# run on pushes to any branch # run on pushes to any branch
@ -64,10 +78,24 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: ${{ matrix.node }} node-version: ${{ matrix.node }}
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- -
name: Install libreoffice name: Install libreoffice
run: | run: |
@ -79,7 +107,7 @@ jobs:
# The --legacy-peer-deps flag is required to work around a bug in npm v7: # The --legacy-peer-deps flag is required to work around a bug in npm v7:
# https://github.com/npm/cli/issues/2199 # https://github.com/npm/cli/issues/2199
run: > run: >
npm install --no-save --legacy-peer-deps pnpm install
ep_align ep_align
ep_author_hover ep_author_hover
ep_cursortrace ep_cursortrace
@ -107,7 +135,7 @@ jobs:
run: src/bin/installDeps.sh run: src/bin/installDeps.sh
- -
name: Run the backend tests name: Run the backend tests
run: cd src && npm test run: cd src && pnpm test
withoutpluginsWindows: withoutpluginsWindows:
# run on pushes to any branch # run on pushes to any branch
@ -125,10 +153,24 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installOnWindows.bat run: src/bin/installOnWindows.bat
@ -139,7 +181,7 @@ jobs:
powershell -Command "(gc settings.json.holder) -replace '\"points\": 10', '\"points\": 1000' | Out-File -encoding ASCII settings.json" powershell -Command "(gc settings.json.holder) -replace '\"points\": 10', '\"points\": 1000' | Out-File -encoding ASCII settings.json"
- -
name: Run the backend tests name: Run the backend tests
run: cd src && npm test run: cd src && pnpm test
withpluginsWindows: withpluginsWindows:
# run on pushes to any branch # run on pushes to any branch
@ -157,17 +199,31 @@ jobs:
- -
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 21
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- -
name: Install Etherpad plugins name: Install Etherpad plugins
# The --legacy-peer-deps flag is required to work around a bug in npm # The --legacy-peer-deps flag is required to work around a bug in npm
# v7: https://github.com/npm/cli/issues/2199 # v7: https://github.com/npm/cli/issues/2199
run: > run: >
npm install --no-save --legacy-peer-deps pnpm install
ep_align ep_align
ep_author_hover ep_author_hover
ep_cursortrace ep_cursortrace
@ -200,4 +256,4 @@ jobs:
powershell -Command "(gc settings.json.holder) -replace '\"points\": 10', '\"points\": 1000' | Out-File -encoding ASCII settings.json" powershell -Command "(gc settings.json.holder) -replace '\"points\": 10', '\"points\": 1000' | Out-File -encoding ASCII settings.json"
- -
name: Run the backend tests name: Run the backend tests
run: cd src && npm test run: cd src && pnpm test

View file

@ -39,16 +39,28 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 'lts/*' node-version: 'lts/*'
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- -
name: Test name: Test
run: | run: |
docker run --rm -d -p 9001:9001 --name test ${{ env.TEST_TAG }} docker run --rm -d -p 9001:9001 --name test ${{ env.TEST_TAG }}
docker logs -f test &
./src/bin/installDeps.sh ./src/bin/installDeps.sh
docker logs -f test &
while true; do while true; do
echo "Waiting for Docker container to start..." echo "Waiting for Docker container to start..."
status=$(docker container inspect -f '{{.State.Health.Status}}' test) || exit 1 status=$(docker container inspect -f '{{.State.Health.Status}}' test) || exit 1
@ -58,7 +70,7 @@ jobs:
*) printf %s\\n "unexpected status: ${status}" >&2; exit 1;; *) printf %s\\n "unexpected status: ${status}" >&2; exit 1;;
esac esac
done done
(cd src && npm run test-container) (cd src && pnpm run test-container)
git clean -dxf . git clean -dxf .
- -
name: Docker meta name: Docker meta

View file

@ -16,7 +16,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
node: [19, 20, 21] node: [20, 21]
steps: steps:
- -
@ -32,16 +32,30 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: ${{ matrix.node }} node-version: ${{ matrix.node }}
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- -
name: Install etherpad plugins name: Install etherpad plugins
# We intentionally install an old ep_align version to test upgrades to # We intentionally install an old ep_align version to test upgrades to
# the minor version number. The --legacy-peer-deps flag is required to # the minor version number. The --legacy-peer-deps flag is required to
# work around a bug in npm v7: https://github.com/npm/cli/issues/2199 # work around a bug in npm v7: https://github.com/npm/cli/issues/2199
run: npm install --no-save --legacy-peer-deps ep_align@0.2.27 run: pnpm install ep_align@0.2.27
# Etherpad core dependencies must be installed after installing the # Etherpad core dependencies must be installed after installing the
# plugin's dependencies, otherwise npm will try to hoist common # plugin's dependencies, otherwise npm will try to hoist common
# dependencies by removing them from src/node_modules and installing them # dependencies by removing them from src/node_modules and installing them

View file

@ -25,11 +25,25 @@ jobs:
- -
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 21
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh run: src/bin/installDeps.sh
@ -81,16 +95,28 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- -
name: Install Etherpad plugins name: Install Etherpad plugins
# The --legacy-peer-deps flag is required to work around a bug in npm v7: # The --legacy-peer-deps flag is required to work around a bug in npm v7:
# https://github.com/npm/cli/issues/2199 # https://github.com/npm/cli/issues/2199
run: > run: >
npm install --no-save --legacy-peer-deps pnpm install
ep_align ep_align
ep_author_hover ep_author_hover
ep_cursortrace ep_cursortrace

View file

@ -23,13 +23,6 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'npm'
cache-dependency-path: |
src/package-lock.json
src/bin/doc/package-lock.json
-
name: Install lockfile-lint
run: npm install --no-save lockfile-lint --legacy-peer-deps
- -
name: Run lockfile-lint on package-lock.json name: Run lockfile-lint on package-lock.json
run: > run: >

View file

@ -23,10 +23,24 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh run: src/bin/installDeps.sh
@ -53,19 +67,33 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- -
name: Install etherpad-load-test name: Install etherpad-load-test
run: sudo npm install -g etherpad-load-test run: pnpm install -g etherpad-load-test
- -
name: Install etherpad plugins name: Install etherpad plugins
# The --legacy-peer-deps flag is required to work around a bug in npm v7: # The --legacy-peer-deps flag is required to work around a bug in npm v7:
# https://github.com/npm/cli/issues/2199 # https://github.com/npm/cli/issues/2199
run: > run: >
npm install --no-save --legacy-peer-deps pnpm install
ep_align ep_align
ep_author_hover ep_author_hover
ep_cursortrace ep_cursortrace
@ -110,10 +138,24 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh run: src/bin/installDeps.sh

View file

@ -20,10 +20,24 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
run: ./bin/installDeps.sh run: ./bin/installDeps.sh

View file

@ -23,10 +23,23 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- -
name: docker network name: docker network
run: docker network create --subnet=172.23.42.0/16 ep_net run: docker network create --subnet=172.23.42.0/16 ep_net

View file

@ -29,16 +29,30 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: ${{ matrix.node }} node-version: ${{ matrix.node }}
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- -
name: Install Etherpad plugins name: Install Etherpad plugins
# The --legacy-peer-deps flag is required to work around a bug in npm # The --legacy-peer-deps flag is required to work around a bug in npm
# v7: https://github.com/npm/cli/issues/2199 # v7: https://github.com/npm/cli/issues/2199
run: > run: >
npm install --no-save --legacy-peer-deps pnpm install
ep_align ep_align
ep_author_hover ep_author_hover
ep_cursortrace ep_cursortrace
@ -66,7 +80,7 @@ jobs:
run: src/bin/installDeps.sh run: src/bin/installDeps.sh
- -
name: Run the backend tests name: Run the backend tests
run: cd src && npm test run: cd src && pnpm test
# Because actions/checkout@v4 is called with "ref: master" and without # Because actions/checkout@v4 is called with "ref: master" and without
# "fetch-depth: 0", the local clone does not have the ${GITHUB_SHA} # "fetch-depth: 0", the local clone does not have the ${GITHUB_SHA}
# commit. Fetch ${GITHUB_REF} to get the ${GITHUB_SHA} commit. Note that a # commit. Fetch ${GITHUB_REF} to get the ${GITHUB_SHA} commit. Note that a
@ -92,7 +106,7 @@ jobs:
- -
name: Install Cypress name: Install Cypress
working-directory: ./src working-directory: ./src
run: npm install cypress --legacy-peer-deps run: pnpm install cypress
- -
name: Run Etherpad & Test Frontend name: Run Etherpad & Test Frontend
working-directory: ./src working-directory: ./src

View file

@ -28,13 +28,25 @@ jobs:
- -
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 21
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
src/package-lock.json with:
src/bin/doc/package-lock.json version: 8
- name: Install npm@6 run_install: false
run: npm install npm@6 -g - name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- -
name: Install all dependencies and symlink for ep_etherpad-lite name: Install all dependencies and symlink for ep_etherpad-lite
shell: msys2 {0} shell: msys2 {0}
@ -42,7 +54,7 @@ jobs:
- -
name: Run the backend tests name: Run the backend tests
shell: msys2 {0} shell: msys2 {0}
run: cd src && npm test run: cd src && pnpm test
- -
name: Build the .zip name: Build the .zip
shell: msys2 {0} shell: msys2 {0}
@ -111,19 +123,35 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: 'npm' - uses: pnpm/action-setup@v3
cache-dependency-path: | name: Install pnpm
etherpad/src/package-lock.json with:
etherpad/src/bin/doc/package-lock.json version: 8
- name: Install npm@6 run_install: false
run: npm install npm@6 -g - name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Only install direct dependencies
run: pnpm config set auto-install-peers false
- name: Install all dependencies and symlink for ep_etherpad-lite
run: .\bin\installOnWindows.bat
working-directory: etherpad/src
- -
name: Run Etherpad name: Run Etherpad
working-directory: etherpad/src
run: | run: |
cd etherpad .\node_modules\.bin\cypress.cmd install --force
npm run prod --prefix ./src pnpm run prod &
curl --connect-timeout 10 --max-time 20 --retry 5 --retry-delay 10 --retry-max-time 60 --retry-connrefused http://127.0.0.1:9001/p/test curl --connect-timeout 10 --max-time 20 --retry 5 --retry-delay 10 --retry-max-time 60 --retry-connrefused http://127.0.0.1:9001/p/test
src\node_modules\.bin\cypress run --config-file src\tests\frontendcypress\cypress.config.js pnpm exec cypress run --config-file ./tests/frontend/cypress/cypress.config.js
# On release, upload windows zip to GitHub release tab # On release, upload windows zip to GitHub release tab
- -
name: Rename to etherpad-lite-win.zip name: Rename to etherpad-lite-win.zip

1
.gitignore vendored
View file

@ -22,3 +22,4 @@ out/
/src/bin/etherpad-1.deb /src/bin/etherpad-1.deb
/src/bin/node.exe /src/bin/node.exe
plugin_packages plugin_packages
/pnpm-lock.yaml

1
.npmrc Normal file
View file

@ -0,0 +1 @@
auto-install-peers=false

View file

@ -64,21 +64,21 @@ jobs:
- *install_libreoffice - *install_libreoffice
- *set_loglevel_warn - *set_loglevel_warn
- "src/bin/installDeps.sh" - "src/bin/installDeps.sh"
- "cd src && npm install && cd -" - "cd src && pnpm install && cd -"
script: script:
- "cd src && npm test" - "cd src && pnpm test"
- name: "Test the Dockerfile" - name: "Test the Dockerfile"
install: install:
- "cd src && npm install && cd -" - "cd src && pnpm install && cd -"
script: script:
- "docker build -t etherpad:test ." - "docker build -t etherpad:test ."
- "docker run -d -p 9001:9001 etherpad:test && sleep 3" - "docker run -d -p 9001:9001 etherpad:test && sleep 3"
- "cd src && npm run test-container" - "cd src && pnpm run test-container"
- name: "Load test Etherpad without Plugins" - name: "Load test Etherpad without Plugins"
install: install:
- *set_loglevel_warn - *set_loglevel_warn
- "src/bin/installDeps.sh" - "src/bin/installDeps.sh"
- "cd src && npm install && cd -" - "cd src && pnpm install && cd -"
- "npm install -g etherpad-load-test" - "npm install -g etherpad-load-test"
script: script:
- "src/tests/frontend/travis/runnerLoadTest.sh" - "src/tests/frontend/travis/runnerLoadTest.sh"
@ -107,16 +107,16 @@ jobs:
- *set_loglevel_warn - *set_loglevel_warn
- "src/bin/installDeps.sh" - "src/bin/installDeps.sh"
- *install_plugins - *install_plugins
- "cd src && npm install && cd -" - "cd src && pnpm install && cd -"
script: script:
- "cd src && npm test" - "cd src && pnpm test"
- name: "Test the Dockerfile" - name: "Test the Dockerfile"
install: install:
- "cd src && npm install && cd -" - "cd src && pnpm install && cd -"
script: script:
- "docker build -t etherpad:test ." - "docker build -t etherpad:test ."
- "docker run -d -p 9001:9001 etherpad:test && sleep 3" - "docker run -d -p 9001:9001 etherpad:test && sleep 3"
- "cd src && npm run test-container" - "cd src && pnpm run test-container"
- name: "Load test Etherpad with Plugins" - name: "Load test Etherpad with Plugins"
install: install:
- *set_loglevel_warn - *set_loglevel_warn

View file

@ -79,10 +79,11 @@ USER root
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199
RUN \ RUN \
mkdir -p /usr/share/man/man1 && \ mkdir -p /usr/share/man/man1 && \
npm install npm@6 -g && \ npm install pnpm -g && \
apk update && apk upgrade && \ apk update && apk upgrade && \
apk add \ apk add \
ca-certificates \ ca-certificates \
curl \
git \ git \
${INSTALL_ABIWORD:+abiword abiword-plugin-command} \ ${INSTALL_ABIWORD:+abiword abiword-plugin-command} \
${INSTALL_SOFFICE:+libreoffice openjdk8-jre libreoffice-common} ${INSTALL_SOFFICE:+libreoffice openjdk8-jre libreoffice-common}
@ -113,13 +114,12 @@ COPY --chown=etherpad:etherpad ${SETTINGS} "${EP_DIR}"/settings.json
#RUN chmod -R g=u . #RUN chmod -R g=u .
USER root USER root
RUN cd src && npm link
USER etherpad USER etherpad
WORKDIR /opt/etherpad-lite WORKDIR /opt/etherpad-lite
HEALTHCHECK --interval=20s --timeout=3s CMD ["etherpad-healthcheck"] HEALTHCHECK --interval=5s --timeout=3s \
CMD curl --silent http://localhost:9001/health | grep -E "pass|ok|up" > /dev/null || exit 1
EXPOSE 9001 EXPOSE 9001
CMD ["npm", "run", "prod", "--prefix", "./src"] CMD ["npm", "run", "prod", "--prefix", "./src"]

1
src/.npmrc Normal file
View file

@ -0,0 +1 @@
auto-install-peers=false

View file

@ -33,7 +33,8 @@ try export GIT_WORK_TREE=${TMP_FOLDER}; git checkout HEAD -f \
|| fatal "failed to copy etherpad to temporary folder" || fatal "failed to copy etherpad to temporary folder"
try mkdir "${TMP_FOLDER}"/.git try mkdir "${TMP_FOLDER}"/.git
try git rev-parse HEAD >${TMP_FOLDER}/.git/HEAD try git rev-parse HEAD >${TMP_FOLDER}/.git/HEAD
try cp -r ./src/node_modules "${TMP_FOLDER}"/src/node_modules # Disable symlinks to avoid problems with Windows
#try pnpm i "${TMP_FOLDER}"/src/node_modules
try cd "${TMP_FOLDER}" try cd "${TMP_FOLDER}"
[ -f src/package.json ] || fatal "failed to copy etherpad to temporary folder" [ -f src/package.json ] || fatal "failed to copy etherpad to temporary folder"
@ -42,16 +43,19 @@ try cd "${TMP_FOLDER}"
# making the windows package smaller # making the windows package smaller
export NODE_ENV=production export NODE_ENV=production
log "do a normal unix install first..." rm -rf node_modules || true
try ./src/bin/installDeps.sh rm -rf src/node_modules || true
#log "do a normal unix install first..."
#$(try cd src && ./bin/installDeps.sh)
log "copy the windows settings template..." log "copy the windows settings template..."
try cp settings.json.template settings.json try cp settings.json.template settings.json
log "resolve symbolic links..." #log "resolve symbolic links..."
try cp -rL node_modules node_modules_resolved #try cp -rL node_modules node_modules_resolved
try rm -rf node_modules #try rm -rf node_modules
try mv node_modules_resolved node_modules #try mv node_modules_resolved node_modules
log "download windows node..." log "download windows node..."
try wget "https://nodejs.org/dist/latest-v20.x/win-x64/node.exe" -O node.exe try wget "https://nodejs.org/dist/latest-v20.x/win-x64/node.exe" -O node.exe

View file

@ -1,13 +0,0 @@
{
"name": "node-doc-generator",
"version": "0.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"marked": {
"version": "12.0.0",
"resolved": "https://registry.npmjs.org/marked/-/marked-12.0.0.tgz",
"integrity": "sha512-Vkwtq9rLqXryZnWaQc86+FHLC6tr/fycMfYAhiOIXkrNmeGAyhSxjqu0Rs1i0bBqw5u0S7+lV9fdH2ZSVaoa0w=="
}
}
}

View file

@ -1,15 +0,0 @@
{
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"name": "node-doc-generator",
"description": "Internal tool for generating Node.js API docs",
"version": "0.0.0",
"engines": {
"node": ">=12.17.0"
},
"dependencies": {
"marked": "^12.0.0"
},
"devDependencies": {},
"optionalDependencies": {},
"bin": "./generate.js"
}

View file

@ -8,17 +8,13 @@ cd "${MY_DIR}/../.." || exit 1
# Source constants and useful functions # Source constants and useful functions
. src/bin/functions.sh . src/bin/functions.sh
is_cmd pnpm || npm install pnpm -g
# Is node installed? # Is node installed?
# Not checking io.js, default installation creates a symbolic link to node # Not checking io.js, default installation creates a symbolic link to node
is_cmd node || fatal "Please install node.js ( https://nodejs.org )" is_cmd node || fatal "Please install node.js ( https://nodejs.org )"
# Is npm installed?
is_cmd npm || fatal "Please install npm ( https://npmjs.org )"
# Check npm version
require_minimal_version "npm" "$(get_program_version "npm")" \
"$REQUIRED_NPM_MAJOR" "$REQUIRED_NPM_MINOR"
# Check node version # Check node version
require_minimal_version "nodejs" "$(get_program_version "node")" \ require_minimal_version "nodejs" "$(get_program_version "node")" \
"$REQUIRED_NODE_MAJOR" "$REQUIRED_NODE_MINOR" "$REQUIRED_NODE_MAJOR" "$REQUIRED_NODE_MINOR"
@ -48,10 +44,10 @@ cd src
if [ -z "${ETHERPAD_PRODUCTION}" ]; then if [ -z "${ETHERPAD_PRODUCTION}" ]; then
log "Installing dev dependencies" log "Installing dev dependencies"
npm ci --no-optional --omit=optional --include=dev --lockfile-version 1 || exit 1 pnpm i || exit 1
else else
log "Installing production dependencies" log "Installing production dependencies"
npm ci --no-optional --omit=optional --omit=dev --lockfile-version 1 --production || exit 1 pnpm i --production || exit 1
fi fi
# Remove all minified data to force node creating it new # Remove all minified data to force node creating it new

View file

@ -13,8 +13,8 @@ mkdir node_modules
cd /D node_modules cd /D node_modules
mklink /D "ep_etherpad-lite" "..\src" mklink /D "ep_etherpad-lite" "..\src"
cd /D "ep_etherpad-lite" cd /D ..\src
cmd /C npm ci --legacy-peer-deps || exit /B 1 cmd /C pnpm i || exit /B 1
cd /D "%~dp0\..\.." cd /D "%~dp0\..\.."

View file

@ -25,7 +25,7 @@ TODO
To run the backend tests, run the following from the Etherpad working directory: To run the backend tests, run the following from the Etherpad working directory:
```shell ```shell
(cd src && npm test) (cd src && pnpm test)
``` ```
To run the frontend tests, visit: http://localhost:9001/tests/frontend/ To run the frontend tests, visit: http://localhost:9001/tests/frontend/

View file

@ -72,4 +72,4 @@ jobs:
run: src/bin/installDeps.sh run: src/bin/installDeps.sh
- -
name: Run the backend tests name: Run the backend tests
run: cd src && npm test run: cd src && pnpm test

9809
src/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -49,12 +49,11 @@
"jsdom": "^24.0.0", "jsdom": "^24.0.0",
"jsonminify": "0.4.2", "jsonminify": "0.4.2",
"languages4translatewiki": "0.1.3", "languages4translatewiki": "0.1.3",
"live-plugin-manager": "^0.18.1", "live-plugin-manager-pnpm": "^0.18.1",
"lodash.clonedeep": "4.5.0", "lodash.clonedeep": "4.5.0",
"log4js": "^6.9.1", "log4js": "^6.9.1",
"measured-core": "^2.0.0", "measured-core": "^2.0.0",
"mime-types": "^2.1.35", "mime-types": "^2.1.35",
"npm": "^6.14.18",
"openapi-backend": "^5.10.6", "openapi-backend": "^5.10.6",
"proxy-addr": "^2.0.7", "proxy-addr": "^2.0.7",
"rate-limiter-flexible": "^4.0.1", "rate-limiter-flexible": "^4.0.1",
@ -100,7 +99,8 @@
}, },
"engines": { "engines": {
"node": ">=18.18.2", "node": ">=18.18.2",
"npm": ">=6.14.0" "npm": ">=6.14.0",
"pnpm": ">=8.3.0"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

5418
src/pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

View file

@ -6,10 +6,10 @@ const hooks = require('./hooks');
const runCmd = require('../../../node/utils/run_cmd'); const runCmd = require('../../../node/utils/run_cmd');
const settings = require('../../../node/utils/Settings'); const settings = require('../../../node/utils/Settings');
const axios = require('axios'); const axios = require('axios');
const {PluginManager} = require("live-plugin-manager"); const {PluginManager} = require('live-plugin-manager-pnpm');
const {promises: fs} = require("fs"); const {promises: fs} = require('fs');
const path = require("path"); const path = require('path');
const {findEtherpadRoot} = require("../../../node/utils/AbsolutePaths"); const {findEtherpadRoot} = require('../../../node/utils/AbsolutePaths');
const logger = log4js.getLogger('plugins'); const logger = log4js.getLogger('plugins');
exports.manager = new PluginManager(); exports.manager = new PluginManager();
@ -25,8 +25,8 @@ const onAllTasksFinished = async () => {
}; };
const headers = { const headers = {
'User-Agent': 'Etherpad/' + settings.getEpVersion(), 'User-Agent': `Etherpad/${settings.getEpVersion()}`,
} };
let tasks = 0; let tasks = 0;
@ -41,24 +41,25 @@ const wrapTaskCb = (cb) => {
}; };
const migratePluginsFromNodeModules = async () => { const migratePluginsFromNodeModules = async () => {
logger.info('start migration of plugins in node_modules') logger.info('start migration of plugins in node_modules');
// Notes: // Notes:
// * Do not pass `--prod` otherwise `npm ls` will fail if there is no `package.json`. // * Do not pass `--prod` otherwise `npm ls` will fail if there is no `package.json`.
// * The `--no-production` flag is required (or the `NODE_ENV` environment variable must be // * The `--no-production` flag is required (or the `NODE_ENV` environment variable must be
// unset or set to `development`) because otherwise `npm ls` will not mention any packages // unset or set to `development`) because otherwise `npm ls` will not mention any packages
// that are not included in `package.json` (which is expected to not exist). // that are not included in `package.json` (which is expected to not exist).
const cmd = ['npm', 'ls', '--long', '--json', '--depth=0', '--no-production']; const cmd = ['pnpm', 'ls', '--long', '--json', '--depth=0', '--no-production'];
const {dependencies = {}} = JSON.parse(await runCmd(cmd, {stdio: [null, 'string']})); const [{dependencies = {}}] = JSON.parse(await runCmd(cmd,
await Promise.all(Object.entries(dependencies).map(async ([pkg, info]) => { {stdio: [null, 'string']}));
if (pkg.startsWith(plugins.prefix) && pkg !== 'ep_etherpad-lite') { await Promise.all(Object.entries(dependencies)
if (!info._resolved) { .filter(([pkg, info]) => pkg.startsWith(plugins.prefix) && pkg !== 'ep_etherpad-lite')
// Install from node_modules directory .map(async ([pkg, info]) => {
await exports.manager.installFromPath(`${findEtherpadRoot()}/node_modules/${pkg}`); if (!info._resolved) {
} else { // Install from node_modules directory
await exports.manager.install(pkg); await exports.manager.installFromPath(`${findEtherpadRoot()}/node_modules/${pkg}`);
} } else {
} await exports.manager.install(pkg);
})); }
}));
await persistInstalledPlugins(); await persistInstalledPlugins();
}; };
@ -76,22 +77,22 @@ exports.checkForMigration = async () => {
for (const plugin of installedPlugins.plugins) { for (const plugin of installedPlugins.plugins) {
if (plugin.name.startsWith(plugins.prefix) && plugin.name !== 'ep_etherpad-lite') { if (plugin.name.startsWith(plugins.prefix) && plugin.name !== 'ep_etherpad-lite') {
await exports.manager.install(plugin.name, plugin.version) await exports.manager.install(plugin.name, plugin.version);
} }
} }
}; };
const persistInstalledPlugins = async () => { const persistInstalledPlugins = async () => {
let installedPlugins = { plugins: []}; const installedPlugins = {plugins: []};
for (const pkg of Object.values(await plugins.getPackages())) { for (const pkg of Object.values(await plugins.getPackages())) {
installedPlugins.plugins.push({ installedPlugins.plugins.push({
name: pkg.name, name: pkg.name,
version: pkg.version, version: pkg.version,
}) });
} }
installedPlugins.plugins = [...new Set(installedPlugins.plugins)]; installedPlugins.plugins = [...new Set(installedPlugins.plugins)];
await fs.writeFile(installedPluginsPath, JSON.stringify(installedPlugins)); await fs.writeFile(installedPluginsPath, JSON.stringify(installedPlugins));
} };
exports.uninstall = async (pluginName, cb = null) => { exports.uninstall = async (pluginName, cb = null) => {
cb = wrapTaskCb(cb); cb = wrapTaskCb(cb);
@ -123,14 +124,13 @@ exports.getAvailablePlugins = (maxCacheAge) => {
return resolve(exports.availablePlugins); return resolve(exports.availablePlugins);
} }
await axios.get('https://static.etherpad.org/plugins.json', {headers: headers}) await axios.get('https://static.etherpad.org/plugins.json', {headers})
.then((pluginsLoaded) => { .then((pluginsLoaded) => {
exports.availablePlugins = pluginsLoaded.data; exports.availablePlugins = pluginsLoaded.data;
cacheTimestamp = nowTimestamp; cacheTimestamp = nowTimestamp;
resolve(exports.availablePlugins);}) resolve(exports.availablePlugins);
.catch(async err => { })
return reject(err); .catch(async (err) => reject(err));
});
}); });
}; };

View file

@ -16,10 +16,10 @@ const logger = log4js.getLogger('plugins');
// Log the version of npm at startup. // Log the version of npm at startup.
(async () => { (async () => {
try { try {
const version = await runCmd(['npm', '--version'], {stdio: [null, 'string']}); const version = await runCmd(['pnpm', '--version'], {stdio: [null, 'string']});
logger.info(`npm --version: ${version}`); logger.info(`pnpm --version: ${version}`);
} catch (err) { } catch (err) {
logger.error(`Failed to get npm version: ${err.stack || err}`); logger.error(`Failed to get pnpm version: ${err.stack || err}`);
// This isn't a fatal error so don't re-throw. // This isn't a fatal error so don't re-throw.
} }
})(); })();

View file

@ -8,4 +8,5 @@ REM around this, everything must consistently use either `src` or
REM `node_modules\ep_etherpad-lite` on Windows. Because some plugins access REM `node_modules\ep_etherpad-lite` on Windows. Because some plugins access
REM Etherpad internals via `require('ep_etherpad-lite/foo')`, REM Etherpad internals via `require('ep_etherpad-lite/foo')`,
REM `node_modules\ep_etherpad-lite` is used here. REM `node_modules\ep_etherpad-lite` is used here.
node run dev cd src
pnpm run prod