Add support for bun as a webapp package manager #800

Merged
dboreham merged 2 commits from VPhung24/bun-for-nextjs-and-webapps into main 2024-07-09 18:00:15 +00:00
6 changed files with 12 additions and 0 deletions

View File

@ -28,6 +28,8 @@ RUN \
&& su ${USERNAME} -c "umask 0002 && npm install -g semver" \
# Install pnpm
&& su ${USERNAME} -c "umask 0002 && npm install -g pnpm" \
# Install bun
&& su ${USERNAME} -c "umask 0002 && npm install -g bun@1.1.x" \
dboreham marked this conversation as resolved
Review

couldn't all these npm installs be combined?

su ${USERNAME} -c "umask 0002 && npm install -g bun@1.1.x semver pnpm"

I don't actually know if it would work, just an idea

couldn't all these npm installs be combined? `su ${USERNAME} -c "umask 0002 && npm install -g bun@1.1.x semver pnpm"` I don't actually know if it would work, just an idea
Review

As a guest contributor (plus as my first pull request and docker noob), I followed @telackey (approved by @dboreham) code style from the pnpm pull request & current code.

@telackey @dboreham your call.

As a guest contributor (plus as my first pull request and docker noob), I followed @telackey (approved by @dboreham) code style from the [pnpm pull request](https://git.vdb.to/cerc-io/stack-orchestrator/pulls/767/files) & current code. @telackey @dboreham your call.
Review

Running npm several times is probably not much slower than running it once to install several packages.
The more important issue is to run all the commands in the same docker layer, which is being done.

Running npm several times is probably not much slower than running it once to install several packages. The more important issue is to run all the commands in the same docker layer, which _is_ being done.
&& npm cache clean --force > /dev/null 2>&1
# [Optional] Uncomment this section to install additional OS packages.

View File

@ -14,6 +14,8 @@ if [ -z "$CERC_BUILD_TOOL" ]; then
CERC_BUILD_TOOL=pnpm
elif [ -f "yarn.lock" ]; then
CERC_BUILD_TOOL=yarn
elif [ -f "bun.lockb" ]; then
CERC_BUILD_TOOL=bun
else
CERC_BUILD_TOOL=npm
fi

View File

@ -13,6 +13,8 @@ if [ -z "$CERC_BUILD_TOOL" ]; then
CERC_BUILD_TOOL=pnpm
elif [ -f "yarn.lock" ]; then
CERC_BUILD_TOOL=yarn
elif [ -f "bun.lockb" ]; then
CERC_BUILD_TOOL=bun
else
CERC_BUILD_TOOL=npm
fi

View File

@ -20,6 +20,8 @@ if [ -z "$CERC_BUILD_TOOL" ]; then
CERC_BUILD_TOOL=pnpm
elif [ -f "yarn.lock" ]; then
CERC_BUILD_TOOL=yarn
elif [ -f "bun.lockb" ]; then
CERC_BUILD_TOOL=bun
else
CERC_BUILD_TOOL=npm
fi

View File

@ -28,6 +28,8 @@ RUN \
&& su ${USERNAME} -c "umask 0002 && npm install -g semver" \
# Install pnpm
&& su ${USERNAME} -c "umask 0002 && npm install -g pnpm" \
# Install bun
&& su ${USERNAME} -c "umask 0002 && npm install -g bun@1.1.x" \
&& npm cache clean --force > /dev/null 2>&1
# [Optional] Uncomment this section to install additional OS packages.

View File

@ -27,6 +27,8 @@ elif [ -f "${WORK_DIR}/package.json" ]; then
CERC_BUILD_TOOL=pnpm
elif [ -f "yarn.lock" ]; then
CERC_BUILD_TOOL=yarn
elif [ -f "bun.lockb" ]; then
CERC_BUILD_TOOL=bun
else
CERC_BUILD_TOOL=npm
fi