Added initial bun support.

This commit is contained in:
SamTV12345 2023-10-02 19:06:25 +02:00
parent b6ce8c7377
commit 8be2dffc37
9 changed files with 32 additions and 9619 deletions

View file

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

View file

@ -14,7 +14,7 @@ cd /D node_modules
mklink /D "ep_etherpad-lite" "..\src"
cd /D "ep_etherpad-lite"
cmd /C npm ci || exit /B 1
cmd /C bun install --frozen-lockfile || exit /B 1
cd /D "%~dp0\..\.."

View file

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

BIN
src/bun.lockb Executable file

Binary file not shown.

9549
src/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -93,6 +93,7 @@
"typescript": "^4.9.5"
},
"engines": {
"bun": ">=1.0.3",
"node": ">=16.20.1",
"npm": ">=6.14.0"
},

View file

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