Refactor project structure and introduce workspaces (#6170)

* prototype for structure change - working

* move server.ts

* Revert "move server.ts"

This reverts commit 4cf2e61dc0.

* adjusted package file

* further cleanup

* add workspace root flag

* fix docker install

* fix loadtest

* fix run
This commit is contained in:
JannikStreek 2024-02-19 22:31:27 +01:00 committed by GitHub
parent a8ff9d5667
commit b4ac96d823
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 48 additions and 13 deletions

View file

@ -107,7 +107,7 @@ jobs:
# The --legacy-peer-deps flag is required to work around a bug in npm v7:
# https://github.com/npm/cli/issues/2199
run: >
pnpm install
pnpm install --workspace-root
ep_align
ep_author_hover
ep_cursortrace
@ -223,7 +223,7 @@ jobs:
# The --legacy-peer-deps flag is required to work around a bug in npm
# v7: https://github.com/npm/cli/issues/2199
run: >
pnpm install
pnpm install --workspace-root
ep_align
ep_author_hover
ep_cursortrace

View file

@ -93,7 +93,7 @@ jobs:
# The --legacy-peer-deps flag is required to work around a bug in npm v7:
# https://github.com/npm/cli/issues/2199
run: >
pnpm install
pnpm install --workspace-root
ep_align
ep_author_hover
ep_cursortrace

View file

@ -88,15 +88,17 @@ COPY --chown=etherpad:etherpad ./.git/HEAD ./.git/HEAD
COPY --chown=etherpad:etherpad ./.git/refs ./.git/refs
COPY --chown=etherpad:etherpad ${SETTINGS} ./settings.json
COPY --chown=etherpad:etherpad ./var ./var
COPY --chown=etherpad:etherpad ./node_modules ./node_modules
COPY --chown=etherpad:etherpad ./package.json ./package.json
COPY --chown=etherpad:etherpad ./pnpm-workspace.yaml ./pnpm-workspace.yaml
FROM build as development
COPY --chown=etherpad:etherpad ./src/package.json .npmrc ./src/pnpm-lock.yaml ./src/
COPY --chown=etherpad:etherpad ./src/bin ./src/bin
RUN { [ -z "${ETHERPAD_PLUGINS}" ] || \
pnpm install --no-save --legacy-peer-deps ${ETHERPAD_PLUGINS}; } && \
pnpm install --workspace-root ${ETHERPAD_PLUGINS}; } && \
src/bin/installDeps.sh
FROM build as production
@ -118,7 +120,7 @@ COPY --chown=etherpad:etherpad ./src ./src
# seems to confuse tools such as `npm outdated`, `npm update`, and some ESLint
# rules.
RUN { [ -z "${ETHERPAD_PLUGINS}" ] || \
pnpm install --no-save --legacy-peer-deps ${ETHERPAD_PLUGINS}; } && \
pnpm install --workspace-root ${ETHERPAD_PLUGINS}; } && \
src/bin/installDeps.sh && \
rm -rf ~/.npm

View file

@ -16,6 +16,7 @@ services:
stdin_open: true
volumes:
- ./src:/opt/etherpad-lite/src
- ./package.json:/opt/etherpad-lite/package.json
- node_modules:/opt/etherpad-lite/src/node_modules
- pnpm-store:/home/etherpad/.local/share/pnpm/store/v3
depends_on:

1
node_modules/ep_etherpad-lite generated vendored
View file

@ -1 +0,0 @@
../src

38
package.json Normal file
View file

@ -0,0 +1,38 @@
{
"name": "etherpad",
"description": "A free and open source realtime collaborative editor",
"homepage": "https://etherpad.org",
"keywords": [
"etherpad",
"realtime",
"collaborative",
"editor"
],
"bin": {
"etherpad-healthcheck": "src/bin/etherpad-healthcheck",
"etherpad-lite": "src/bin/run"
},
"scripts": {
"lint": "pnpm --filter ep_etherpad-lite run lint",
"test": "pnpm --filter ep_etherpad-lite run test",
"test-container": "pnpm --filter ep_etherpad-lite run test-container",
"dev": "pnpm --filter ep_etherpad-lite run dev",
"prod": "pnpm --filter ep_etherpad-lite run prod",
"ts-check": "pnpm --filter ep_etherpad-lite run ts-check",
"ts-check:watch": "pnpm --filter ep_etherpad-lite run ts-check:watch"
},
"dependencies": {
"ep_etherpad-lite": "workspace:./src"
},
"engines": {
"node": ">=18.18.2",
"npm": ">=6.14.0",
"pnpm": ">=8.3.0"
},
"repository": {
"type": "git",
"url": "https://github.com/ether/etherpad-lite.git"
},
"version": "1.9.7",
"license": "Apache-2.0"
}

0
pnpm-workspace.yaml Normal file
View file

View file

@ -35,11 +35,6 @@ fi
log "Installing dependencies..."
(mkdir -p node_modules &&
cd node_modules &&
{ [ -d ep_etherpad-lite ] || ln -sf ../src ep_etherpad-lite; } &&
cd ep_etherpad-lite)
cd src
if [ -z "${ETHERPAD_PRODUCTION}" ]; then

View file

@ -32,4 +32,4 @@ src/bin/installDeps.sh "$@" || exit 1
# Move to the node folder and start
log "Starting Etherpad..."
exec pnpm run dev --prefix ./src "$@"
exec pnpm run dev "$@"