diff --git a/Dockerfile b/Dockerfile index ba4610d51..bbe258483 100644 --- a/Dockerfile +++ b/Dockerfile @@ -92,6 +92,7 @@ COPY --chown=etherpad:etherpad ./var ./var FROM build as development COPY --chown=etherpad:etherpad ./src/package.json .npmrc ./src/pnpm-lock.yaml ./src/ +COPY --chown=etherpad:etherpad ./pnpm-lock.yaml ./pnpm-lock.yaml COPY --chown=etherpad:etherpad ./package.json ./package.json COPY --chown=etherpad:etherpad ./src/bin ./src/bin diff --git a/README.md b/README.md index 2c9b80586..6503908de 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ Update to the latest version with `git pull origin`, then run If cloning to a subdirectory within another project, you may need to do the following: - 1. Start the server manually (e.g. `node src/node/server.ts`) + 1. Start the server manually (e.g. `node server.ts`) 2. Edit the db `filename` in `settings.json` to the relative directory with the file (e.g. `application/lib/etherpad-lite/var/dirty.db`) 3. Add auto-generated files to the main project `.gitignore` diff --git a/doc/api/hooks_server-side.adoc b/doc/api/hooks_server-side.adoc index d95d4ec6b..88c14dfcb 100644 --- a/doc/api/hooks_server-side.adoc +++ b/doc/api/hooks_server-side.adoc @@ -2,7 +2,7 @@ These hooks are called on server-side. === loadSettings -Called from: src/node/server.ts +Called from: server.ts Things in context: @@ -11,7 +11,7 @@ Things in context: Use this hook to receive the global settings in your plugin. === shutdown -Called from: src/node/server.ts +Called from:server.ts Things in context: None diff --git a/docker-compose.yml b/docker-compose.yml index 189c23f91..ff54636a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,6 +17,8 @@ services: volumes: - ./src:/opt/etherpad-lite/src - ./package.json:/opt/etherpad-lite/package.json + - ./pnpm-lock.yaml:/opt/etherpad-lite/pnpm-lock.yaml + - ./server.ts:/opt/etherpad-lite/server.ts - node_modules:/opt/etherpad-lite/src/node_modules - pnpm-store:/home/etherpad/.local/share/pnpm/store/v3 depends_on: diff --git a/package.json b/package.json index 0c2cbc627..88630eefd 100644 --- a/package.json +++ b/package.json @@ -10,14 +10,14 @@ ], "bin": { "etherpad-healthcheck": "src/bin/etherpad-healthcheck", - "etherpad-lite": "src/node/server.ts" + "etherpad-lite": "src/bin/run" }, "scripts": { "lint": "eslint .", "test": "mocha --import=tsx --timeout 120000 --recursive src/tests/backend/specs src/node_modules/ep_*/static/tests/backend/specs", "test-container": "mocha --import=tsx --timeout 5000 src/tests/container/specs/api", - "dev": "node --import tsx src/node/server.ts", - "prod": "node --import tsx src/node/server.ts", + "dev": "node --import tsx server.ts", + "prod": "node --import tsx server.ts", "ts-check": "tsc --noEmit", "ts-check:watch": "tsc --noEmit --watch" }, diff --git a/src/node/server.ts b/server.ts similarity index 92% rename from src/node/server.ts rename to server.ts index 76ffd3a6a..1402d3a79 100755 --- a/src/node/server.ts +++ b/server.ts @@ -24,13 +24,13 @@ * limitations under the License. */ -import {PluginType} from "./types/Plugin"; -import {ErrorCaused} from "./types/ErrorCaused"; +import {PluginType} from "./src/node/types/Plugin"; +import {ErrorCaused} from "./src/node/types/ErrorCaused"; import {PromiseHooks} from "node:v8"; import log4js from 'log4js'; -const settings = require('./utils/Settings'); +const settings = require('./src/node/utils/Settings'); let wtfnode: any; if (settings.dumpOnUncleanExit) { @@ -43,19 +43,19 @@ if (settings.dumpOnUncleanExit) { * early check for version compatibility before calling * any modules that require newer versions of NodeJS */ -const NodeVersion = require('./utils/NodeVersion'); +const NodeVersion = require('./src/node/utils/NodeVersion'); NodeVersion.enforceMinNodeVersion('12.17.0'); NodeVersion.checkDeprecationStatus('12.17.0', '1.9.0'); -const UpdateCheck = require('./utils/UpdateCheck'); -const db = require('./db/DB'); -const express = require('./hooks/express'); -const hooks = require('../static/js/pluginfw/hooks'); -const pluginDefs = require('../static/js/pluginfw/plugin_defs'); -const plugins = require('../static/js/pluginfw/plugins'); -const installer = require('../static/js/pluginfw/installer'); -const {Gate} = require('./utils/promises'); -const stats = require('./stats') +const UpdateCheck = require('./src/node/utils/UpdateCheck'); +const db = require('./src/node/db/DB'); +const express = require('./src/node/hooks/express'); +const hooks = require('./src/static/js/pluginfw/hooks'); +const pluginDefs = require('./src/static/js/pluginfw/plugin_defs'); +const plugins = require('./src/static/js/pluginfw/plugins'); +const installer = require('./src/static/js/pluginfw/installer'); +const {Gate} = require('./src/node/utils/promises'); +const stats = require('./src/node/stats') const logger = log4js.getLogger('server'); diff --git a/src/bin/cleanRun.sh b/src/bin/cleanRun.sh index adac8c662..e596df94c 100755 --- a/src/bin/cleanRun.sh +++ b/src/bin/cleanRun.sh @@ -36,4 +36,4 @@ src/bin/installDeps.sh "$@" || exit 1 #Move to the node folder and start echo "Starting Etherpad..." cd src -exec node --import tsx ./node/server.ts "$@" +exec node --import tsx ../server.ts "$@" diff --git a/src/bin/deb-src/sysroot/etc/init/etherpad.conf b/src/bin/deb-src/sysroot/etc/init/etherpad.conf index 9a2fcf42f..d55422421 100644 --- a/src/bin/deb-src/sysroot/etc/init/etherpad.conf +++ b/src/bin/deb-src/sysroot/etc/init/etherpad.conf @@ -20,7 +20,7 @@ end script script cd $EPHOME/ - exec su -s /bin/sh -c 'exec "$0" "$@"' $EPUSER -- node --import tsx src/node/server.ts \ + exec su -s /bin/sh -c 'exec "$0" "$@"' $EPUSER -- node --import tsx server.ts \ >> $EPLOGS/access.log \ 2>> $EPLOGS/error.log echo "Etherpad is running on http://localhost:9001 - To change settings edit /opt/etherpad/settings.json" diff --git a/src/bin/debugRun.sh b/src/bin/debugRun.sh index 1336e295a..2e7babf3e 100755 --- a/src/bin/debugRun.sh +++ b/src/bin/debugRun.sh @@ -17,4 +17,4 @@ echo "Open 'chrome://inspect' on Chrome to start debugging." cd src # Use 0.0.0.0 to allow external connections to the debugger # (ex: running Etherpad on a docker container). Use default port # (9229) -exec node --import tsx --inspect=0.0.0.0:9229 ./node/server.ts "$@" +exec node --import tsx --inspect=0.0.0.0:9229 ../server.ts "$@" diff --git a/src/bin/fastRun.sh b/src/bin/fastRun.sh index 6b4996175..94d411e06 100755 --- a/src/bin/fastRun.sh +++ b/src/bin/fastRun.sh @@ -19,4 +19,4 @@ cd "${MY_DIR}/../.." || exit 1 echo "Running directly, without checking/installing dependencies" # run Etherpad main class -exec node --import tsx src/node/server.ts "$@" +exec node --import tsx server.ts "$@" diff --git a/src/package.json b/src/package.json index 784efd9f6..b40720350 100644 --- a/src/package.json +++ b/src/package.json @@ -75,8 +75,7 @@ "wtfnode": "^0.9.1" }, "bin": { - "etherpad-healthcheck": "bin/etherpad-healthcheck", - "etherpad-lite": "node/server.ts" + "etherpad-healthcheck": "bin/etherpad-healthcheck" }, "devDependencies": { "@types/async": "^3.2.24", @@ -111,8 +110,6 @@ "lint": "eslint .", "test": "mocha --import=tsx --timeout 120000 --recursive tests/backend/specs ../node_modules/ep_*/static/tests/backend/specs", "test-container": "mocha --import=tsx --timeout 5000 tests/container/specs/api", - "dev": "node --import tsx node/server.ts", - "prod": "node --import tsx node/server.ts", "ts-check": "tsc --noEmit", "ts-check:watch": "tsc --noEmit --watch" }, diff --git a/src/pnpm-lock.yaml b/src/pnpm-lock.yaml index 72e07cfc6..fcdab8ce1 100644 --- a/src/pnpm-lock.yaml +++ b/src/pnpm-lock.yaml @@ -112,7 +112,7 @@ dependencies: version: 8.1.2 terser: specifier: ^5.27.1 - version: 5.27.1 + version: 5.27.2 threads: specifier: ^1.7.0 version: 1.7.0 @@ -1889,7 +1889,7 @@ packages: string.prototype.trimstart: 1.0.7 typed-array-buffer: 1.0.1 typed-array-byte-length: 1.0.0 - typed-array-byte-offset: 1.0.0 + typed-array-byte-offset: 1.0.1 typed-array-length: 1.0.4 unbox-primitive: 1.0.2 which-typed-array: 1.1.14 @@ -4773,8 +4773,8 @@ packages: yallist: 4.0.0 dev: false - /terser@5.27.1: - resolution: {integrity: sha512-29wAr6UU/oQpnTw5HoadwjUZnFQXGdOfj0LjZ4sVxzqwHh/QVkvr7m8y9WoR4iN3FRitVduTc6KdjcW38Npsug==} + /terser@5.27.2: + resolution: {integrity: sha512-sHXmLSkImesJ4p5apTeT63DsV4Obe1s37qT8qvwHRmVxKTBH7Rv9Wr26VcAMmLbmk9UliiwK8z+657NyJHHy/w==} engines: {node: '>=10'} hasBin: true dependencies: @@ -4965,13 +4965,14 @@ packages: is-typed-array: 1.1.13 dev: true - /typed-array-byte-offset@1.0.0: - resolution: {integrity: sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==} + /typed-array-byte-offset@1.0.1: + resolution: {integrity: sha512-tcqKMrTRXjqvHN9S3553NPCaGL0VPgFI92lXszmrE8DMhiDPLBYLlvo8Uu4WZAAX/aGqp/T1sbA4ph8EWjDF9Q==} engines: {node: '>= 0.4'} dependencies: available-typed-arrays: 1.0.6 call-bind: 1.0.7 for-each: 0.3.3 + gopd: 1.0.1 has-proto: 1.0.1 is-typed-array: 1.1.13 dev: true diff --git a/src/web.config b/src/web.config index 65f2cf03f..de603a782 100644 --- a/src/web.config +++ b/src/web.config @@ -2,7 +2,7 @@ - + @@ -23,7 +23,7 @@ - +